Browse Source

调整代码规范优化

hejq 7 years ago
parent
commit
c5ab563221

+ 23 - 19
src/main/java/com/uas/platform/b2c/prod/store/service/impl/StoreApplyServiceImpl.java

@@ -262,7 +262,8 @@ public class StoreApplyServiceImpl implements StoreApplyService {
 		}, pageInfo);
 		}, pageInfo);
 	}
 	}
 
 
-	public Page<StoreApply> pageStoreApplicationsByAuthor(final PageInfo pageInfo, StoreApply.ApplyStatus status, StoreType type, String keyword) {
+	@Override
+    public Page<StoreApply> pageStoreApplicationsByAuthor(final PageInfo pageInfo, StoreApply.ApplyStatus status, StoreType type, String keyword) {
 		if (status != null) {
 		if (status != null) {
 			if (StoreApply.ApplyStatus.PREPARE.equals(status)) {
 			if (StoreApply.ApplyStatus.PREPARE.equals(status)) {
 				SimpleExpression exCheck = new SimpleExpression("status", StoreApply.ApplyStatus.CHECK, CriterionExpression.Operator.EQ);
 				SimpleExpression exCheck = new SimpleExpression("status", StoreApply.ApplyStatus.CHECK, CriterionExpression.Operator.EQ);
@@ -305,23 +306,9 @@ public class StoreApplyServiceImpl implements StoreApplyService {
 			if (prepareApply != null && passApply != null) {
 			if (prepareApply != null && passApply != null) {
 				return new ResultMap(CodeType.NOT_PERMIT, "已审核和待审核的开铺申请同时存在");
 				return new ResultMap(CodeType.NOT_PERMIT, "已审核和待审核的开铺申请同时存在");
 			} else if (prepareApply != null) {
 			} else if (prepareApply != null) {
-                Enterprise enterprise = enterpriseDao.findByUu(prepareApply.getEnterprise().getUu());
-                EnterpriseSimple enterpriseSimple = prepareApply.getEnterprise();
-                enterpriseSimple.setEnName(enterprise.getEnName());
-                enterpriseSimple.setEnShortname(enterprise.getEnShortname());
-                enterpriseSimple.setAddress(enterprise.getEnAddress());
-                enterpriseSimple.setEnUrl(enterprise.getEnUrl());
-                prepareApply.setEnterprise(enterpriseSimple);
-				return ResultMap.success(prepareApply);
-			} else if (passApply != null){
-                Enterprise enterprise = enterpriseDao.findByUu(passApply.getEnterprise().getUu());
-                EnterpriseSimple enterpriseSimple = passApply.getEnterprise();
-                enterpriseSimple.setEnName(enterprise.getEnName());
-                enterpriseSimple.setEnShortname(enterprise.getEnShortname());
-                enterpriseSimple.setAddress(enterprise.getEnAddress());
-                enterpriseSimple.setEnUrl(enterprise.getEnUrl());
-                passApply.setEnterprise(enterpriseSimple);
-				return ResultMap.success(passApply);
+				return ResultMap.success(covert(prepareApply));
+			} else if (passApply != null) {
+				return ResultMap.success(covert(passApply));
 			} else {
 			} else {
 				return ResultMap.success(null);
 				return ResultMap.success(null);
 			}
 			}
@@ -331,7 +318,24 @@ public class StoreApplyServiceImpl implements StoreApplyService {
 		}
 		}
 	}
 	}
 
 
-	@Override
+    /**
+     * 店铺赋值方法提取出来
+     *
+     * @param storeApply 店铺信息
+     * @return StoreApply
+     */
+    private StoreApply covert(StoreApply storeApply) {
+        Enterprise enterprise = enterpriseDao.findByUu(storeApply.getEnterprise().getUu());
+        EnterpriseSimple enterpriseSimple = storeApply.getEnterprise();
+        enterpriseSimple.setEnName(enterprise.getEnName());
+        enterpriseSimple.setEnShortname(enterprise.getEnShortname());
+        enterpriseSimple.setAddress(enterprise.getEnAddress());
+        enterpriseSimple.setEnUrl(enterprise.getEnUrl());
+        storeApply.setEnterprise(enterpriseSimple);
+        return storeApply;
+    }
+
+    @Override
 	public com.uas.sso.support.Page<StoreInfoAndProdExport> getStoreInfoAndProdCount(Pageable pageable, Date startTime, Date endTime) {
 	public com.uas.sso.support.Page<StoreInfoAndProdExport> getStoreInfoAndProdCount(Pageable pageable, Date startTime, Date endTime) {
 		if (pageable == null) {
 		if (pageable == null) {
 			return null;
 			return null;