From 0c9a7d863d46138a574ed3aa966f9a2e1b6a2d91 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 29 三月 2024 11:39:18 +0800
Subject: [PATCH] git ch

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |  117 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 97 insertions(+), 20 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
index 03a8e69..1117e60 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -514,7 +514,7 @@
         InsuranceApply update = new InsuranceApply();
         update.setEditDate(new Date());
         update.setEditor(model.getCreator());
-        update.setStatus(Constants.InsuranceApplyStatus.COMPANY_APPLY_SIGNATURE.getKey());
+        update.setStatus(Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey());
         update.setCheckDate(update.getEditDate());
         update.setCheckInfo("浼佷笟瀹屾垚绛剧讲鏂规纭涔�");
         update.setCheckUserId(model.getCreator());
@@ -547,7 +547,7 @@
         InsuranceApply update = new InsuranceApply();
         update.setEditDate(new Date());
         update.setEditor(model.getCreator());
-        update.setStatus(Constants.InsuranceApplyStatus.COMPANY_MEMBER_LIST_SIGNATURE.getKey());
+        update.setStatus(Constants.InsuranceApplyStatus.WTB_COMPANY_MEMBER_LIST_SIGNATURE.getKey());
         update.setCheckDate(update.getEditDate());
         update.setCheckInfo("浼佷笟瀹屾垚绛剧讲浜哄憳鍚嶅崟");
         update.setCheckUserId(model.getCreator());
@@ -752,7 +752,7 @@
                         .selectAs(Company::getName,InsuranceApply::getCompanyName)
                         .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                         .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
-                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD.getKey())
+                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey())
                         .eq(Solutions::getType,Constants.ONE)
                         .isNotNull(InsuranceApply::getSignQrsNo));
         if(applyList !=null && applyList.size()>0 ){
@@ -781,7 +781,7 @@
                         .selectAs(Company::getName,InsuranceApply::getCompanyName)
                         .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                         .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
-                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.COMPANY_APPLY_SIGNATURE.getKey())
+                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WTB_COMPANY_APPLY_SIGNATURE.getKey())
                         .eq(Solutions::getType,Constants.ONE)
                         .isNotNull(InsuranceApply::getSignMemberListNo));
         if(applyList !=null && applyList.size()>0 ){
@@ -956,7 +956,7 @@
                             .eq(Solutions::getType,Constants.ONE)
                             .eq(InsuranceApply::getSignMemberListNo,data.getApplyNo())
                             .last("limit 1" ));
-            if(modelMemberList != null && Constants.equalsInteger(modelMemberList.getStatus(),Constants.InsuranceApplyStatus.COMPANY_APPLY_SIGNATURE.getKey())){
+            if(modelMemberList != null && Constants.equalsInteger(modelMemberList.getStatus(),Constants.InsuranceApplyStatus.WTB_COMPANY_APPLY_SIGNATURE.getKey())){
                 //瀹屾垚绛剧讲宸插畬鎴愭搷浣�
                 String link = signService.linkFile(data.getApplyNo());
                 String fileUrl = uploadSignFile(link);
@@ -1129,6 +1129,7 @@
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public Integer check(InsuranceApply insuranceApply) {
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         if(insuranceApply.getId() == null){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -1137,31 +1138,35 @@
         if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.DATA_EMPTY);
         }
-        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.UPLOAD.getKey())){
-            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
-        }
-
         Solutions solutions = solutionsMapper.selectById(model.getSolutionId());
         if(Objects.isNull(solutions)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
         }
+        if(solutions.getType().equals(Constants.ZERO)){
+            if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.UPLOAD.getKey())){
+                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+            }
+        }else{
+            if(!user.getType().equals(Constants.TWO)){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风鏃犳硶杩涜璇ユ搷浣�");
+            }
+            if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_RETURN.getKey())){
+                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+            }
+        }
 
         Constants.ApplyLogType applyLogType = null;
-        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         InsuranceApply update = new InsuranceApply();
         update.setEditDate(new Date());
         update.setEditor(user.getId());
         update.setCheckDate(update.getEditDate());
         update.setCheckInfo(insuranceApply.getCheckInfo());
         update.setCheckUserId(user.getId());
-        update.setId(model.getId());
-        Constants.NoticeType noticeType = Constants.NoticeType.ONE;
+        update.setId(model.getId()); 
         if(insuranceApply.getDealBackApply() ==1){
             //濡傛灉鏄笉閫氳繃
             applyLogType = Constants.ApplyLogType.PLATFORM_RETURN ;
             update.setStatus(Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey());
-
-            noticeType = Constants.NoticeType.FOUR;
         }else{
             applyLogType = Constants.ApplyLogType.PLATFORM_CHECK_PASS;
             update.setStatus(Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey());
@@ -1173,10 +1178,7 @@
         //鍒犻櫎鍏朵粬寰呭姙
         noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey())
                 .ne(Notices::getType,Constants.NoticeType.SIX.getStatus())
-                .eq(Notices::getObjId,model.getId()));
-//        Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(),model.getCompanyId(),noticeType);
-//        noticesMapper.insert(notices);
-
+                .eq(Notices::getObjId,model.getId())); 
         String info =applyLogType.getInfo();
         if(StringUtils.isNotBlank(update.getCheckInfo())){
             info = info.replace("${param}", update.getCheckInfo());
@@ -1220,6 +1222,9 @@
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鍛樺伐淇℃伅瀛樺湪閲嶅淇℃伅");
         }
         Constants.InsuranceApplyStatus insuranceApplyStatus = Constants.InsuranceApplyStatus.UPLOAD;
+        if(solutions.getType().equals(Constants.ONE)){
+            insuranceApplyStatus = Constants.InsuranceApplyStatus.WTB_UPLOAD;
+        }
         insuranceApply.setCreateDate(new Date());
         insuranceApply.setCreator(loginUserInfo.getId());
         insuranceApply.setEditor(loginUserInfo.getId());
@@ -2083,7 +2088,7 @@
         Constants.ApplyLogType applyLogType = null;
         String info = "";
         //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炲凡绛剧珷鐘舵�佷笅鐨勯��鍥炵敵璇风姸鎬佽繘琛屾搷浣�
-        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.UPLOAD.getKey())){
+        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey())){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
         }
         Company company = user.getCompany();
@@ -2120,6 +2125,8 @@
         return  link;
     }
 
+
+
     @Override
     public  InsuranceApply  queryApplyDetail(Integer applyId){
         InsuranceApply model = findDetail(applyId);
@@ -2154,7 +2161,7 @@
         if(Objects.isNull(model) ||! Constants.equalsInteger(Constants.ZERO,model.getIsdeleted())){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
-        if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){
+        if(!Constants.equalsInteger(Constants.InsuranceApplyStatus.WTB_COMPANY_APPLY_SIGNATURE.getKey(),model.getStatus())){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔绛剧珷鎿嶄綔锛�");
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
@@ -2193,6 +2200,76 @@
     }
 
 
+    /**
+     * 濮旀墭淇� 鎶曚繚鐢宠绛剧讲
+     * @param id
+     * @return
+     */
+    @Override
+    public  String getSignWTBTBDLink(Integer id) {
+        if(id == null ){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        MPJLambdaWrapper wrapper=  new MPJLambdaWrapper<InsuranceApply>()
+                .selectAll(InsuranceApply.class)
+                .selectAs(Solutions::getSignKeyword,InsuranceApply::getSignKeyword)
+                .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                .eq(InsuranceApply::getId,id)
+                .last("limit 1");
 
+        InsuranceApply model = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,wrapper);
+        if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        Solutions solutions = solutionsMapper.selectById(model.getSolutionId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
+        }
+        if(solutions.getType().equals(Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝闈炲鎵樹繚鏂规淇濆崟!");
+        }
+        if(!model.getUnionApplyTbdStatus().equals(Constants.ONE)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝鍟嗘埛鏈笂浼犳垨宸茬缃�");
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        Constants.ApplyLogType applyLogType = null;
+        String info = "";
+        //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炲凡绛剧珷鐘舵�佷笅鐨勯��鍥炵敵璇风姸鎬佽繘琛屾搷浣�
+        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey())){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+        }
+        Company company = user.getCompany();
+        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(),"瀵逛笉璧凤紝浼佷笟灏氭湭鍏峰鍦ㄧ嚎绛剧珷鏉′欢锛岃鑱旂郴骞冲彴绠$悊鍛樼‘璁");
+        }
+        Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId,model.getId())
+                .eq(Multifile::getObjType,Constants.MultiFile.COMPANY_TBD_SIGNED_PDF.getKey())
+                .eq(Multifile::getIsdeleted,Constants.ZERO).last("limit 1"));
+        if(f == null || StringUtils.isBlank(f.getFileurl())){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇纭涔︽枃浠跺け璐ワ紝璇疯仈绯诲晢鎴风‘璁ゆ姇淇濈敵璇蜂功鏄惁姝g‘锛�");
+        }
+        String url = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode()+f.getFileurl();
+        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.applySign(company.getName(),url,company.getName(),company.getCode(),company.getEmail(),model.getSignKeyword(),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(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        InsuranceApply update= new InsuranceApply();
+        update.setId(model.getId());
+        update.setEditor(user.getId());
+        update.setEditDate(new Date());
+        update.setApplyTbdNo(applyNo);
+        insuranceApplyMapper.updateById(update);
+        return  link;
+    }
 
 }

--
Gitblit v1.9.3