From 44a0ef1620cad87479390900eb6ded041c7b8d7b Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 17 五月 2024 16:56:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/1.0.1' into 1.0.1
---
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java | 69 +++++++++++++++++++++++-----------
1 files changed, 46 insertions(+), 23 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 a259e96..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)
@@ -313,6 +322,7 @@
memberInsuranceJoinMapper.insertBatchSomeColumn(memberInsuranceList);
}
+ this.updateApplyCurrentFee(insuranceApply.getId(),null);
return 1;
}
@@ -1596,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));
@@ -1643,7 +1653,6 @@
noticesMapper.insert(shopNotices);
}
}
-
return insuranceApply.getId();
}
@@ -1709,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);
//瀛樺偍鏃ュ織鏁版嵁
@@ -1735,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)
@@ -1744,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(),"鏁版嵁寮傚父锛氫繚闄╂柟妗堜笅鏈煡璇㈠埌宸ョ淇℃伅");
@@ -1794,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());
@@ -2516,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_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());
@@ -2557,6 +2577,9 @@
insuranceApplyMapper.updateById(insuranceApply);
}
}
+// if(1==1){
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED);
+// }
}
--
Gitblit v1.9.3