From 06b919319e949de66879a8505e9e4640ad3db18f Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期一, 01 四月 2024 10:21:39 +0800
Subject: [PATCH] 提交一把

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |   50 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 insertions(+), 4 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 0902a7f..6e65926 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
@@ -153,6 +153,39 @@
         return  1;
 
     }
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public Integer closeWtbForShop(InsuranceApply insuranceApply) {
+        if(insuranceApply.getId() == null ||StringUtils.isBlank(insuranceApply.getCheckInfo())){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        InsuranceApply model = insuranceApplyMapper.selectById(insuranceApply.getId());
+
+        if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        //鍙湁瀹℃牳閫氳繃鐨勭姸鎬佸彲鍏抽棴
+        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_BUSINESS_CHECK_PASS.getKey())){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        InsuranceApply update = new InsuranceApply();
+        update.setEditDate(new Date());
+        update.setEditor(user.getId());
+        update.setStatus(Constants.InsuranceApplyStatus.WTB_CLOSED.getKey());
+        update.setCheckDate(update.getEditDate());
+        update.setCheckInfo(insuranceApply.getCheckInfo());
+        update.setCheckUserId(user.getId());
+        update.setId(model.getId());
+        insuranceApplyMapper.updateById(update);
+
+        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.SHOP_CLOSE_WTB_APPLY;
+        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;
+    }
 
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
@@ -1261,15 +1294,19 @@
         if(Objects.isNull(solutions)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
         }
-        if(solutions.getType().equals(Constants.ZERO)){
+        if(Constants.equalsObject(solutions.getType(),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)){
+            if(!Constants.equalsObject(user.getType(),Constants.TWO)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风鏃犳硶杩涜璇ユ搷浣�");
             }
-            if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_RETURN.getKey())){
+            //濮旀墭淇濆緟绛剧讲銆佸緟瀹℃牳鍙繘琛岄��鍥炴搷浣�
+            if(!(Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey())
+                    ||Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_COMPANY_APPLY_SIGNATURE.getKey())
+                    ||Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_COMPANY_MEMBER_LIST_SIGNATURE.getKey())
+                    )){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
             }
         }
@@ -1286,9 +1323,14 @@
             //濡傛灉鏄笉閫氳繃
             applyLogType = Constants.ApplyLogType.PLATFORM_RETURN ;
             update.setStatus(Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey());
+            if(Constants.equalsObject(solutions.getType(),Constants.ONE)){
+                update.setStatus(Constants.InsuranceApplyStatus.WTB_RETURN.getKey());
+            }
         }else{
             applyLogType = Constants.ApplyLogType.PLATFORM_CHECK_PASS;
-            update.setStatus(Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey());
+            if(Constants.equalsObject(solutions.getType(),Constants.ONE)){
+                update.setStatus(Constants.InsuranceApplyStatus.WTB_BUSINESS_CHECK_PASS.getKey());
+            }
         }
         insuranceApplyMapper.updateById(update);
 

--
Gitblit v1.9.3