From eea444a1d985ddd104565139c65e4b3921285e81 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 23 一月 2024 10:20:39 +0800
Subject: [PATCH] 开发业务接口

---
 server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java    |   62 ++++++++++++++++++--
 server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java             |    1 
 server/service/src/main/java/com/doumee/core/utils/Constants.java                            |   29 ++++++---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |   39 +++++++++---
 4 files changed, 104 insertions(+), 27 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/core/utils/Constants.java b/server/service/src/main/java/com/doumee/core/utils/Constants.java
index 07c89d8..200e527 100644
--- a/server/service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -632,6 +632,15 @@
         PLATFORM_UN_AGREE_BACK(9, "椹冲洖閫�鍥炵敵璇�","鎻愪氦鎰忚锛�${param}"),
         COMPANY_EDIT(10, "淇濆崟淇敼","鎻愪氦鎰忚锛�${param1}\n${param2}"),
         PLATFORM_CHECK_PASS(11, "鎶曚繚瀹℃牳閫氳繃",""),
+        CA_PLATFORM_CHECK_PASS_NO(12, "閫�鍥炴姇淇�","鎻愪氦鎰忚锛�${param}"),
+        CA_PLATFORM_AGREE_BACK_APPLY(13, "鍚屾剰閫�鍥炵敵璇�","鎻愪氦鎰忚锛�${param}"),
+        CA_PLATFORM_CHECK_APPROVE(14, "鎵瑰崟瀹屾垚",""),
+        CA_PLATFORM_CHECK_SIGNATURE(15, "浼佷笟绛剧珷",""),
+        CA_COMPANY_EDIT(16, "鎵瑰崟淇敼","鎻愪氦鎰忚锛�${param1}\n${param2}"),
+        CA_COMPANY_COMMIT(17, "鎻愪氦鎶曚繚","鎻愪氦鎰忚锛�${param}"),
+        CA_COMPANY_BACK_APPLY(18, "鐢宠閫�鍥�","鎻愪氦鎰忚锛�${param}"),
+        CA_COMPANY_CLOSE(19, "鍏抽棴璁㈠崟",""),
+        CA_PALTFORM_REFUSE_APPLY(20, "椹冲洖閫�鍥炵敵璇�",""),
         ;
         // 鎴愬憳鍙橀噺
         private String name;
@@ -696,10 +705,11 @@
         SIGNATURE(3, "宸茬绔犲緟涓婁紶淇濋櫓鍗�",""),
         FAIL_RETURN(4, "淇濆崟鍑哄叿澶辫触閫�鍥�",""),
         UPLOAD_INSURANCE(5, "淇濆崟瀹屾垚","淇濋櫓鐢熸晥璧锋湡锛�${param}鍙樻洿涓�${param1}"),
-        COMPANY_APPLY_RETURN(6, "浼佷笟鐢宠閫�鍥�(涓嶅彲椹冲洖)","鎻愪氦鎰忚锛�${param}"),
-        COMPANY_APPLY_RETURN_SELECT(7, "浼佷笟鐢宠閫�鍥�(鍙┏鍥�)","鎻愪氦鎰忚锛�${param}"),
-        CLOSE(8, "璁㈠崟鍏抽棴",""),
-        PLATFORM_CHECK_PASS(9,"骞冲彴鎶曚繚瀹℃牳閫氳繃",""),
+        COMPANY_BACK_APPLY_UPLOAD(6, "浼佷笟鐢宠閫�鍥�(鎻愪氦鎶曚繚)","鎻愪氦鎰忚锛�${param}"),
+        COMPANY_BACK_APPLY_WAIT_SIGNATURE(7, "浼佷笟鐢宠閫�鍥�(寰呯绔�)","鎻愪氦鎰忚锛�${param}"),
+        COMPANY_BACK_APPLY_SIGNATURE(8, "浼佷笟鐢宠閫�鍥�(宸茬绔�)","鎻愪氦鎰忚锛�${param}"),
+        CLOSE(9, "璁㈠崟鍏抽棴",""),
+        PLATFORM_CHECK_PASS(10,"骞冲彴鎶曚繚瀹℃牳閫氳繃",""),
         ;
         // 鎴愬憳鍙橀噺
         private String name;
@@ -771,11 +781,12 @@
         UPLOAD(0, "鎻愪氦鍔犲噺淇�/鎹㈠巶鐢宠"),
         SIGNATURE(1, "宸茬绔�"),
         APPROVE(2, "宸蹭笂浼犲鎵�"),
-        RETURN_APPLY(3, "鍙戣捣閫�鍥炵敵璇�"),
-        PLATFORM_AGREE(4, "骞冲彴鍚屾剰锛堝凡閫�鍥烇級"),
-        CLOSE(5, "宸插叧闂�"),
-        PALTFORM_CHECK_PASS(6, "瀹℃牳涓嶉�氳繃"),
-        PALTFORM_CHECK_PASS_NO(7, "瀹℃牳閫氳繃"),
+        RETURN_APPLY_UPLOAD(3, "鍙戣捣閫�鍥炵敵璇�(寰呭鏍�)"),
+        RETURN_APPLY_SIGNATURE(4, "鍙戣捣閫�鍥炵敵璇凤紙宸茬绔狅級"),
+        PLATFORM_AGREE(5, "骞冲彴鍚屾剰锛堝凡閫�鍥烇級"),
+        CLOSE(6, "宸插叧闂�"),
+        PALTFORM_CHECK_PASS(7, "瀹℃牳閫氳繃"),
+        PALTFORM_CHECK_PASS_NO(8, "瀹℃牳涓嶉�氳繃"),
         ;
         // 鎴愬憳鍙橀噺
         private String name;
diff --git a/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java b/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
index dc5d146..3e27eda 100644
--- a/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
+++ b/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
@@ -21,6 +21,7 @@
      */
     Integer create(ApplyChange applyChange);
     Integer back(ApplyChange param);
+    Integer dealBackApply(ApplyChange param);
     /**
      * 涓婚敭鍒犻櫎
      *
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 4651ecc..847d831 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
@@ -74,8 +74,8 @@
     private SolutionsMapper solutionsMapper;
 
     /**
-     * 骞冲彴閫�鍥炵敵璇�
-     * @param insuranceApply
+     * 骞冲彴閫�鍥炴姇淇�
+     * @param param
      * @return
      */
     @Override
@@ -89,7 +89,9 @@
         if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.DATA_EMPTY);
         }
-        if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){
+        if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
+                ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
+            //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
@@ -103,7 +105,47 @@
         update.setId(model.getId());
         applyChangeMapper.updateById(update);
 
-        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.PLATFORM_RETURN;
+        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_CHECK_PASS_NO;
+        String info =applyLogType.getInfo();
+        info = info.replace("${param}", update.getCheckInfo());
+        ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+        applyLogMapper.insert(log);
+        return  1;
+
+    }
+    /**
+     * 骞冲彴閫�鍥炴姇淇�
+     * @param param
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public Integer dealBackApply(ApplyChange param) {
+        if(param.getId() == null ||StringUtils.isBlank(param.getCheckInfo())){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        ApplyChange model = applyChangeMapper.selectById(param.getId());
+
+        if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
+                ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
+            //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        ApplyChange update = new ApplyChange();
+        update.setEditDate(new Date());
+        update.setEditor(user.getId());
+        update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey());
+        update.setCheckDate(update.getEditDate());
+        update.setCheckInfo(param.getCheckInfo());
+        update.setCheckUserId(user.getId());
+        update.setId(model.getId());
+        applyChangeMapper.updateById(update);
+
+        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_CHECK_PASS_NO;
         String info =applyLogType.getInfo();
         info = info.replace("${param}", update.getCheckInfo());
         ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
@@ -533,8 +575,8 @@
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鏁版嵁宸插垹闄�,鏃犳硶杩涜璇ユ搷浣�");
         }
         Constants.ApplyChangeLogStatus applyChangeLogStatus = Constants.ApplyChangeLogStatus.RETURN_APPLY;
-
-        if(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY.getKey())){
+        if(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey())
+                ||applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){
             //鍙戣捣閫�鍥炵敵璇�
             if(loginUserInfo.getType().equals(Constants.ONE)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炰紒涓氱鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
@@ -548,7 +590,9 @@
             if(loginUserInfo.getType().equals(Constants.ZERO)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲钩鍙扮鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
             }
-            if(!applyChange.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY.getKey())){
+            if(!(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey())
+                            ||applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())
+                    )){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀敊璇棤娉曡繘琛岃鎿嶄綔!");
             }
         }else if(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.UPLOAD.getKey())){
@@ -557,7 +601,9 @@
             if(loginUserInfo.getType().equals(Constants.ZERO)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲钩鍙扮鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
             }
-            if(!applyChange.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY.getKey())){
+            if(!(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey())
+                            ||applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())
+                    )){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀敊璇棤娉曡繘琛岃鎿嶄綔!");
             }
         }else if(applyChangeOptDTO.getOptType().equals(Constants.ApplyChangeStatus.CLOSE.getKey())){
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 dc2857e..760d0d0 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
@@ -180,23 +180,32 @@
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         Constants.ApplyLogType applyLogType = null;
         String info = "";
+        InsuranceApply update = new InsuranceApply();
         if(insuranceApply.getDealBackApply() ==1){
-            //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炵敵璇风姸鎬佽繘琛屾搷浣�
-            if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_APPLY_RETURN_SELECT.getKey())){
+            //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炲凡绛剧珷鐘舵�佷笅鐨勯��鍥炵敵璇风姸鎬佽繘琛屾搷浣�
+            if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
             }
             applyLogType = Constants.ApplyLogType.PLATFORM_UN_AGREE_BACK;
             info = applyLogType.getInfo();
             info = info.replace("${param}", insuranceApply.getCheckInfo());
+            update.setStatus(Constants.InsuranceApplyStatus.SIGNATURE.getKey());
         }else{
             //濡傛灉鏄悓鎰�,涓ょ鐢宠閫�鍥炵姸鎬侀兘鍙搷浣�
-            if(!(Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_APPLY_RETURN_SELECT.getKey())
-                ||Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_APPLY_RETURN.getKey()))){
+            if(!(Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())
+                    ||Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE.getKey())
+                    ||Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD.getKey()))){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
             }
             applyLogType = Constants.ApplyLogType.PLATFORM_AGREE_BACK;
+            if( Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())){
+                update.setStatus(Constants.InsuranceApplyStatus.SIGNATURE.getKey());
+            }else if( Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE.getKey())){
+                update.setStatus(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey());
+            }else if(  Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD.getKey())){
+                update.setStatus(Constants.InsuranceApplyStatus.UPLOAD.getKey());
+            }
         }
-        InsuranceApply update = new InsuranceApply();
         update.setEditDate(new Date());
         update.setEditor(user.getId());
         //鍚屾剰閫�鍥烇紝鐩存帴鍥炲埌鏈�鍒濈姸鎬侊紝濡傛灉椹冲洖閫�鍥炵敵璇凤紝鍒欎繚鍗曠姸鎬佸洖鍒板緟涓婁紶淇濋櫓鍗�
@@ -670,15 +679,20 @@
         if(insuranceApply.getIsdeleted().equals(Constants.ONE)){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鏁版嵁宸插垹闄�,鏃犳硶杩涜璇ユ搷浣�");
         }
-        Constants.InsuranceApplyStatus insuranceApplyStatus =  Constants.InsuranceApplyStatus.COMPANY_APPLY_RETURN;
+        //-----TODU-------RJ-------瀹屽杽閫�鍥炵姸鎬佸垎寮�鏍囪------------------
+        Constants.InsuranceApplyStatus insuranceApplyStatus =  Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE;
         if(insuranceApplyOptDTO.getOptType().equals(Constants.ONE)){
-            if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.COMPANY_APPLY_RETURN.getKey())){
-                throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"閫�鍥炵敵璇蜂腑锛岃鍕块噸澶嶆搷浣�");
-            }
             if(!(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD.getKey())
                     ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())
                     ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.SIGNATURE.getKey()))){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀潪鍙敵璇烽��鍥�!");
+            }
+            if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD.getKey())){
+                insuranceApplyStatus =  Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD;
+            }else   if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())){
+                insuranceApplyStatus =  Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE;
+            }else  if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.SIGNATURE.getKey())){
+                insuranceApplyStatus =  Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE;
             }
         }else if(insuranceApplyOptDTO.getOptType().equals(Constants.TWO)){
             insuranceApplyStatus =  Constants.InsuranceApplyStatus.CLOSE;
@@ -697,7 +711,12 @@
         insuranceApply.setCheckUserId(loginUserInfo.getId());
         insuranceApplyMapper.updateById(insuranceApply);
         //瀛樺偍鏃ュ織鏁版嵁
-        this.saveApplyLog(insuranceApply,insuranceApplyStatus,null);
+        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.COMPANY_APPLY_RETURN;
+        String info =applyLogType.getInfo();
+        info = info.replace("${param}", insuranceApplyOptDTO.getOptIllustration());
+        ApplyLog log = new ApplyLog(insuranceApply,applyLogType.getName(),info,insuranceApply.getId(),applyLogType.getKey(),JSONObject.toJSONString(insuranceApply), JSONObject.toJSONString(insuranceApply));
+        applyLogMapper.insert(log);
+//        this.saveApplyLog(insuranceApply,insuranceApplyStatus,null);
     }
 
 

--
Gitblit v1.9.3