zhaohongpeng 8 лет назад
Родитель
Сommit
39e3027fdd

+ 9 - 0
src/main/java/com/uas/platform/b2c/prod/store/facade/StoreApplyFacade.java

@@ -29,6 +29,15 @@ public interface StoreApplyFacade {
 	 */
 	ResultMap confirmOpenStore(String uuid, StoreApply storeApply);
 
+
+	/**
+	 * 自动确认开铺
+	 *
+	 * @param uuid			店铺申请信息编号
+	 * @param storeApply	更新的店铺信息
+	 */
+	ResultMap autoConfirmOpenStore(String uuid, StoreApply storeApply);
+
 	/**
 	 * 保存店铺申请信息
 	 *

+ 63 - 0
src/main/java/com/uas/platform/b2c/prod/store/facade/impl/StoreApplyFacadeImpl.java

@@ -34,6 +34,7 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 
 	private final StoreApplyService storeApplyService;
 
+
 	@Autowired
 	public StoreApplyFacadeImpl(StoreInService storeService, StoreApplyService storeApplyService) {
 		this.storeService = storeService;
@@ -114,6 +115,8 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 		storeApply.setBrands(apply.getBrands());
 
 		storeApplyService.handlerApply(storeApply);
+		//自动确认开通店铺;
+		this.autoConfirmOpenStore(uuid, storeApply);
 		return ResultMap.success(null);
 	}
 
@@ -172,6 +175,66 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 		return ResultMap.success(storeIn.getUuid());
 	}
 
+
+
+	public ResultMap autoConfirmOpenStore(String uuid, StoreApply storeApply) {
+		Date date = new Date();
+		// 验证
+		if (StringUtils.isEmpty(uuid) || storeApply == null) {
+			return new ResultMap(CodeType.NO_INFO, "开铺申请和编号信息不能为空");
+		}
+		storeApply.setBannerUrl("http://dfs.ubtob.com/group1/M00/19/BF/CgpkyFlSBRmAcascAANK5vkByag940.jpg");
+		storeApply.setLogoUrl("https://dfs.ubtob.com/group1/M00/88/4D/CgpkyFrMEHeAbmFgAAAVUSwA8go871.png");
+		if ( StringUtils.isEmpty(storeApply.getLogoUrl())
+				|| StringUtils.isEmpty(storeApply.getBannerUrl())) {
+			return new ResultMap(CodeType.NOT_COMPLETE_INFO, "LOGO或横幅广告不能为空");
+		}
+		// 更新店铺申请信息
+		StoreApply apply = storeApplyService.findByUuid(uuid);
+		if (apply == null) {
+			return new ResultMap(CodeType.NOT_EXiST, "该店铺申请信息不存在");
+		}
+		if (StringUtils.hasText(storeApply.getStoreUuid())) {
+			apply.setStoreUuid(storeApply.getStoreUuid().toLowerCase());
+		}
+		apply.setLogoUrl(storeApply.getLogoUrl());
+		apply.setBannerUrl(storeApply.getBannerUrl());
+/*		if (storeApply.getEnterprise() != null) {
+			EnterpriseSimple enterprise = apply.getEnterprise();
+			enterprise.setEnUrl(storeApply.getEnterprise().getEnUrl());
+			enterprise.setAddress(storeApply.getEnterprise().getAddress());
+			enterprise.setEnTel(storeApply.getEnterprise().getEnTel());
+			enterprise.setEnFax(storeApply.getEnterprise().getEnFax());
+			// 更新企业信息JSON字符串
+			apply.setEnterprise(enterprise);
+		}
+
+		User user  = SystemSession.getUser();
+		if (user == null || user.getEnterprise() == null) {
+			return new ResultMap(CodeType.ERROR_STATE, "用户没有登录或账户信息异常");
+		}
+
+		// 添加资质信息
+		List<Qualification> qualifications = storeApply.getQualifications();
+		List<Qualification> existQualifications = apply.getQualifications();
+		for (Qualification qualification : qualifications) {
+			qualification.setEnUU(user.getEnterprise().getUu());
+			qualification.setUploaderUU(user.getUserUU());
+			qualification.setCreateTime(date);
+			qualification.setUpdateTime(date);
+			existQualifications.add(qualification);
+		}
+		// 更新资质信息JSON字符串
+		apply.setQualifications(existQualifications);*/
+		User user  = SystemSession.getUser();
+		if (user == null || user.getEnterprise() == null) {
+			return new ResultMap(CodeType.ERROR_STATE, "用户没有登录或账户信息异常");
+		}
+		storeApply = storeApplyService.handlerApply(apply);
+		StoreIn storeIn = storeService.createByStoreApplyAndSave(storeApply);
+		return ResultMap.success(storeIn.getUuid());
+	}
+
 	@Override
 	public ResultMap saveUpdateOfApply(String uuid, StoreApply apply) {
 		// 验证参数合法性