From 1d2fa9783d47a19650450b81fc4f2e6c97b1d4ac Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期二, 09 四月 2024 15:38:13 +0800
Subject: [PATCH] 提交一把
---
server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
index 895e124..a2e652a 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
@@ -32,6 +32,7 @@
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
@@ -154,6 +155,13 @@
.selectAs(Solutions::getSpecialAgreement,UnionApply::getSpecialAgreement)
.selectAs(Solutions::getSpecialInfo,UnionApply::getSpecialInfo);
queryWrapper.select("(select count(b.id) from apply_detail b where b.isdeleted=0 and b.union_apply_id=t.id) as insureNum ");
+
+ queryWrapper.select("(select count(1) from apply_change a inner join insurance_apply b on a.apply_id = b.id where b.union_apply_id=t.id " +
+ "and b.status = "+Constants.InsuranceApplyStatus.WTB_TOUBAOING.getKey()+" and a.type = 0 ) as addApplyNum ");
+
+ queryWrapper.select("(select count(1) from apply_change a inner join insurance_apply b on a.apply_id = b.id where b.union_apply_id=t.id " +
+ "and b.status = "+Constants.InsuranceApplyStatus.WTB_TOUBAOING.getKey()+" and a.type = 1 ) as changeApplyNum ");
+
queryWrapper.leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId);
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
if(Constants.equalsInteger(user.getType(),Constants.TWO)){
@@ -618,6 +626,13 @@
multifile.setFileurl(uploadMultifileDTO.getFileurl());
multifile.setName(uploadMultifileDTO.getName());
multifileMapper.insert(multifile);
+
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.IA_HBD_UPLOAD_TBD;
+ ApplyLog log = new ApplyLog(unionApply,applyLogType.getName(), null
+ ,unionApply.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(unionApply));
+ applyLogMapper.insert(log);
+
}
@@ -723,6 +738,7 @@
List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda()
.select(ApplyDetail::getId,ApplyDetail::getApplyId,ApplyDetail::getPrice)
.in(ApplyDetail::getUnionApplyId,unionApply.getId()));
+ unionApplyBXDDTO.setEndTime(DateUtil.getMontageDate(unionApplyBXDDTO.getEndTime(),2));
//鎬诲ぉ鏁�
Integer maxDays = DateUtil.calculateBetween(unionApplyBXDDTO.getStartTime(),unionApplyBXDDTO.getEndTime(),0);
//瀹為檯宸茬粡浜х敓璐圭敤鐨勫ぉ鏁�
@@ -746,12 +762,14 @@
}
BigDecimal price = Constants.formatBigdecimal(applyDetails.get(Constants.ZERO).getPrice());
-
Optional<UnionApplyBXDDetailDTO> unionApplyBXDDDetailTO= unionApplyBXDDetailDTOList.stream().filter(
m->m.getApplyId().equals(insuranceApply.getId())).findFirst();
if(unionApplyBXDDDetailTO.isPresent()){
UnionApplyBXDDetailDTO unionApplyBXDDetailDTO = unionApplyBXDDDetailTO.get();
- price = Constants.formatBigdecimal(price).add(Constants.formatBigdecimal(unionApplyBXDDetailDTO.getServerMoney()));
+
+ BigDecimal dayServerMoney = unionApplyBXDDetailDTO.getServerMoney().divide(new BigDecimal(maxDays),2, RoundingMode.HALF_UP);
+
+ price = Constants.formatBigdecimal(price).add(Constants.formatBigdecimal(dayServerMoney));
//涓婁紶淇濆崟淇℃伅
if(StringUtils.isNotBlank(unionApplyBXDDetailDTO.getFileUrl())){
Multifile multifile = new Multifile();
@@ -779,7 +797,8 @@
//鐢熸垚鎶曚繚璁板綍
if(CollectionUtils.isNotEmpty(applyDetailList)){
List<MemberInsurance> memberInsuranceList = new ArrayList<>();
- for (ApplyDetail applyDetail:applyDetailList) {
+ for (ApplyDetail applyDetail:applyDetailList.stream()
+ .filter(m->Constants.equalsInteger(m.getApplyId(),(insuranceApply.getId()))).collect(Collectors.toList())) {
applyDetail.setPrice(price);
applyDetail.setFee(price.multiply(new BigDecimal(maxDays)));
MemberInsurance memberInsurance = new MemberInsurance(applyDetail,user.getId());
@@ -842,7 +861,7 @@
multifileMapper.insert(multifile);
}
- Constants.ApplyLogType applyLogType = Constants.ApplyLogType.IA_HBD_UPLOAD_TBD;
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.IA_HBD_UPLOAD_BXD;
String info = "";
if(Objects.nonNull(unionApplyBXDDTO.getStartTime())&&Objects.nonNull(unionApplyBXDDTO.getEndTime())){
info =applyLogType.getInfo();
--
Gitblit v1.9.3