Przeglądaj źródła

Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

wangqiong123 2 lat temu
rodzic
commit
a851d66423

+ 9
- 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java Wyświetl plik

@@ -21,6 +21,7 @@ import com.ruoyi.framework.manager.AsyncManager;
21 21
 import com.ruoyi.framework.manager.factory.AsyncFactory;
22 22
 import com.ruoyi.framework.security.context.AuthenticationContextHolder;
23 23
 import com.ruoyi.system.mapper.SysRoleMapper;
24
+import com.ruoyi.system.mapper.SysUserMapper;
24 25
 import com.ruoyi.system.service.ISysConfigService;
25 26
 import com.ruoyi.system.service.ISysUserService;
26 27
 import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +57,8 @@ public class SysLoginService
56 57
     private ISysConfigService configService;
57 58
     @Autowired
58 59
     private SysRoleMapper roleMapper;
60
+    @Autowired
61
+    private SysUserMapper userMapper;
59 62
 
60 63
     /**
61 64
      * 登录验证
@@ -231,7 +234,12 @@ public class SysLoginService
231 234
         AjaxResult ajax = AjaxResult.success();
232 235
         String username = loginBody.getUsername();
233 236
         // 根据用户名获取用户信息,如果用户不存在则新增用户
234
-        SysUser user = userService.selectUserByUserName(username);
237
+        SysUser user =null;
238
+        if(username.contains("@")) {
239
+            user=  userMapper.selectUserByEmail(username);
240
+        }else {
241
+            user=  userService.selectUserByUserName(username);
242
+        }
235 243
         if(user==null){
236 244
             // 新增用户
237 245
             user = new SysUser();

+ 3
- 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java Wyświetl plik

@@ -63,7 +63,9 @@ public class SysPermissionService
63 63
         // 管理员拥有所有权限
64 64
         if (user.isAdmin())
65 65
         {
66
-            perms.add("*:*:*");
66
+            // 查询所有数据权限,排除案件管理下的权限即可
67
+            perms.addAll(menuService.selectAdminMenu());
68
+          //  perms.add("*:*:*");
67 69
         }
68 70
         else
69 71
         {

+ 10
- 2
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java Wyświetl plik

@@ -1,11 +1,12 @@
1 1
 package com.ruoyi.system.service;
2 2
 
3
-import java.util.List;
4
-import java.util.Set;
5 3
 import com.ruoyi.common.core.domain.TreeSelect;
6 4
 import com.ruoyi.common.core.domain.entity.SysMenu;
7 5
 import com.ruoyi.system.domain.vo.RouterVo;
8 6
 
7
+import java.util.List;
8
+import java.util.Set;
9
+
9 10
 /**
10 11
  * 菜单 业务层
11 12
  * 
@@ -141,4 +142,11 @@ public interface ISysMenuService
141 142
      * @return 结果
142 143
      */
143 144
     public boolean checkMenuNameUnique(SysMenu menu);
145
+
146
+    /**
147
+     * 查询管理员权限
148
+     * @return
149
+     */
150
+
151
+    Set<String> selectAdminMenu();
144 152
 }

+ 30
- 10
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java Wyświetl plik

@@ -1,15 +1,6 @@
1 1
 package com.ruoyi.system.service.impl;
2 2
 
3
-import java.util.ArrayList;
4
-import java.util.Arrays;
5
-import java.util.HashSet;
6
-import java.util.Iterator;
7
-import java.util.LinkedList;
8
-import java.util.List;
9
-import java.util.Set;
10
-import java.util.stream.Collectors;
11
-import org.springframework.beans.factory.annotation.Autowired;
12
-import org.springframework.stereotype.Service;
3
+import cn.hutool.core.collection.CollectionUtil;
13 4
 import com.ruoyi.common.constant.Constants;
14 5
 import com.ruoyi.common.constant.UserConstants;
15 6
 import com.ruoyi.common.core.domain.TreeSelect;
@@ -24,6 +15,11 @@ import com.ruoyi.system.mapper.SysMenuMapper;
24 15
 import com.ruoyi.system.mapper.SysRoleMapper;
25 16
 import com.ruoyi.system.mapper.SysRoleMenuMapper;
26 17
 import com.ruoyi.system.service.ISysMenuService;
18
+import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.stereotype.Service;
20
+
21
+import java.util.*;
22
+import java.util.stream.Collectors;
27 23
 
28 24
 /**
29 25
  * 菜单 业务层处理
@@ -120,6 +116,28 @@ public class SysMenuServiceImpl implements ISysMenuService
120 116
         }
121 117
         return permsSet;
122 118
     }
119
+    /**
120
+     * 查询管理员权限
121
+     * @return
122
+     */
123
+    @Override
124
+    public Set<String> selectAdminMenu() {
125
+        Set<String> permsSet = new HashSet<>();
126
+        List<SysMenu> sysMenus = menuMapper.selectMenuList(new SysMenu());
127
+        Long caseMenuId =null;
128
+        if(CollectionUtil.isNotEmpty(sysMenus)){
129
+            Optional<SysMenu> optional = sysMenus.stream().filter(sysMenu -> sysMenu.getMenuName().equals("案件列表")).findFirst();
130
+            if(optional.isPresent()){
131
+                caseMenuId= optional.get().getMenuId();
132
+            }
133
+            for (SysMenu sysMenu : sysMenus) {
134
+                if(!sysMenu.getParentId().equals(caseMenuId)&&StringUtils.isNotEmpty(sysMenu.getPerms())){
135
+                    permsSet.addAll(Arrays.asList(sysMenu.getPerms().trim().split(",")));
136
+                }
137
+            }
138
+        }
139
+        return permsSet;
140
+    }
123 141
 
124 142
     /**
125 143
      * 根据用户ID查询菜单
@@ -346,6 +364,8 @@ public class SysMenuServiceImpl implements ISysMenuService
346 364
         return UserConstants.UNIQUE;
347 365
     }
348 366
 
367
+
368
+
349 369
     /**
350 370
      * 获取路由名称
351 371
      * 

+ 3
- 3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java Wyświetl plik

@@ -483,11 +483,11 @@ public class SysUserServiceImpl implements ISysUserService {
483 483
             checkUserDataScope(userId);
484 484
         }
485 485
         // 删除用户与角色关联
486
-        userRoleMapper.deleteUserRole(userIds);
486
+      //  userRoleMapper.deleteUserRole(userIds);
487 487
         // 删除用户与岗位关联
488
-        userPostMapper.deleteUserPost(userIds);
488
+     //   userPostMapper.deleteUserPost(userIds);
489 489
         // 删除用户部门关联
490
-        userDeptMapper.deleteUserByIds(userIds);
490
+      //  userDeptMapper.deleteUserByIds(userIds);
491 491
         int i = userMapper.deleteUserByIds(userIds);
492 492
             for (Long userId : userIds) {
493 493
                 // 删除缓存

+ 2
- 10
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java Wyświetl plik

@@ -120,18 +120,11 @@ public class WeChatUserServiceImpl implements WeChatUserService {
120 120
         if(checkPhoneUnique!=null){
121 121
             return AjaxResult.warn("手机号已存在");
122 122
         }
123
-        SysUser checkEmailUnique = sysUserMapper.checkEmailUnique(ientityAuthentication.getEmail());
124
-        if(checkEmailUnique!=null){
125
-            return AjaxResult.warn("邮箱已存在");
126
-        }
127 123
 
128
-        // 根据身份证查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增
129
-        SysUser sysUser=sysUserMapper.selectUserByIdCard(ientityAuthentication.getIdentityNo());
124
+        // 根据邮箱查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增
125
+        SysUser sysUser=sysUserMapper.selectUserByEmail(ientityAuthentication.getEmail());
130 126
         // 查询角色
131 127
         Long roleIdByName =ientityAuthentication.getRoleId();
132
-//        if(roleIdByName==null){
133
-//            return AjaxResult.warn("被申请人角色不存在,请联系系统管理员新增角色");
134
-//        }
135 128
         if(sysUser!=null){
136 129
             sysUser.setIdCard(ientityAuthentication.getIdentityNo());
137 130
             sysUser.setNickName(ientityAuthentication.getName());
@@ -145,7 +138,6 @@ public class WeChatUserServiceImpl implements WeChatUserService {
145 138
             ientityAuthentication.setUserId(sysUser.getUserId());
146 139
             int count=0;
147 140
            if(CollectionUtil.isNotEmpty(sysUser.getRoles()) && roleIdByName!=null){
148
-
149 141
                for (SysRole role : sysUser.getRoles()) {
150 142
                    if(Objects.equals(role.getRoleId(), roleIdByName)){
151 143
                        count++;

+ 374
- 374
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Wyświetl plik

@@ -1806,8 +1806,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1806 1806
             if(CollectionUtil.isEmpty(operatorList)){
1807 1807
                 return AjaxResult.error("未找到案件操作人员");
1808 1808
             }
1809
-            long applicantCount = operatorList.stream().filter(affiliate -> (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).count();
1810
-            long resCount = operatorList.stream().filter(affiliate -> (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).count();
1809
+            long applicantCount = operatorList.stream().filter(affiliate ->StrUtil.isNotEmpty(affiliate.getPhone())&& (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).count();
1810
+            long resCount = operatorList.stream().filter(affiliate ->StrUtil.isNotEmpty(affiliate.getPhone())&& (affiliate.getRoleType() != null) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).count();
1811 1811
             if(applicantCount==0 && resCount==0){
1812 1812
                 return AjaxResult.error("申请人操作人、被申请人操作人手机号不存在,请修改案件信息");
1813 1813
             }else if(applicantCount==0 ){
@@ -2534,6 +2534,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2534 2534
         }
2535 2535
         // 调解结果
2536 2536
         Integer mediaResult = req.getMediaResult();
2537
+        if (mediaResult == null) {
2538
+            return AjaxResult.error("请选择调解结果");
2539
+        }
2537 2540
         if (application.getMediationMethod().equals("1")) {
2538 2541
             // 线上调解
2539 2542
             List<MsCaseAttach> attachList = req.getAttachList();
@@ -2639,7 +2642,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2639 2642
                                                     double positionX = coordinateObj.getDoubleValue("positionX");
2640 2643
                                                     double positionY = coordinateObj.getDoubleValue("positionY");
2641 2644
                                                     sealSignRecord.setPositionXpsn(positionX + 120);
2642
-                                                    sealSignRecord.setPositionYpsn(positionY+40);
2645
+                                                    sealSignRecord.setPositionYpsn(positionY + 40);
2643 2646
                                                 }
2644 2647
                                             } else if (keyword.equals("被申请人(签字):")) {
2645 2648
                                                 //签名
@@ -2654,7 +2657,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2654 2657
                                                     double positionX = coordinateObj.getDoubleValue("positionX");
2655 2658
                                                     double positionY = coordinateObj.getDoubleValue("positionY");
2656 2659
                                                     sealSignRecord.setPositionXpsnRes(positionX + 120);
2657
-                                                    sealSignRecord.setPositionYpsnRes(positionY+10 );
2660
+                                                    sealSignRecord.setPositionYpsnRes(positionY + 10);
2658 2661
                                                 }
2659 2662
                                             } else if (keyword.equals("调解员(签字):")) {
2660 2663
                                                 //签名
@@ -2669,7 +2672,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2669 2672
                                                     double positionX = coordinateObj.getDoubleValue("positionX");
2670 2673
                                                     double positionY = coordinateObj.getDoubleValue("positionY");
2671 2674
                                                     sealSignRecord.setPositionXpsnMedi(positionX + 120);
2672
-                                                    sealSignRecord.setPositionYpsnMedi(positionY+10 );
2675
+                                                    sealSignRecord.setPositionYpsnMedi(positionY + 10);
2673 2676
                                                 }
2674 2677
                                             } else {
2675 2678
                                                 // 设置用印位置
@@ -2854,6 +2857,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2854 2857
                                     }
2855 2858
 
2856 2859
                                     application.setMediaResult(mediaResult);
2860
+                                    application.setSealFlag(req.getSealFlag());
2857 2861
                                     msCaseApplicationMapper.updateByPrimaryKeySelective(application);
2858 2862
                                 } else {
2859 2863
                                     return AjaxResult.error();
@@ -2867,411 +2871,407 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2867 2871
 
2868 2872
                     }
2869 2873
                 }
2870
-            }
2871
-
2872
-            return AjaxResult.success();
2873
-        } else if (mediaResult.intValue() == 2) {
2874
-            //未达成调解
2875
-            //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信
2876
-            // 申请人短信
2877
-            SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
2878
-            request.setTemplateId("2066725");
2879
-            request.setPhone(applicantAffiliateOpt.get().getPhone());
2880
-            request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()});
2881
-            // todo 短信
2874
+                return AjaxResult.success();
2875
+
2876
+            } else if (mediaResult == 2) {
2877
+                //未达成调解
2878
+                //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信
2879
+                // 申请人短信
2880
+                SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
2881
+                request.setTemplateId("2066725");
2882
+                request.setPhone(applicantAffiliateOpt.get().getPhone());
2883
+                request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()});
2884
+                // todo 短信
2882 2885
 //                cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(request);
2883
-            cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject();
2884
-            // 新增短信记录
2885
-            SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null);
2886
-            if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
2887
-                appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
2888
-            } else {
2889
-                appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
2890
-            }
2891
-            smsRecordMapper.saveSmsSendRecord(appSmsSendRecord);
2892
-            // 被申请人短信
2893
-            SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
2894
-            request1.setTemplateId("2066725");
2895
-            request1.setPhone(resAffiliateOpt.get().getPhone());
2896
-            request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()});
2886
+                cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject();
2887
+                // 新增短信记录
2888
+                SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null);
2889
+                if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
2890
+                    appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
2891
+                } else {
2892
+                    appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
2893
+                }
2894
+                smsRecordMapper.saveSmsSendRecord(appSmsSendRecord);
2895
+                // 被申请人短信
2896
+                SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
2897
+                request1.setTemplateId("2066725");
2898
+                request1.setPhone(resAffiliateOpt.get().getPhone());
2899
+                request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()});
2897 2900
 //                todo 短信注释
2898 2901
 //                cn.hutool.json.JSONObject resJsonObject = SmsUtils.sendSms(request1);
2899
-            cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject();
2900
-            // 新增短信记录
2901
-            SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null);
2902
-            if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
2903
-                resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
2904
-            } else {
2905
-                resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
2906
-            }
2907
-            smsRecordMapper.saveSmsSendRecord(resSmsSendRecord);
2908
-            // 修改案件状态为结束
2909
-            Example flowExample = new Example(MsCaseFlow.class);
2910
-            flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
2911
-            MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
2912
-            if (caseFlow != null) {
2913
-                // 新增日志
2914
-                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2915
-                // todo 新增结束日志
2916
-                CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
2917
-                application.setCaseFlowId(caseFlow.getId());
2918
-                application.setCaseStatusName(caseFlow.getCaseStatusName());
2919
-                application.setMediaResult(mediaResult);
2920
-                msCaseApplicationMapper.updateByPrimaryKey(application);
2921
-            }
2922
-            return AjaxResult.success();
2923
-        } else if (mediaResult.intValue() == 3) {
2924
-            //未达成调解但不再争议
2925
-            // 修改案件状态为结束
2926
-            Example flowExample = new Example(MsCaseFlow.class);
2927
-            flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
2928
-            MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
2929
-            if (caseFlow != null) {
2930
-                application.setCaseFlowId(caseFlow.getId());
2931
-                application.setCaseStatusName(caseFlow.getCaseStatusName());
2932
-                application.setMediaResult(mediaResult);
2933
-                msCaseApplicationMapper.updateByPrimaryKey(application);
2934
-                // 新增日志
2935
-                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2936
-                // todo 新增结束日志
2937
-                CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
2938
-            }
2939
-            return AjaxResult.success();
2940
-        } else if (mediaResult.intValue() == 4) {
2941
-            //未达成调解但同意引入仲裁
2942
-            String accessSec = "mCFMA6ffe938v79m";
2943
-            MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
2944
-            BeanUtils.copyProperties(application, applicationVO);
2945
-
2946
-            CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
2947
-            BeanUtils.copyProperties(applicationVO, caseApplicationVO);
2948
-            boolean importFlag = applicationVO.isImportFlag();
2949
-            if (importFlag == true) {
2950
-                caseApplicationVO.setImportFlag(1);
2951
-            } else {
2952
-                caseApplicationVO.setImportFlag(0);
2953
-            }
2954
-            String paramsbody = JSONUtil.toJsonStr(caseApplicationVO);
2955
-            long timestamp = System.currentTimeMillis();
2956
-            String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp);
2957
-            String urlstr = arbitrateUrl;
2958
-            HttpResponse httpResponse = HttpRequest.post(urlstr)
2959
-                    .header("timestampstr", String.valueOf(timestamp))
2960
-                    .header("signstr", signStr)
2961
-                    .body(paramsbody)
2962
-                    .execute();
2963
-            // 修改案件状态为结束
2964
-            Example flowExample = new Example(MsCaseFlow.class);
2965
-            flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
2966
-            MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
2967
-            if (caseFlow != null) {
2968
-                // 新增日志
2969
-                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2970
-                // todo 新增结束日志
2971
-                CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
2972
-                application.setCaseFlowId(caseFlow.getId());
2973
-                application.setCaseStatusName(caseFlow.getCaseStatusName());
2974
-                application.setMediaResult(mediaResult);
2975
-                msCaseApplicationMapper.updateByPrimaryKey(application);
2976
-            }
2902
+                cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject();
2903
+                // 新增短信记录
2904
+                SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null);
2905
+                if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
2906
+                    resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
2907
+                } else {
2908
+                    resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
2909
+                }
2910
+                smsRecordMapper.saveSmsSendRecord(resSmsSendRecord);
2911
+                // 修改案件状态为结束
2912
+                Example flowExample = new Example(MsCaseFlow.class);
2913
+                flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
2914
+                MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
2915
+                if (caseFlow != null) {
2916
+                    // 新增日志
2917
+                    CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2918
+                    // todo 新增结束日志
2919
+                    CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
2920
+                    application.setCaseFlowId(caseFlow.getId());
2921
+                    application.setCaseStatusName(caseFlow.getCaseStatusName());
2922
+                    application.setMediaResult(mediaResult);
2923
+                    msCaseApplicationMapper.updateByPrimaryKey(application);
2924
+                }
2925
+                return AjaxResult.success();
2926
+            } else if (mediaResult == 3) {
2927
+                //未达成调解但不再争议
2928
+                // 修改案件状态为结束
2929
+                Example flowExample = new Example(MsCaseFlow.class);
2930
+                flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
2931
+                MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
2932
+                if (caseFlow != null) {
2933
+                    application.setCaseFlowId(caseFlow.getId());
2934
+                    application.setCaseStatusName(caseFlow.getCaseStatusName());
2935
+                    application.setMediaResult(mediaResult);
2936
+                    msCaseApplicationMapper.updateByPrimaryKey(application);
2937
+                    // 新增日志
2938
+                    CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2939
+                    // todo 新增结束日志
2940
+                    CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
2941
+                }
2942
+                return AjaxResult.success();
2943
+            } else if (mediaResult == 4) {
2944
+                //未达成调解但同意引入仲裁
2945
+                String accessSec = "mCFMA6ffe938v79m";
2946
+                MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
2947
+                BeanUtils.copyProperties(application, applicationVO);
2948
+
2949
+                CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
2950
+                BeanUtils.copyProperties(applicationVO, caseApplicationVO);
2951
+                boolean importFlag = applicationVO.isImportFlag();
2952
+                if (importFlag) {
2953
+                    caseApplicationVO.setImportFlag(1);
2954
+                } else {
2955
+                    caseApplicationVO.setImportFlag(0);
2956
+                }
2957
+                String paramsbody = JSONUtil.toJsonStr(caseApplicationVO);
2958
+                long timestamp = System.currentTimeMillis();
2959
+                String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp);
2960
+                String urlstr = arbitrateUrl;
2961
+                HttpResponse httpResponse = HttpRequest.post(urlstr)
2962
+                        .header("timestampstr", String.valueOf(timestamp))
2963
+                        .header("signstr", signStr)
2964
+                        .body(paramsbody)
2965
+                        .execute();
2966
+                // 修改案件状态为结束
2967
+                Example flowExample = new Example(MsCaseFlow.class);
2968
+                flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
2969
+                MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
2970
+                if (caseFlow != null) {
2971
+                    // 新增日志
2972
+                    CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2973
+                    // todo 新增结束日志
2974
+                    CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
2975
+                    application.setCaseFlowId(caseFlow.getId());
2976
+                    application.setCaseStatusName(caseFlow.getCaseStatusName());
2977
+                    application.setMediaResult(mediaResult);
2978
+                    msCaseApplicationMapper.updateByPrimaryKey(application);
2979
+                }
2977 2980
 
2978
-            return AjaxResult.success();
2979
-        } else if (mediaResult.intValue() == 5) {
2980
-            // 达成和解
2981
-            List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
2982
-            if (caseAttachList != null && caseAttachList.size() > 0) {
2983
-                for (MsCaseAttach caseAttach : caseAttachList) {
2984
-                    if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
2985
-                        // String prefix = "/profile";
2986
-                        //  int startIndex = prefix.length();
2987
-                        String annexPath = caseAttach.getAnnexPath();
2981
+                return AjaxResult.success();
2982
+            } else if (mediaResult == 5) {
2983
+                // 达成和解
2984
+                List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
2985
+                if (caseAttachList != null && caseAttachList.size() > 0) {
2986
+                    for (MsCaseAttach caseAttach : caseAttachList) {
2987
+                        if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
2988
+                            // String prefix = "/profile";
2989
+                            //  int startIndex = prefix.length();
2990
+                            String annexPath = caseAttach.getAnnexPath();
2988 2991
 //                                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
2989
-                        if (annexPath.contains("/profile/upload")) {
2990
-                            annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload");
2991
-                        }
2992
-                        String path = annexPath;
2993
-                        //获取文件上传地址
2994
-                        EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
2995
-                        String body = response.getBody();
2996
-                        if (body != null) {
2997
-                            JSONObject jsonObject = JSONObject.parseObject(body);
2998
-                            String fileId = jsonObject.getJSONObject("data").getString("fileId");
2999
-                            String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
3000
-                            //上传文件流
3001
-                            EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
3002
-                            JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
3003
-                            if (jsonObject1.getIntValue("errCode") == 0) {
3004
-                                //查看文件上传状态
3005
-                                Thread.sleep(1000);
3006
-                                EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
3007
-                                JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
3008
-                                JSONObject data = jsonObject2.getJSONObject("data");
3009
-                                int fileStatus = data.getIntValue("fileStatus");
3010
-                                if (fileStatus == 2 || fileStatus == 5) {
3011
-                                    String fileName = data.getString("fileName");
3012
-                                    //上传成功,获取文件签名印章位置
3013
-                                    SealSignRecord sealSignRecord = new SealSignRecord();
3014
-                                    sealSignRecord.setFileid(fileId);
3015
-                                    EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord);
3016
-                                    Gson gson = new Gson();
3017
-                                    JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
3018
-                                    JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
3019
-                                    String keywordPositions = positionsData.get("keywordPositions").toString();
3020
-                                    //发起签署
3021
-                                    sealSignRecord.setFilename(fileName);
3022
-
3023
-                                    Long arbitratorId = application.getMediatorId();
3024
-                                    if (arbitratorId != null) {
3025
-                                        SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
3026
-                                        if (sysUser == null) {
3027
-                                            return AjaxResult.error();
3028
-                                        }
3029
-                                        sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
3030
-                                        sealSignRecord.setPensonNameMedi(sysUser.getNickName());
3031
-                                    }
3032
-                                    // todo 申请人账户
3033
-                                    sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone());
3034
-                                    sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName());
3035
-                                    // 被申账户
3036
-                                    sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone());
3037
-                                    sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName());
3038
-                                    //解析文件签名印章位置
3039
-                                    JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
3040
-                                    for (int i = 0; i < jsonArray.size(); i++) {
3041
-                                        JSONObject jsonObject3 = jsonArray.getJSONObject(i);
3042
-                                        String keyword = jsonObject3.getString("keyword");
3043
-                                        if (keyword.equals("申请人(签字):")) {
3044
-                                            //签名
3045
-                                            JSONArray positionsArray = jsonObject3.getJSONArray("positions");
3046
-                                            // 遍历 positionsArray 中的每个元素
3047
-                                            for (int j = 0; j < positionsArray.size(); j++) {
3048
-                                                JSONObject positionObj = positionsArray.getJSONObject(j);
3049
-                                                int pageNum = positionObj.getIntValue("pageNum");
3050
-                                                sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
3051
-                                                JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
3052
-                                                JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
3053
-                                                double positionX = coordinateObj.getDoubleValue("positionX");
3054
-                                                double positionY = coordinateObj.getDoubleValue("positionY");
3055
-                                                sealSignRecord.setPositionXpsn(positionX + 120);
3056
-                                                sealSignRecord.setPositionYpsn(positionY);
2992
+                            if (annexPath.contains("/profile/upload")) {
2993
+                                annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload");
2994
+                            }
2995
+                            String path = annexPath;
2996
+                            //获取文件上传地址
2997
+                            EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
2998
+                            String body = response.getBody();
2999
+                            if (body != null) {
3000
+                                JSONObject jsonObject = JSONObject.parseObject(body);
3001
+                                String fileId = jsonObject.getJSONObject("data").getString("fileId");
3002
+                                String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
3003
+                                //上传文件流
3004
+                                EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
3005
+                                JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
3006
+                                if (jsonObject1.getIntValue("errCode") == 0) {
3007
+                                    //查看文件上传状态
3008
+                                    Thread.sleep(1000);
3009
+                                    EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
3010
+                                    JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
3011
+                                    JSONObject data = jsonObject2.getJSONObject("data");
3012
+                                    int fileStatus = data.getIntValue("fileStatus");
3013
+                                    if (fileStatus == 2 || fileStatus == 5) {
3014
+                                        String fileName = data.getString("fileName");
3015
+                                        //上传成功,获取文件签名印章位置
3016
+                                        SealSignRecord sealSignRecord = new SealSignRecord();
3017
+                                        sealSignRecord.setFileid(fileId);
3018
+                                        EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord);
3019
+                                        Gson gson = new Gson();
3020
+                                        JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
3021
+                                        JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
3022
+                                        String keywordPositions = positionsData.get("keywordPositions").toString();
3023
+                                        //发起签署
3024
+                                        sealSignRecord.setFilename(fileName);
3025
+
3026
+                                        Long arbitratorId = application.getMediatorId();
3027
+                                        if (arbitratorId != null) {
3028
+                                            SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
3029
+                                            if (sysUser == null) {
3030
+                                                return AjaxResult.error();
3057 3031
                                             }
3058
-                                        } else if (keyword.equals("被申请人(签字):")) {
3059
-                                            //签名
3060
-                                            JSONArray positionsArray = jsonObject3.getJSONArray("positions");
3061
-                                            // 遍历 positionsArray 中的每个元素
3062
-                                            for (int j = 0; j < positionsArray.size(); j++) {
3063
-                                                JSONObject positionObj = positionsArray.getJSONObject(j);
3064
-                                                int pageNum = positionObj.getIntValue("pageNum");
3065
-                                                sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum));
3066
-                                                JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
3067
-                                                JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
3068
-                                                double positionX = coordinateObj.getDoubleValue("positionX");
3069
-                                                double positionY = coordinateObj.getDoubleValue("positionY");
3070
-                                                sealSignRecord.setPositionXpsnRes(positionX + 120);
3071
-                                                sealSignRecord.setPositionYpsnRes(positionY + 10);
3032
+                                            sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
3033
+                                            sealSignRecord.setPensonNameMedi(sysUser.getNickName());
3034
+                                        }
3035
+                                        // todo 申请人账户
3036
+                                        sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone());
3037
+                                        sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName());
3038
+                                        // 被申账户
3039
+                                        sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone());
3040
+                                        sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName());
3041
+                                        //解析文件签名印章位置
3042
+                                        JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
3043
+                                        for (int i = 0; i < jsonArray.size(); i++) {
3044
+                                            JSONObject jsonObject3 = jsonArray.getJSONObject(i);
3045
+                                            String keyword = jsonObject3.getString("keyword");
3046
+                                            if (keyword.equals("申请人(签字):")) {
3047
+                                                //签名
3048
+                                                JSONArray positionsArray = jsonObject3.getJSONArray("positions");
3049
+                                                // 遍历 positionsArray 中的每个元素
3050
+                                                for (int j = 0; j < positionsArray.size(); j++) {
3051
+                                                    JSONObject positionObj = positionsArray.getJSONObject(j);
3052
+                                                    int pageNum = positionObj.getIntValue("pageNum");
3053
+                                                    sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
3054
+                                                    JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
3055
+                                                    JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
3056
+                                                    double positionX = coordinateObj.getDoubleValue("positionX");
3057
+                                                    double positionY = coordinateObj.getDoubleValue("positionY");
3058
+                                                    sealSignRecord.setPositionXpsn(positionX + 120);
3059
+                                                    sealSignRecord.setPositionYpsn(positionY);
3060
+                                                }
3061
+                                            } else if (keyword.equals("被申请人(签字):")) {
3062
+                                                //签名
3063
+                                                JSONArray positionsArray = jsonObject3.getJSONArray("positions");
3064
+                                                // 遍历 positionsArray 中的每个元素
3065
+                                                for (int j = 0; j < positionsArray.size(); j++) {
3066
+                                                    JSONObject positionObj = positionsArray.getJSONObject(j);
3067
+                                                    int pageNum = positionObj.getIntValue("pageNum");
3068
+                                                    sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum));
3069
+                                                    JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
3070
+                                                    JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
3071
+                                                    double positionX = coordinateObj.getDoubleValue("positionX");
3072
+                                                    double positionY = coordinateObj.getDoubleValue("positionY");
3073
+                                                    sealSignRecord.setPositionXpsnRes(positionX + 120);
3074
+                                                    sealSignRecord.setPositionYpsnRes(positionY + 10);
3075
+                                                }
3072 3076
                                             }
3073 3077
                                         }
3074
-                                    }
3075 3078
 
3076
-                                    EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord);
3077
-
3078
-                                    JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
3079
-                                    if (jsonObject3 != null) {
3080
-                                        if (jsonObject3.getIntValue("code") == 0) {
3081
-                                            //获取签署流程ID
3082
-                                            JSONObject data1 = jsonObject3.getJSONObject("data");
3083
-                                            String signFlowId = data1.getString("signFlowId");
3084
-                                            //保存案件id,文件id,文件名称.流程id到签署用印记录表里
3085
-                                            sealSignRecord.setCaseAppliId(application.getId());
3086
-                                            sealSignRecord.setSignFlowid(signFlowId);
3087
-                                            sealSignRecord.setSignFlowStatus(1);//待签名
3088
-                                            MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
3089
-                                            BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
3090
-                                            msSealSignRecord.setFileId(sealSignRecord.getFileid());
3091
-                                            msSealSignRecord.setFileName(sealSignRecord.getFilename());
3092
-                                            msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
3093
-                                            sealSignRecordMapper.insert(msSealSignRecord);
3094
-                                            // 申请人签名记录
3095
-                                            SealSignRecord sealSignRecordapply = new SealSignRecord();
3096
-                                            sealSignRecordapply.setSignFlowid(signFlowId);
3097
-                                            sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone());
3098
-                                            EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
3099
-                                            JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
3100
-                                            JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
3101
-                                            String urlapply = signUrlData.get("shortUrl").getAsString();
3102
-                                            String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1);
3103
-
3104
-                                            //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
3105
-                                            // 申请人短信
3106
-                                            SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
3107
-                                            request.setTemplateId("2047719");
3108
-                                            request.setPhone(applicantAffiliateOpt.get().getPhone());
3109
-                                            request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew});
3110
-                                            // todo 短信
3079
+                                        EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord);
3080
+
3081
+                                        JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
3082
+                                        if (jsonObject3 != null) {
3083
+                                            if (jsonObject3.getIntValue("code") == 0) {
3084
+                                                //获取签署流程ID
3085
+                                                JSONObject data1 = jsonObject3.getJSONObject("data");
3086
+                                                String signFlowId = data1.getString("signFlowId");
3087
+                                                //保存案件id,文件id,文件名称.流程id到签署用印记录表里
3088
+                                                sealSignRecord.setCaseAppliId(application.getId());
3089
+                                                sealSignRecord.setSignFlowid(signFlowId);
3090
+                                                sealSignRecord.setSignFlowStatus(1);//待签名
3091
+                                                MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
3092
+                                                BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
3093
+                                                msSealSignRecord.setFileId(sealSignRecord.getFileid());
3094
+                                                msSealSignRecord.setFileName(sealSignRecord.getFilename());
3095
+                                                msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
3096
+                                                sealSignRecordMapper.insert(msSealSignRecord);
3097
+                                                // 申请人签名记录
3098
+                                                SealSignRecord sealSignRecordapply = new SealSignRecord();
3099
+                                                sealSignRecordapply.setSignFlowid(signFlowId);
3100
+                                                sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone());
3101
+                                                EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
3102
+                                                JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
3103
+                                                JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
3104
+                                                String urlapply = signUrlData.get("shortUrl").getAsString();
3105
+                                                String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1);
3106
+
3107
+                                                //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
3108
+                                                // 申请人短信
3109
+                                                SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
3110
+                                                request.setTemplateId("2047719");
3111
+                                                request.setPhone(applicantAffiliateOpt.get().getPhone());
3112
+                                                request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew});
3113
+                                                // todo 短信
3111 3114
 //                                                cn.hutool.json.JSONObject smsObj = SmsUtils.sendSms(request);
3112
-                                            cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject();
3113
-                                            SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null);
3114
-                                            // 新增短信记录
3115
-                                            if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
3116
-                                                smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
3117
-                                            } else {
3118
-                                                smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
3119
-                                            }
3120
-                                            smsRecordMapper.saveSmsSendRecord(smsSendRecord);
3121
-                                            // 被申签名记录
3122
-                                            SealSignRecord sealSignRecordRespon = new SealSignRecord();
3123
-                                            sealSignRecordRespon.setSignFlowid(signFlowId);
3124
-                                            sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone());
3125
-                                            EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
3126
-                                            JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
3127
-                                            JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
3128
-                                            String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
3129
-                                            String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1);
3130
-
3131
-                                            SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
3132
-                                            request1.setTemplateId("2047719");
3133
-                                            request1.setPhone(resAffiliateOpt.get().getPhone());
3134
-                                            request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew});
3135
-                                            // todo 短信
3115
+                                                cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject();
3116
+                                                SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null);
3117
+                                                // 新增短信记录
3118
+                                                if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
3119
+                                                    smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
3120
+                                                } else {
3121
+                                                    smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
3122
+                                                }
3123
+                                                smsRecordMapper.saveSmsSendRecord(smsSendRecord);
3124
+                                                // 被申签名记录
3125
+                                                SealSignRecord sealSignRecordRespon = new SealSignRecord();
3126
+                                                sealSignRecordRespon.setSignFlowid(signFlowId);
3127
+                                                sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone());
3128
+                                                EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
3129
+                                                JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
3130
+                                                JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
3131
+                                                String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
3132
+                                                String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1);
3133
+
3134
+                                                SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
3135
+                                                request1.setTemplateId("2047719");
3136
+                                                request1.setPhone(resAffiliateOpt.get().getPhone());
3137
+                                                request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew});
3138
+                                                // todo 短信
3136 3139
 //                                                cn.hutool.json.JSONObject resObj = SmsUtils.sendSms(request1);
3137
-                                            cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject();
3140
+                                                cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject();
3141
+
3142
+                                                SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null);
3143
+                                                // 新增短信记录
3144
+                                                if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
3145
+                                                    resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
3146
+                                                } else {
3147
+                                                    resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
3148
+                                                }
3149
+                                                smsRecordMapper.saveSmsSendRecord(resSendRecord);
3138 3150
 
3139
-                                            SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null);
3140
-                                            // 新增短信记录
3141
-                                            if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) {
3142
-                                                resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode());
3143 3151
                                             } else {
3144
-                                                resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode());
3152
+                                                throw new ServiceException(jsonObject3.getString("message"));
3145 3153
                                             }
3146
-                                            smsRecordMapper.saveSmsSendRecord(resSendRecord);
3147
-
3148 3154
                                         } else {
3149
-                                            throw new ServiceException(jsonObject3.getString("message"));
3155
+                                            return AjaxResult.error();
3156
+                                        }
3157
+
3158
+                                        // 修改案件状态为待签名
3159
+                                        Example flowExample = new Example(MsCaseFlow.class);
3160
+                                        flowExample.createCriteria().andEqualTo("caseStatusName", "待签名");
3161
+                                        MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
3162
+                                        if (caseFlow != null) {
3163
+                                            application.setCaseFlowId(caseFlow.getId());
3164
+                                            application.setCaseStatusName(caseFlow.getCaseStatusName());
3165
+                                            // 新增日志
3166
+                                            CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
3150 3167
                                         }
3168
+
3169
+                                        application.setMediaResult(mediaResult);
3170
+                                        msCaseApplicationMapper.updateByPrimaryKeySelective(application);
3171
+                                        return AjaxResult.success();
3151 3172
                                     } else {
3152 3173
                                         return AjaxResult.error();
3153 3174
                                     }
3154
-
3155
-                                    // 修改案件状态为待签名
3156
-                                    Example flowExample = new Example(MsCaseFlow.class);
3157
-                                    flowExample.createCriteria().andEqualTo("caseStatusName", "待签名");
3158
-                                    MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
3159
-                                    if (caseFlow != null) {
3160
-                                        application.setCaseFlowId(caseFlow.getId());
3161
-                                        application.setCaseStatusName(caseFlow.getCaseStatusName());
3162
-                                        // 新增日志
3163
-                                        CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
3164
-                                    }
3165
-
3166
-                                    application.setMediaResult(mediaResult);
3167
-                                    msCaseApplicationMapper.updateByPrimaryKeySelective(application);
3168
-                                    return AjaxResult.success();
3169 3175
                                 } else {
3170 3176
                                     return AjaxResult.error();
3171 3177
                                 }
3172
-                            } else {
3173
-                                return AjaxResult.error();
3174 3178
                             }
3179
+                            break;
3175 3180
                         }
3176
-                        break;
3177 3181
                     }
3178 3182
                 }
3179 3183
             }
3180
-        }
3181
-
3182
-    else
3183
-
3184
-    {
3185
-        // 线下调解
3186
-        List<MsCaseAttach> attachList = req.getAttachList();
3187
-        if (CollectionUtil.isEmpty(attachList)) {
3188
-            return AjaxResult.error("请上传调解资料");
3189
-        }
3190
-        // 先删除已经存在的调解书
3191
-        if (StrUtil.isEmpty(application.getCaseSource())) {
3192
-            List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
3193
-            if (CollectionUtil.isNotEmpty(existAttach)) {
3194
-                // todo 对接北明,同步案件状态,删除
3195
-                for (MsCaseAttach msCaseAttach : existAttach) {
3196
-                    if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
3197
-                        continue;
3184
+        } else {
3185
+            // 线下调解
3186
+            List<MsCaseAttach> attachList = req.getAttachList();
3187
+            if (CollectionUtil.isEmpty(attachList)) {
3188
+                return AjaxResult.error("请上传调解资料");
3189
+            }
3190
+            // 先删除已经存在的调解书
3191
+            if (StrUtil.isEmpty(application.getCaseSource())) {
3192
+                List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
3193
+                if (CollectionUtil.isNotEmpty(existAttach)) {
3194
+                    // todo 对接北明,同步案件状态,删除
3195
+                    for (MsCaseAttach msCaseAttach : existAttach) {
3196
+                        if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
3197
+                            continue;
3198
+                        }
3199
+                        beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
3198 3200
                     }
3199
-                    beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
3200 3201
                 }
3201 3202
             }
3202
-        }
3203
-        msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
3204
-        for (MsCaseAttach attach : attachList) {
3205
-            attach.setCaseAppliId(req.getId());
3206
-            msCaseAttachMapper.updateCaseAttach(attach);
3207
-        }
3208
-        // todo 对接北明,调用上传附件接口
3209
-        List<MsCaseAttach> msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
3210
-        if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) {
3211
-            for (MsCaseAttach msCaseAttach : msCaseAttaches) {
3212
-                String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath();
3213
-                File file = new File(templatePath.replace("/profile", "/uploadPath"));
3214
-                MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
3215
-                // 更新附件表
3216
-                if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
3217
-                    msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId());
3218
-                    msCaseAttachMapper.updateCaseAttach(msCaseAttach);
3203
+            msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
3204
+            for (MsCaseAttach attach : attachList) {
3205
+                attach.setCaseAppliId(req.getId());
3206
+                msCaseAttachMapper.updateCaseAttach(attach);
3207
+            }
3208
+            // todo 对接北明,调用上传附件接口
3209
+            List<MsCaseAttach> msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
3210
+            if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) {
3211
+                for (MsCaseAttach msCaseAttach : msCaseAttaches) {
3212
+                    String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath();
3213
+                    File file = new File(templatePath.replace("/profile", "/uploadPath"));
3214
+                    MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
3215
+                    // 更新附件表
3216
+                    if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
3217
+                        msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId());
3218
+                        msCaseAttachMapper.updateCaseAttach(msCaseAttach);
3219
+                    }
3219 3220
                 }
3220 3221
             }
3221
-        }
3222
-        // 修改案件状态为待送达
3223
-        Example flowExample = new Example(MsCaseFlow.class);
3224
-        if (mediaResult == 1 || mediaResult == 5) {
3225
-            // 达成调解,达成和解,案件状态改为待送达
3226
-            flowExample.createCriteria().andEqualTo("caseStatusName", "待送达");
3227
-        } else if (mediaResult == 2 || mediaResult == 3) {
3228
-            // 未达成调解,未达成调解但不在争议改为结束状态
3229
-            flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
3230
-        } else if (mediaResult == 4) {
3231
-            //  未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口
3232
-            flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
3233
-            String accessSec = "mCFMA6ffe938v79m";
3234
-            MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
3235
-            BeanUtils.copyProperties(application, applicationVO);
3236
-
3237
-            CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
3238
-            BeanUtils.copyProperties(applicationVO, caseApplicationVO);
3239
-            boolean importFlag = applicationVO.isImportFlag();
3240
-            if (importFlag == true) {
3241
-                caseApplicationVO.setImportFlag(1);
3242
-            } else {
3243
-                caseApplicationVO.setImportFlag(0);
3244
-            }
3245
-            String paramsbody = JSONUtil.toJsonStr(caseApplicationVO);
3246
-            long timestamp = System.currentTimeMillis();
3247
-            String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp);
3248
-            String urlstr = arbitrateUrl;
3249
-            HttpResponse httpResponse = HttpRequest.post(urlstr)
3250
-                    .header("timestampstr", String.valueOf(timestamp))
3251
-                    .header("signstr", signStr)
3252
-                    .body(paramsbody)
3253
-                    .execute();
3254
-        }
3255
-        MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
3256
-        if (caseFlow != null) {
3257
-            application.setCaseFlowId(caseFlow.getId());
3258
-            application.setCaseStatusName(caseFlow.getCaseStatusName());
3259
-            application.setMediaResult(mediaResult);
3260
-            msCaseApplicationMapper.updateByPrimaryKey(application);
3261
-            // 新增日志
3262
-            CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
3263
-            if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
3264
-                CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
3265
-                // todo 结束对接北明,为调解失败状态
3266
-                caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL);
3222
+            // 修改案件状态为待送达
3223
+            Example flowExample = new Example(MsCaseFlow.class);
3224
+            if (mediaResult == 1 || mediaResult == 5) {
3225
+                // 达成调解,达成和解,案件状态改为待送达
3226
+                flowExample.createCriteria().andEqualTo("caseStatusName", "待送达");
3227
+            } else if (mediaResult == 2 || mediaResult == 3) {
3228
+                // 未达成调解,未达成调解但不在争议改为结束状态
3229
+                flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
3230
+            } else if (mediaResult == 4) {
3231
+                //  未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口
3232
+                flowExample.createCriteria().andEqualTo("caseStatusName", "结束");
3233
+                String accessSec = "mCFMA6ffe938v79m";
3234
+                MsCaseApplicationVO applicationVO = new MsCaseApplicationVO();
3235
+                BeanUtils.copyProperties(application, applicationVO);
3236
+
3237
+                CaseApplicationVO caseApplicationVO = new CaseApplicationVO();
3238
+                BeanUtils.copyProperties(applicationVO, caseApplicationVO);
3239
+                boolean importFlag = applicationVO.isImportFlag();
3240
+                if (importFlag == true) {
3241
+                    caseApplicationVO.setImportFlag(1);
3242
+                } else {
3243
+                    caseApplicationVO.setImportFlag(0);
3244
+                }
3245
+                String paramsbody = JSONUtil.toJsonStr(caseApplicationVO);
3246
+                long timestamp = System.currentTimeMillis();
3247
+                String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp);
3248
+                String urlstr = arbitrateUrl;
3249
+                HttpResponse httpResponse = HttpRequest.post(urlstr)
3250
+                        .header("timestampstr", String.valueOf(timestamp))
3251
+                        .header("signstr", signStr)
3252
+                        .body(paramsbody)
3253
+                        .execute();
3267 3254
             }
3255
+            MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
3256
+            if (caseFlow != null) {
3257
+                application.setCaseFlowId(caseFlow.getId());
3258
+                application.setCaseStatusName(caseFlow.getCaseStatusName());
3259
+                application.setMediaResult(mediaResult);
3260
+                msCaseApplicationMapper.updateByPrimaryKey(application);
3261
+                // 新增日志
3262
+                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
3263
+                if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
3264
+                    CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
3265
+                    // todo 结束对接北明,为调解失败状态
3266
+                    caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL);
3267
+                }
3268
+            }
3269
+            return AjaxResult.success();
3268 3270
         }
3269
-        return AjaxResult.success();
3270
-    }
3271 3271
 
3272 3272
 
3273
-        return AjaxResult.success();
3274
-}
3273
+        return AjaxResult.error();
3274
+    }
3275 3275
 
3276 3276
     /**
3277 3277
      * 确定会议结果