From f63e0073e96abe1e52d74749f408e3f542600a09 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期三, 03 四月 2024 13:27:12 +0800
Subject: [PATCH] 提交一把

---
 server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java |  105 ++++++++++++++++++++++++++++------------------------
 1 files changed, 57 insertions(+), 48 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
index 94fe74f..d1e0c22 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -135,13 +135,17 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鏂规淇℃伅");
         }
 
-        if(
-//                Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
-//                ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey())
-//                ||
-                Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
-            //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
-            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+        if(Constants.equalsInteger(solutions.getType(),Constants.ZERO)){
+            if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
+                //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
+                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+            }
+        }else if(Constants.equalsInteger(solutions.getType(),Constants.ZERO)){
+            if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
+            || Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey()) ){
+                //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
+                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+            }
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         ApplyChange update = new ApplyChange();
@@ -1606,14 +1610,11 @@
         }else if(applyChangeOptDTO.getOptType().equals(6)){
             //浼佷笟鍏抽棴
             applyLogType = Constants.ApplyLogType.CA_COMPANY_CLOSE;
-            if(!loginUserInfo.getType().equals(Constants.ONE)){
-                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氱鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
-            }
-            if(!applyChange.getStatus().equals(Constants.ApplyChangeStatus.PLATFORM_AGREE.getKey())){
+            if(!(applyChange.getStatus().equals(Constants.ApplyChangeStatus.PLATFORM_AGREE.getKey())
+                    ||applyChange.getStatus().equals(Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()))){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀敊璇棤娉曡繘琛岃鎿嶄綔!");
             }
             applyChange.setStatus(Constants.ApplyChangeStatus.CLOSE.getKey());
-
             //瀛樺偍寰呭姙淇℃伅
             //鍒犻櫎鍏朵粬寰呭姙
             noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,applyChange.getId()));
@@ -1641,11 +1642,13 @@
         MPJLambdaWrapper<ApplyChange> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper.selectAll(ApplyChange.class)
                 .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode)
+                .selectAs(Company::getId,ApplyChange::getCompanyId)
                 .selectAs(Company::getName,ApplyChange::getCompanyName)
                 .selectAs(InsuranceApply::getStartTime,ApplyChange::getStartTime)
                 .selectAs(InsuranceApply::getEndTime,ApplyChange::getEndTime)
                 .selectAs(Solutions::getName,ApplyChange::getSolutionsName)
                 .selectAs(Solutions::getType,ApplyChange::getSolutionType)
+                .selectAs(Solutions::getId,ApplyChange::getSolutionsId)
                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0  )",ApplyChange::getAddNum)
                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1  )",ApplyChange::getDelNum)
                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2  )",ApplyChange::getChangeNum)
@@ -1671,7 +1674,7 @@
         applyChange.setApplyLogList(applyLogList);
 
         List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
-                .eq(Multifile::getObjId,Constants.equalsInteger(applyChange.getSolutionType(),Constants.ZERO)? applyChange.getId():applyChange.getUnionChangeId())
+                .eq(Multifile::getObjId, applyChange.getId() )
                 .in(Multifile::getObjType, Arrays.asList(new Integer[]{Constants.MultiFile.CA_APPLY_JIAJIAN_SIGN.getKey()
                         ,Constants.MultiFile.CA_PD_PDF.getKey()
                         ,Constants.MultiFile.CA_APPLY_CHANGEUNIT_SIGN.getKey()}))
@@ -1747,9 +1750,9 @@
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         Company company = user.getCompany();
-        if(debugModel){
+        /*if(debugModel){
             company = companyMapper.selectById(model.getCompanyId());
-        }
+        }*/
         if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝浼佷笟灏氭湭鍏峰鍦ㄧ嚎绛剧珷鏉′欢锛岃鑱旂郴骞冲彴绠$悊鍛樼‘璁");
         }
@@ -1994,14 +1997,9 @@
         if(Objects.isNull(model) ||! Constants.equalsInteger(Constants.ZERO,model.getIsdeleted())){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
-        if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){
-            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔绛剧珷鎿嶄綔锛�");
-        }
+
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-        Company company = user.getCompany();
-        if(debugModel){
-            company = companyMapper.selectById(model.getCompanyId());
-        }
+        Company company = companyMapper.selectById(model.getCompanyId());
         if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝浼佷笟灏氭湭鍏峰鍦ㄧ嚎绛剧珷鏉′欢锛岃鑱旂郴骞冲彴绠$悊鍛樼‘璁");
         }
@@ -2009,32 +2007,43 @@
         if(Objects.isNull(solutions)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
         }
-        if(solutions.getType().equals(Constants.ZERO)){
-            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝闈炲鎵樹繚鏂规淇濆崟锛屾棤娉曡繘琛岃鎿嶄綔!");
-        }
         String fileUrl = null;
-        if(Constants.equalsObject(model.getType(), Constants.ONE)){
-            fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","琚繚闄╀汉");
+        if(solutions.getType().equals(Constants.ONE)){
+            if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){
+                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔绛剧珷鎿嶄綔锛�");
+            }
+            if(Constants.equalsObject(model.getType(), Constants.ONE)){
+                fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","琚繚闄╀汉");
+            }else{
+                fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","琚繚闄╀汉");
+            }
+            String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
+            notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
+            String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"浜哄憳鍚嶅崟绛剧珷",company.getSignId(),notifyUrl);
+            if(StringUtils.isBlank(applyNo) ){
+                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+            }
+            String link = signService.signLink(applyNo,company.getName(),company.getCode());
+            if(StringUtils.isBlank(link) ){
+                throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+            }
+            ApplyChange update= new ApplyChange();
+            update.setId(model.getId());
+            update.setEditor(user.getId());
+            update.setEditDate(new Date());
+            update.setSignMemberListNo(applyNo);
+            applyChangeMapper.updateById(update);
+            return link;
         }else{
-            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","琚繚闄╀汉");
+            if(model.getType().equals(Constants.ONE)){
+                return this.getSignLinkChangeUnit(model);
+            }else{
+                return this.getSignLinkJiajiabao(model);
+            }
+
+
+
         }
-        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
-        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
-        String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"浜哄憳鍚嶅崟绛剧珷",company.getSignId(),notifyUrl);
-        if(StringUtils.isBlank(applyNo) ){
-            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
-        }
-        String link = signService.signLink(applyNo,company.getName(),company.getCode());
-        if(StringUtils.isBlank(link) ){
-            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
-        }
-        ApplyChange update= new ApplyChange();
-        update.setId(model.getId());
-        update.setEditor(user.getId());
-        update.setEditDate(new Date());
-        update.setSignMemberListNo(applyNo);
-        applyChangeMapper.updateById(update);
-        return  link;
     }
 
 
@@ -2068,7 +2077,7 @@
         if(solutions.getType().equals(Constants.ZERO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐩翠繚鍗曟嵁鏃犳硶杩涜璇ユ搷浣�");
         }else{
-            if(!Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.COMPANY_SIGN.getKey())){
+            if(!Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey())){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
             }
         }
@@ -2082,9 +2091,9 @@
         update.setId(model.getId());
         if(applyChange.getDealBackApply() ==1){
             //濡傛灉鏄笉閫氳繃
-            update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey());
+            update.setStatus(Constants.ApplyChangeStatus.PLATFORM_AGREE.getKey());
         }else{
-            update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS.getKey());
+            update.setStatus(Constants.ApplyChangeStatus.CHECHED_PASSED.getKey());
         }
         applyChangeJoinMapper.updateById(update);
         Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.APPLY_CHANGE;

--
Gitblit v1.9.3