From 3a5fbcae78f6d395468826ce5dbcf6b4643aec7e Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期三, 03 四月 2024 18:02:58 +0800
Subject: [PATCH] 提交一把

---
 server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 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 5caee2c..d4ed737 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
@@ -146,7 +146,14 @@
         MPJLambdaWrapper<UnionApply> queryWrapper = new MPJLambdaWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
         queryWrapper.selectAll(UnionApply.class);
-        queryWrapper.selectAs(Solutions::getName,UnionApply::getSolutionName);
+        queryWrapper.selectAs(Solutions::getName,UnionApply::getSolutionName)
+          .selectAs(Solutions::getMaxAge,UnionApply::getMaxAge)
+                .selectAs(Solutions::getMinAge,UnionApply::getMinAge)
+                .selectAs(Solutions::getPrice,UnionApply::getPrice)
+                .selectAs(Solutions::getTimeUnit,UnionApply::getTimeUnit)
+                .selectAs(Solutions::getOrtherInfo,UnionApply::getOrtherInfo)
+                .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.leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId);
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
@@ -409,7 +416,7 @@
         if(insuranceApplyList.size()!=saveUnionApplyDTO.getApplyIds().size()){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鏁版嵁宸插鐞嗭紝璇峰埛鏂伴噸璇�");
         }
-
+        saveUnionApplyDTO.setEndDate(DateUtil.getMontageDate(saveUnionApplyDTO.getEndDate(),2));
         UnionApply unionApply = new UnionApply();
         unionApply.setCreateDate(new Date());
         unionApply.setCreator(user.getId());
@@ -733,7 +740,12 @@
         List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper.selectList(new QueryWrapper<InsuranceApply>()
                 .lambda().eq(InsuranceApply::getUnionApplyId,unionApply.getId()));
         for (InsuranceApply insuranceApply:insuranceApplyList) {
-            BigDecimal price = Constants.formatBigdecimal(insuranceApply.getPrice());
+            List<ApplyDetail> applyDetails = applyDetailList.stream()
+                    .filter(m->Constants.equalsInteger(m.getApplyId(),(insuranceApply.getId()))).collect(Collectors.toList());
+            if(CollectionUtils.isEmpty(applyDetails)){
+                continue;
+            }
+            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()){
@@ -763,11 +775,9 @@
             }else if(useDays>0){
                 currentFee =  new BigDecimal(useDays).multiply(price);
             }
-
-            List<ApplyDetail> applyDetails = applyDetailList.stream()
-                    .filter(m->Constants.equalsInteger(m.getApplyId(),(insuranceApply.getId()))).collect(Collectors.toList());
             //鏇存柊鎶曚繚鐢宠鍗�
             insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
+                    .set(InsuranceApply::getUnionApplyTbdStatus,Constants.THREE)
                     .set(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_DONE.getKey())
                     .set(InsuranceApply::getFee,price.multiply(new BigDecimal(applyDetails.size())).multiply(new BigDecimal(maxDays)))
                     .set(InsuranceApply::getCurrentFee,currentFee.multiply(new BigDecimal(applyDetails.size())))
@@ -775,6 +785,7 @@
                     .set(InsuranceApply::getEndTime,unionApplyBXDDTO.getEndTime())
                     .set(InsuranceApply::getEditDate,new Date())
                     .set(InsuranceApply::getEditor,user.getId())
+                    .set(InsuranceApply::getCode,unionApplyBXDDTO.getCode())
                     .eq(InsuranceApply::getId,insuranceApply.getId()));
             //鏇存柊鎶曚繚鍗曟槑缁嗛噾棰�
             applyDetailJoinMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda()
@@ -798,6 +809,7 @@
                 .set(UnionApply::getEditor,user.getId())
                 .set(UnionApply::getStartTime,unionApplyBXDDTO.getStartTime())
                 .set(UnionApply::getEndTime,unionApplyBXDDTO.getEndTime())
+                .set(UnionApply::getCode,unionApplyBXDDTO.getCode())
                 .set(UnionApply::getFee,sumFee)
                 .set(UnionApply::getCurrentFee,sumCurrFee)
                 .eq(UnionApply::getId,unionApply.getId())

--
Gitblit v1.9.3