Browse Source

feat(StoreApply):店铺审核优化

Hu Jie 6 years ago
parent
commit
7034e70169

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

@@ -23,6 +23,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 店铺申请外观实现类
@@ -78,6 +79,16 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 			if (StringUtils.isEmpty(apply.getEnQualification())) {
 				return new ResultMap(CodeType.NO_INFO, "公司资质信息不能为空");
 			}
+			if (StoreType.AGENCY != apply.getType() && StoreType.DISTRIBUTION != apply.getType()
+					&& StoreType.ORIGINAL_FACTORY != apply.getType()) {
+				return new ResultMap(CodeType.ERROR_STATE, "请选择正确的的店铺类型");
+			}
+			if (!storeApply.getType().equals(apply.getType())) {
+				storeApply.setType(apply.getType());
+				if (StoreType.DISTRIBUTION.equals(storeApply.getType())) {
+					apply.setBrands(null);
+				}
+			}
 			if (StoreType.AGENCY == apply.getType() || StoreType.ORIGINAL_FACTORY == apply.getType()) {
 				if (CollectionUtils.isEmpty(apply.getBrands())) {
 					return new ResultMap(CodeType.NO_INFO, "品牌审核信息不能为空");
@@ -111,6 +122,11 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 			}
 			storeApply.setReason(apply.getReason());
 		}
+		List<Qualification> qualifications = apply.getQualifications();
+		qualifications.stream().filter(qualification -> StringUtils.isEmpty(qualification.getResourceUrl())).collect(Collectors.toList());
+		if (CollectionUtils.isEmpty(qualifications)) {
+			return new ResultMap(CodeType.NOT_PERMIT, "公司资质信息不能为空");
+		}
 		// 保存审核时的审核人信息和是否通过状态
 		storeApply.setFinalPerson(user.getUserName());
 		storeApply.setStatus(status);
@@ -150,6 +166,16 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 		if (StringUtils.isEmpty(apply.getEnQualification())) {
 			return new ResultMap(CodeType.NO_INFO, "公司资质信息不能为空");
 		}
+		if (StoreType.AGENCY != apply.getType() && StoreType.DISTRIBUTION != apply.getType()
+				&& StoreType.ORIGINAL_FACTORY != apply.getType()) {
+			return new ResultMap(CodeType.ERROR_STATE, "请选择正确的的店铺类型");
+		}
+		if (!storeApply.getType().equals(apply.getType())) {
+			storeApply.setType(apply.getType());
+			if (StoreType.DISTRIBUTION.equals(storeApply.getType())) {
+				apply.setBrands(null);
+			}
+		}
 		if (StoreType.AGENCY == apply.getType() || StoreType.ORIGINAL_FACTORY == apply.getType()) {
 			if (CollectionUtils.isEmpty(apply.getBrands())) {
 				return new ResultMap(CodeType.NO_INFO, "品牌审核信息不能为空");
@@ -167,6 +193,7 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 				}
 			}
 		}
+		storeApply.setQualificationsJson(apply.getQualificationsJson());
 		Date date = new Date();
 		storeApply.setReason(null);
 		storeApply.setAuthPerson(user.getUserName());
@@ -188,7 +215,6 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 			if (entry.getValue() == null || "".equals(entry.getValue())) {
 				return true;
 			}
-
 		}
 		return false;
 	}