From 241867ae64ccfe5bf61bd5e939af1f308ca1e3b3 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期日, 07 四月 2024 15:25:47 +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/UnionChangeServiceImpl.java |   70 ++++++++++++++++++++++++++---------
 1 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
index ad8d7af..d491222 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -172,15 +172,40 @@
                             .selectAs(SystemUser::getType,ApplyLog::getCreatorType)
                             .leftJoin(SystemUser.class,SystemUser::getId,ApplyLog::getCreator)
                             .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId)
-                            .in(ApplyLog::getObjType,Constants.ApplyLogType.getTypeList(Constants.THREE))
+                            .in(ApplyLog::getObjType,Constants.ApplyLogType.getTypeList(Constants.FOUR))
                             .eq(ApplyLog::getApplyId,unionChange.getId())
                             .orderByAsc(ApplyLog::getCreateDate)
             );
             unionChange.setApplyLogList(applyLogList);
         }
+        initFiles(unionChange);
         return unionChange;
     }
 
+    private void initFiles(UnionChange unionChange) {
+        List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId, unionChange.getId() )
+                .in(Multifile::getObjType, Arrays.asList(new Integer[]{Constants.MultiFile.WTB_CA_TBD_PDF.getKey(),Constants.MultiFile.WTB_CA_DONE_PDF.getKey()}))
+                .eq(Multifile::getIsdeleted,Constants.ZERO));
+        if(multifiles!=null){
+            String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()
+                    +systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
+            for(Multifile f : multifiles){
+                if(StringUtils.isBlank(f.getFileurl())){
+                    continue;
+                }
+                f.setFileurlFull(path+f.getFileurl());
+                if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.WTB_CA_TBD_PDF.getKey())){
+                    //绛剧讲鍚庣敵璇峰崟
+                    unionChange.setApplyFile(f);
+                }
+                if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.WTB_CA_DONE_PDF.getKey())){
+                    //绛剧讲鍚庣敵璇峰崟
+                    unionChange.setPidanFile(f);
+                }
+            }
+        }
+    }
 
 
     @Override
@@ -374,13 +399,16 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-        if(user.getType().equals(Constants.TWO)){
+        user.setType(Constants.formatIntegerNum(user.getType()));
+        if(!user.getType().equals(Constants.TWO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
         }
         UnionChange unionChange = unionChangeMapper.selectById(closeDTO.getId());
         if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
+        unionChange.setStatus(Constants.formatIntegerNum(unionChange.getStatus()));
+        unionChange.setShopId(Constants.formatIntegerNum(unionChange.getShopId()));
         if(!unionChange.getShopId().equals(user.getCompanyId())){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧烽潪鎮ㄧ殑鍚堝苟鍗曪紝鎮ㄦ棤娉曡繘琛屾搷浣滐紒");
         }
@@ -401,14 +429,14 @@
 
         applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda()
                 .set(ApplyChagneDetail::getUnionChangeId,null)
-                .in(ApplyChagneDetail::getApplyId,unionChange.getId()));
+                .eq(ApplyChagneDetail::getUnionChangeId,unionChange.getId()));
 
         unionChangeMapper.update(null,new UpdateWrapper<UnionChange>().lambda()
-                .set(UnionChange::getStatus,Constants.UnionApplyStatus.CLOSE.getKey())
+                .set(UnionChange::getStatus,Constants.UnionChangeStatus.CLOSE.getKey())
                 .eq(UnionChange::getId,unionChange.getId())
         );
 
-        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_UPLOAD;
+        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_CLOSE;
         String info =applyLogType.getInfo();
         info = info.replace("${param}", closeDTO.getReason());
         ApplyLog log = new ApplyLog(unionChange,applyLogType.getName(), info
@@ -494,6 +522,7 @@
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         UnionChange unionChange = this.unionChangeDetail(smsCheckDTO.getBusinessId());
+        unionChange.setStatus(Constants.formatIntegerNum(unionChange.getStatus()));
         if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
@@ -506,7 +535,7 @@
         if(unionChange.getStatus().equals(Constants.UnionChangeStatus.CLOSE.getKey())){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡鍏抽棴");
         }
-        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.MERGE.getKey())){
+        if(!unionChange.getStatus().equals(Constants.UnionChangeStatus.MERGE.getKey())){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曠姸鎬佸凡娴佽浆");
         }
         Company company =  companyMapper.selectById(user.getCompanyId());
@@ -559,6 +588,8 @@
         if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
+        unionChange.setStatus(Constants.formatIntegerNum(unionChange.getStatus()));
+        unionChange.setShopId(Constants.formatIntegerNum(unionChange.getShopId()));
         if(!unionChange.getShopId().equals(user.getCompanyId())){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧烽潪鎮ㄧ殑鍚堝苟鍗曪紝鎮ㄦ棤娉曡繘琛屾搷浣滐紒");
         }
@@ -568,7 +599,7 @@
         if(unionChange.getStatus().equals(Constants.UnionChangeStatus.CLOSE.getKey())){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡鍏抽棴");
         }
-        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.UPLOAD_INSURANCE_POLICY.getKey())){
+        if(!unionChange.getStatus().equals(Constants.UnionChangeStatus.UPLOAD_INSURANCE_POLICY.getKey())){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曠姸鎬佸凡娴佽浆");
         }
 
@@ -608,19 +639,17 @@
                         ||StringUtils.isBlank(m.getFileurl())
                         ||StringUtils.isBlank(m.getName())
                 ){
-                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鍔犲噺淇�/鎹㈠巶涓氬姟鎵瑰崟鏂囦欢淇℃伅缂哄け");
+                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鎵瑰崟鏂囦欢淇℃伅缂哄け");
                 }
-                multifile.setIsdeleted(Constants.ZERO);
-                multifile.setCreator(user.getId());
-                multifile.setCreateDate(new Date());
-                multifile.setCreateDate(new Date());
-                multifile.setObjType(Constants.MultiFile.CA_PD_PDF.getKey());
-                multifile.setType(Constants.TWO);
-                multifileMapper.insert(multifile);
+                m.setId(null);
+                m.setIsdeleted(Constants.ZERO);
+                m.setCreator(user.getId());
+                m.setCreateDate(new Date());
+                m.setObjType(Constants.MultiFile.CA_PD_PDF.getKey());
+                m.setType(Constants.TWO);
+                multifileMapper.insert(m);
             }
         }
-
-
         if(CollectionUtils.isNotEmpty(applyChangeList)){
             for (ApplyChange applyChange:applyChangeList) {
                 applyChange.setApplyStartTime(unionChangeBXDDTO.getApplyDate());
@@ -628,7 +657,12 @@
                 applyChange.setEditDate(new Date());
                 applyChange.setEditor(user.getId());
                 applyChange.setStatus(Constants.ApplyChangeStatus.APPROVE.getKey());
-                List<ApplyChagneDetail> allList = applyChagneDetailJoinMapper.selectList(new QueryWrapper<ApplyChagneDetail>().lambda().eq(ApplyChagneDetail::getApplyChangeId,applyChange.getId()));
+                List<ApplyChagneDetail> allList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
+                        new MPJLambdaWrapper<ApplyChagneDetail>().selectAll(ApplyChagneDetail.class)
+                                .selectAs(Member::getName,ApplyChagneDetail::getMemberName )
+                                .selectAs(Member::getIdcardNo,ApplyChagneDetail::getIdcardNo )
+                                .leftJoin(Member.class,Member::getId,ApplyChagneDetail::getMemberId)
+                                .eq(ApplyChagneDetail::getApplyChangeId,applyChange.getId()));
                 this.dealApplyChangeDetail(applyChange,allList);
                 applyChange.setCode(unionChangeBXDDTO.getCode());
                 applyChange.setCheckUserId(user.getId());

--
Gitblit v1.9.3