From 5056b731dcaebbc3a48a4a910413cc4dd6c9c19a Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期四, 11 四月 2024 15:36:12 +0800
Subject: [PATCH] 提交一把
---
server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 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 90eb09a..878ba4d 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
@@ -158,12 +158,19 @@
.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 ");
+ if(pageWrap.getModel().getQueryFlag() == 1){
+ 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 a.status = "+Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()+" and a.type = 0 ) as addApplyNum ");
+ }else if(pageWrap.getModel().getQueryFlag() ==2){
+ 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 a.status = "+Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()+" and a.type = 1 ) as changeApplyNum ");
+ }else{
+ 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.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)){
@@ -380,7 +387,6 @@
}
}
}
-
}
@@ -443,13 +449,22 @@
Integer maxDays = DateUtil.calculateBetween(saveUnionApplyDTO.getStartDate(),saveUnionApplyDTO.getEndDate(),0);
- List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().select(ApplyDetail::getId,ApplyDetail::getPrice)
+ List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda()
+ .select(ApplyDetail::getId,ApplyDetail::getPrice,ApplyDetail::getStartTime,ApplyDetail::getEndTime,ApplyDetail::getFee)
.in(ApplyDetail::getApplyId,saveUnionApplyDTO.getApplyIds())
.eq(ApplyDetail::getIsdeleted,Constants.ZERO));
if(applyDetailList.size()==0){
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝瀛樺湪濮旀墭鎶曚繚鐢宠璁板綍淇℃伅鏈夎锛岃杩斿洖鏌ョ湅鐢宠浜哄憳鏄惁涓虹┖锛�");
}
- unionApply.setFee(applyDetailList.stream().map(i->Constants.formatBigdecimal(i.getPrice()).multiply(new BigDecimal(maxDays))).reduce(BigDecimal.ZERO,BigDecimal::add));
+ BigDecimal fee = BigDecimal.ZERO;
+ for (ApplyDetail applyDetail:applyDetailList) {
+ Integer oldDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0);
+ fee =fee.add(new BigDecimal(maxDays).multiply( applyDetail.getFee()).divide(new BigDecimal(oldDays),2,RoundingMode.HALF_UP));
+ }
+ unionApply.setFee(fee);
+
+// unionApply.setFee(applyDetailList.stream()
+// .map(i->Constants.formatBigdecimal(i.getPrice()).multiply(new BigDecimal(maxDays))).reduce(BigDecimal.ZERO,BigDecimal::add));
unionApplyMapper.insert(unionApply);
--
Gitblit v1.9.3