From 356a40aadb35fa3cf61bc0214e1d803956d98114 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 17 五月 2024 16:45:32 +0800 Subject: [PATCH] git ch --- server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java | 99 +++++++++++++++++++++++++++++++------------------ 1 files changed, 63 insertions(+), 36 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 3a437bb..07136ac 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 @@ -1,5 +1,6 @@ package com.doumee.service.business.impl; +import cn.hutool.core.util.IdcardUtil; import com.alibaba.fastjson.JSONObject; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.core.annotation.excel.ExcelExporter; @@ -98,6 +99,8 @@ private DuSolutionJoinMapper duSolutionJoinMapper; @Autowired private DuWorktypeMapper duWorktypeMapper; + @Autowired + private DuWorkTypeJoinMapper duWorkTypeJoinMapper; @Autowired private NoticesMapper noticesMapper; @@ -235,11 +238,17 @@ update.setCode(insuranceApply.getCode()); update.setEndTime(actEndTime); update.setStartTime(insuranceApply.getStartTime()); + CountCyclePriceDTO countCyclePriceDTO = new CountCyclePriceDTO(); + countCyclePriceDTO.setSolutionsId(model.getSolutionId()); + countCyclePriceDTO.setStartDate(insuranceApply.getStartTime()); + update.setFinalEndTime(this.getCountCyclePriceVO(countCyclePriceDTO).getEndDate()); insuranceApplyMapper.updateById(update); //淇敼鏄庣粏琛岀殑寮�濮嬬粨鏉熸棩鏈� - applyDetailMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda().set(ApplyDetail::getStartTime,insuranceApply.getStartTime()) - .set(ApplyDetail::getEndTime,actEndTime).eq(ApplyDetail::getApplyId,model.getId())); + applyDetailMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda() + .set(ApplyDetail::getStartTime,insuranceApply.getStartTime()) + .set(ApplyDetail::getEndTime,actEndTime) + .eq(ApplyDetail::getApplyId,model.getId())); multifileMapper.update(null,new UpdateWrapper<Multifile>().lambda() .eq(Multifile::getIsdeleted,Constants.ZERO) @@ -258,6 +267,10 @@ insuranceApply.getBaoxiandanFile().setType(Constants.TWO); multifileMapper.insert(insuranceApply.getBaoxiandanFile()); update.setBaoxiandanFile(insuranceApply.getBaoxiandanFile()); + + noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,Constants.NoticeObjectType.INSURANCE_APPLY.getKey()) + .ne(Notices::getType,Constants.NoticeType.SIX.getStatus()) + .eq(Notices::getObjId,insuranceApply.getId())); Constants.ApplyLogType applyLogType = Constants.ApplyLogType.UPLOAD_INSURANCE; String info = ""; @@ -309,6 +322,7 @@ memberInsuranceJoinMapper.insertBatchSomeColumn(memberInsuranceList); } + this.updateApplyCurrentFee(insuranceApply.getId(),null); return 1; } @@ -1592,18 +1606,18 @@ insuranceApply.setCheckUserId(loginUserInfo.getId()); insuranceApply.setStatus(insuranceApplyStatus.getKey()); insuranceApply.setUnionApplyTbdStatus(Constants.ZERO); - CountCyclePriceDTO countCyclePriceDTO = new CountCyclePriceDTO(); countCyclePriceDTO.setSolutionsId(insuranceApply.getSolutionId()); countCyclePriceDTO.setStartDate(insuranceApply.getStartTime()); CountCyclePriceVO countCyclePriceVO = this.getCountCyclePriceVO(countCyclePriceDTO); insuranceApply.setApplyEndTime(countCyclePriceVO.getEndDate()); insuranceApply.setEndTime(countCyclePriceVO.getEndDate()); + insuranceApply.setFinalEndTime(countCyclePriceVO.getEndDate()); insuranceApplyMapper.insert(insuranceApply); //澶勭悊涓嬬骇鏁版嵁 - this.dealApplyDetailData(insuranceApply,solutions,applyDetailList,loginUserInfo,countCyclePriceVO); + this.dealApplyDetailData(insuranceApply,solutions,applyDetailList,loginUserInfo,countCyclePriceVO,true); InsuranceApply updBean = new InsuranceApply(); updBean.setId(insuranceApply.getId()); updBean.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); @@ -1639,7 +1653,6 @@ noticesMapper.insert(shopNotices); } } - return insuranceApply.getId(); } @@ -1705,7 +1718,7 @@ } //澶勭悊涓嬬骇鏁版嵁 - this.dealApplyDetailData(insuranceApply,solutions,applyDetailList,loginUserInfo,countCyclePriceVO); + this.dealApplyDetailData(insuranceApply,solutions,applyDetailList,loginUserInfo,countCyclePriceVO,false); insuranceApply.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); insuranceApplyMapper.updateById(insuranceApply); //瀛樺偍鏃ュ織鏁版嵁 @@ -1731,7 +1744,8 @@ - public void dealApplyDetailData(InsuranceApply insuranceApply,Solutions solutions,List<ApplyDetail> applyDetailList,LoginUserInfo loginUserInfo,CountCyclePriceVO countCyclePriceVO){ + public void dealApplyDetailData(InsuranceApply insuranceApply,Solutions solutions,List<ApplyDetail> applyDetailList, + LoginUserInfo loginUserInfo,CountCyclePriceVO countCyclePriceVO,Boolean checkNewData){ //鏌ヨ淇濋櫓鏂规涓嬬殑鎵�鏈夋淳閬e崟浣� List<DuSolution> duSolutionList = duSolutionJoinMapper.selectJoinList(DuSolution.class,new MPJLambdaWrapper<DuSolution>() .selectAll(DuSolution.class) @@ -1740,16 +1754,22 @@ .eq(DispatchUnit::getIsdeleted,Constants.ZERO) .eq(DispatchUnit::getUnitStatus,Constants.ONE) .eq(DuSolution::getIsdeleted,Constants.ZERO) + .eq(checkNewData,DispatchUnit::getDataType,Constants.TWO) .eq(DuSolution::getStatus,Constants.ONE) - .eq(DuSolution::getSolutionId,insuranceApply.getSolutionId())); + .eq(DuSolution::getSolutionId,insuranceApply.getSolutionId()) + .apply(" t1.BASE_ID in ( select du.id from dispatch_unit du where du.STATUS = 0 and du.ISDELETED = 0 ) ") + ); if(!CollectionUtils.isNotEmpty(duSolutionList)){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏁版嵁寮傚父锛氫繚闄╂柟妗堜笅鏈煡璇㈠埌娲鹃仯鍗曚綅"); } //鏌ヨ鎵�鏈夋淳閬e崟浣嶄笅鐨勫伐绉� List<Integer> duSolutionIdList = duSolutionList.stream().map(i->i.getId()).collect(Collectors.toList()); - List<DuWorktype> duWorktypeList = duWorktypeMapper.selectList(new QueryWrapper<DuWorktype>().lambda() + List<DuWorktype> duWorktypeList = duWorkTypeJoinMapper.selectJoinList(DuWorktype.class,new MPJLambdaWrapper<DuWorktype>() + .selectAll(DuWorktype.class) + .innerJoin(Worktype.class,Worktype::getId,DuWorktype::getWorkTypeId) .eq(DuWorktype::getIsdeleted,Constants.ZERO) .eq(DuWorktype::getStatus,Constants.ONE) + .eq(checkNewData,Worktype::getDataType,Constants.TWO) .in(DuWorktype::getDuSolutionId,duSolutionIdList)); if(!CollectionUtils.isNotEmpty(duWorktypeList)){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏁版嵁寮傚父锛氫繚闄╂柟妗堜笅鏈煡璇㈠埌宸ョ淇℃伅"); @@ -1790,12 +1810,16 @@ member.setName(applyDetail.getMemberName()); member.setCompanyId(insuranceApply.getCompanyId()); member.setSex(Constants.getSexByIdCard(applyDetail.getIdcardNo())); + if(!IdcardUtil.isValidCard(applyDetail.getIdcardNo())){ + throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鎶曚繚鍛樺伐淇℃伅韬唤璇佷俊鎭敊璇痆"+member.getName()+"]"); + } member.setIdcardNo(applyDetail.getIdcardNo()); member.setApplyId(insuranceApply.getId()); member.setStartTime(applyDetail.getStartTime()); member.setEndTime(applyDetail.getEndTime()); member.setDuId(applyDetail.getDuId()); member.setWorktypeId(applyDetail.getWorktypeId()); + memberMapper.insert(member); }else{ member.setApplyId(insuranceApply.getId()); @@ -2512,38 +2536,38 @@ */ @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) - public void updateApplyCurrentFee(Integer id){ + public void updateApplyCurrentFee(Integer id,Integer unionId){ List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class,new MPJLambdaWrapper<InsuranceApply>() .selectAll(InsuranceApply.class) .eq(InsuranceApply::getIsdeleted,Constants.ZERO) - .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_TOUBAOING.getKey()) + .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_DONE.getKey()) .eq(!Objects.isNull(id),InsuranceApply::getId,id) + .eq(!Objects.isNull(unionId),InsuranceApply::getUnionApplyId,unionId) .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)){ for (InsuranceApply insuranceApply:insuranceApplyList) { -// Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); -// if(Objects.isNull(solutions)){ -// continue; -// } + Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); + if(Objects.isNull(solutions)){ + continue; + } BigDecimal sumAmount = BigDecimal.ZERO; List<ApplyDetail> applyDetailList = applyDetailMapper .selectList(new QueryWrapper<ApplyDetail>().lambda() .eq(ApplyDetail::getApplyId,insuranceApply.getId())); if(CollectionUtils.isNotEmpty(applyDetailList)){ for (ApplyDetail applyDetail: applyDetailList) { - //2024-1-30 10:04:24 淇敼 鏍规嵁瀹為檯澶╂暟杩涜璁$畻 褰撳墠璐圭敤 鎬婚噾棰�/鎬诲ぉ鏁�*瀹為檯澶╂暟 -// Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0); - BigDecimal fee = applyDetail.getFee(); + BigDecimal fee = Objects.isNull(insuranceApply.getServerCost())? + solutions.getPrice(): + solutions.getPrice().add(insuranceApply.getServerCost()); + //鍦ㄥ紑濮嬬粨鏉熸棩鏈熶箣闂� if(applyDetail.getStartTime().compareTo(new Date()) <= 0 && applyDetail.getEndTime().compareTo(new Date()) >= 0 ){ - Integer days = DateUtil.calculateBetween(applyDetail.getStartTime(),new Date(),0); - applyDetail.setCurrentFee(new BigDecimal(days).multiply(applyDetail.getPrice())); - //applyDetail.setCurrentFee(fee.divide(BigDecimal.valueOf(maxDays),2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(days))); + applyDetail.setCurrentFee(Constants.produceFee(solutions,fee,insuranceApply.getStartTime(),insuranceApply.getFinalEndTime(),applyDetail.getStartTime())); applyDetailMapper.updateById(applyDetail); - }else if(applyDetail.getStartTime().compareTo(new Date()) <= 0&&applyDetail.getEndTime().compareTo(new Date()) <= 0){ - applyDetail.setCurrentFee(fee); + }else if(applyDetail.getStartTime().compareTo(new Date()) <= 0&&applyDetail.getEndTime().compareTo(new Date()) <= 0){ + //鍦ㄧ粨鏉熸棩鏈熶箣鍚� + applyDetail.setCurrentFee(applyDetail.getFee()); applyDetailMapper.updateById(applyDetail); } sumAmount = sumAmount.add(applyDetail.getCurrentFee()); @@ -2553,6 +2577,9 @@ insuranceApplyMapper.updateById(insuranceApply); } } +// if(1==1){ +// throw new BusinessException(ResponseStatus.NOT_ALLOWED); +// } } @@ -2606,13 +2633,13 @@ public String getSignTBQRSLink(SmsCheckDTO smsCheckDTO) { if(Objects.isNull(smsCheckDTO) || Objects.isNull(smsCheckDTO.getBusinessId()) - || StringUtils.isBlank(smsCheckDTO.getCode()) +// || StringUtils.isBlank(smsCheckDTO.getCode()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } - if(!debugModel){ - smsEmailService.validateCode(smsCheckDTO.getCode()); - } +// if(!debugModel){ +// smsEmailService.validateCode(smsCheckDTO.getCode()); +// } MPJLambdaWrapper wrapper= new MPJLambdaWrapper<InsuranceApply>() .selectAll(InsuranceApply.class) .selectAs(Solutions::getSignKeyword,InsuranceApply::getSignKeyword) @@ -2702,14 +2729,14 @@ public String getMemberListOnlineSignLink(SmsCheckDTO smsCheckDTO) { if(Objects.isNull(smsCheckDTO) || Objects.isNull(smsCheckDTO.getBusinessId()) - || StringUtils.isBlank(smsCheckDTO.getCode()) +// || StringUtils.isBlank(smsCheckDTO.getCode()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } //楠岃瘉 楠岃瘉鐮� - if(!debugModel){ - smsEmailService.validateCode(smsCheckDTO.getCode()); - } +// if(!debugModel){ +// smsEmailService.validateCode(smsCheckDTO.getCode()); +// } InsuranceApply model = this.queryApplyDetail(smsCheckDTO.getBusinessId()); if(Objects.isNull(model)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇繚鍗曚俊鎭�"); @@ -2765,14 +2792,14 @@ public String getSignWTBTBDLink(SmsCheckDTO smsCheckDTO) { if(Objects.isNull(smsCheckDTO) || Objects.isNull(smsCheckDTO.getBusinessId()) - || StringUtils.isBlank(smsCheckDTO.getCode()) +// || StringUtils.isBlank(smsCheckDTO.getCode()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } //楠岃瘉 楠岃瘉鐮� - if(!debugModel){ - smsEmailService.validateCode(smsCheckDTO.getCode()); - } +// if(!debugModel){ +// smsEmailService.validateCode(smsCheckDTO.getCode()); +// } MPJLambdaWrapper wrapper= new MPJLambdaWrapper<InsuranceApply>() .selectAll(InsuranceApply.class) .selectAs(Solutions::getSignKeyword,InsuranceApply::getSignKeyword) -- Gitblit v1.9.3