From 75ab4754b8fb7a79b8da134c6aaa6e7b05b5b325 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 31 一月 2024 10:10:08 +0800
Subject: [PATCH] 开发业务接口
---
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 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..d9c548e 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;
@@ -704,7 +707,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()));
@@ -1044,7 +1052,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 +1063,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 +1244,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 +1263,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