From bd57081dc1bcd94e1e4043a9e0a7c6953d4bb9d4 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期一, 01 四月 2024 19:19:01 +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/UnionApplyServiceImpl.java |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 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 b37246d..da340b8 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
@@ -414,6 +414,8 @@
         UnionApply unionApply = new UnionApply();
         unionApply.setCreateDate(new Date());
         unionApply.setCreator(user.getId());
+        unionApply.setEditor(user.getId());
+        unionApply.setEditDate(new Date());
         unionApply.setCompanyId(user.getCompanyId());
         unionApply.setStartTime(saveUnionApplyDTO.getStartDate());
         unionApply.setEndTime(saveUnionApplyDTO.getEndDate());
@@ -470,7 +472,9 @@
         if(!user.getType().equals(Constants.TWO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
         }
-        if(Objects.isNull(closeDTO)||Objects.isNull(closeDTO.getId())){
+        if(Objects.isNull(closeDTO)
+                ||Objects.isNull(closeDTO.getId())
+                ||StringUtils.isBlank(closeDTO.getReason())){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         UnionApply unionApply = unionApplyMapper.selectById(closeDTO.getId());
@@ -489,15 +493,24 @@
         //鍚堝苟鍗曠姸鎬佸浜庡緟鎶曚繚
         if(unionApply.getStatus().equals(Constants.UnionApplyStatus.UPLOAD_INSURANCE_POLICY.getKey())
         || unionApply.getStatus().equals(Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey())){
-            //TODO 鍒犻櫎浼佷笟鎶曚繚鍗曠殑 绛剧讲鏁版嵁
-
+            multifileMapper.delete(new QueryWrapper<Multifile>()
+                    .lambda()
+                    .apply(" multifile.id in ( select i.id  from insurance_apply i where i.UNION_APPLY_ID = "+unionApply.getId()+" ) ")
+                    .eq(Multifile::getObjType,Constants.MultiFile.COMPANY_TBD_SIGNED.getKey()));
         }
         insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
                 .set(InsuranceApply::getUnionApplyId,null)
                 .set(InsuranceApply::getCheckDate,new Date())
+                .set(unionApply.getStatus().equals(Constants.UnionApplyStatus.UPLOAD_INSURANCE_POLICY.getKey())
+                        || unionApply.getStatus().equals(Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey()),
+                        InsuranceApply::getUnionApplyTbdStatus,Constants.ZERO)
+                .set(unionApply.getStatus().equals(Constants.UnionApplyStatus.UPLOAD_INSURANCE_POLICY.getKey())
+                        || unionApply.getStatus().equals(Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey()),
+                        InsuranceApply::getApplyTbdNo,null)
                 .set(InsuranceApply::getCheckUserId,user.getId())
                 .set(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_BUSINESS_CHECK_PASS.getKey())
-                .eq(InsuranceApply::getUnionApplyId,unionApply.getId()));
+                .eq(InsuranceApply::getUnionApplyId,unionApply.getId())
+        );
 
         applyDetailJoinMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda()
                 .set(ApplyDetail::getUnionApplyId,null)
@@ -516,8 +529,6 @@
         info = info.replace("${param}", closeDTO.getReason());
         ApplyLog log = new ApplyLog(unionApply,applyLogType.getName(), info
                 ,unionApply.getId(),applyLogType.getKey(),null, null);
-        applyLogMapper.insert(log);
-
         applyLogMapper.insert(log);
     }
 
@@ -799,7 +810,7 @@
                 .set(UnionApply::getCurrentFee,sumCurrFee)
                 .eq(UnionApply::getId,unionApply.getId())
         );
-        //鍚堝苟鍗� 鎬讳繚鍗�
+        //鍚堝苟鍗� 鏂囦欢
         if(StringUtils.isNotBlank(unionApplyBXDDTO.getFileUrl())){
             Multifile multifile = new Multifile();
             multifile.setIsdeleted(Constants.ZERO);

--
Gitblit v1.9.3