From 55fbb9724c8f69f3516ac293c4dfa67e2a1d9620 Mon Sep 17 00:00:00 2001 From: nidapeng <jp@doumee.com> Date: 星期五, 29 三月 2024 16:36:15 +0800 Subject: [PATCH] 提交一把 --- server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java | 80 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 73 insertions(+), 7 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java index 75e4954..dea6695 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java @@ -27,10 +27,7 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import java.util.Objects; -import java.util.UUID; +import java.util.*; /** * 淇濋櫓鏂规淇℃伅琛⊿ervice瀹炵幇 @@ -40,6 +37,8 @@ @Service public class SolutionsServiceImpl implements SolutionsService { + @Autowired + private MultifileMapper multifileMapper; @Autowired private SolutionsMapper solutionsMapper; @Autowired @@ -61,6 +60,15 @@ LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); initCreateParam(solutions);//宸ョ鏁版嵁鏈夋晥鎬ф楠岋紝鍘婚櫎绌虹櫧琛屾暟鎹� + + if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda() + .eq(Solutions::getName,solutions.getName()) + .eq(Solutions::getIsdeleted,Constants.ZERO) + .eq(Solutions::getDataType,Constants.ZERO) + )>Constants.ZERO){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鏂规鍚嶇О宸插瓨鍦�"); + } + solutions.setIsdeleted(Constants.ZERO); solutions.setCreator(user.getId()); solutions.setCreateDate(new Date()); @@ -78,6 +86,20 @@ solutionsMapper.insert(newModel); dealWorkType(solutions,newModel,solutions.getWorktypeIdList(),true); + if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){ + if (solutions.getFanganFile()==null || StringUtils.isBlank(solutions.getFanganFile().getFileurl())){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇蜂笂浼犳柟妗堢‘璁や功锛�"); + } + + Multifile file = solutions.getFanganFile(); + file.setIsdeleted(Constants.ZERO); + file.setCreateDate(new Date()); + file.setCreator(user.getId()); + file.setObjId(solutions.getId()); + file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()); + file.setType(Constants.formatIntegerNum(file.getType())); + multifileMapper.insert(file); + } return solutions.getId(); } @@ -167,7 +189,14 @@ } //鏁版嵁鏈夋晥鎬ф牎楠� initCreateParam(solutions); - + if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda() + .eq(Solutions::getName,solutions.getName()) + .eq(Solutions::getIsdeleted,Constants.ZERO) + .eq(Solutions::getDataType,Constants.ZERO) + .ne(Solutions::getId,solutions.getId()) + )>Constants.ZERO){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鏂规鍚嶇О宸插瓨鍦�"); + } solutions.setEditor(user.getId()); solutions.setVersion(UUID.randomUUID().toString()); solutions.setEditDate(new Date()); @@ -200,7 +229,25 @@ .lambda() .eq(SolutionWorktype::getSolutionId,solutions.getId()) ); - + if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){ + if (solutions.getFanganFile()!=null && StringUtils.isNotBlank(solutions.getFanganFile().getFileurl())){ + multifileMapper.update(null,new UpdateWrapper<Multifile>().lambda() + .set(Multifile::getIsdeleted,Constants.ONE) + .set(Multifile::getEditDate,solutions.getEditDate()) + .set(Multifile::getEditor,solutions.getEditor()) + .eq(Multifile::getObjId,solutions.getId()) + .eq(Multifile::getIsdeleted,Constants.ZERO) + .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey())); + Multifile file = solutions.getFanganFile(); + file.setIsdeleted(Constants.ZERO); + file.setCreateDate(solutions.getEditDate()); + file.setCreator(solutions.getEditor()); + file.setObjId(solutions.getId()); + file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()); + file.setType(Constants.formatIntegerNum(file.getType())); + multifileMapper.insert(file); + } + } solutionsMapper.update(null,new UpdateWrapper<Solutions>() .lambda() @@ -270,7 +317,9 @@ MPJLambdaWrapper<Solutions> queryWrapper = new MPJLambdaWrapper<>(); queryWrapper.selectAll(Solutions.class); queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName); + queryWrapper.selectAs(Company::getName,Solutions::getShopName); queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId); + queryWrapper.leftJoin(Company.class,Company::getId,Solutions::getShopId); queryWrapper.eq(Solutions::getId,id); Solutions model = solutionsJoinMapper.selectJoinOne(Solutions.class,queryWrapper); if(model == null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){ @@ -285,6 +334,12 @@ wrapper.orderByAsc(SolutionWorktype::getSortnum); List<SolutionWorktype> worktypeList = solutionWorktypeJoinMapper.selectJoinList(SolutionWorktype.class,wrapper); model.setWorktypeList(worktypeList); + Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda() + .eq(Multifile::getObjId,model.getId()) + .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()) + .eq(Multifile::getIsdeleted,Constants.ZERO) + .last("limit 1")); + model.setFanganFile(f);//鏂规纭涔� return model; } @@ -315,8 +370,13 @@ Utils.MP.blankToNull(pageWrap.getModel()); queryWrapper.selectAll(Solutions.class); queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName); + queryWrapper.selectAs(Company::getName,Solutions::getShopName); queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId); - + queryWrapper.leftJoin(Company.class,Company::getId,Solutions::getShopId); + LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + if(user.getType().equals(Constants.ONE)){ + queryWrapper.exists(("select 1 from company_solution b where b.isdeleted=0 and b.company_id="+user.getCompanyId()+" and b.SOLUTION_BASE_ID = t.id")); + } if (pageWrap.getModel().getId() != null) { queryWrapper.eq(Solutions::getId, pageWrap.getModel().getId()); } @@ -451,11 +511,17 @@ List<Solutions> solutionsList = solutionsJoinMapper.selectJoinList(Solutions.class,new MPJLambdaWrapper<Solutions>() .selectAll(Solutions.class) .leftJoin(CompanySolution.class,CompanySolution::getSolutionId,Solutions::getId) + .leftJoin(Company.class,Company::getId,CompanySolution::getCompanyId) + .leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId) .eq(Solutions::getIsdeleted,Constants.ZERO) .eq(Solutions::getStatus,Constants.ZERO) .eq(Solutions::getDataType,dataType) .eq(CompanySolution::getIsdeleted,Constants.ZERO) .eq(CompanySolution::getCompanyId,user.getCompanyId()) + .eq(Company::getIsdeleted,Constants.ZERO) + .eq(Company::getStatus,Constants.ZERO) + .eq(Insurance::getIsdeleted,Constants.ZERO) + .eq(Insurance::getStatus,Constants.ZERO) .orderByAsc(Solutions::getSortnum) ); return solutionsList; -- Gitblit v1.9.3