diff --git a/agent-manager/src/main/java/com/mortals/xhx/module/declare/service/impl/DeclareServiceImpl.java b/agent-manager/src/main/java/com/mortals/xhx/module/declare/service/impl/DeclareServiceImpl.java index 43a7f6a0d6931bcb517bec0179e35406ea24de7e..906267c183b2893942f2dd1cdfa73b2100000de1 100644 --- a/agent-manager/src/main/java/com/mortals/xhx/module/declare/service/impl/DeclareServiceImpl.java +++ b/agent-manager/src/main/java/com/mortals/xhx/module/declare/service/impl/DeclareServiceImpl.java @@ -11,6 +11,9 @@ import com.mortals.xhx.module.company.model.CompanyEntity; import com.mortals.xhx.module.company.service.CompanyService; import com.mortals.xhx.module.declare.model.*; import com.mortals.xhx.module.declare.service.DeclareFinImagesService; +import com.mortals.xhx.module.evaluation.model.EvaluationInfoEntity; +import com.mortals.xhx.module.evaluation.model.EvaluationInfoQuery; +import com.mortals.xhx.module.evaluation.service.EvaluationInfoService; import com.mortals.xhx.module.park.model.ParkEntity; import com.mortals.xhx.module.park.service.ParkService; import org.springframework.beans.BeanUtils; @@ -47,9 +50,11 @@ import lombok.extern.slf4j.Slf4j; public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, DeclareEntity, Long> implements DeclareService { @Autowired private DeclareImagesService declareImagesService; - @Autowired private DeclareFinImagesService declareFinImagesService; + @Autowired + private EvaluationInfoService evaluationInfoService; + @Autowired private CategoryService categoryService; @Autowired @@ -83,23 +88,30 @@ public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, Decl .find(new DeclareFinImagesQuery().declareIdList(idList)).parallelStream() .collect(Collectors.groupingBy(DeclareFinImagesEntity::getDeclareId)); list.forEach(item -> item.setDeclareFinImagesList(declareFinImagesListMap.get(item.getId()))); + + Map<Long, List<EvaluationInfoEntity>> evaluationListMap = evaluationInfoService + .find(new EvaluationInfoQuery().declareIdList(idList)).parallelStream() + .collect(Collectors.groupingBy(EvaluationInfoEntity::getDeclareId)); + list.forEach(item -> item.setEvaluationInfoList(evaluationListMap.get(item.getId()))); + + } @Override protected void saveBefore(DeclareEntity entity, Context context) throws AppException { - if(!ObjectUtils.isEmpty(entity.getCategoryId())){ + if (!ObjectUtils.isEmpty(entity.getCategoryId())) { CategoryEntity categoryEntity = categoryService.get(entity.getCategoryId()); - entity.setCategoryName(categoryEntity==null?"":categoryEntity.getCategoryName()); - entity.setCategoryCode(categoryEntity==null?"":categoryEntity.getCategoryCode()); + entity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getCategoryName()); + entity.setCategoryCode(categoryEntity == null ? "" : categoryEntity.getCategoryCode()); } - if(!ObjectUtils.isEmpty(entity.getParkId())){ + if (!ObjectUtils.isEmpty(entity.getParkId())) { ParkEntity parkEntity = parkService.get(entity.getParkId()); - entity.setParkName(parkEntity==null?"":parkEntity.getName()); + entity.setParkName(parkEntity == null ? "" : parkEntity.getName()); } - if(!ObjectUtils.isEmpty(entity.getCompanyId())){ + if (!ObjectUtils.isEmpty(entity.getCompanyId())) { CompanyEntity companyEntity = companyService.get(entity.getCompanyId()); - entity.setCompanyName(companyEntity==null?"":companyEntity.getName()); + entity.setCompanyName(companyEntity == null ? "" : companyEntity.getName()); } @@ -172,10 +184,11 @@ public class DeclareServiceImpl extends AbstractCRUDServiceImpl<DeclareDao, Decl public Rest<String> declareCancel(DeclareQuery query, Context context) { //鏍¢獙鍙栨秷鐢虫姤鏃堕棿 DeclareEntity declareEntity = this.get(query.getId(), context); - if(ObjectUtils.isEmpty(declareEntity)) throw new AppException("鐢虫姤淇℃伅涓嶅瓨鍦紒id:"+query.getId()); + if (ObjectUtils.isEmpty(declareEntity)) throw new AppException("鐢虫姤淇℃伅涓嶅瓨鍦紒id:" + query.getId()); long between = DateUtil.between(declareEntity.getCreateTime(), new Date(), DateUnit.MINUTE); - if(between > 30) throw new AppException("瓒呰繃30鍒嗛挓鏃犳硶鍙栨秷鐢虫姤锛�"); - if(declareEntity.getDeclareStatus() != DeclareStatusEnum.鑽夌ǹ.getValue()) throw new AppException("褰撳墠鐢虫姤涓嶆槸鑽夌ǹ鐘舵€侊紝涓嶈兘鎾ら攢锛�"); + if (between > 30) throw new AppException("瓒呰繃30鍒嗛挓鏃犳硶鍙栨秷鐢虫姤锛�"); + if (declareEntity.getDeclareStatus() != DeclareStatusEnum.鑽夌ǹ.getValue()) + throw new AppException("褰撳墠鐢虫姤涓嶆槸鑽夌ǹ鐘舵€侊紝涓嶈兘鎾ら攢锛�"); declareEntity.setDeclareStatus(DeclareStatusEnum.鎾ら攢.getValue()); declareEntity.setUpdateTime(new Date()); diff --git a/agent-manager/src/main/java/com/mortals/xhx/module/declare/web/DeclareController.java b/agent-manager/src/main/java/com/mortals/xhx/module/declare/web/DeclareController.java index 72a68920835a947c936db1e3d56a9730afbb3b93..c75dfb3db7c72882072137a73ef892ee82bccaae 100644 --- a/agent-manager/src/main/java/com/mortals/xhx/module/declare/web/DeclareController.java +++ b/agent-manager/src/main/java/com/mortals/xhx/module/declare/web/DeclareController.java @@ -12,6 +12,9 @@ import com.mortals.xhx.module.declare.model.*; import com.mortals.xhx.module.declare.service.DeclareFinImagesService; import com.mortals.xhx.module.declare.service.DeclareImagesService; import com.mortals.xhx.module.declare.service.DeclareService; +import com.mortals.xhx.module.evaluation.model.EvaluationInfoEntity; +import com.mortals.xhx.module.evaluation.model.EvaluationInfoQuery; +import com.mortals.xhx.module.evaluation.service.EvaluationInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -37,6 +40,9 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare @Autowired private DeclareFinImagesService declareFinImagesService; + @Autowired + private EvaluationInfoService evaluationInfoService; + public DeclareController() { super.setModuleDesc("浼佷笟浠e姙鐢虫姤"); } @@ -54,6 +60,11 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare entity.setDeclareImagesList(declareImagesEntities); List<DeclareFinImagesEntity> declareFinImagesEntities = declareFinImagesService.find(new DeclareFinImagesQuery().declareId(id)); entity.setDeclareFinImagesList(declareFinImagesEntities); + + List<EvaluationInfoEntity> evaluationInfoEntities = evaluationInfoService.find(new EvaluationInfoQuery().declareId(id)); + entity.setEvaluationInfoList(evaluationInfoEntities); + + return super.infoAfter(id, model, entity, context); } @@ -68,7 +79,7 @@ public class DeclareController extends BaseCRUDJsonBodyMappingController<Declare String busiDesc = "鐢虫姤鎾ら攢" + this.getModuleDesc(); try { Rest<String> rest = this.service.declareCancel(query, getContext()); - if(YesNoEnum.NO.getValue()==rest.getCode()){ + if (YesNoEnum.NO.getValue() == rest.getCode()) { throw new AppException(rest.getMsg()); } jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);