Java tutorial
package com.yuwang.pinju.web.module.shop.action; import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import net.sf.json.JSONObject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.opensymphony.xwork2.ActionContext; import com.yuwang.pinju.Constant.ShopConstant; import com.yuwang.pinju.common.FileSecurityUtils; import com.yuwang.pinju.common.Money; import com.yuwang.pinju.core.common.ManagerException; import com.yuwang.pinju.core.common.Result; import com.yuwang.pinju.core.common.ResultCodeMsg; import com.yuwang.pinju.core.constant.system.PinjuConstant; import com.yuwang.pinju.core.item.manager.CategoryCacheManager; import com.yuwang.pinju.core.item.manager.CategoryMarginManager; import com.yuwang.pinju.core.margin.ao.MarginAO; import com.yuwang.pinju.core.margin.manager.MarginManager; import com.yuwang.pinju.core.member.manager.MemberManager; import com.yuwang.pinju.core.shop.ao.ShopOpenAO; import com.yuwang.pinju.core.shop.ao.ShopShowInfoAO; import com.yuwang.pinju.core.shop.manager.ShopOpenManager; import com.yuwang.pinju.core.shop.manager.ShopShowInfoManager; import com.yuwang.pinju.core.storage.manager.FileStorageManager; import com.yuwang.pinju.core.util.EmptyUtil; import com.yuwang.pinju.core.util.ObjectUtil; import com.yuwang.pinju.domain.item.CategoryDO; import com.yuwang.pinju.domain.margin.MarginSellerDO; import com.yuwang.pinju.domain.shop.ShopBusinessInfoDO; import com.yuwang.pinju.domain.shop.ShopCustomerInfoDO; import com.yuwang.pinju.domain.shop.ShopFlowInfoDO; import com.yuwang.pinju.domain.shop.ShopInfoDO; import com.yuwang.pinju.domain.shop.ShopIshopInfoDO; import com.yuwang.pinju.domain.shop.ShopOpenFlowDO; import com.yuwang.pinju.domain.trade.DirectPayParamDO; import com.yuwang.pinju.web.annotatioin.AssistantPermission; import com.yuwang.pinju.web.cookie.CookieLoginInfo; import com.yuwang.pinju.web.cookie.PinjuCookieManager; import com.yuwang.pinju.web.interceptor.MemberAuthInterceptor; import com.yuwang.pinju.web.interceptor.LoginInterceptor.MemberCheckerAware; import com.yuwang.pinju.web.message.MessageName; import com.yuwang.pinju.web.module.shop.screen.ShopOpenBaseAction; import com.yuwang.pinju.web.struts2.PinjuAction; import com.yuwang.pinju.web.valitation.ActionInvokeResult; /** * ?action * * @author xueqi * * @since 2011-7-4 */ public class ShopOpenFlowAction extends ShopOpenBaseAction implements MemberCheckerAware { /** * */ private static final long serialVersionUID = 1L; private String test = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); protected final Log log = LogFactory.getLog(this.getClass().getName()); /** * ????? 0:? 1:? 2:?? 2.0 */ private Integer brandSaveType; /** * manager 2.0 */ private CategoryCacheManager categoryCacheManager; /** * ?? 2.0 */ private Integer messageType; /** * ?? 2.0 */ private Integer currentBrand; /** * ?(?/?/??) --2.0 */ private Integer fillType; /** * ?? 2.0 */ private Integer brandSeq; /** * ???; 2.0 */ private Integer isNewBrand; private MarginManager marginManager; private ShopOpenAO shopOpenAO; private ShopOpenFlowDO shopOpenFlowDO; private ShopCustomerInfoDO shopCustomerInfoDO; private ShopBusinessInfoDO shopBusinessInfoDO; private ShopIshopInfoDO shopIshopInfoDO; private ShopFlowInfoDO shopFlowInfoDO; private String businessLicenseEndDate; private File[] myFile; private String myFileFileName; private FileStorageManager fileStorageManager; private String shopName; private String result; private ShopOpenManager shopOpenManager; private MarginAO marginAO; /** * id */ private Long categoryId; /** * ?? */ private String selectedCategory; /** * ? */ private int isHaveOuterShop = 2; private MemberManager memberManager; /** * ?? */ private int exchangeMargin; /** * ??? */ private String exchangePrice; /** * ? */ private int fillStep; private String errorMessage; public Integer getBrandSaveType() { return brandSaveType; } public void setBrandSaveType(Integer brandSaveType) { this.brandSaveType = brandSaveType; } private ShopShowInfoManager shopShowInfoManager; private CategoryMarginManager categoryMarginManager; public Integer getMessageType() { return messageType; } public void setMessageType(Integer messageType) { this.messageType = messageType; } public CategoryCacheManager getCategoryCacheManager() { return categoryCacheManager; } public void setCategoryCacheManager(CategoryCacheManager categoryCacheManager) { this.categoryCacheManager = categoryCacheManager; } /** * list */ private Map<Long, String> shopCategoryList; public Integer getCurrentBrand() { return currentBrand; } public void setCurrentBrand(Integer currentBrand) { this.currentBrand = currentBrand; } private ShopShowInfoAO shopShowInfoAO; /** * ???? * * @return */ @SuppressWarnings("unchecked") public String shopOpenAgreement() { String returnString = ""; // CB,??? long userId = queryUserId(); List shopInfoList = null; if (sellerType == ShopConstant.SELLER_TYPE_C.intValue()) { shopInfoList = shopOpenAO.queryShopCustomerInfo(userId); if (shopInfoList != null && shopInfoList.size() > 0) { shopCustomerInfoDO = (ShopCustomerInfoDO) shopInfoList.get(0); } else { shopCustomerInfoDO = null; } initOutShopInfoParam(); // setShopCustomerCookie(); returnString = "successC"; } else { shopInfoList = shopOpenAO.queryShopBusinessInfo(userId); if (shopInfoList != null && shopInfoList.size() > 0) { shopBusinessInfoDO = (ShopBusinessInfoDO) shopInfoList.get(0); } else { shopBusinessInfoDO = null; } // setShopBusinessCookie(ShopConstant.IS_FILL_SHOP_INFO_NO); returnString = "FILL_SHOP_INFO_B_SETP1"; } // ?? shopCategoryList = shopShowInfoAO.initShopCategoryList(); initBaseParam(); return returnString; } /** * ?C? * * @param shopCustomerInfoDO * @return */ private String validateSaveCustomerShopInfo(ShopCustomerInfoDO shopCustomerInfoDO, Long userId) { StringBuffer message = new StringBuffer(); message.append(validateMember()); if (message != null && message.length() > 0) { return message.toString(); } if (shopCustomerInfoDO != null) { if (shopCustomerInfoDO.getName() == null || "".equals(shopCustomerInfoDO.getName()) || shopCustomerInfoDO.getName().trim().length() == 0) { message.append("???<br>"); } else { if (null != shopCustomerInfoDO.getName() && shopCustomerInfoDO.getName().length() > 20) { message.append("???20<br>"); } else if (shopOpenAO.queryShopInfosByName(shopCustomerInfoDO.getName(), userId)) { message.append("??????<br>"); } } if (shopCustomerInfoDO.getShopCategory() == null) { message.append("?<br>"); } else { if (shopCustomerInfoDO.getShopCategory() != null && !ObjectUtil.isIntType(shopCustomerInfoDO.getShopCategory())) { message.append("<br>"); } } if (shopCustomerInfoDO.getShopNature() == null) { message.append("??<br>"); } else { if (shopCustomerInfoDO.getShopNature() != null && !ObjectUtil.isIntType(String.valueOf(shopCustomerInfoDO.getShopNature()))) { message.append("?<br>"); } } // if (shopCustomerInfoDO.getGoodsSource() == null) { // message.append("???<br>"); // } // if (shopCustomerInfoDO.getGoodsSource() != null // && !ObjectUtil.isIntType(String.valueOf(shopCustomerInfoDO.getGoodsSource()))) { // message.append("??<br>"); // } if (shopCustomerInfoDO.getDescription() == null || "".equals(shopCustomerInfoDO.getDescription()) || shopCustomerInfoDO.getDescription().trim().length() == 0) { //message.append("??<br>"); } else { if (shopCustomerInfoDO.getDescription() != null && (shopCustomerInfoDO.getDescription().length() > 500)) { message.append("??500<br>"); } } if (shopCustomerInfoDO.getProvince() == null) { message.append("???<br>"); } if (shopCustomerInfoDO.getCity() == null) { message.append("??<br>"); } if (isHaveOuterShop == 0) { if (shopCustomerInfoDO.getOuterShopAddressUrl() == null || "".equals(shopCustomerInfoDO.getOuterShopAddressUrl()) || shopCustomerInfoDO.getOuterShopAddressUrl().trim().length() == 0) { message.append("?Url?<br>"); } else { if (shopCustomerInfoDO.getOuterShopAddressUrl() != null && !ObjectUtil .isUrlPatten(String.valueOf(shopCustomerInfoDO.getOuterShopAddressUrl()))) { message.append("?Url<br>"); } } // if (shopCustomerInfoDO.getOuterShopLevel() == null) { // message.append("<br>"); // } // if (shopCustomerInfoDO.getOuterShopSaleScope() == null) { // message.append("<br>"); // } // if (shopCustomerInfoDO.getIsEnterB2c() == null) { // message.append("??B2C<br>"); // } } String[] alertStrC = { "", "??", "??", "?" }; String[] alertStrC2 = { "", "??", "??", "?" }; if (myFile == null || myFileFileName.length() <= 0) { for (int i = 0; i < 4; i++) { message.append(alertStrC[i] + "<br>"); } } else { String fileNames[] = myFileFileName.split(","); for (int i = 0; i < 3; i++) { if (i + 1 <= fileNames.length) { if (null == fileNames[i] || "".equals(fileNames[i])) { message.append(alertStrC[i] + "<br>"); } } else { message.append(alertStrC[i] + "<br>"); } if (i == 0) { // if (myFile[i].length() / PinjuConstant.FILE_SIZE_K > 80) { // message.append(alertStrC2[i] + "<br>"); // return message.toString(); // } } else { if (myFile[i].length() / PinjuConstant.FILE_SIZE_K > 500) { message.append(alertStrC2[i] + "<br>"); return message.toString(); } } if (!FileSecurityUtils.isImageValid(myFile[i])) { message.append(alertStrC2[i] + "??<br>"); return message.toString(); } } } } else { message.append("?"); } initOutShopInfoParam(); return message.toString(); } public Integer getBrandSeq() { return brandSeq; } public void setBrandSeq(Integer brandSeq) { this.brandSeq = brandSeq; } /** * ?B? * * @param shopBusinessInfoDO * @return */ private String validateSaveBusinessShopInfo1(ShopBusinessInfoDO shopBusinessInfoDO, Long userId) { StringBuffer message = new StringBuffer(); message.append(validateMember()); if (message != null && message.length() > 0) { return message.toString(); } if (shopBusinessInfoDO != null) { if (shopBusinessInfoDO.getName() == null || "".equals(shopBusinessInfoDO.getName()) || shopBusinessInfoDO.getName().trim().length() == 0) { message.append("???<br>"); } else { if (null != shopBusinessInfoDO.getName() && shopBusinessInfoDO.getName().length() > 20) { message.append("???20<br>"); } else if (shopOpenAO.queryShopInfosByName(shopBusinessInfoDO.getName(), userId)) { message.append("??????<br>"); } } if (shopBusinessInfoDO.getShopCategory() == null) { message.append("?<br>"); } else { if (shopBusinessInfoDO.getShopCategory() != null && !ObjectUtil.isIntType(shopBusinessInfoDO.getShopCategory())) { message.append("<br>"); } } // if (shopBusinessInfoDO.getShopNature()==null) { // message.append("?<br>"); // }else{ // if (shopBusinessInfoDO.getShopNature() != null // && !ObjectUtil.isIntType(String.valueOf(shopBusinessInfoDO // .getShopNature()))) { // message.append("<br>"); // } // } if (shopBusinessInfoDO.getGoodsSource() == null) { message.append("???<br>"); } else { if (shopBusinessInfoDO.getGoodsSource() != null && !ObjectUtil.isIntType(String.valueOf(shopBusinessInfoDO.getGoodsSource()))) { message.append("??<br>"); } } if (shopBusinessInfoDO.getDescription() == null || "".equals(shopBusinessInfoDO.getDescription()) || shopBusinessInfoDO.getDescription().trim().length() == 0) { //message.append("??<br>"); } else { if (shopBusinessInfoDO.getDescription() != null && (shopBusinessInfoDO.getDescription().length() > 500)) { message.append("??500<br>"); } } if (myFile == null || myFileFileName.length() <= 0) { //message.append("<br>"); } else { if (myFile[0].length() / PinjuConstant.FILE_SIZE_K > 80) { message.append("" + "<br>"); return message.toString(); } if (!FileSecurityUtils.isImageValid(myFile[0])) { message.append("??" + "<br>"); return message.toString(); } } } else { message.append("?"); } return message.toString(); } /** * ?B? * * @param shopBusinessInfoDO * @return */ private String validateSaveBusinessShopInfo2(ShopBusinessInfoDO shopBusinessInfoDO) { StringBuffer message = new StringBuffer(); message.append(validateMember()); if (message != null && message.length() > 0) { return message.toString(); } if (shopBusinessInfoDO != null) { if (null == shopBusinessInfoDO.getEnterpriseName() || "".equals(shopBusinessInfoDO.getEnterpriseName()) || shopBusinessInfoDO.getEnterpriseName().trim().length() == 0) { message.append("????!<br> "); } else { if (null != shopBusinessInfoDO.getEnterpriseName() && shopBusinessInfoDO.getEnterpriseName().length() > 30) { message.append("????30!<br> "); } } if (null == shopBusinessInfoDO.getBusinessLicenseNumber() || "".equals(shopBusinessInfoDO.getBusinessLicenseNumber()) || shopBusinessInfoDO.getBusinessLicenseNumber().trim().length() == 0) { message.append("???! <br>"); } else { if (null != shopBusinessInfoDO.getBusinessLicenseNumber() && shopBusinessInfoDO.getBusinessLicenseNumber().length() > 18) { message.append("???18?!<br> "); } else if (!ObjectUtil.isNum(shopBusinessInfoDO.getBusinessLicenseNumber())) { message.append("??! <br>"); } } if (null == shopBusinessInfoDO.getOrganizationCodeNumber() || "".equals(shopBusinessInfoDO.getOrganizationCodeNumber()) || shopBusinessInfoDO.getOrganizationCodeNumber().trim().length() == 0) { message.append("????! <br>"); } else { if (null != shopBusinessInfoDO.getOrganizationCodeNumber() && shopBusinessInfoDO.getOrganizationCodeNumber().length() > 10) { message.append("10???\"-\"????!<br>"); } else if (!ObjectUtil.isNumZ2(shopBusinessInfoDO.getOrganizationCodeNumber())) { message.append("10???\"-\"????!<br>"); } } if (null == shopBusinessInfoDO.getBusiness() || "".equals(shopBusinessInfoDO.getBusiness()) || shopBusinessInfoDO.getBusiness().trim().length() == 0) { message.append("???!<br> "); } else { if (null != shopBusinessInfoDO.getBusiness() && shopBusinessInfoDO.getBusiness().length() > 50) { message.append("???50!<br> "); } } if (null == businessLicenseEndDate || "".equals(businessLicenseEndDate)) { message.append("???!<br> "); } else { DateFormat format1 = null; if (null != businessLicenseEndDate && !ObjectUtil.isDate(businessLicenseEndDate)) { message.append("??!<br> "); } else { String str[] = businessLicenseEndDate.split("-"); if (str.length == 3) { businessLicenseEndDate = str[0] + "-" + str[1] + "-" + str[2]; format1 = new SimpleDateFormat("yyyy-MM-dd"); try { if (null != businessLicenseEndDate && format1.parse(businessLicenseEndDate).getTime() < new Date().getTime()) { message.append("????<br> "); } } catch (ParseException e) { log.error(e.getMessage()); } } else { message.append("??!<br> "); } } } if (null == shopBusinessInfoDO.getLegalName() || "".equals(shopBusinessInfoDO.getLegalName()) || shopBusinessInfoDO.getLegalName().trim().length() == 0) { message.append("???!<br> "); } else { if (null != shopBusinessInfoDO.getLegalName() && shopBusinessInfoDO.getLegalName().length() > 20) { message.append("???20! <br>"); } else if (!ObjectUtil.isZEng(shopBusinessInfoDO.getLegalName().trim())) { message.append("??? <br>"); } } if (null == shopBusinessInfoDO.getRegistAddress() || "".equals(shopBusinessInfoDO.getRegistAddress()) || shopBusinessInfoDO.getRegistAddress().trim().length() == 0) { message.append("???!<br> "); } else { if (null != shopBusinessInfoDO.getRegistAddress() && shopBusinessInfoDO.getRegistAddress().length() > 50) { message.append("???50!<br> "); } } if (shopBusinessInfoDO.getProvince() == null || shopBusinessInfoDO.getProvince().trim().length() == 0) { message.append("???<br>"); } if (shopBusinessInfoDO.getCity() == null || shopBusinessInfoDO.getCity().trim().length() == 0) { message.append("??<br>"); } if (isHaveOuterShop == 0) { if (shopBusinessInfoDO.getOuterShopAddressUrl() == null || "".equals(shopBusinessInfoDO.getOuterShopAddressUrl()) || shopBusinessInfoDO.getOuterShopAddressUrl().trim().length() == 0) { message.append("?Url?<br>"); } else { if (shopBusinessInfoDO.getOuterShopAddressUrl() != null && !ObjectUtil .isUrlPatten(String.valueOf(shopBusinessInfoDO.getOuterShopAddressUrl()))) { message.append("?Url<br>"); } } /*if (shopBusinessInfoDO.getOuterShopLevel()==null) { message.append("<br>"); }if (shopBusinessInfoDO.getOuterShopSaleScope()==null) { message.append("<br>"); }if (shopBusinessInfoDO.getIsEnterB2c()==null) { message.append("??B2C<br>"); }*/ } // String [] alertStr = {"??","??","????","???","?","??","????","?"}; // String [] alertStr2 = {"??","??","??/??","???","?","??","????","?"}; String[] alertStr = { "??", "??", "?" }; String[] alertStr2 = { "??", "??", "?" }; //String [] alertStr3 = {"??","??","?"}; if (myFile == null || myFileFileName.length() <= 0) { //for(int i=0;i<7;i++){ for (int i = 0; i < 3; i++) { message.append(alertStr[i] + "<br>"); } } else { String fileNames[] = myFileFileName.split(","); //for(int i=0;i<7;i++){ for (int i = 0; i < myFile.length; i++) { //if(i+1<=fileNames.length){ if (null == fileNames[i] || "".equals(fileNames[i])) { message.append(alertStr[i] + "<br>"); return message.toString(); } //}else{ // message.append(alertStr[i]+"<br>"); //} if (myFile[i].length() / PinjuConstant.FILE_SIZE_K > 500) { message.append(alertStr2[i] + "<br>"); return message.toString(); } if (!FileSecurityUtils.isImageValid(myFile[i])) { message.append(alertStr2[i] + "??<br>"); return message.toString(); } } } } else { message.append("? "); } return message.toString(); } public Integer getFillType() { return fillType; } public void setFillType(Integer fillType) { this.fillType = fillType; } /** * ?B? * * @param shopBusinessInfoDO * @return */ private String validateSaveBusinessShopInfo3(ShopBusinessInfoDO shopBusinessInfoDO) { StringBuffer message = new StringBuffer(); message.append(validateMember()); if (message != null && message.length() > 0) { return message.toString(); } if (myFile != null && myFile.length > 0) { String brandNames = shopBusinessInfoDO.getBrandName(); String brandName[] = brandNames.split(";"); //String fileNames[] = myFileFileName.split(","); String alertString[] = { "?logo", "??/??", "???" }; if (myFile.length % 3 != 0) { message.append("??,??"); return message.toString(); } for (int i = 0; i < myFile.length; i++) { int k = 0; if (i % 3 == 0) { k = 80; } else { k = 500; } if (myFile[i].length() / PinjuConstant.FILE_SIZE_K > k) { message.append( "?: \"" + brandName[i] + "\" " + alertString[i % 3] + "<br>"); return message.toString(); } if (!FileSecurityUtils.isImageValid(myFile[i])) { message.append( "?: \"" + brandName[i] + "\" +alertString[i%3]+??<br>"); return message.toString(); } } } return message.toString(); } /** * ?B? * * @param shopBusinessInfoDO * @return */ private String validateSaveBusinessShopInfo4(ShopBusinessInfoDO shopBusinessInfoDO) { StringBuffer message = new StringBuffer(); message.append(validateMember()); if (message != null && message.length() > 0) { return message.toString(); } if (shopBusinessInfoDO != null) { /*if (null==shopBusinessInfoDO.getContactName() || "".equals(shopBusinessInfoDO.getContactName()) || shopBusinessInfoDO.getContactName().trim().length()==0) { message.append("????<br>"); }else{ if (null!=shopBusinessInfoDO.getContactName() && shopBusinessInfoDO.getContactName().length()>20) { message.append("????20<br>"); }else if(!ObjectUtil.isZEng(shopBusinessInfoDO.getContactName().trim())){ message.append("?????<br>"); } } if (null==shopBusinessInfoDO.getContactPhone()) { message.append("?????<br>"); }*/ // else{ // if (null!=shopBusinessInfoDO.getContactPhone() // && (!(ObjectUtil.isMobile(shopBusinessInfoDO.getContactPhone()) || ObjectUtil.isTel(shopBusinessInfoDO.getContactPhone()) ))) { // message.append("????<br>"); // } // } /*if (null==shopBusinessInfoDO.getContactAddress() || "".equals(shopBusinessInfoDO.getContactAddress()) || shopBusinessInfoDO.getContactAddress().trim().length()==0) { message.append("???<br>"); }else{ if (null!=shopBusinessInfoDO.getContactAddress() && shopBusinessInfoDO.getContactAddress().length()>500) { if (null!=shopBusinessInfoDO.getContactAddress() && shopBusinessInfoDO.getContactAddress().length()>500) { message.append("???500<br>"); } } } if (null==shopBusinessInfoDO.getContactPostalCode()) { message.append("???<br>"); }else{ if (null!=shopBusinessInfoDO.getOrganizationCodeNumber() && (!ObjectUtil.isPostal(shopBusinessInfoDO.getContactPostalCode()))) { message.append("??<br>"); } }*/ if (null == shopBusinessInfoDO.getShopManagerName() || "".equals(shopBusinessInfoDO.getShopManagerName()) || shopBusinessInfoDO.getShopManagerName().trim().length() == 0) { message.append("???<br>"); } else { if (null != shopBusinessInfoDO.getShopManagerName() && (shopBusinessInfoDO.getShopManagerName().length() > 20)) { message.append("???20<br>"); } else if (!ObjectUtil.isZEng(shopBusinessInfoDO.getShopManagerName().trim())) { message.append("????<br>"); } } if (null == shopBusinessInfoDO.getShopManagerTelephone()) { message.append("??<br>"); } // else{ // if (null!=shopBusinessInfoDO.getShopManagerTelephone() // && (!ObjectUtil.isTel(shopBusinessInfoDO.getShopManagerTelephone()))) { // message.append("?<br>"); // } // } if (null == shopBusinessInfoDO.getShopManagerMobile()) { message.append("???<br>"); } // else{ // if (null!=shopBusinessInfoDO.getShopManagerMobile() // && (!ObjectUtil.isMobile(shopBusinessInfoDO.getShopManagerMobile()))) { // message.append("??<br>"); // } // } if (null == shopBusinessInfoDO.getShopManagerEmail()) { message.append("?<br>"); } else { if (null != shopBusinessInfoDO.getShopManagerEmail() && (!ObjectUtil.isEmail(shopBusinessInfoDO.getShopManagerEmail()))) { message.append("<br>"); } } // if (null==shopBusinessInfoDO.getShopManagerFax()) { // message.append("?<br>"); // } // else{ // if (null!=shopBusinessInfoDO.getShopManagerFax() // && !shopBusinessInfoDO.getShopManagerFax().equals("") // && (!ObjectUtil.isTel(shopBusinessInfoDO.getShopManagerFax()))) { // message.append("<br>"); // } // } /*if (null==shopBusinessInfoDO.getEmergencyContactName() || "".equals(shopBusinessInfoDO.getEmergencyContactName()) || shopBusinessInfoDO.getEmergencyContactName().trim().length()==0) { message.append("????<br>"); }else{ if (null!=shopBusinessInfoDO.getEmergencyContactName() && shopBusinessInfoDO.getEmergencyContactName().length()>20) { message.append("????20<br>"); }else if(!ObjectUtil.isZEng(shopBusinessInfoDO.getEmergencyContactName().trim())){ message.append("?????<br>"); } } if (null==shopBusinessInfoDO.getEmergencyContactPhone()) { message.append("?????<br>"); }*/ // else{ // if (null!=shopBusinessInfoDO.getEmergencyContactPhone() // && (!ObjectUtil.isMobile(shopBusinessInfoDO.getEmergencyContactPhone()))) { // message.append("????<br>"); // } // } } else { message.append("?"); } return message.toString(); } private String[] saveFile(File[] files) { String fileNames[] = myFileFileName.split(","); String picNames[] = null; String fileNameString[] = new String[files.length]; try { for (int i = 0; i < files.length; i++) { fileNameString[i] = FileSecurityUtils.getImageFileName(files[i], fileNames[i]); } picNames = fileStorageManager.saveImage(files, fileNameString, queryUserId(), queryNickName(), true); } catch (ManagerException e) { } return picNames; } /** * ???? * * @return */ public String queryAjaxShopName() { JSONObject json = this.queryAjaxSelShopName(); result = json.toString(); return "success"; } private JSONObject queryAjaxSelShopName() { try { long userId = queryUserId(); boolean isContain = shopOpenAO.queryShopInfosByName(shopName, userId); JSONObject json = new JSONObject(); if (isContain) { json.put("isRename", "1"); json.put("message", "<font color='red'>??????</font>"); } else { json.put("isRename", "0"); json.put("message", "<img src='http://static.pinju.com/img/icon-succeed.png'/>"); } return json; } catch (Exception e) { log.error(e); } return null; } public ShopIshopInfoDO getShopIshopInfoDO() { return shopIshopInfoDO; } public void setShopIshopInfoDO(ShopIshopInfoDO shopIshopInfoDO) { this.shopIshopInfoDO = shopIshopInfoDO; } /** * ?C? * * @return */ public String saveCustomerShopInfo() { try { long userId = queryUserId(); String nickname = queryNickName(); //?C? errorMessage = validateSaveCustomerShopInfo(shopCustomerInfoDO, userId); //? if (null != errorMessage && !"".equals(errorMessage)) { shopCategoryList = shopShowInfoAO.initShopCategoryList(); initBaseParam(); initOutShopInfoParam(); return "successC"; } String picNames[] = null; boolean flag = true; if (myFile != null && myFile.length > 0) { //? picNames = saveFile(myFile); //??? if (picNames != null && picNames.length > 0) { if (picNames.length == 4) { shopCustomerInfoDO.setShopLogo(picNames[0]); shopCustomerInfoDO.setBusinessLicense(picNames[1]); shopCustomerInfoDO.setOrganizationCode(picNames[2]); shopCustomerInfoDO.setTaxPass(picNames[3]); } else { shopCustomerInfoDO.setShopLogo(""); shopCustomerInfoDO.setBusinessLicense(picNames[0]); shopCustomerInfoDO.setOrganizationCode(picNames[1]); shopCustomerInfoDO.setTaxPass(picNames[2]); } } else { flag = false; shopCustomerInfoDO.setTaxPass("none"); } } else { flag = false; } if (!flag) { shopCustomerInfoDO.setShopLogo(""); shopCustomerInfoDO.setBusinessLicense("none"); shopCustomerInfoDO.setOrganizationCode("none"); shopCustomerInfoDO.setTaxPass("none"); } shopCustomerInfoDO.setUserId(userId); shopCustomerInfoDO.setNickname(nickname); shopCustomerInfoDO.setSellerType(String.valueOf(sellerType)); shopCustomerInfoDO.setApproveStatus(ShopConstant.APPROVE_STATUS_NO); if (isHaveOuterShop == 1) { shopCustomerInfoDO.setOuterShopAddressUrl(""); shopCustomerInfoDO.setOuterShopLevel(null); shopCustomerInfoDO.setOuterShopSaleScope(null); shopCustomerInfoDO.setIsEnterB2c(null); } //?userid?C?,,?? List<ShopCustomerInfoDO> resultList = shopOpenAO.queryShopCustomerInfo(userId); if (resultList != null && resultList.size() > 0) { shopOpenManager.updateShopCustomerInfo(shopCustomerInfoDO); } else { shopCustomerInfoDO.setApproveStatus(ShopConstant.APPROVE_STATUS_NO); shopOpenManager.saveShopInfo(sellerType, shopCustomerInfoDO); } //?userid,sellerytpe???.,,?? List<ShopOpenFlowDO> shopOpenFlowList = shopOpenAO.queryShopOpenFlow(userId); if (shopOpenFlowList != null && shopOpenFlowList.size() > 0) { shopOpenFlowDO = (ShopOpenFlowDO) shopOpenFlowList.get(0); shopOpenFlowDO.setAuditCount(shopOpenFlowDO.getAuditCount() + 1); shopOpenFlowDO.setIsAgreement(ShopConstant.IS_AGREEMENT_TRUE); shopOpenFlowDO.setNoPassReason(""); shopOpenFlowDO.setAuditStatus(ShopConstant.AUDIT_STATUS_WAIT); shopOpenFlowDO.setAuditProgress(""); shopOpenFlowDO.setGmtModified(new Date()); shopOpenFlowDO.setIsFillInfo(ShopConstant.IS_FILL_SHOP_INFO_STEP1); shopOpenManager.updateShopOpenFlow(shopOpenFlowDO); } else { shopOpenFlowDO = new ShopOpenFlowDO(); shopOpenFlowDO.setUserId(userId); shopOpenFlowDO.setConfiguration("USER_NAME=" + nickname); shopOpenFlowDO.setIsAgreement(ShopConstant.IS_AGREEMENT_TRUE); shopOpenFlowDO.setSellerType(sellerType); shopOpenFlowDO.setAuditCount(1); shopOpenFlowDO.setAuditProgress(""); shopOpenFlowDO.setAuditStatus(ShopConstant.AUDIT_STATUS_WAIT); shopOpenFlowDO.setIsBlack(0); shopOpenFlowDO.setIsKa(ShopConstant.IS_KA_NO); shopOpenFlowDO.setIsOnlineAuditEnd(0); shopOpenFlowDO.setIsPostalAuditEnd(0); shopOpenFlowDO.setNoPassReason(""); shopOpenFlowDO.setReviewer(""); shopOpenFlowDO.setGmtCreate(new Date()); shopOpenFlowDO.setGmtModified(new Date()); shopOpenFlowDO.setIsFillInfo(ShopConstant.IS_FILL_SHOP_INFO_STEP1); shopOpenManager.agreement(shopOpenFlowDO); } List<ShopCustomerInfoDO> shopInfoList = shopOpenAO.queryShopCustomerInfo(userId); shopCustomerInfoDO = (ShopCustomerInfoDO) shopInfoList.get(0); //cookie // PinjuCookieManager.clearShopC(); } catch (ManagerException e) { log.error(e.getMessage()); } if (!shopOpenFlowDO.getAuditStatus().equals(ShopConstant.AUDIT_STATUS_PASS)) { return "SHOP_OPEN_BEGIN"; } return "success"; } private String validateMember() { CookieLoginInfo login = CookieLoginInfo.getCookieLoginInfo(); if (!isSameMember(login)) { log.warn("current member has been is not same member before form submited, before info: " + getPj0() + ", current login info: " + login); ActionInvokeResult.setInvokeMessageKey(MessageName.OPERATE_MEMBER_NOT_MATCH, login.getNickname()); //return INPUT; errorMessage = MessageName.OPERATE_MEMBER_NOT_MATCH; return errorMessage; } return ""; } private String validateSaveBusinessShopInfo(int fillStep, Long userId) { if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP1.intValue()) { errorMessage = validateSaveBusinessShopInfo1(shopBusinessInfoDO, userId); if (null != errorMessage && !"".equals(errorMessage)) { shopCategoryList = shopShowInfoAO.initShopCategoryList(); initBaseParam(); return "FILL_SHOP_INFO_B_SETP1"; } } else if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP2.intValue()) { errorMessage = validateSaveBusinessShopInfo2(shopBusinessInfoDO); if (null != errorMessage && !"".equals(errorMessage)) { initOutShopInfoParam(); return "FILL_SHOP_INFO_B_SETP2"; } } else if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP3.intValue()) { errorMessage = validateSaveBusinessShopInfo3(shopBusinessInfoDO); if (null != errorMessage && !"".equals(errorMessage)) { return "FILL_SHOP_INFO_B_SETP3"; } } else if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP4.intValue()) { errorMessage = validateSaveBusinessShopInfo4(shopBusinessInfoDO); if (null != errorMessage && !"".equals(errorMessage)) { return "FILL_SHOP_INFO_B_SETP4"; } } return ""; } /** * ?B? * * @return */ public String saveBusinessShopInfo() { try { long userId = queryUserId(); String nickname = queryNickName(); String errorRedirect = validateSaveBusinessShopInfo(fillStep, userId); if (errorRedirect != null && errorRedirect.length() > 0) { return errorRedirect; } String picNames[] = null; //?? if (myFile != null && myFile.length > 0) { picNames = saveFile(myFile); // if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP1.intValue()) { if (picNames != null && picNames.length > 0) { shopBusinessInfoDO.setShopLogo(picNames[0]); } } // else if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP2.intValue()) { if (picNames != null && picNames.length > 0) { shopBusinessInfoDO.setBusinessLicense(picNames[0]); shopBusinessInfoDO.setOrganizationCode(picNames[1]); shopBusinessInfoDO.setTaxPass(picNames[2]); } } // else if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP3.intValue()) { StringBuffer logo = new StringBuffer(); StringBuffer brandCertificate = new StringBuffer(); StringBuffer qualityCertificate = new StringBuffer(); if (picNames != null && picNames.length > 0) { for (int i = 0; i < picNames.length; i++) { if (i % 3 == 0) { logo.append(picNames[i]).append(","); } else if (i % 3 == 1) { brandCertificate.append(picNames[i]).append(","); } else if (i % 3 == 2) { qualityCertificate.append(picNames[i]).append(","); } } String logoStr = logo.substring(0, logo.length() - 1); String brandCertificateStr = brandCertificate.substring(0, brandCertificate.length() - 1); String qualityCertificateStr = qualityCertificate.substring(0, qualityCertificate.length() - 1); shopBusinessInfoDO.setBrandLogo(logoStr); shopBusinessInfoDO.setBrandCertificate(brandCertificateStr); shopBusinessInfoDO.setQualityCertificate(qualityCertificateStr); } } } else { if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP1.intValue()) { shopBusinessInfoDO.setShopLogo(""); } } //??--? if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP1.intValue() && (shopBusinessInfoDO.getDescription() == null || shopBusinessInfoDO.getDescription().trim().equals(""))) { shopBusinessInfoDO.setDescription(" "); } //??--?? if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP1.intValue() && shopBusinessInfoDO.getGoodsSource() == null) { shopBusinessInfoDO.setGoodsSource(-1); } //? if (businessLicenseEndDate != null && businessLicenseEndDate.length() > 0) { DateFormat format1 = null; if (businessLicenseEndDate.split("-").length > 1) { format1 = new SimpleDateFormat("yyyy-MM-dd"); } else { String str[] = businessLicenseEndDate.split("/"); businessLicenseEndDate = str[2] + "-" + str[0] + "-" + str[1]; format1 = new SimpleDateFormat("yyyy-MM-dd"); } shopBusinessInfoDO.setBusinessLicenseEndDate(format1.parse(businessLicenseEndDate)); } shopBusinessInfoDO.setUserId(userId); shopBusinessInfoDO.setNickname(nickname); shopBusinessInfoDO.setSellerType(String.valueOf(sellerType)); shopBusinessInfoDO.setApproveStatus(ShopConstant.APPROVE_STATUS_NO); //?,?? List<ShopBusinessInfoDO> resultList = shopOpenAO.queryShopBusinessInfo(userId); if (resultList != null && resultList.size() > 0) { if (isHaveOuterShop == 1) { shopBusinessInfoDO.setOuterShopAddressUrl(""); shopBusinessInfoDO.setOuterShopLevel(null); shopBusinessInfoDO.setOuterShopSaleScope(null); shopBusinessInfoDO.setIsEnterB2c(null); } else if (2 == isHaveOuterShop) { shopBusinessInfoDO.setOuterShopAddressUrl( ((ShopBusinessInfoDO) resultList.get(0)).getOuterShopAddressUrl()); shopBusinessInfoDO .setOuterShopLevel(((ShopBusinessInfoDO) resultList.get(0)).getOuterShopLevel()); shopBusinessInfoDO.setOuterShopSaleScope( ((ShopBusinessInfoDO) resultList.get(0)).getOuterShopSaleScope()); shopBusinessInfoDO.setIsEnterB2c(((ShopBusinessInfoDO) resultList.get(0)).getIsEnterB2c()); } // shopOpenAO.updateShopBusinessInfo(userId, shopBusinessInfoDO); } else { //? shopOpenAO.saveShopInfo(sellerType, shopBusinessInfoDO); } resultList = shopOpenAO.queryShopBusinessInfo(userId); shopBusinessInfoDO = (ShopBusinessInfoDO) resultList.get(0); //? if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_NO.intValue()) { // String cookieString = PinjuCookieManager.getShop1(); // log.error(cookieString); // setShopBusinessCookie(fillStep); return "FILL_SHOP_INFO_B_SETP1"; } else if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP1.intValue()) { initOutShopInfoParam(); // setShopBusinessCookie(fillStep); // PinjuCookieManager.clearShop1(); return "FILL_SHOP_INFO_B_SETP2"; } else if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP2.intValue()) { // setShopBusinessCookie(fillStep); // PinjuCookieManager.clearShop2(); return "FILL_SHOP_INFO_B_SETP3"; } else if (fillStep == ShopConstant.IS_FILL_SHOP_INFO_STEP3.intValue()) { // setShopBusinessCookie(fillStep); // PinjuCookieManager.clearShop3(); return "FILL_SHOP_INFO_B_SETP4"; } //??? // if (null != shopOpenFlowDO) { // List<ShopOpenFlowDO> shopOpenFlowList = shopOpenAO.queryShopOpenFlow(userId); // if (shopOpenFlowList != null && shopOpenFlowList.size() > 0) { // shopOpenFlowDO = (ShopOpenFlowDO) shopOpenFlowList.get(0); // shopOpenFlowDO // .setAuditCount(shopOpenFlowDO.getAuditCount() + 1); // shopOpenFlowDO // .setIsAgreement(ShopConstant.IS_AGREEMENT_TRUE); // shopOpenFlowDO.setNoPassReason(""); // shopOpenFlowDO // .setAuditStatus(ShopConstant.AUDIT_STATUS_WAIT); // shopOpenFlowDO.setAuditProgress(""); // shopOpenFlowDO.setGmtModified(new Date()); // shopOpenFlowDO.setUserId(userId); // shopOpenFlowDO.setSellerType(sellerType); // shopOpenFlowDO // .setIsFillInfo(ShopConstant.IS_FILL_SHOP_INFO_STEP4); // shopOpenManager.updateShopOpenFlow(shopOpenFlowDO); // } else { // shopOpenFlowDO = new ShopOpenFlowDO(); // shopOpenFlowDO.setUserId(userId); // shopOpenFlowDO.setConfiguration("USER_NAME="+nickname); // shopOpenFlowDO // .setIsAgreement(ShopConstant.IS_AGREEMENT_TRUE); // shopOpenFlowDO.setSellerType(sellerType); // shopOpenFlowDO.setAuditCount(1); // shopOpenFlowDO.setAuditProgress(""); // shopOpenFlowDO.setAuditStatus(ShopConstant.AUDIT_STATUS_WAIT); // //shopOpenFlowDO.setConfiguration(""); // shopOpenFlowDO.setIsBlack(0); // shopOpenFlowDO.setIsKa(ShopConstant.IS_KA_NO); // shopOpenFlowDO.setIsOnlineAuditEnd(0); // shopOpenFlowDO.setIsPostalAuditEnd(0); // shopOpenFlowDO.setNoPassReason(""); // shopOpenFlowDO.setReviewer(""); // shopOpenFlowDO.setGmtCreate(new Date()); // shopOpenFlowDO.setGmtModified(new Date()); // shopOpenFlowDO // .setIsFillInfo(ShopConstant.IS_FILL_SHOP_INFO_STEP4); // shopOpenManager.agreement(shopOpenFlowDO); // } // PinjuCookieManager.clearShop4(); // return "SHOP_OPEN_BEGIN"; // } // } catch (ManagerException e) { // log.error(e.getMessage()); } catch (ParseException e) { } return "success"; } /** * ?cookie * @param step */ // private void setShopBusinessCookie(Integer step){ // try { // //? // if (step.equals(ShopConstant.IS_FILL_SHOP_INFO_NO)) { // //?cookie // String cookieString = PinjuCookieManager.getShop1(); // log.error(cookieString); // //cookie // if (cookieString != null && cookieString.length() > 0) { // //shopBusinessInfoDO? // if (shopBusinessInfoDO == null) { // shopBusinessInfoDO = new ShopBusinessInfoDO(); // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getName())) { // String name = getCookieParamValue(cookieString, "name"); // if (!EmptyUtil.isBlank(name)) { // shopBusinessInfoDO.setName(URLDecoder.decode(name, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopNature())) { // shopBusinessInfoDO.setShopNature(getCookieParamValue(cookieString, "shopNature")); // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopCategory())) { // shopBusinessInfoDO.setShopCategory(getCookieParamValue(cookieString, "shopCategory")); // } // } // // } // //? // else if (step.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP1)) { // String cookieString = PinjuCookieManager.getShop2(); // log.error(cookieString); // if (cookieString != null && cookieString.length() > 0) { // if (EmptyUtil.isBlank(shopBusinessInfoDO.getProvince())) { // String province = getCookieParamValue(cookieString, "province"); // if (!EmptyUtil.isBlank(province)) { // shopBusinessInfoDO.setProvince(URLDecoder.decode(province, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getCity())) { // String city = getCookieParamValue(cookieString, "city"); // if (!EmptyUtil.isBlank(city)) { // shopBusinessInfoDO.setCity(URLDecoder.decode(city, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getEnterpriseName())) { // String enterpriseName = getCookieParamValue(cookieString, "enterpriseName"); // if (!EmptyUtil.isBlank(enterpriseName)) { // shopBusinessInfoDO.setEnterpriseName(URLDecoder.decode(enterpriseName, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getBusinessLicenseNumber())) { // shopBusinessInfoDO.setBusinessLicenseNumber(getCookieParamValue(cookieString, // "businessLicenseNumber")); // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getOrganizationCodeNumber())) { // shopBusinessInfoDO.setOrganizationCodeNumber(getCookieParamValue(cookieString, // "organizationCodeNumber")); // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getBusiness())) { // String business = getCookieParamValue(cookieString, "business"); // if (!EmptyUtil.isBlank(business)) { // shopBusinessInfoDO.setBusiness(URLDecoder.decode(business, "UTF-8")); // } // } // if (shopBusinessInfoDO.getBusinessLicenseEndDate() == null) { // String dateString = getCookieParamValue(cookieString, "businessLicenseEndDate"); // if (!EmptyUtil.isBlank(dateString)) { // DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); // try { // shopBusinessInfoDO.setBusinessLicenseEndDate(format1.parse(dateString)); // } catch (ParseException e) { // log.error(e); // } // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getLegalName())) { // String legalNameString = getCookieParamValue(cookieString, "legalName"); // if (!EmptyUtil.isBlank(legalNameString)) { // shopBusinessInfoDO.setLegalName(URLDecoder.decode(legalNameString, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getRegistAddress())) { // String registAddress = getCookieParamValue(cookieString, "registAddress"); // if (!EmptyUtil.isBlank(registAddress)) { // shopBusinessInfoDO.setRegistAddress(URLDecoder.decode(registAddress, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getOuterShopAddressUrl())) { // String shopAddressUrl = getCookieParamValue(cookieString, "shopAddressUrl"); // if (!EmptyUtil.isBlank(shopAddressUrl)) { // shopBusinessInfoDO.setOuterShopAddressUrl(URLDecoder.decode(shopAddressUrl, "UTF-8")); // } // } // } // } // //? // else if (step.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP2)) { // String cookieString = PinjuCookieManager.getShop3(); // log.error(cookieString); // if (cookieString != null && cookieString.length() > 0) { // if (EmptyUtil.isBlank(shopBusinessInfoDO.getTrademarkNumber())) { // String trademarkNumber = getCookieParamValue(cookieString, "trademarkNumber"); // if (!EmptyUtil.isBlank(trademarkNumber) && !trademarkNumber.equals("")) { // shopBusinessInfoDO.setTrademarkNumber(URLDecoder.decode(trademarkNumber, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getBrandName())) { // String brandName = getCookieParamValue(cookieString, "brandName"); // if (!EmptyUtil.isBlank(brandName) && !brandName.equals("")) { // shopBusinessInfoDO.setBrandName(URLDecoder.decode(brandName, "UTF-8")); // } // } // } // } // //? // else if (step.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP3)) { // String cookieString = PinjuCookieManager.getShop4(); // log.error(cookieString); // if (cookieString != null && cookieString.length() > 0) { // if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerName())) { // String shopManagerName = getCookieParamValue(cookieString, "shopManagerName"); // if (!EmptyUtil.isBlank(shopManagerName)) { // shopBusinessInfoDO.setShopManagerName(URLDecoder.decode(shopManagerName, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerTelephone())) { // shopBusinessInfoDO.setShopManagerTelephone(getCookieParamValue(cookieString, // "shopManagerTelephone")); // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerMobile())) { // shopBusinessInfoDO.setShopManagerMobile(getCookieParamValue(cookieString, "shopManagerMobile")); // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerEmail())) { // shopBusinessInfoDO.setShopManagerEmail(getCookieParamValue(cookieString, "shopManagerEmail")); // } // if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerFax())) { // shopBusinessInfoDO.setShopManagerFax(getCookieParamValue(cookieString, "shopManagerFax")); // } // } // // } // } catch (UnsupportedEncodingException e) { // log.error(e); // } // } /** * cookie */ // private void setShopCustomerCookie(){ // try { // String cookieString = PinjuCookieManager.getShopC(); // log.error(cookieString); // if (cookieString != null && cookieString.length() > 0) { // if (shopCustomerInfoDO == null) { // shopCustomerInfoDO = new ShopCustomerInfoDO(); // } // if (EmptyUtil.isBlank(shopCustomerInfoDO.getName())) { // String name = getCookieParamValue(cookieString, "name"); // if (!EmptyUtil.isBlank(name)) { // shopCustomerInfoDO.setName(URLDecoder.decode(name, "UTF-8")); // } // } // if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopNature())) { // shopCustomerInfoDO.setShopNature(getCookieParamValue(cookieString, "shopNature")); // } // if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopCategory())) { // shopCustomerInfoDO.setShopCategory(getCookieParamValue(cookieString, "shopCategory")); // } // if(EmptyUtil.isBlank(shopCustomerInfoDO.getOuterShopAddressUrl())){ // String shopAddressUrl = getCookieParamValue(cookieString, "shopAddressUrl"); // if(!EmptyUtil.isBlank(shopAddressUrl)){ // shopCustomerInfoDO.setOuterShopAddressUrl(URLDecoder.decode(shopAddressUrl, "UTF-8")); // } // } // if(EmptyUtil.isBlank(shopCustomerInfoDO.getProvince())){ // String province = getCookieParamValue(cookieString, "province"); // if(!EmptyUtil.isBlank(province)){ // shopCustomerInfoDO.setProvince(URLDecoder.decode(province, "UTF-8")); // } // } // if(EmptyUtil.isBlank(shopCustomerInfoDO.getCity())){ // String city = getCookieParamValue(cookieString, "city"); // if(!EmptyUtil.isBlank(city)){ // shopCustomerInfoDO.setCity(URLDecoder.decode(city, "UTF-8")); // } // } // } // } catch (UnsupportedEncodingException e) { // log.error(e); // } // } private String getCookieParamValue(String cookieString, String key) { String splitCookie[] = cookieString.split(","); Map<String, String> map = new HashMap<String, String>(splitCookie.length); for (int i = 0; i < splitCookie.length; i++) { String keyValue[] = splitCookie[i].split("="); map.put(keyValue[0], keyValue.length > 1 ? keyValue[1] : ""); } log.error(map); return map.get(key); } /** * ??(?) * @return error: shopOpenCash.ftl * @return success: /orderPay tenDirectSendOrder */ public String payMargin() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } try { //???? long userId = queryUserId(); ShopInfoDO shopInfoDO = shopShowInfoManager.queryShopBaseInfoByUser(userId, null); categoryId = Long.parseLong(shopInfoDO.getShopCategory()); Integer exchangePriceInt = categoryMarginManager.getItemMargin(categoryId, Integer.parseInt(shopInfoDO.getSellerType())); String exchangePriceString = new Money(Long.valueOf(exchangePriceInt.toString())).getAmount() .toString(); Object object = shopOpenManager.saveExchangeInfo(userId, exchangeMargin, exchangePriceString); if (object == null) { errorMessage = "??"; return "error"; } /****** ??? Add By ShiXing@2011.08.18 ******/ //exchangePrice = new Money(Long.valueOf(exchangePriceInt.toString())).getAmount().toString(); Result result = marginAO.payMargin(userId); if (!result.isSuccess()) { errorMessage = ResultCodeMsg.getResultMessage(result.getResultCode()); return "error"; } DirectPayParamDO directPayParamDO = (DirectPayParamDO) result.getModel("directPayParamDO"); Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("directPayParamDO", directPayParamDO); ActionContext.getContext().setParameters(paramMap); /****** ShiXing End! ******/ } catch (Exception e) { log.error(e.getMessage()); } return "success"; } /** * ?? (3?) --- 2.0 * @return statusError: iWillOpenShopAction.htm * @return fillCustomerBaseInfo: shopOpenFillCustomerBaseInfo.ftl * @return fillCustomerUploadInfo: shopOpenFillCustomerUploadInfo.ftl * @return fillBusinessBaseInfo: shopOpenFillBusinessBaseInfo.ftl * @return fillBusinessUploadInfo: shopOpenFillBusinessUploadInfo.ftl * @return fillBusinessBrandInfo: shopOpenFillBusinessBrandInfo.ftl * @return fillIShopBaseInfo: shopOpenFillIShopBaseInfo.ftl * @return fillIShopUploadInfo: shopOpenFillIShopUploadInfo.ftl */ public String queryShopInfo() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } Long userId = queryUserId(); shopFlowInfoDO = shopOpenAO.queryFlowInfo(userId); if (shopFlowInfoDO != null && shopFlowInfoDO.getAuditStatus() != null && (shopFlowInfoDO.getAuditStatus().equals(ShopConstant.AUDIT_STATUS_OPEN_END) || shopFlowInfoDO.getAuditStatus().equals(ShopConstant.AUDIT_STATUS_PASS) || shopFlowInfoDO.getAuditStatus().equals(ShopConstant.AUDIT_STATUS_WAIT))) { return "statusError"; } //? if (fillType == null) { fillType = 3; } if (fillType.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP1)) { initOutShopInfoParam(); initBaseParam(); shopCategoryList = shopShowInfoAO.initShopCategoryList(); } //?? sellerType = Integer.parseInt(shopFlowInfoDO.getSellerType()); //? if (sellerType.equals(ShopConstant.SELLER_TYPE_C)) { List<ShopCustomerInfoDO> shopInfoList = shopOpenAO.queryShopCustomerInfo(userId); if (shopInfoList != null && shopInfoList.size() > 0) { shopCustomerInfoDO = shopInfoList.get(0); } //cookie setShopCustomerBaseCookie(); if (fillType.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP1)) { return "fillCustomerBaseInfo"; } else if (fillType.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP2)) { return "fillCustomerUploadInfo"; } //?? } else if (sellerType.equals(ShopConstant.SELLER_TYPE_B) || sellerType.equals(ShopConstant.SELLER_TYPE_B2)) { List<ShopBusinessInfoDO> shopInfoList = shopOpenAO.queryShopBusinessInfo(userId); if (shopInfoList != null && shopInfoList.size() > 0) { shopBusinessInfoDO = shopInfoList.get(0); } setShopBusinessBaseCookie(); setShopBrandCookie(); if (fillType.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP1)) { return "fillBusinessBaseInfo"; } else if (fillType.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP2)) { return "fillBusinessUploadInfo"; } else if (fillType.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP3)) { //???? if (isNewBrand != null && isNewBrand.intValue() == 1) { shopBusinessInfoDO.setBrandName(""); shopBusinessInfoDO.setBrandEnglishName(""); shopBusinessInfoDO.setBrandStory(""); shopBusinessInfoDO.setTrademarkNumber(""); } int newBrandSeq = 0; String brandNameString = shopBusinessInfoDO.getBrandName(); if (brandNameString != null && brandNameString.length() > 0) { newBrandSeq = brandNameString.split("@!@").length - 1; } //? brandSeq = newBrandSeq; //?? if (currentBrand == null) { currentBrand = 0; } if (brandSeq != null) { String brandName = shopBusinessInfoDO.getBrandName(); String brandEnglishName = shopBusinessInfoDO.getBrandEnglishName(); String brandStory = shopBusinessInfoDO.getBrandStory(); String trademarkNumber = shopBusinessInfoDO.getTrademarkNumber(); if (brandName != null && brandName.length() > 0) { shopBusinessInfoDO.setBrandName(brandName.split("@!@")[currentBrand]); } if (brandEnglishName != null && brandEnglishName.length() > 0) { String[] ename = brandEnglishName.split("@!@"); if (ename.length <= currentBrand) { shopBusinessInfoDO.setBrandEnglishName(""); } else { shopBusinessInfoDO .setBrandEnglishName(brandEnglishName.split("@!@")[currentBrand].trim()); } } if (brandStory != null && brandStory.length() > 0) { shopBusinessInfoDO.setBrandStory(brandStory.split("@!@")[currentBrand]); } if (trademarkNumber != null && trademarkNumber.length() > 0) { shopBusinessInfoDO.setTrademarkNumber(trademarkNumber.split("@!@")[currentBrand]); } } else { brandSeq = 0; } return "fillBusinessBrandInfo"; } //i?? } else if (sellerType.equals(ShopConstant.SELLER_TYPE_IShop)) { List<ShopIshopInfoDO> shopInfoList = shopOpenAO.queryShopIShopnfo(userId); if (shopInfoList != null && shopInfoList.size() > 0) { shopIshopInfoDO = shopInfoList.get(0); } setShopIShopBaseCookie(); if (fillType.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP1)) { return "fillIShopBaseInfo"; } else if (fillType.equals(ShopConstant.IS_FILL_SHOP_INFO_STEP2)) { return "fillIShopUploadInfo"; } } return "error"; } /** * ?base cookie */ private void setShopBusinessBaseCookie() { try { // ??cookie String cookieString = PinjuCookieManager.getShop1(); log.info(cookieString); // cookie if (cookieString != null && cookieString.length() > 0) { //? // shopBusinessInfoDO? if (shopBusinessInfoDO == null) { shopBusinessInfoDO = new ShopBusinessInfoDO(); } if (EmptyUtil.isBlank(shopBusinessInfoDO.getName())) { String name = getCookieParamValue(cookieString, "name"); if (!EmptyUtil.isBlank(name)) { shopBusinessInfoDO.setName(URLDecoder.decode(name, "UTF-8")); } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopNature())) { shopBusinessInfoDO.setShopNature(getCookieParamValue(cookieString, "shopNature")); } if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopCategory())) { shopBusinessInfoDO.setShopCategory(getCookieParamValue(cookieString, "shopCategory")); } //?? if (EmptyUtil.isBlank(shopBusinessInfoDO.getProvince())) { String province = getCookieParamValue(cookieString, "province"); if (!EmptyUtil.isBlank(province)) { shopBusinessInfoDO.setProvince(URLDecoder.decode(province, "UTF-8")); } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getCity())) { String city = getCookieParamValue(cookieString, "city"); if (!EmptyUtil.isBlank(city)) { shopBusinessInfoDO.setCity(URLDecoder.decode(city, "UTF-8")); } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getEnterpriseName())) { String enterpriseName = getCookieParamValue(cookieString, "enterpriseName"); if (!EmptyUtil.isBlank(enterpriseName)) { shopBusinessInfoDO.setEnterpriseName(URLDecoder.decode(enterpriseName, "UTF-8")); } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getBusinessLicenseNumber())) { shopBusinessInfoDO .setBusinessLicenseNumber(getCookieParamValue(cookieString, "businessLicenseNumber")); } if (EmptyUtil.isBlank(shopBusinessInfoDO.getOrganizationCodeNumber())) { shopBusinessInfoDO .setOrganizationCodeNumber(getCookieParamValue(cookieString, "organizationCodeNumber")); } if (EmptyUtil.isBlank(shopBusinessInfoDO.getBusiness())) { String business = getCookieParamValue(cookieString, "business"); if (!EmptyUtil.isBlank(business)) { shopBusinessInfoDO.setBusiness(URLDecoder.decode(business, "UTF-8")); } } if (shopBusinessInfoDO.getBusinessLicenseEndDate() == null) { String dateString = getCookieParamValue(cookieString, "businessLicenseEndDate"); if (!EmptyUtil.isBlank(dateString)) { DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); try { shopBusinessInfoDO.setBusinessLicenseEndDate(format1.parse(dateString)); } catch (ParseException e) { log.error(e); } } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getLegalName())) { String legalNameString = getCookieParamValue(cookieString, "legalName"); if (!EmptyUtil.isBlank(legalNameString)) { shopBusinessInfoDO.setLegalName(URLDecoder.decode(legalNameString, "UTF-8")); } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getRegistAddress())) { String registAddress = getCookieParamValue(cookieString, "registAddress"); if (!EmptyUtil.isBlank(registAddress)) { shopBusinessInfoDO.setRegistAddress(URLDecoder.decode(registAddress, "UTF-8")); } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getOuterShopAddressUrl())) { String shopAddressUrl = getCookieParamValue(cookieString, "shopAddressUrl"); if (!EmptyUtil.isBlank(shopAddressUrl)) { shopBusinessInfoDO.setOuterShopAddressUrl(URLDecoder.decode(shopAddressUrl, "UTF-8")); } } //?? if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerName())) { String shopManagerName = getCookieParamValue(cookieString, "shopManagerName"); if (!EmptyUtil.isBlank(shopManagerName)) { shopBusinessInfoDO.setShopManagerName(URLDecoder.decode(shopManagerName, "UTF-8")); } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerTelephone())) { shopBusinessInfoDO .setShopManagerTelephone(getCookieParamValue(cookieString, "shopManagerTelephone")); } if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerMobile())) { shopBusinessInfoDO.setShopManagerMobile(getCookieParamValue(cookieString, "shopManagerMobile")); } if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerEmail())) { shopBusinessInfoDO.setShopManagerEmail(getCookieParamValue(cookieString, "shopManagerEmail")); } if (EmptyUtil.isBlank(shopBusinessInfoDO.getShopManagerFax())) { shopBusinessInfoDO.setShopManagerFax(getCookieParamValue(cookieString, "shopManagerFax")); } } } catch (UnsupportedEncodingException e) { log.error(e); } } /** * ??cookie */ private void setShopBrandCookie() { try { String cookieString = PinjuCookieManager.getShop2(); log.info(cookieString); if (cookieString != null && cookieString.length() > 0) { if (EmptyUtil.isBlank(shopBusinessInfoDO.getTrademarkNumber())) { String trademarkNumber = getCookieParamValue(cookieString, "trademarkNumber"); if (!EmptyUtil.isBlank(trademarkNumber) && !trademarkNumber.equals("")) { shopBusinessInfoDO.setTrademarkNumber(URLDecoder.decode(trademarkNumber, "UTF-8")); } } if (EmptyUtil.isBlank(shopBusinessInfoDO.getBrandName())) { String brandName = getCookieParamValue(cookieString, "brandName"); if (!EmptyUtil.isBlank(brandName) && !brandName.equals("")) { shopBusinessInfoDO.setBrandName(URLDecoder.decode(brandName, "UTF-8")); } } } } catch (UnsupportedEncodingException e) { log.error(e); } } /** * cookie --2.0 */ private void setShopCustomerBaseCookie() { try { // ??cookie String cookieString = PinjuCookieManager.getShop1(); log.info(cookieString); // cookie if (cookieString != null && cookieString.length() > 0) { //? // shopCustomerInfoDO? if (shopCustomerInfoDO == null) { shopCustomerInfoDO = new ShopCustomerInfoDO(); } if (EmptyUtil.isBlank(shopCustomerInfoDO.getName())) { String name = getCookieParamValue(cookieString, "name"); if (!EmptyUtil.isBlank(name)) { shopCustomerInfoDO.setName(URLDecoder.decode(name, "UTF-8")); } } if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopNature())) { shopCustomerInfoDO.setShopNature(getCookieParamValue(cookieString, "shopNature")); } if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopCategory())) { shopCustomerInfoDO.setShopCategory(getCookieParamValue(cookieString, "shopCategory")); } //?? if (EmptyUtil.isBlank(shopCustomerInfoDO.getProvince())) { String province = getCookieParamValue(cookieString, "province"); if (!EmptyUtil.isBlank(province)) { shopCustomerInfoDO.setProvince(URLDecoder.decode(province, "UTF-8")); } } if (EmptyUtil.isBlank(shopCustomerInfoDO.getCity())) { String city = getCookieParamValue(cookieString, "city"); if (!EmptyUtil.isBlank(city)) { shopCustomerInfoDO.setCity(URLDecoder.decode(city, "UTF-8")); } } if (EmptyUtil.isBlank(shopCustomerInfoDO.getEnterpriseName())) { String enterpriseName = getCookieParamValue(cookieString, "enterpriseName"); if (!EmptyUtil.isBlank(enterpriseName)) { shopCustomerInfoDO.setEnterpriseName(URLDecoder.decode(enterpriseName, "UTF-8")); } } if (EmptyUtil.isBlank(shopCustomerInfoDO.getBusinessLicenseNumber())) { shopCustomerInfoDO .setBusinessLicenseNumber(getCookieParamValue(cookieString, "businessLicenseNumber")); } if (EmptyUtil.isBlank(shopCustomerInfoDO.getOrganizationCodeNumber())) { shopCustomerInfoDO .setOrganizationCodeNumber(getCookieParamValue(cookieString, "organizationCodeNumber")); } if (EmptyUtil.isBlank(shopCustomerInfoDO.getBusiness())) { String business = getCookieParamValue(cookieString, "business"); if (!EmptyUtil.isBlank(business)) { shopCustomerInfoDO.setBusiness(URLDecoder.decode(business, "UTF-8")); } } if (shopCustomerInfoDO.getBusinessLicenseEndDate() == null) { String dateString = getCookieParamValue(cookieString, "businessLicenseEndDate"); if (!EmptyUtil.isBlank(dateString)) { DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); try { shopCustomerInfoDO.setBusinessLicenseEndDate(format1.parse(dateString)); } catch (ParseException e) { log.error(e); } } } if (EmptyUtil.isBlank(shopCustomerInfoDO.getLegalName())) { String legalNameString = getCookieParamValue(cookieString, "legalName"); if (!EmptyUtil.isBlank(legalNameString)) { shopCustomerInfoDO.setLegalName(URLDecoder.decode(legalNameString, "UTF-8")); } } if (EmptyUtil.isBlank(shopCustomerInfoDO.getRegistAddress())) { String registAddress = getCookieParamValue(cookieString, "registAddress"); if (!EmptyUtil.isBlank(registAddress)) { shopCustomerInfoDO.setRegistAddress(URLDecoder.decode(registAddress, "UTF-8")); } } if (EmptyUtil.isBlank(shopCustomerInfoDO.getOuterShopAddressUrl())) { String shopAddressUrl = getCookieParamValue(cookieString, "shopAddressUrl"); if (!EmptyUtil.isBlank(shopAddressUrl)) { shopCustomerInfoDO.setOuterShopAddressUrl(URLDecoder.decode(shopAddressUrl, "UTF-8")); } } //?? if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopManagerName())) { String shopManagerName = getCookieParamValue(cookieString, "shopManagerName"); if (!EmptyUtil.isBlank(shopManagerName)) { shopCustomerInfoDO.setShopManagerName(URLDecoder.decode(shopManagerName, "UTF-8")); } } if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopManagerTelephone())) { shopCustomerInfoDO .setShopManagerTelephone(getCookieParamValue(cookieString, "shopManagerTelephone")); } if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopManagerMobile())) { shopCustomerInfoDO.setShopManagerMobile(getCookieParamValue(cookieString, "shopManagerMobile")); } if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopManagerEmail())) { shopCustomerInfoDO.setShopManagerEmail(getCookieParamValue(cookieString, "shopManagerEmail")); } if (EmptyUtil.isBlank(shopCustomerInfoDO.getShopManagerFax())) { shopCustomerInfoDO.setShopManagerFax(getCookieParamValue(cookieString, "shopManagerFax")); } } } catch (UnsupportedEncodingException e) { log.error(e); } } /** * i?cookie --2.0 */ private void setShopIShopBaseCookie() { try { // ??cookie String cookieString = PinjuCookieManager.getShop1(); log.info(cookieString); // cookie if (cookieString != null && cookieString.length() > 0) { //? // shopBusinessInfoDO? if (shopIshopInfoDO == null) { shopIshopInfoDO = new ShopIshopInfoDO(); } if (EmptyUtil.isBlank(shopIshopInfoDO.getName())) { String name = getCookieParamValue(cookieString, "name"); if (!EmptyUtil.isBlank(name)) { shopIshopInfoDO.setName(URLDecoder.decode(name, "UTF-8")); } } if (EmptyUtil.isBlank(shopIshopInfoDO.getShopNature())) { shopIshopInfoDO.setShopNature(getCookieParamValue(cookieString, "shopNature")); } if (EmptyUtil.isBlank(shopIshopInfoDO.getShopCategory())) { shopIshopInfoDO.setShopCategory(getCookieParamValue(cookieString, "shopCategory")); } //?? if (EmptyUtil.isBlank(shopIshopInfoDO.getShopManagerName())) { String shopManagerName = getCookieParamValue(cookieString, "shopManagerName"); if (!EmptyUtil.isBlank(shopManagerName)) { shopIshopInfoDO.setShopManagerName(URLDecoder.decode(shopManagerName, "UTF-8")); } } if (EmptyUtil.isBlank(shopIshopInfoDO.getShopManagerTelephone())) { shopIshopInfoDO .setShopManagerTelephone(getCookieParamValue(cookieString, "shopManagerTelephone")); } if (EmptyUtil.isBlank(shopIshopInfoDO.getShopManagerMobile())) { shopIshopInfoDO.setShopManagerMobile(getCookieParamValue(cookieString, "shopManagerMobile")); } if (EmptyUtil.isBlank(shopIshopInfoDO.getShopManagerEmail())) { shopIshopInfoDO.setShopManagerEmail(getCookieParamValue(cookieString, "shopManagerEmail")); } if (EmptyUtil.isBlank(shopIshopInfoDO.getShopManagerFax())) { shopIshopInfoDO.setShopManagerFax(getCookieParamValue(cookieString, "shopManagerFax")); } } } catch (UnsupportedEncodingException e) { log.error(e); } } /** * ?????.??,??? --2.0 * @return */ public String checkIsPayMarginSuccess() { //MarginManager getMarginSellerDOBySellerId Long sellerId = queryUserId(); try { //?? MarginSellerDO marginSellerDO = marginManager.getMarginSellerDOBySellerId(sellerId); //marginSellerDO? if (marginSellerDO != null) { return "redirectSellerIndex"; } return "currentPage"; } catch (ManagerException e) { log.error("?????", e); } return "currentPage"; } /** * ? --2.0 * @return shopOpenEnd: /my/sell.htm * @return openShopIndex1: shopOpentep2.ftl * @return openShopIndex2: shopOpentep3.ftl * @return openShopIndex3: shopOpentep4.ftl * @return openShopIndex4: shopOpentep5.ftl * @return openShopIndex: shopOpentep1.ftl **/ public String iWillOpenShop() { Long userId = queryUserId(); //???? try { //???? ShopInfoDO shopInfoDO = shopShowInfoManager.queryShopBaseInfoByUser(userId, null); if (shopInfoDO != null) { Long sellerType = Long.parseLong(shopInfoDO.getSellerType()); boolean booleanC = true; boolean booleanB = true; boolean booleanIShop = true; booleanC = shopShowInfoManager.checkHasCustomerInfo(userId); booleanIShop = shopShowInfoManager.checkHasIShopInfo(userId); booleanB = shopShowInfoManager.checkHasBusinessInfo(userId); boolean b2 = true; if (!booleanC && !booleanB && !booleanIShop) { if (sellerType.equals(ShopConstant.SELLER_TYPE_C)) { ShopCustomerInfoDO shopCustomerInfo = new ShopCustomerInfoDO(); shopCustomerInfo.setUserId(userId); shopCustomerInfo.setSellerType(String.valueOf(sellerType)); b2 = shopShowInfoManager.insertCustomerInfo(shopCustomerInfo); if (!b2) { errorMessage = "?!"; return "error"; } } else if (sellerType.equals(ShopConstant.SELLER_TYPE_IShop)) { ShopIshopInfoDO shopIshopInfo = new ShopIshopInfoDO(); shopIshopInfo.setUserId(userId); shopIshopInfo.setSellerType(String.valueOf(sellerType)); b2 = shopShowInfoManager.insertIShopInfo(shopIshopInfo); if (!b2) { errorMessage = "?!"; return "error"; } } else { ShopBusinessInfoDO shopBusinessInfo = new ShopBusinessInfoDO(); shopBusinessInfo.setUserId(userId); shopBusinessInfo.setSellerType(String.valueOf(sellerType)); b2 = shopShowInfoManager.insertBusinessInfo(shopBusinessInfo); if (!b2) { errorMessage = "?!"; return "error"; } } } List<ShopOpenFlowDO> shopOpenFlowDOList = shopOpenManager.queryShopOpenFlow(userId); if (shopOpenFlowDOList == null || shopOpenFlowDOList.size() == 0) { shopOpenFlowDO = new ShopOpenFlowDO(); shopOpenFlowDO.setUserId(userId); shopOpenFlowDO.setIsAgreement(ShopConstant.IS_AGREEMENT_TRUE); shopOpenFlowDO.setAuditStatus(ShopConstant.AUDIT_STATUS_NOT_APPLY); shopOpenFlowDO.setGmtCreate(new Date()); shopOpenFlowDO.setIsFillInfo(ShopConstant.IS_FILL_SHOP_INFO_NO); shopOpenFlowDO.setSellerType(Integer.parseInt(sellerType.toString())); shopOpenFlowDO.setConfiguration("USER_NAME=" + queryNickName()); shopOpenFlowDO.setAuditCount(0); shopOpenFlowDO.setIsKa(ShopConstant.IS_KA_NO); shopOpenFlowDO.setIsBlack(ShopConstant.BLACK_FALSE); shopOpenManager.saveShopOpenFlow(shopOpenFlowDO); } } //??? shopFlowInfoDO = shopOpenAO.queryFlowInfo(userId); if (shopFlowInfoDO != null) { if (shopFlowInfoDO.getIsAccountSet() != null && !shopFlowInfoDO.getIsAccountSet().equals(ShopConstant.IS_ACCOUNT_SET_COMPLETE)) { } else { MarginSellerDO marginSellerDO = marginManager.getMarginSellerDOBySellerId(userId); // ??,null?? //marginSellerDO = new MarginSellerDO(); if (marginSellerDO != null) { return "shopOpenEnd"; } if (shopInfoDO != null && shopInfoDO.getExchangeMargin() != null && shopInfoDO.getShopInfoConfig("MARGIN_PRICE") != null) { log.warn("???,??...."); return "shopOpenLast"; } } } //return "shopOpenEnd"; } catch (ManagerException e) { log.error("?,[marginManager.getMarginSellerDOBySellerId]!", e); } //?error? if (ActionContext.getContext().getParameters() != null) { Map<String, Object> map = ActionContext.getContext().getParameters(); if (map.get("errorMessage") != null && map.get("errorMessage").toString().length() > 0) { setErrorMessage(map.get("errorMessage").toString()); map.remove("errorMessage"); ActionContext.getContext().setParameters(map); } } if (null != shopFlowInfoDO) { if (null != shopFlowInfoDO.getSellerType() && !"".equals(shopFlowInfoDO.getSellerType())) { // ((?null && ( || ?)) // && (??null && (? || ??))) if ((null != shopFlowInfoDO.getIsAccountSet() && (ShopConstant.IS_ACCOUNT_SET_NOT_BEGIN .equals(shopFlowInfoDO.getIsAccountSet()) || ShopConstant.IS_ACCOUNT_SET_NOT_COMPLETE.equals(shopFlowInfoDO.getIsAccountSet()))) && (null != shopFlowInfoDO.getIsFillComplete() && (ShopConstant.IS_FILL_COMPLETE_NOT_BEGIN .equals(shopFlowInfoDO.getIsFillComplete()) || ShopConstant.IS_FILL_COMPLETE_NOT_COMPLETE .equals(shopFlowInfoDO.getIsFillComplete().intValue())))) { return "openShopIndex1"; } // ((?null && ?) // && (??null && (? || ??))) else if ((null != shopFlowInfoDO.getIsAccountSet() && ShopConstant.IS_ACCOUNT_SET_COMPLETE.equals(shopFlowInfoDO.getIsAccountSet().intValue())) && (null != shopFlowInfoDO.getIsFillComplete() && (ShopConstant.IS_FILL_COMPLETE_NOT_BEGIN .equals(shopFlowInfoDO.getIsFillComplete().intValue()) || ShopConstant.IS_FILL_COMPLETE_NOT_COMPLETE .equals(shopFlowInfoDO.getIsFillComplete().intValue())))) { return "openShopIndex2"; } //((??null && ??) && (?null && (? || ))) else if ((null != shopFlowInfoDO.getIsFillComplete() && ShopConstant.IS_FILL_COMPLETE_COMPLETE .equals(shopFlowInfoDO.getIsFillComplete().intValue())) && (null != shopFlowInfoDO.getIsAccountSet() && (ShopConstant.IS_ACCOUNT_SET_NOT_COMPLETE .equals(shopFlowInfoDO.getIsAccountSet().intValue()) || ShopConstant.IS_ACCOUNT_SET_NOT_BEGIN .equals(shopFlowInfoDO.getIsAccountSet().intValue())))) { return "openShopIndex4"; } //((?null && ?) && (??null && ??)) else if ((null != shopFlowInfoDO.getIsAccountSet() && ShopConstant.IS_ACCOUNT_SET_COMPLETE.equals(shopFlowInfoDO.getIsAccountSet().intValue())) && (null != shopFlowInfoDO.getIsFillComplete() && ShopConstant.IS_FILL_COMPLETE_COMPLETE .equals(shopFlowInfoDO.getIsFillComplete().intValue()))) { return "openShopIndex3"; } } } return "openShopIndex"; } /** * ?? --2.0 * @return auditStatusPage: shopOpenAuditStatus.ftl */ public String showAuditStatusPage() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } Long userId = queryUserId(); List<ShopOpenFlowDO> list = shopOpenAO.queryShopOpenFlow(userId); if (list != null && list.size() > 0) { shopOpenFlowDO = list.get(0); if (shopOpenFlowDO.getAuditStatus().equals(ShopConstant.AUDIT_STATUS_NO)) { String noPassReason = shopOpenFlowDO.getNoPassReason(); if (noPassReason != null && noPassReason.length() > 0) { String noPassReasons[] = noPassReason.split("@!@"); shopOpenFlowDO.setNoPassReason(noPassReasons[noPassReasons.length - 1]); } } } return "auditStatusPage"; } /** * ??[2.0] * @return openShopIndex1: iWillOpenShopAction.htm * @return statusError: shopOpentep1.ftl **/ public String shopOpenSignAgreement() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } Long userId = queryUserId(); if (null != userId) { List<ShopOpenFlowDO> list = shopOpenAO.queryShopOpenFlow(userId); if (null != list && list.size() > 0) { return "openShopIndex1"; } //??? shopOpenFlowDO = new ShopOpenFlowDO(); shopOpenFlowDO.setUserId(userId); shopOpenFlowDO.setIsAgreement(ShopConstant.IS_AGREEMENT_TRUE); shopOpenFlowDO.setAuditStatus(ShopConstant.AUDIT_STATUS_NOT_APPLY); shopOpenFlowDO.setGmtCreate(new Date()); shopOpenFlowDO.setIsFillInfo(ShopConstant.IS_FILL_SHOP_INFO_NO); shopOpenFlowDO.setSellerType(sellerType); shopOpenFlowDO.setConfiguration("USER_NAME=" + queryNickName()); shopOpenFlowDO.setAuditCount(0); shopOpenFlowDO.setIsKa(ShopConstant.IS_KA_NO); shopOpenFlowDO.setIsBlack(ShopConstant.BLACK_FALSE); if (sellerType.equals(ShopConstant.SELLER_TYPE_C)) { ShopCustomerInfoDO shopCustomerInfo = new ShopCustomerInfoDO(); shopCustomerInfo.setUserId(userId); shopCustomerInfo.setNickname(queryNickName()); shopCustomerInfo.setIsSupplier(0); shopCustomerInfo.setGmtCreate(new Date()); shopCustomerInfo.setApproveStatus(ShopConstant.APPROVE_STATUS_NO); shopCustomerInfo.setSellerType(String.valueOf(sellerType)); Result result = (Result) shopOpenManager.signAgreementLoadData(sellerType, shopCustomerInfo, shopOpenFlowDO); if (null != result && !result.isSuccess()) { errorMessage = "????"; return "statusError"; } } else if (sellerType.equals(ShopConstant.SELLER_TYPE_IShop)) { ShopIshopInfoDO shopIshopInfo = new ShopIshopInfoDO(); shopIshopInfo.setUserId(userId); shopIshopInfo.setNickname(queryNickName()); shopIshopInfo.setIsSupplier(0); shopIshopInfo.setGmtCreate(new Date()); shopIshopInfo.setApproveStatus(ShopConstant.APPROVE_STATUS_NO); shopIshopInfo.setSellerType(String.valueOf(sellerType)); Result result = (Result) shopOpenManager.signAgreementLoadData(sellerType, shopIshopInfo, shopOpenFlowDO); if (null != result && !result.isSuccess()) { errorMessage = "????"; return "statusError"; } } else { ShopBusinessInfoDO shopBusinessInfo = new ShopBusinessInfoDO(); shopBusinessInfo.setUserId(userId); shopBusinessInfo.setNickname(queryNickName()); shopBusinessInfo.setIsSupplier(0); shopBusinessInfo.setGmtCreate(new Date()); shopBusinessInfo.setApproveStatus(ShopConstant.APPROVE_STATUS_NO); shopBusinessInfo.setSellerType(String.valueOf(sellerType)); Result result = (Result) shopOpenManager.signAgreementLoadData(sellerType, shopBusinessInfo, shopOpenFlowDO); if (null != result && !result.isSuccess()) { errorMessage = "????"; return "statusError"; } } } return "openShopIndex1"; } /** * ??? --2.0 * @return choiceFillIndex: shopOpenChoiceFillIndex.ftl */ public String choiceFillIndex() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } Long userId = queryUserId(); //??? shopFlowInfoDO = shopOpenAO.queryFlowInfo(userId); return "choiceFillIndex"; } /** * ? --2.0 * @return reopenShop: iWillOpenShopAction.htm * @return statusError: iWillOpenShopAction.htm */ public String reopenShop() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } Long userId = queryUserId(); ShopFlowInfoDO shopFlowInfoDO = shopOpenAO.queryFlowInfo(userId); if (null != shopFlowInfoDO && !shopFlowInfoDO.getAuditStatus().equals(ShopConstant.AUDIT_STATUS_NO)) { return "statusError"; } ShopOpenFlowDO shopOpenFlowDO = new ShopOpenFlowDO(); shopOpenFlowDO.setUserId(userId); shopOpenFlowDO.setAuditStatus(ShopConstant.AUDIT_STATUS_NOT_APPLY); shopOpenFlowDO.setIsFillInfo(ShopConstant.IS_FILL_SHOP_INFO_NO); shopOpenFlowDO.setGmtModified(new Date()); shopOpenAO.updateShopOpenFlow(shopOpenFlowDO); return "reopenShop"; } /** * ?2.0 * @return */ @SuppressWarnings("unchecked") public String changeSellType() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } Long userId = queryUserId(); List list = shopOpenAO.queryShopOpenFlow(userId); if (null != list && list.size() > 0) { ShopOpenFlowDO shopOpenFlowDO = (ShopOpenFlowDO) list.get(0); if (null != shopOpenFlowDO && shopOpenFlowDO.getAuditStatus().equals(ShopConstant.AUDIT_STATUS_NOT_APPLY)) { Result result = (Result) shopOpenManager .deleteShopDateByUpdateSellerType(shopOpenFlowDO.getSellerType(), userId); if (null != result && !result.isSuccess()) { Map<String, Object> parameters = new HashMap<String, Object>(); errorMessage = ""; parameters.put("errorMessage", errorMessage); ActionContext.getContext().setParameters(parameters); return "statusError"; } } } return "changeSellType"; } /** * ?,?-- 2.0 * @return shopOpenEnd: /my/sell.htm * @return error: shopOpenLast.ftl */ public String shopOpenEnd() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } Long userId = queryUserId(); //???? try { MarginSellerDO marginSellerDO = marginManager.getMarginSellerDOBySellerId(userId); //? //??,null?? //marginSellerDO = new MarginSellerDO(); if (marginSellerDO == null) { errorMessage = "<font color=\"red\">????</font><font color=\"gray\"><a href=\"/shop/showPayMarginPageAction.htm\">???</a></font><br>??4008-211-588"; return "error"; } else { Result result = shopOpenManager.setShopIsOpenForMargin(userId); if (!result.isSuccess()) { errorMessage = "<font color=\"red\">??</font><br>??4008-211-588"; return "error"; } } } catch (ManagerException e) { log.error(e); } return "shopOpenEnd"; } public String showShopOpenEnd() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } log.warn("in showShopOpenEnd"); return "showShopOpenEnd"; } /** * ????2.0 * @return showPayMarginPage: shopOpenCash.ftl * @return error: error.ftl * @return statusError: iWillOpenShopAction.htm */ public String showPayMarginPage() { if (CookieLoginInfo.getCookieLoginInfo().isAssistantAccount()) { return MemberAuthInterceptor.accessDenied(); } Long userId = queryUserId(); ShopFlowInfoDO shopFlowInfoDO = shopOpenAO.queryFlowInfo(userId); if (shopFlowInfoDO == null) { errorMessage = "???!"; return "error"; } //?? if (shopFlowInfoDO.getAuditStatus() != null && shopFlowInfoDO.getAuditStatus().equals(ShopConstant.AUDIT_STATUS_PASS) && shopFlowInfoDO.getIsAccountSet() != null && shopFlowInfoDO.getIsAccountSet().equals(ShopConstant.IS_ACCOUNT_SET_COMPLETE)) { try { ShopInfoDO shopInfoDO = shopShowInfoManager.queryShopBaseInfoByUser(userId, null); if (shopInfoDO == null) { errorMessage = "???!"; return "error"; } if (shopInfoDO != null) { String category = shopInfoDO.getShopCategory(); if (category == null) { errorMessage = "???!"; return "error"; } String sellerType = shopInfoDO.getSellerType(); if (sellerType == null || sellerType.length() == 0) { sellerType = shopFlowInfoDO.getSellerType(); } categoryId = Long.parseLong(category); int price = categoryMarginManager.getItemMargin(Long.parseLong(category), Integer.parseInt(shopInfoDO.getSellerType())); // ??? List<CategoryDO> categoryList = categoryCacheManager.getRootCategoryList(); if (categoryList != null && categoryList.size() > 0) { shopCategoryList = new HashMap<Long, String>(); for (int i = 0; i < categoryList.size(); i++) { shopCategoryList.put((categoryList.get(i)).getId(), (categoryList.get(i).getName())); if (categoryId != null && categoryId.equals(categoryList.get(i).getId())) { selectedCategory = categoryList.get(i).getName(); } } } if (selectedCategory == null) { errorMessage = "???!"; return "error"; } // ??? exchangePrice = new Money(Long.valueOf(price)).getAmount().toString(); } } catch (ManagerException e) { log.error("???", e); } } else { return "statusError"; } return "showPayMarginPage"; } public String getErrorMessage() { return errorMessage; } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public MemberManager getMemberManager() { return memberManager; } public void setMemberManager(MemberManager memberManager) { this.memberManager = memberManager; } public int getExchangeMargin() { return exchangeMargin; } public void setExchangeMargin(int exchangeMargin) { this.exchangeMargin = exchangeMargin; } public int getFillStep() { return fillStep; } public void setFillStep(int fillStep) { this.fillStep = fillStep; } public ShopCustomerInfoDO getShopCustomerInfoDO() { return shopCustomerInfoDO; } public void setShopShowInfoManager(ShopShowInfoManager shopShowInfoManager) { this.shopShowInfoManager = shopShowInfoManager; } public void setCategoryMarginManager(CategoryMarginManager categoryMarginManager) { this.categoryMarginManager = categoryMarginManager; } public void setShopCustomerInfoDO(ShopCustomerInfoDO shopCustomerInfoDO) { this.shopCustomerInfoDO = shopCustomerInfoDO; } public ShopBusinessInfoDO getShopBusinessInfoDO() { return shopBusinessInfoDO; } // public void setShopBusinessInfoDO(ShopBusinessInfoDO shopBusinessInfoDO) { // this.shopBusinessInfoDO = shopBusinessInfoDO; // } private Integer sellerType; public ShopOpenFlowDO getShopOpenFlowDO() { return shopOpenFlowDO; } public void setShopShowInfoAO(ShopShowInfoAO shopShowInfoAO) { this.shopShowInfoAO = shopShowInfoAO; } public Map<Long, String> getShopCategoryList() { return shopCategoryList; } public void setShopCategoryList(Map<Long, String> shopCategoryList) { this.shopCategoryList = shopCategoryList; } public void setShopOpenFlowDO(ShopOpenFlowDO shopOpenFlowDO) { this.shopOpenFlowDO = shopOpenFlowDO; } public ShopOpenAO getShopOpenAO() { return shopOpenAO; } public void setShopOpenAO(ShopOpenAO shopOpenAO) { this.shopOpenAO = shopOpenAO; } public int getSellerType() { return sellerType; } public void setSellerType(Integer sellerType) { this.sellerType = sellerType; } public String getExchangePrice() { return exchangePrice; } public void setExchangePrice(String exchangePrice) { this.exchangePrice = exchangePrice; } public int getIsHaveOuterShop() { return isHaveOuterShop; } public void setIsHaveOuterShop(int isHaveOuterShop) { this.isHaveOuterShop = isHaveOuterShop; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public String getShopName() { return shopName; } public void setShopName(String shopName) { this.shopName = shopName; } public FileStorageManager getFileStorageManager() { return fileStorageManager; } public void setFileStorageManager(FileStorageManager fileStorageManager) { this.fileStorageManager = fileStorageManager; } public File[] getMyFile() { return myFile; } public void setMyFile(File[] myFile) { this.myFile = myFile; } public String getMyFileFileName() { return myFileFileName; } public void setMyFileFileName(String myFileFileName) { this.myFileFileName = myFileFileName; } public String getBusinessLicenseEndDate() { return businessLicenseEndDate; } public void setBusinessLicenseEndDate(String businessLicenseEndDate) { this.businessLicenseEndDate = businessLicenseEndDate; } public ShopOpenManager getShopOpenManager() { return shopOpenManager; } public void setShopOpenManager(ShopOpenManager shopOpenManager) { this.shopOpenManager = shopOpenManager; } public Long getCategoryId() { return categoryId; } public void setCategoryId(Long categoryId) { this.categoryId = categoryId; } public String getSelectedCategory() { return selectedCategory; } public void setSelectedCategory(String selectedCategory) { this.selectedCategory = selectedCategory; } public void setMarginAO(MarginAO marginAO) { this.marginAO = marginAO; } public MarginAO getMarginAO() { return marginAO; } public void setMarginManager(MarginManager marginManager) { this.marginManager = marginManager; } public ShopFlowInfoDO getShopFlowInfoDO() { return shopFlowInfoDO; } public void setShopFlowInfoDO(ShopFlowInfoDO shopFlowInfoDO) { this.shopFlowInfoDO = shopFlowInfoDO; } }