From 48eb5dc61ac07d232632b13d040006128ed5cceb Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期三, 31 一月 2024 20:59:23 +0800 Subject: [PATCH] 开发业务接口 --- server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java | 61 ++++++++++++++++++++++++++---- 1 files changed, 52 insertions(+), 9 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java index 072eaa4..cf56469 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java @@ -17,6 +17,7 @@ import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; import com.doumee.dao.business.join.ApplyDetailJoinMapper; import com.doumee.dao.business.join.ApplyLogJoinMapper; +import com.doumee.dao.business.join.DuSolutionJoinMapper; import com.doumee.dao.business.join.InsuranceApplyJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.dao.business.vo.CountCyclePriceVO; @@ -86,6 +87,8 @@ private MemberMapper memberMapper; @Autowired private DuSolutionMapper duSolutionMapper; + @Autowired + private DuSolutionJoinMapper duSolutionJoinMapper; @Autowired private DuWorktypeMapper duWorktypeMapper; @@ -428,10 +431,14 @@ @Override public void dealWaitSignedData(){ List<InsuranceApply> applyList = insuranceApplyMapper.selectList(new QueryWrapper<InsuranceApply>().lambda() - .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WAIT_SIGNATURE) + .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey()) .isNotNull(InsuranceApply::getSignApplyNo)); if(applyList !=null && applyList.size()>0 ){ for(InsuranceApply model : applyList){ + String status = signService.linkFileStatus(model.getSignApplyNo()); + if(!StringUtils.equals(status,"3")){ + continue; + } String link = signService.linkFile(model.getSignApplyNo()); String fileUrl = uploadSignFile(link); if(StringUtils.isBlank(fileUrl)){ @@ -443,10 +450,14 @@ } } List<ApplyChange> chagneList = applyChangeMapper.selectList(new QueryWrapper<ApplyChange>().lambda() - .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.UPLOAD) + .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.UPLOAD.getKey()) .isNotNull(ApplyChange::getSignApplyNo)); if(chagneList !=null && chagneList.size()>0 ){ for(ApplyChange model : chagneList){ + String status = signService.linkFileStatus(model.getSignApplyNo()); + if(!StringUtils.equals(status,"3")){ + continue; + } String link = signService.linkFile(model.getSignApplyNo()); String fileUrl = uploadSignFile(link); if(StringUtils.isBlank(fileUrl)){ @@ -704,7 +715,12 @@ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鏂规淇℃伅"); } //鏌ヨ淇濋櫓鏂规涓嬬殑鎵�鏈夋淳閬e崟浣� - List<DuSolution> duSolutionList = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda() + List<DuSolution> duSolutionList = duSolutionJoinMapper.selectJoinList(DuSolution.class,new MPJLambdaWrapper<DuSolution>() + .selectAll(DuSolution.class) + .innerJoin(DispatchUnit.class,DispatchUnit::getId,DuSolution::getDispatchUnitId) + .eq(DispatchUnit::getCompanyId,insuranceApply.getCompanyId()) + .eq(DispatchUnit::getIsdeleted,Constants.ZERO) + .eq(DispatchUnit::getUnitStatus,Constants.ONE) .eq(DuSolution::getIsdeleted,Constants.ZERO) .eq(DuSolution::getStatus,Constants.ONE) .eq(DuSolution::getSolutionId,insuranceApply.getSolutionId())); @@ -911,6 +927,12 @@ //浼佷笟浜哄憳鏌ョ湅鏈紒涓氭暟鎹� if(loginUserInfo.getType().equals(Constants.ONE)){ queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId()); + }else{ + if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){ + queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList()); + }else{ + queryWrapper.eq(InsuranceApply::getCompanyId, -1); + } } if (pageWrap.getModel().getSolutionId() != null) { queryWrapper.eq(InsuranceApply::getSolutionId, pageWrap.getModel().getSolutionId()); @@ -991,6 +1013,12 @@ //浼佷笟浜哄憳鏌ョ湅鏈紒涓氭暟鎹� if(loginUserInfo.getType().equals(Constants.ONE)){ queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId()); + }else{ + if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){ + queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList()); + }else{ + queryWrapper.eq(InsuranceApply::getCompanyId, -1); + } } if (model.getSolutionId() != null) { queryWrapper.eq(InsuranceApply::getSolutionId, model.getSolutionId()); @@ -1044,7 +1072,7 @@ MPJLambdaWrapper wrapper= new MPJLambdaWrapper<InsuranceApply>() .selectAll(InsuranceApply.class) .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) - .selectAs(Company::getName,ApplyLog::getCompanyName) + .selectAs(Company::getName,InsuranceApply::getCompanyName) .select(" ( select count(1) from apply_detail ad where ad.apply_id = t.id ) as insureNum") .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) @@ -1055,6 +1083,11 @@ if(Objects.isNull(insuranceApply)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } + + if(insuranceApply.getStartTime().compareTo(new Date())<0 && insuranceApply.getEndTime().compareTo(new Date()) > 0 ){ + insuranceApply.setLoseEfficacyDays(DateUtil.daysBetweenDates(insuranceApply.getEndTime(),new Date())); + } + initApplyStatus(insuranceApply); @@ -1231,12 +1264,13 @@ */ @Override @Transactional(rollbackFor = {Exception.class}) - public void updateApplyCurrentFee(){ + public void updateApplyCurrentFee(Integer id){ List<InsuranceApply> insuranceApplyList = insuranceApplyMapper.selectList(new QueryWrapper<InsuranceApply>().lambda() .eq(InsuranceApply::getIsdeleted,Constants.ZERO) .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()) - .ge(InsuranceApply::getStartTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 00:00:00") - .le(InsuranceApply::getEndTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 23:59:59") + .eq(!Objects.isNull(id),InsuranceApply::getId,id) + .le(InsuranceApply::getStartTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 00:00:00") + .ge(InsuranceApply::getEndTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 23:59:59") ); if(CollectionUtils.isNotEmpty(insuranceApplyList)){ @@ -1249,8 +1283,17 @@ List<ApplyDetail> applyDetailList = applyDetailMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId())); if(CollectionUtils.isNotEmpty(applyDetailList)){ for (ApplyDetail applyDetail: applyDetailList) { - applyDetail.setCurrentFee(Constants.countDetailFee(solutions,new Date(),applyDetail.getStartTime())); - applyDetailMapper.updateById(applyDetail); + //2024-1-30 10:04:24 淇敼 鏍规嵁瀹為檯澶╂暟杩涜璁$畻 褰撳墠璐圭敤 鎬婚噾棰�/鎬诲ぉ鏁�*瀹為檯澶╂暟 + Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0) + 1 ; + BigDecimal fee = applyDetail.getFee(); + if(applyDetail.getStartTime().compareTo(new Date()) <= 0 && applyDetail.getEndTime().compareTo(new Date()) >= 0 ){ + Integer days = DateUtil.calculateBetween(applyDetail.getStartTime(),new Date(),0) + 1 ; + applyDetail.setCurrentFee(fee.divide(BigDecimal.valueOf(maxDays),2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(days))); + applyDetailMapper.updateById(applyDetail); + } +// DateUtil.daysBetweenDates(applyDetail.getEndTime(),applyDetail.getStartTime()); +// applyDetail.setCurrentFee(Constants.countDetailFee(solutions,new Date(),applyDetail.getStartTime())); +// applyDetailMapper.updateById(applyDetail); sumAmount = sumAmount.add(applyDetail.getCurrentFee()); } } -- Gitblit v1.9.3