From 09da100729793848bc01b51f7b05ca3f1e7ec64f Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期四, 20 六月 2024 14:05:35 +0800 Subject: [PATCH] 提交一把 --- server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java | 66 ++++++++++++++++----------------- 1 files changed, 32 insertions(+), 34 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java index d581e01..e3e32ca 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java @@ -17,6 +17,7 @@ import com.doumee.dao.business.dto.*; import com.doumee.dao.business.join.*; import com.doumee.dao.business.model.*; +import com.doumee.dao.business.vo.ChangeDealTypeVO; import com.doumee.dao.business.vo.CountCyclePriceVO; import com.doumee.dao.system.model.SystemUser; import com.doumee.service.business.ApplyChangeService; @@ -685,6 +686,7 @@ .set(ApplyDetail::getEndTime, delValidTime) .set(ApplyDetail::getEditor, update.getEditor()) .set(ApplyDetail::getEditDate, update.getEditDate()) + .eq(ApplyDetail::getId, oldModel.getId()) ); totalFee = totalFee.add(updateFee).subtract(oldModel.getFee()); @@ -703,12 +705,6 @@ .set( ApplyChagneDetail::getEndTime, delValidTime) .eq(ApplyChagneDetail::getId,detail.getId()) ); - -// if(1==1){ -// throw new BusinessException(ResponseStatus.SERVER_ERROR); -// } - - } member.setApplyId(update.getApplyId()); @@ -881,10 +877,10 @@ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌浼佷笟鍒嗛厤淇濋櫓鏂规淇℃伅"); } //鐢宠鏃堕棿蹇呴』澶勪簬淇濆崟鐨勬椂闂磋寖鍥村唴 - if (!(DateUtil.compareDate( insuranceApply.getStartTime(),applyChange.getValidTime()) >= Constants.ZERO - && DateUtil.compareDate( applyChange.getValidTime(),insuranceApply.getEndTime()) >= Constants.ZERO)) { - throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "鐢宠鏃ユ湡鏈浜庝繚鍗曟棩鏈熷唴锛屾棤娉曡繘琛岃鎿嶄綔"); - } +// if (!(DateUtil.compareDate( insuranceApply.getStartTime(),applyChange.getValidTime()) >= Constants.ZERO +// && DateUtil.compareDate( applyChange.getValidTime(),insuranceApply.getEndTime()) >= Constants.ZERO)) { +// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "鐢宠鏃ユ湡鏈浜庝繚鍗曟棩鏈熷唴锛屾棤娉曡繘琛岃鎿嶄綔"); +// } //鏌ヨ淇濆崟涓嬫槸鍚﹀瓨鍦ㄨ繘琛屼腑鐨勫姞鍑忎繚/鎹㈠巶鍗曟嵁 if(applyChangeMapper.selectCount(new QueryWrapper<ApplyChange>().lambda() .eq(ApplyChange::getApplyId,insuranceApply.getId()) @@ -1002,10 +998,10 @@ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌浼佷笟鍒嗛厤淇濋櫓鏂规淇℃伅"); } //鐢宠鏃堕棿蹇呴』澶勪簬淇濆崟鐨勬椂闂磋寖鍥村唴 - if (!(DateUtil.compareDate( insuranceApply.getStartTime(),applyChange.getValidTime()) >= Constants.ZERO - && DateUtil.compareDate( applyChange.getValidTime(),insuranceApply.getEndTime()) >= Constants.ZERO)) { - throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "鐢宠鏃ユ湡鏈浜庝繚鍗曟棩鏈熷唴锛屾棤娉曡繘琛岃鎿嶄綔"); - } +// if (!(DateUtil.compareDate( insuranceApply.getStartTime(),applyChange.getValidTime()) >= Constants.ZERO +// && DateUtil.compareDate( applyChange.getValidTime(),insuranceApply.getEndTime()) >= Constants.ZERO)) { +// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "鐢宠鏃ユ湡鏈浜庝繚鍗曟棩鏈熷唴锛屾棤娉曡繘琛岃鎿嶄綔"); +// } //鏌ヨ淇濆崟涓嬫槸鍚﹀瓨鍦ㄨ繘琛屼腑鐨勫姞鍑忎繚/鎹㈠巶鍗曟嵁 if(applyChangeMapper.selectCount(new QueryWrapper<ApplyChange>().lambda() .eq(ApplyChange::getApplyId,insuranceApply.getId()) @@ -1042,8 +1038,11 @@ public BigDecimal dealApplyChangeData(ApplyChange applyChange,InsuranceApply insuranceApply,CompanySolution companySolution,Solutions solutions,LoginUserInfo loginUserInfo,BigDecimal fee){ - - + if(Objects.nonNull(solutions.getDelOnlyReplace())&& solutions.getDelOnlyReplace().equals(Constants.ONE)){ + if(applyChange.getDelDetailList().size() > applyChange.getAddDetailList().size()){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "璇ヤ繚闄╂柟妗堜粎鏀寔鏇挎崲锛堝噺淇濅汉鏁颁笉寰楀ぇ浜庡姞淇濅汉鏁帮級"); + } + } //鏌ヨ淇濋櫓鏂规涓嬬殑鎵�鏈夋淳閬e崟浣� List<DuSolution> duSolutionList = duSolutionJoinMapper.selectJoinList(DuSolution.class,new MPJLambdaWrapper<DuSolution>() .selectAll(DuSolution.class) @@ -1057,7 +1056,6 @@ 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() @@ -1070,17 +1068,15 @@ ApplyChangeCyclePriceDTO applyChangeCyclePriceDTO = new ApplyChangeCyclePriceDTO(); applyChangeCyclePriceDTO.setApplyId(insuranceApply.getId()); + + //鍔犱繚鏁版嵁 List<ApplyChagneDetail> addDetailList = applyChange.getAddDetailList(); - Integer addDetailSize = 0 ; + if (CollectionUtils.isNotEmpty(addDetailList)) { - addDetailSize = addDetailList.size(); if(Objects.isNull(solutions.getCanAdd()) || solutions.getCanAdd().equals(Constants.ZERO)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "璇ヤ繚闄╂柟妗堟棤娉曡繘琛屽姞淇�"); } -// if(companySolution.getCanAdd().equals(Constants.ZERO)){ -// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "璇ヤ紒涓氬垎閰嶄繚闄╂柟妗堟棤娉曡繘琛屽姞淇�"); -// } //楠岃瘉鏄惁瀛樺湪閲嶅鏁版嵁 List<String> idcarNo = addDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList()); Set<String> set = new HashSet<>(idcarNo); @@ -1104,9 +1100,7 @@ //鍑忎繚鏁版嵁 List<ApplyChagneDetail> delDetailList = applyChange.getDelDetailList(); - Integer delDetailSize = 0 ; if (CollectionUtils.isNotEmpty(delDetailList)) { - delDetailSize = delDetailList.size() ; //楠岃瘉鏄惁瀛樺湪閲嶅鏁版嵁 List<String> idcarNo = delDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList()); Set<String> set = new HashSet<>(idcarNo); @@ -1121,11 +1115,7 @@ fee = fee.add(delDetailList.stream().map(ApplyChagneDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); } - if(Objects.nonNull(solutions.getDelOnlyReplace())&& solutions.getDelOnlyReplace().equals(Constants.ONE)){ - if(delDetailSize > addDetailSize){ - throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "璇ヤ繚闄╂柟妗堜粎鏀寔鏇挎崲锛堝噺淇濅汉鏁颁笉寰楀ぇ浜庡姞淇濅汉鏁帮級"); - } - } + //鎹㈠巶涓氬姟 List<ApplyChagneDetail> changeDetailList = applyChange.getChangeDetailList(); @@ -1222,9 +1212,10 @@ applyChagneDetail.setIsdeleted(Constants.ZERO); applyChagneDetail.setApplyChangeId(applyChange.getId()); applyChagneDetail.setType(Constants.ONE); - + applyChagneDetail.setApplyDetailId(applyDetail.getId()); applyChagneDetail.setStartTime(applyDetail.getStartTime()); applyChagneDetail.setEndTime(endTime); + applyChagneDetail.setReduceMoney(BigDecimal.ZERO); member.setApplyId(insuranceApply.getId()); member.setDuId(applyChagneDetail.getDuId()); @@ -1235,6 +1226,8 @@ //鏌ヨ鍑忎繚鏃ユ湡 // Integer delDays = DateUtil.daysBetweenDates(applyDetail.getEndTime(),endTime); // ; + + //鏌ヨ鍛ㄦ湡鏁伴噺 applyChagneDetail.setFee( Constants.reduceFee(solutions, Objects.isNull(insuranceApply.getServerCost())? @@ -1244,6 +1237,11 @@ applyDetail.getStartTime(),endTime) .subtract(applyDetail.getFee() )); + //濡傛灉鏄噺淇濅笟鍔′负浠呮浛鎹� 涓� 鏂规鐨勬墸璐瑰懆鏈熷拰鎬诲懆鏈熺浉绛� 鍒欏鐞嗗噺淇濊垂鐢� + if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE) + && Constants.equalsInteger(solutions.getTimeUnit(),solutions.getInsureCycleUnit())){ + applyChagneDetail.setReduceMoney(solutions.getPrice().multiply(new BigDecimal(-1))); + } applyChagneDetailJoinMapper.insert(applyChagneDetail); } } @@ -2144,10 +2142,10 @@ } //鏍规嵁鎵瑰崟鏃ユ湡 鍜� 缁撴潫鏃ユ湡 璁$畻閲戦 //楠岃瘉鎵瑰崟鏃ユ湡鏄惁鍦ㄥ綋鍓嶆棩鏈熷悗 涓� 鍦ㄤ繚鍗曠粨鏉熸棩鏈熷墠 鐢宠鏃堕棿蹇呴』澶勪簬淇濆崟鐨勬椂闂磋寖鍥村唴 - if (!(DateUtil.compareDate( insuranceApply.getStartTime(),applyChangeCyclePriceDTO.getValidTime()) >= Constants.ZERO - && DateUtil.compareDate( applyChangeCyclePriceDTO.getValidTime(),insuranceApply.getEndTime()) >= Constants.ZERO)) { - throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "鐢宠鏃ユ湡鏈浜庝繚鍗曟棩鏈熷唴锛屾棤娉曡繘琛岃鎿嶄綔"); - } +// if (!(DateUtil.compareDate( insuranceApply.getStartTime(),applyChangeCyclePriceDTO.getValidTime()) >= Constants.ZERO +// && DateUtil.compareDate( applyChangeCyclePriceDTO.getValidTime(),insuranceApply.getEndTime()) >= Constants.ZERO)) { +// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "鐢宠鏃ユ湡鏈浜庝繚鍗曟棩鏈熷唴锛屾棤娉曡繘琛岃鎿嶄綔"); +// } BigDecimal sumPrice = Objects.isNull(insuranceApply.getServerCost())?solutions.getPrice():solutions.getPrice().add(insuranceApply.getServerCost()); CountCyclePriceVO returnCountCyclePriceVO = new CountCyclePriceVO(); returnCountCyclePriceVO.setCyclePrice(Constants.addFee(solutions, -- Gitblit v1.9.3