Browse Source

storeApplyServiceImpl代码优化

Hu Jie 7 years ago
parent
commit
42780a3a1f

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

@@ -44,8 +44,6 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 	@Override
 	public ResultMap handlerApply(String uuid, StoreApply.ApplyStatus status, StoreApply apply) {
 		// 通过uuid找到店铺申请信息
-		Date date = new Date();
-		StoreApply storeApply = storeApplyService.findByUuid(uuid);
 		User user = SystemSession.getUser();
 		if (user == null || user.getEnterprise() == null) {
 			return new ResultMap(CodeType.NOT_PERMIT, "请进行用户登录操作");
@@ -60,6 +58,7 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 		if (apply == null) {
 			return new ResultMap(CodeType.NO_INFO, "店铺申请信息不能为空");
 		}
+		StoreApply storeApply = storeApplyService.findByUuid(uuid);
 		// 检测资质信息
 		if (StoreApply.ApplyStatus.PASS == status) {
 			// TODO 检测企业信息以及品牌信息
@@ -102,6 +101,7 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 			}
 			storeApply.setReason(apply.getReason());
 		}
+		Date date = new Date();
 		// 保存审核时的审核人信息和是否通过状态
 		storeApply.setAuthPerson(user.getUserName());
 		storeApply.setAuthTime(date);

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

@@ -28,7 +28,6 @@ import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
-import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
@@ -103,12 +102,12 @@ public class StoreApplyServiceImpl implements StoreApplyService {
 		}
 		// 检测是否存在待处理开铺申请
 		StoreApply existApply = storeApplyDao.findByEnUUAndStatus(user.getEnterprise().getUu(), StoreApply.ApplyStatus.PREPARE);
-		if(existApply != null) {
+		if (existApply != null) {
 			return new ResultMap(CodeType.SAVED, "AUTH_PREPARE");
 		}
 		// 检测是否存在待处理开铺申请
 		existApply = storeApplyDao.findByEnUUAndStatus(user.getEnterprise().getUu(), StoreApply.ApplyStatus.PASS);
-		if(existApply != null) {
+		if (existApply != null) {
 			return new ResultMap(CodeType.SAVED, "AUTH_PASS");
 		}
 

+ 2 - 4
src/main/java/com/uas/platform/b2c/prod/store/service/impl/StoreInServiceImpl.java

@@ -126,9 +126,6 @@ public class StoreInServiceImpl implements StoreInService {
 		if (storeApply == null || storeApply.getEnUU() == null) {
 			return null;
 		}
-
-		StoreIn store;
-		Date date = new Date();
 		StoreIn existStore = storeDao.findByStoreName(storeApply.getStoreName());
 		if (existStore != null) {
 			throw new IllegalStatusException("店铺信息已经存在");
@@ -137,7 +134,8 @@ public class StoreInServiceImpl implements StoreInService {
 		if (existStore != null) {
 			throw new IllegalStatusException("店铺英文缩写已经存在");
 		}
-		store = new StoreIn();
+		StoreIn store = new StoreIn();
+		Date date = new Date();
 		if (StringUtils.isEmpty(storeApply.getStoreUuid())) {
 			store.setUuid(UuidUtils.generatedUuid());
 		} else {