ソースを参照

PC端人脸核身

18792927508 2 年 前
コミット
cc4d7139dc

+ 2
- 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/miniprogress/IdentityAuthenticationController.java ファイルの表示

23
     @Anonymous
23
     @Anonymous
24
     @PostMapping("/selectIdentityAuthenticaEIDtoken")
24
     @PostMapping("/selectIdentityAuthenticaEIDtoken")
25
     public AjaxResult selectIdentityAuthenticaEIDtoken() {
25
     public AjaxResult selectIdentityAuthenticaEIDtoken() {
26
-        JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthenticaEIDtoken(false);
26
+        JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthEIDToken(false);
27
         return success(tokenResult);
27
         return success(tokenResult);
28
     }
28
     }
29
     /**
29
     /**
32
     @Anonymous
32
     @Anonymous
33
     @PostMapping("/selectPCIdentityAuthenticaEIDtoken")
33
     @PostMapping("/selectPCIdentityAuthenticaEIDtoken")
34
     public AjaxResult selectPCIdentityAuthenticaEIDtoken() {
34
     public AjaxResult selectPCIdentityAuthenticaEIDtoken() {
35
-        JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthenticaEIDtoken(true);
35
+        JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthEIDToken(true);
36
         return success(tokenResult);
36
         return success(tokenResult);
37
     }
37
     }
38
     /**
38
     /**

+ 1
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java ファイルの表示

22
     SEAL_PICTURE(10, "印章图片"),
22
     SEAL_PICTURE(10, "印章图片"),
23
     FLOW_SVG(11, "流程节点SVG"),
23
     FLOW_SVG(11, "流程节点SVG"),
24
     MEETING_FILE(12, "被申请人证据"),
24
     MEETING_FILE(12, "被申请人证据"),
25
+    MEDIATE_BOOK_PDF(13, "PDF调解书或和解协议"),
25
 
26
 
26
 
27
 
27
     ;
28
     ;

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/IdentityAuthenticationService.java ファイルの表示

22
      * isPC 是否PC端
22
      * isPC 是否PC端
23
      * @return
23
      * @return
24
      */
24
      */
25
-    JSONObject selectIdentityAuthenticaEIDtoken(boolean isPC);
25
+    JSONObject selectIdentityAuthEIDToken(boolean isPC);
26
 
26
 
27
     /**
27
     /**
28
      * 小程序人脸核身后查询身份认证结果
28
      * 小程序人脸核身后查询身份认证结果

+ 10
- 7
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/IdentityAuthenticationServiceImpl.java ファイルの表示

2
 
2
 
3
 
3
 
4
 import cn.hutool.core.codec.Base64;
4
 import cn.hutool.core.codec.Base64;
5
+import cn.hutool.core.util.StrUtil;
5
 import cn.hutool.crypto.SmUtil;
6
 import cn.hutool.crypto.SmUtil;
6
 import cn.hutool.crypto.asymmetric.SM2;
7
 import cn.hutool.crypto.asymmetric.SM2;
7
 import cn.hutool.crypto.symmetric.SymmetricCrypto;
8
 import cn.hutool.crypto.symmetric.SymmetricCrypto;
90
      * @return
91
      * @return
91
      */
92
      */
92
     @Override
93
     @Override
93
-    public JSONObject selectIdentityAuthenticaEIDtoken(boolean isPC) {
94
+    public JSONObject selectIdentityAuthEIDToken(boolean isPC) {
94
         JSONObject objJSON = new JSONObject();
95
         JSONObject objJSON = new JSONObject();
95
         objJSON.put("EidToken", "");
96
         objJSON.put("EidToken", "");
96
         try {
97
         try {
116
             String respJSON = GetEidTokenResponse.toJsonString(resp);
117
             String respJSON = GetEidTokenResponse.toJsonString(resp);
117
             objJSON = JSON.parseObject(respJSON);
118
             objJSON = JSON.parseObject(respJSON);
118
         } catch (TencentCloudSDKException e) {
119
         } catch (TencentCloudSDKException e) {
119
-            System.out.println(e.toString());
120
-            System.out.println("获取Eidtoken失败");
120
+            throw new ServiceException("获取Eidtoken失败");
121
         }
121
         }
122
         return objJSON;
122
         return objJSON;
123
     }
123
     }
139
                 parse = JSON.parseObject(s);
139
                 parse = JSON.parseObject(s);
140
             }
140
             }
141
         } catch (Exception e) {
141
         } catch (Exception e) {
142
-            System.out.println(e.toString());
142
+           throw new ServiceException(e.getMessage());
143
         }
143
         }
144
         return parse;
144
         return parse;
145
     }
145
     }
226
             }
226
             }
227
             return AjaxResult.success(authentication);
227
             return AjaxResult.success(authentication);
228
         } catch (TencentCloudSDKException e) {
228
         } catch (TencentCloudSDKException e) {
229
-            System.out.println(e.toString());
229
+            return AjaxResult.error(e.getMessage());
230
         }
230
         }
231
-        return AjaxResult.success();
232
     }
231
     }
233
 
232
 
234
     @Override
233
     @Override
235
     public JSONObject selectPCEIDtokenStatus(String eidToken) {
234
     public JSONObject selectPCEIDtokenStatus(String eidToken) {
235
+        // todo 送达时需要判断是否有pdf版的调解书,没有则不送达,签名完后下载pdf时不删除之前的doc调解书,上传调解书时,pdf的需要将类型设为13,异步发送短信邮件时将登录用户传参过来
236
+        // todo E证通审核过后将PC端的机器id在YML文件中改掉
236
         JSONObject objJSON = null;
237
         JSONObject objJSON = null;
237
         try {
238
         try {
238
             Credential cred = new Credential(credentialSecretId, credentialSecretKey);
239
             Credential cred = new Credential(credentialSecretId, credentialSecretKey);
251
             GetEidResultResponse resp = client.GetEidResult(req);
252
             GetEidResultResponse resp = client.GetEidResult(req);
252
             // 输出json格式的字符串回包,Status	String	枚举:init:token未验证 doing: 验证中 finished: 验证完成 timeout: token已超时
253
             // 输出json格式的字符串回包,Status	String	枚举:init:token未验证 doing: 验证中 finished: 验证完成 timeout: token已超时
253
             String s = GetEidResultResponse.toJsonString(resp);
254
             String s = GetEidResultResponse.toJsonString(resp);
254
-            objJSON = JSON.parseObject(s);
255
+            if(StrUtil.isNotEmpty(s)) {
256
+                objJSON = JSON.parseObject(s);
257
+            }
255
         } catch (TencentCloudSDKException e) {
258
         } catch (TencentCloudSDKException e) {
256
             throw new ServiceException("获取E证通Token状态失败");
259
             throw new ServiceException("获取E证通Token状态失败");
257
         }
260
         }

+ 11
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsSignSealService.java ファイルの表示

1
 package com.ruoyi.wisdomarbitrate.service.mscase;
1
 package com.ruoyi.wisdomarbitrate.service.mscase;
2
 
2
 
3
+import com.google.gson.Gson;
3
 import com.ruoyi.common.core.domain.AjaxResult;
4
 import com.ruoyi.common.core.domain.AjaxResult;
4
 import com.ruoyi.common.exception.EsignDemoException;
5
 import com.ruoyi.common.exception.EsignDemoException;
5
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO;
6
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO;
6
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
7
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
8
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
7
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
9
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
8
 
10
 
9
 import java.io.IOException;
11
 import java.io.IOException;
32
     AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException;
34
     AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException;
33
 
35
 
34
     AjaxResult sealCheckCallback(String reqbodystr) throws EsignDemoException, IOException;
36
     AjaxResult sealCheckCallback(String reqbodystr) throws EsignDemoException, IOException;
37
+
38
+    /**
39
+     * 签名后下载调解书
40
+     * @param caseApplicationselect 案件信息
41
+     * @param signFlowId 签名流程id
42
+     * @param gson
43
+     * @param caseAppliId 案件id
44
+     */
45
+    void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId);
35
 }
46
 }

+ 5
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java ファイルの表示

3114
                         .execute();
3114
                         .execute();
3115
             }
3115
             }
3116
             MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
3116
             MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
3117
-            if (caseFlow != null) {
3117
+            if (caseFlow != null ) {
3118
                 application.setCaseFlowId(caseFlow.getId());
3118
                 application.setCaseFlowId(caseFlow.getId());
3119
                 application.setCaseStatusName(caseFlow.getCaseStatusName());
3119
                 application.setCaseStatusName(caseFlow.getCaseStatusName());
3120
                 application.setMediaResult(mediaResult);
3120
                 application.setMediaResult(mediaResult);
3121
                 msCaseApplicationMapper.updateByPrimaryKeySelective(application);
3121
                 msCaseApplicationMapper.updateByPrimaryKeySelective(application);
3122
-                // 新增日志
3123
-                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
3124
                 if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
3122
                 if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
3125
                     CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
3123
                     CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
3126
                     //  结束对接北明,为调解失败状态
3124
                     //  结束对接北明,为调解失败状态
3127
                     caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL);
3125
                     caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL);
3128
                 }
3126
                 }
3127
+            }else {
3128
+                msCaseApplicationMapper.updateByPrimaryKeySelective(application);
3129
             }
3129
             }
3130
+            // 新增日志
3131
+            CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
3130
             return AjaxResult.success();
3132
             return AjaxResult.success();
3131
         }
3133
         }
3132
 
3134
 

+ 266
- 306
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java ファイルの表示

78
 
78
 
79
 import static com.google.common.io.Files.getFileExtension;
79
 import static com.google.common.io.Files.getFileExtension;
80
 import static com.ruoyi.common.core.domain.AjaxResult.success;
80
 import static com.ruoyi.common.core.domain.AjaxResult.success;
81
+
81
 @Slf4j
82
 @Slf4j
82
 @Service
83
 @Service
83
 public class MsSignSealServiceImpl implements MsSignSealService {
84
 public class MsSignSealServiceImpl implements MsSignSealService {
85
+    @Autowired
86
+    private MsSignSealService msSignSealService;
84
 
87
 
85
     @Autowired
88
     @Autowired
86
     MsCaseApplicationMapper msCaseApplicationMapper;
89
     MsCaseApplicationMapper msCaseApplicationMapper;
135
     ShortMessageService shortMessageService;
138
     ShortMessageService shortMessageService;
136
 
139
 
137
 
140
 
138
-
139
-
140
     @Override
141
     @Override
141
     @Transactional
142
     @Transactional
142
     public AjaxResult sealApply(MsSignSealDTO dto) {
143
     public AjaxResult sealApply(MsSignSealDTO dto) {
161
                 application.setCaseFlowId(nextFlow.getId());
162
                 application.setCaseFlowId(nextFlow.getId());
162
                 application.setCaseStatusName(nextFlow.getCaseStatusName());
163
                 application.setCaseStatusName(nextFlow.getCaseStatusName());
163
                 caseApplicationMapper.updateByPrimaryKeySelective(application);
164
                 caseApplicationMapper.updateByPrimaryKeySelective(application);
164
-                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
165
+                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null);
165
             }
166
             }
166
         } else {
167
         } else {
167
             // 单独
168
             // 单独
171
             application.setCaseFlowId(nextFlow.getId());
172
             application.setCaseFlowId(nextFlow.getId());
172
             application.setCaseStatusName(nextFlow.getCaseStatusName());
173
             application.setCaseStatusName(nextFlow.getCaseStatusName());
173
             caseApplicationMapper.updateByPrimaryKeySelective(application);
174
             caseApplicationMapper.updateByPrimaryKeySelective(application);
174
-            CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
175
+            CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null);
175
         }
176
         }
176
         return AjaxResult.success("用印申请成功");
177
         return AjaxResult.success("用印申请成功");
177
 
178
 
217
         if (records != null && records.size() > 0) {
218
         if (records != null && records.size() > 0) {
218
             for (MsCaseLogRecordVO msCaseLogRecordVO : records) {
219
             for (MsCaseLogRecordVO msCaseLogRecordVO : records) {
219
                 String content = msCaseLogRecordVO.getCaseStatusName();
220
                 String content = msCaseLogRecordVO.getCaseStatusName();
220
-                if(StringUtils.isNotEmpty(content)){
221
-                    if(content.equals("结束")){
221
+                if (StringUtils.isNotEmpty(content)) {
222
+                    if (content.equals("结束")) {
222
                         recordsNew.add(msCaseLogRecordVO);
223
                         recordsNew.add(msCaseLogRecordVO);
223
-                    }else {
224
-                        if(!content.equals(msCaseFlow.getCaseStatusName())){
224
+                    } else {
225
+                        if (!content.equals(msCaseFlow.getCaseStatusName())) {
225
                             recordsNew.add(msCaseLogRecordVO);
226
                             recordsNew.add(msCaseLogRecordVO);
226
-                        }else{
227
+                        } else {
227
                             break;
228
                             break;
228
                         }
229
                         }
229
                     }
230
                     }
234
 
235
 
235
         CaseLogRecord caseLogRecordin = new CaseLogRecord();
236
         CaseLogRecord caseLogRecordin = new CaseLogRecord();
236
         List<MsCaseLogRecordVO> caseLogRecordsin = new ArrayList<>();
237
         List<MsCaseLogRecordVO> caseLogRecordsin = new ArrayList<>();
237
-        if(!"结束".equals(msCaseFlow.getNodeName())){
238
+        if (!"结束".equals(msCaseFlow.getNodeName())) {
238
             caseLogRecordin.setCaseNodeName(msCaseFlow.getNodeName());
239
             caseLogRecordin.setCaseNodeName(msCaseFlow.getNodeName());
239
             List<MsCaseFlowVO> msCaseFlowvos = caseFlowMapper.selectFlowRole(caseFlowId);
240
             List<MsCaseFlowVO> msCaseFlowvos = caseFlowMapper.selectFlowRole(caseFlowId);
240
             StringBuilder roleIn = new StringBuilder();
241
             StringBuilder roleIn = new StringBuilder();
241
-            for(MsCaseFlowVO mscaseFlowVO:msCaseFlowvos){
242
-                if(!"结束".equals(mscaseFlowVO.getNodeName())){
243
-                    roleIn.append( mscaseFlowVO.getRoleName()+"正在进行"+mscaseFlowVO.getNodeName()+";");
242
+            for (MsCaseFlowVO mscaseFlowVO : msCaseFlowvos) {
243
+                if (!"结束".equals(mscaseFlowVO.getNodeName())) {
244
+                    roleIn.append(mscaseFlowVO.getRoleName() + "正在进行" + mscaseFlowVO.getNodeName() + ";");
244
                 }
245
                 }
245
             }
246
             }
246
-            caseLogRecordin.setContent(roleIn.toString().substring(0,roleIn.toString().length()-1));
247
+            caseLogRecordin.setContent(roleIn.toString().substring(0, roleIn.toString().length() - 1));
247
 
248
 
248
             MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
249
             MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
249
-            if(nextFlow!=null){
250
+            if (nextFlow != null) {
250
                 String nodeName = nextFlow.getNodeName();
251
                 String nodeName = nextFlow.getNodeName();
251
-                if(StringUtils.isNotEmpty(nodeName)){
252
-                    if(!"结束".equals(nodeName)){
252
+                if (StringUtils.isNotEmpty(nodeName)) {
253
+                    if (!"结束".equals(nodeName)) {
253
                         List<MsCaseFlowVO> nextMsCaseFlowvo = caseFlowMapper.selectFlowRole(nextFlow.getId());
254
                         List<MsCaseFlowVO> nextMsCaseFlowvo = caseFlowMapper.selectFlowRole(nextFlow.getId());
254
                         StringBuilder roleIn1 = new StringBuilder();
255
                         StringBuilder roleIn1 = new StringBuilder();
255
-                        for(MsCaseFlowVO mscaseFlowVO:nextMsCaseFlowvo){
256
-                            roleIn1.append( mscaseFlowVO.getRoleName()+";");
256
+                        for (MsCaseFlowVO mscaseFlowVO : nextMsCaseFlowvo) {
257
+                            roleIn1.append(mscaseFlowVO.getRoleName() + ";");
257
                         }
258
                         }
258
-                        caseLogRecordin.setNextRoleName("下一节点角色:"+roleIn1.toString().substring(0,roleIn1.toString().length()-1));
259
+                        caseLogRecordin.setNextRoleName("下一节点角色:" + roleIn1.toString().substring(0, roleIn1.toString().length() - 1));
259
                     }
260
                     }
260
                 }
261
                 }
261
             }
262
             }
274
                 caseLogRecord1.setCaseNodeName(msCaseFlowVOs.get(0).getNodeName());
275
                 caseLogRecord1.setCaseNodeName(msCaseFlowVOs.get(0).getNodeName());
275
 
276
 
276
                 StringBuilder rolenext = new StringBuilder();
277
                 StringBuilder rolenext = new StringBuilder();
277
-                for(MsCaseFlowVO mscaseFlowVO:msCaseFlowVOs){
278
+                for (MsCaseFlowVO mscaseFlowVO : msCaseFlowVOs) {
278
                     String nodeName1 = mscaseFlowVO.getNodeName();
279
                     String nodeName1 = mscaseFlowVO.getNodeName();
279
-                    if(StringUtils.isNotEmpty(nodeName1)){
280
-                        if("结束".equals(nodeName1)){
280
+                    if (StringUtils.isNotEmpty(nodeName1)) {
281
+                        if ("结束".equals(nodeName1)) {
281
                             rolenext.append("结束;");
282
                             rolenext.append("结束;");
282
-                        }else {
283
-                            rolenext.append( mscaseFlowVO.getRoleName()+"将进行"+mscaseFlowVO.getNodeName()+";");
283
+                        } else {
284
+                            rolenext.append(mscaseFlowVO.getRoleName() + "将进行" + mscaseFlowVO.getNodeName() + ";");
284
                         }
285
                         }
285
                     }
286
                     }
286
                 }
287
                 }
287
-                caseLogRecord1.setContent( rolenext.toString().substring(0,rolenext.toString().length()-1));
288
+                caseLogRecord1.setContent(rolenext.toString().substring(0, rolenext.toString().length() - 1));
288
                 caseLogRecordsnext.add(caseLogRecord1);
289
                 caseLogRecordsnext.add(caseLogRecord1);
289
             }
290
             }
290
 
291
 
291
         }
292
         }
292
-        if(caseLogRecordsin!=null&&caseLogRecordsin.size()>0){
293
+        if (caseLogRecordsin != null && caseLogRecordsin.size() > 0) {
293
             datas.put("finishCasenode", recordsNew);
294
             datas.put("finishCasenode", recordsNew);
294
-        }else {
295
+        } else {
295
             MsCaseLogRecordVO msCaseLogRecordVO1 = new MsCaseLogRecordVO();
296
             MsCaseLogRecordVO msCaseLogRecordVO1 = new MsCaseLogRecordVO();
296
             msCaseLogRecordVO1.setContent("结束");
297
             msCaseLogRecordVO1.setContent("结束");
297
             recordsNew.add(msCaseLogRecordVO1);
298
             recordsNew.add(msCaseLogRecordVO1);
308
         MsCaseLogRecord caseLogRecord = new MsCaseLogRecord();
309
         MsCaseLogRecord caseLogRecord = new MsCaseLogRecord();
309
         caseLogRecord.setCaseAppliId(id);
310
         caseLogRecord.setCaseAppliId(id);
310
         List<MsCaseLogRecordVO> records = caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord);
311
         List<MsCaseLogRecordVO> records = caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord);
311
-        if(CollectionUtil.isNotEmpty(records)){
312
-            records.forEach(record->{
312
+        if (CollectionUtil.isNotEmpty(records)) {
313
+            records.forEach(record -> {
313
                 StringBuilder contentBuilder = new StringBuilder();
314
                 StringBuilder contentBuilder = new StringBuilder();
314
-                String caseNodeTime="";
315
-                if(record.getCreateTime()!=null){
316
-                    caseNodeTime= DateUtil.format(record.getCreateTime(), DatePattern.NORM_DATETIME_FORMATTER);
315
+                String caseNodeTime = "";
316
+                if (record.getCreateTime() != null) {
317
+                    caseNodeTime = DateUtil.format(record.getCreateTime(), DatePattern.NORM_DATETIME_FORMATTER);
317
                 }
318
                 }
318
                 Integer caseNode = record.getCaseNode();
319
                 Integer caseNode = record.getCaseNode();
319
                 String createBy = record.getCreateBy();
320
                 String createBy = record.getCreateBy();
320
-                if(StrUtil.isNotEmpty(createBy)){
321
+                if (StrUtil.isNotEmpty(createBy)) {
321
                     contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("(").append(record.getCreateBy()).append(")").append("于").append(caseNodeTime);
322
                     contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("(").append(record.getCreateBy()).append(")").append("于").append(caseNodeTime);
322
-                }else{
323
+                } else {
323
                     contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("于").append(caseNodeTime);
324
                     contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("于").append(caseNodeTime);
324
                 }
325
                 }
325
 
326
 
326
-                if(StrUtil.isNotEmpty(record.getContent())){
327
+                if (StrUtil.isNotEmpty(record.getContent())) {
327
                     contentBuilder.append(record.getContent());
328
                     contentBuilder.append(record.getContent());
328
-                }else if(caseNode.intValue() == 0){
329
+                } else if (caseNode.intValue() == 0) {
329
                     contentBuilder.append(record.getCaseStatusName());
330
                     contentBuilder.append(record.getCaseStatusName());
330
                 }
331
                 }
331
-                if(StrUtil.isNotEmpty(record.getNotes())){
332
+                if (StrUtil.isNotEmpty(record.getNotes())) {
332
                     contentBuilder.append(",").append(record.getNotes());
333
                     contentBuilder.append(",").append(record.getNotes());
333
                 }
334
                 }
334
                 record.setContent(contentBuilder.toString());
335
                 record.setContent(contentBuilder.toString());
340
 
341
 
341
     @Override
342
     @Override
342
     @Transactional(rollbackFor = Exception.class)
343
     @Transactional(rollbackFor = Exception.class)
343
-    public AjaxResult msCaseFile(List<Long> ids){
344
-        // todo
344
+    public AjaxResult msCaseFile(List<Long> ids) {
345
+        StringBuilder error = new StringBuilder();
345
         try {
346
         try {
346
             for (Long id : ids) {
347
             for (Long id : ids) {
347
                 MsCaseApplication caseApplication1 = msCaseApplicationMapper.selectByPrimaryKey(id);
348
                 MsCaseApplication caseApplication1 = msCaseApplicationMapper.selectByPrimaryKey(id);
348
-                if (caseApplication1 == null) {
349
-                    return AjaxResult.error("未查询到相关案件");
350
-                }
351
-                MsCaseApplicationVO msCaseApplicationVO = new MsCaseApplicationVO();
352
-                BeanUtil.copyProperties(caseApplication1, msCaseApplicationVO);
353
-                List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
354
-                if (caseAttachList != null && caseAttachList.size() > 0) {
355
-                    for (MsCaseAttach caseAttach : caseAttachList) {
356
-                        if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
357
-                            String prefix = "/profile";
358
-                            int startIndex = prefix.length();
359
-                            String annexPath = caseAttach.getAnnexPath();
360
-                            String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
361
-                            File file = new File(path);
362
-                            if (!file.exists()) {
363
-                                Gson gson = new Gson();
364
-                                MsSealSignRecord sealSignRecord = new MsSealSignRecord();
365
-                                sealSignRecord.setCaseAppliId(id);
366
-                                List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord);
367
-                                if (sealSignRecords != null && sealSignRecords.size() > 0) {
368
-                                    String signFlowid = sealSignRecords.get(0).getSignFlowId();
369
-                                    EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowid);
370
-                                    JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
371
-                                    JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
372
-                                    JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
373
-                                    if (filesArray != null && filesArray.size() > 0) {
374
-                                        JsonObject fileObject = (JsonObject) filesArray.get(0);
375
-                                        String fileDownloadUrl = fileObject.get("downloadUrl").toString();
376
-                                        String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
377
-
378
-                                        LocalDate now = LocalDate.now();
379
-                                        String year = Integer.toString(now.getYear());
380
-                                        String month = String.format("%02d", now.getMonthValue());
381
-                                        String day = String.format("%02d", now.getDayOfMonth());
382
-                                        String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
383
-                                        String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
384
-                                        String saveName = fileName;
385
-                                        String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
386
-
387
-                                        // 创建日期目录
388
-                                        File saveFolder = new File(saveFolderPath);
389
-                                        if (!saveFolder.exists()) {
390
-                                            saveFolder.mkdirs();
391
-                                        }
392
-                                        String resultFilePath = saveFolderPath + "/" + fileName;
393
-                                        File resultFilePathFile = new File(resultFilePath);
394
-                                        if (!resultFilePathFile.exists()) {
395
-                                            resultFilePathFile.createNewFile();
396
-                                        }
397
-
398
-                                        boolean downLoadFile = FileTransformation.downLoadFileByUrl(filearbitraUrl, resultFilePath);
399
-                                        if (downLoadFile) {
400
-                                            MsCaseAttach caseAttach1 = new MsCaseAttach();
401
-                                            caseAttach1.setCaseAppliId(id);
402
-                                            caseAttach1.setAnnexType(7);
403
-                                            caseAttach1.setAnnexPath(savePath);
404
-                                            caseAttach1.setAnnexName(saveName);
405
-                                            msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach1);
406
-
407
-                                            caseAttach.setAnnexPath(savePath);
408
-                                            caseAttach.setAnnexName(saveName);
409
-                                        }
349
+                if (caseApplication1 != null) {
350
+
351
+                    MsCaseApplicationVO msCaseApplicationVO = new MsCaseApplicationVO();
352
+                    BeanUtil.copyProperties(caseApplication1, msCaseApplicationVO);
353
+                    List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
354
+                    // 只能送达pdf版调解书
355
+
356
+                    if (CollectionUtil.isNotEmpty(caseAttachList)) {
357
+                        long count = caseAttachList.stream().filter(msCaseAttach -> msCaseAttach.getAnnexType() != null && msCaseAttach.getAnnexType().equals(AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode())).count();
358
+                        if (count > 0) {
359
+                            Integer caseFlowId = caseApplication1.getCaseFlowId();
360
+                            // 查询当前节点
361
+                            MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
362
+                            if (currentFlow != null) {
363
+                                // 根据流程id查找下一个流程节点
364
+                                MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
365
+                                caseApplication1.setCaseFlowId(nextFlow.getId());
366
+                                caseApplication1.setCaseStatusName(nextFlow.getCaseStatusName());
367
+                                caseApplicationMapper.updateByPrimaryKeySelective(caseApplication1);
368
+
369
+                                // 获取案件相关人员
370
+                                List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(id);
371
+                                if (CollectionUtil.isNotEmpty(affiliates)) {
372
+                                    // 申请操作人
373
+                                    Optional<MsCaseAffiliate> applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst();
374
+                                    // 被申请操作人
375
+                                    Optional<MsCaseAffiliate> resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
376
+                                    if (applicantAffiliateOpt.isPresent() && resAffiliateOpt.isPresent()) {
377
+                                        ExecutorService executor = ThreadUtil.createThreadPool();
378
+                                        // 发送邮件
379
+                                        CompletableFuture.runAsync(() -> {
380
+                                            if (StrUtil.isNotEmpty(applicantAffiliateOpt.get().getEmail())) {
381
+                                                boolean appEmailFlag = sendCaseEmail(caseApplication1, applicantAffiliateOpt.get().getEmail(), caseAttachList);
382
+                                            }
383
+                                            if (!StrUtil.isEmpty(resAffiliateOpt.get().getEmail())) {
384
+                                                boolean appEmailFlag = sendCaseEmail(caseApplication1, resAffiliateOpt.get().getEmail(), caseAttachList);
385
+                                            }
386
+                                        }, executor);
387
+                                        // 发送签收短信,2126313	尊敬的{1}用户,您的{2}文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?{3},如非本人操作,请忽略本短信
388
+                                        CompletableFuture.runAsync(() -> {
389
+                                            SysUser sysUser = sysUserMapper.selectUserById(applicantAffiliateOpt.get().getUserId());
390
+                                            // 获取短信链接uuid
391
+                                            MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build();
392
+                                            String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
393
+                                            if (!StrUtil.isEmpty(sysUser.getPhonenumber())) {
394
+                                                SmsUtils.sendSms(caseApplication1, "2126313", sysUser.getPhonenumber(), new String[]{sysUser.getNickName(), caseApplication1.getCaseNum(), "authId=" + roomUuid});
395
+                                            } else if (StrUtil.isNotEmpty(sysUser.getEmail())) {
396
+                                                String content = "尊敬的" + sysUser.getNickName() + "用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId=" + roomUuid + ",如非本人操作,请忽略本短信";
397
+                                                sendEmail(caseApplication1, sysUser, "调解系统文件签收", content);
398
+                                            }
399
+                                        }, executor);
410
                                     }
400
                                     }
411
                                 }
401
                                 }
412
-
413
                             }
402
                             }
414
 
403
 
404
+                            CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
405
+                        } else {
406
+                            error.append("案件编号为" + caseApplication1.getCaseNum() + "未找到pdf版调解书,请上传\r\n");
415
                         }
407
                         }
408
+                    } else {
409
+                        error.append("案件编号为" + caseApplication1.getCaseNum() + "未找到pdf版调解书,请上传\r\n");
416
                     }
410
                     }
417
                 }
411
                 }
418
-                Integer caseFlowId = caseApplication1.getCaseFlowId();
419
-                // 查询当前节点
420
-                MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
421
-                if(currentFlow==null){
422
-                    return AjaxResult.error("未找到当前流程节点");
423
-                }
424
-                // 根据流程id查找下一个流程节点
425
-                MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
426
-                caseApplication1.setCaseFlowId(nextFlow.getId());
427
-                caseApplication1.setCaseStatusName(nextFlow.getCaseStatusName());
428
-                caseApplicationMapper.updateByPrimaryKeySelective(caseApplication1);
429
-
430
-                // 获取案件相关人员
431
-                List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(id);
432
-                if(CollectionUtil.isEmpty(affiliates)){
433
-                    return AjaxResult.error("未找到案件相关人员");
434
-                }
435
-                // 申请操作人
436
-                Optional<MsCaseAffiliate> applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1  && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst();
437
-                // 被申请操作人
438
-                Optional<MsCaseAffiliate> resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1  && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
439
-                if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) {
440
-                    throw new ServiceException("未找到案件操作人员");
441
-                }
442
-                ExecutorService executor = ThreadUtil.createThreadPool();
443
-                // 发送邮件
444
-                CompletableFuture.runAsync(() -> {
445
-                if (StrUtil.isNotEmpty(applicantAffiliateOpt.get().getEmail())) {
446
-                    boolean appEmailFlag = sendCaseEmail(caseApplication1, applicantAffiliateOpt.get().getEmail(), caseAttachList);
447
-                }
448
-                if (!StrUtil.isEmpty(resAffiliateOpt.get().getEmail())) {
449
-                    boolean appEmailFlag = sendCaseEmail(caseApplication1, resAffiliateOpt.get().getEmail(), caseAttachList);
450
-                } }, executor);
451
-                // 发送签收短信,2126313	尊敬的{1}用户,您的{2}文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?{3},如非本人操作,请忽略本短信
452
-                CompletableFuture.runAsync(() -> {
453
-                    SysUser sysUser = sysUserMapper.selectUserById(applicantAffiliateOpt.get().getUserId());
454
-                    // 获取短信链接uuid
455
-                    MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build();
456
-                    String   roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
457
-                if (!StrUtil.isEmpty(sysUser.getPhonenumber())) {
458
-                    SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid});
459
-                }else if(StrUtil.isNotEmpty(sysUser.getEmail())){
460
-                  String  content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信";
461
-                    sendEmail(caseApplication1, sysUser, "调解系统文件签收", content);
462
-                }
463
-                }, executor);
464
-                CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
465
 
412
 
466
             }
413
             }
467
 
414
 
468
         } catch (Exception e) {
415
         } catch (Exception e) {
469
             throw new ServiceException("调解书发送失败");
416
             throw new ServiceException("调解书发送失败");
470
         }
417
         }
471
-
418
+        if (error.length() > 0) {
419
+            return AjaxResult.error(error.toString());
420
+        }
472
         return AjaxResult.success("");
421
         return AjaxResult.success("");
473
     }
422
     }
423
+
474
     public void sendEmail(MsCaseApplication application, SysUser user, String subject, String sendContent) {
424
     public void sendEmail(MsCaseApplication application, SysUser user, String subject, String sendContent) {
475
         boolean emailFlag = emailOutUtil.sendMessage(user.getEmail(), subject, sendContent, null, null);
425
         boolean emailFlag = emailOutUtil.sendMessage(user.getEmail(), subject, sendContent, null, null);
476
 
426
 
498
         msSendMailHistoryRecord.setId(null);
448
         msSendMailHistoryRecord.setId(null);
499
         sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord);
449
         sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord);
500
     }
450
     }
451
+
501
     @Override
452
     @Override
502
     @Transactional
453
     @Transactional
503
     public AjaxResult msCaseSign(MsSignSealDTO dto) {
454
     public AjaxResult msCaseSign(MsSignSealDTO dto) {
504
         Long caseId = dto.getCaseId();
455
         Long caseId = dto.getCaseId();
505
         MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId);
456
         MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId);
506
-        if(caseApplicationselect==null){
457
+        if (caseApplicationselect == null) {
507
             return AjaxResult.error("当前案件不存在");
458
             return AjaxResult.error("当前案件不存在");
508
         }
459
         }
509
         // 查询当前节点
460
         // 查询当前节点
515
         Example example = new Example(MsCaseAffiliate.class);
466
         Example example = new Example(MsCaseAffiliate.class);
516
         example.createCriteria().andEqualTo("caseAppliId", caseId);
467
         example.createCriteria().andEqualTo("caseAppliId", caseId);
517
         List<MsCaseAffiliate> msCaseAffiliates = msCaseAffiliateMapper.selectByExample(example);
468
         List<MsCaseAffiliate> msCaseAffiliates = msCaseAffiliateMapper.selectByExample(example);
518
-        if(CollectionUtil.isEmpty(msCaseAffiliates)){
469
+        if (CollectionUtil.isEmpty(msCaseAffiliates)) {
519
             return AjaxResult.error("未找到案件相关人员");
470
             return AjaxResult.error("未找到案件相关人员");
520
         }
471
         }
521
         // 被申请操作人
472
         // 被申请操作人
522
         Optional<MsCaseAffiliate> resAffiliateOpt = msCaseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
473
         Optional<MsCaseAffiliate> resAffiliateOpt = msCaseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
523
         ExecutorService executor = ThreadUtil.createThreadPool();
474
         ExecutorService executor = ThreadUtil.createThreadPool();
524
-        if(!resAffiliateOpt.isPresent()){
475
+        if (!resAffiliateOpt.isPresent()) {
525
             return AjaxResult.error("案件相关人员不完整");
476
             return AjaxResult.error("案件相关人员不完整");
526
         }
477
         }
527
         for (MsCaseAffiliate affiliate : msCaseAffiliates) {
478
         for (MsCaseAffiliate affiliate : msCaseAffiliates) {
528
             //  申请人签收,根据流程id查找下一个流程节点
479
             //  申请人签收,根据流程id查找下一个流程节点
529
-            if(affiliate.getUserId()!=null
480
+            if (affiliate.getUserId() != null
530
                     && loginUserId.equals(affiliate.getUserId())
481
                     && loginUserId.equals(affiliate.getUserId())
531
-                    &&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(1)||affiliate.getRoleType().equals(2))) {
482
+                    && affiliate.getRoleType() != null && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))) {
532
                 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
483
                 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
533
                 caseApplicationselect.setCaseFlowId(nextFlow.getId());
484
                 caseApplicationselect.setCaseFlowId(nextFlow.getId());
534
                 caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
485
                 caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
552
             }
503
             }
553
 
504
 
554
             // 被申请人签收
505
             // 被申请人签收
555
-            if(affiliate.getUserId()!=null
506
+            if (affiliate.getUserId() != null
556
                     && loginUserId.equals(affiliate.getUserId())
507
                     && loginUserId.equals(affiliate.getUserId())
557
-                    &&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(3)||affiliate.getRoleType().equals(4))) {
508
+                    && affiliate.getRoleType() != null && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))) {
558
 
509
 
559
                 // 根据流程id查找下一个流程节点
510
                 // 根据流程id查找下一个流程节点
560
                 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
511
                 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
561
                 caseApplicationselect.setCaseFlowId(nextFlow.getId());
512
                 caseApplicationselect.setCaseFlowId(nextFlow.getId());
562
                 caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
513
                 caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
563
                 caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
514
                 caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
564
-                CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
515
+                CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null);
565
                 CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
516
                 CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
566
                 //  被申请人签收结束对接北明,为调解成功状态
517
                 //  被申请人签收结束对接北明,为调解成功状态
567
-                if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
518
+                if (StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
568
                     applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
519
                     applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
569
                 }
520
                 }
570
                 break;
521
                 break;
580
     public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException {
531
     public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException {
581
         Long caseId = dto.getCaseId();
532
         Long caseId = dto.getCaseId();
582
         List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(caseId);
533
         List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(caseId);
583
-        if(CollectionUtil.isEmpty(affiliates)){
534
+        if (CollectionUtil.isEmpty(affiliates)) {
584
             return AjaxResult.error("未找到案件相关人员");
535
             return AjaxResult.error("未找到案件相关人员");
585
         }
536
         }
586
         SysUser user = sysUserMapper.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId());
537
         SysUser user = sysUserMapper.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId());
587
         List<SysRole> roles = user.getRoles();
538
         List<SysRole> roles = user.getRoles();
588
-        if(CollectionUtil.isEmpty(roles)){
539
+        if (CollectionUtil.isEmpty(roles)) {
589
             return AjaxResult.error("该用户未绑定角色");
540
             return AjaxResult.error("该用户未绑定角色");
590
         }
541
         }
591
         long mediatorCount = roles.stream().filter(sysRole -> sysRole.getRoleName().equals("调解员")).count();
542
         long mediatorCount = roles.stream().filter(sysRole -> sysRole.getRoleName().equals("调解员")).count();
592
         List<MsCaseAffiliate> operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null
543
         List<MsCaseAffiliate> operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null
593
                 && msCaseAffiliate.getOperatorFlag() == 1
544
                 && msCaseAffiliate.getOperatorFlag() == 1
594
                 && StrUtil.isNotEmpty(msCaseAffiliate.getPhone())).collect(Collectors.toList());
545
                 && StrUtil.isNotEmpty(msCaseAffiliate.getPhone())).collect(Collectors.toList());
595
-        Optional<MsCaseAffiliate> appOpt =null;
596
-        Optional<MsCaseAffiliate> resOpt =null;
597
-        if(CollectionUtil.isNotEmpty(operatorList)){
598
-           appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null && msCaseAffiliate.getUserId()!=null
546
+        Optional<MsCaseAffiliate> appOpt = null;
547
+        Optional<MsCaseAffiliate> resOpt = null;
548
+        if (CollectionUtil.isNotEmpty(operatorList)) {
549
+            appOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null && msCaseAffiliate.getUserId() != null
599
                             && (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2))
550
                             && (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2))
600
                     .findFirst();
551
                     .findFirst();
601
-            resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null&& msCaseAffiliate.getUserId()!=null
552
+            resOpt = operatorList.stream().filter(msCaseAffiliate -> msCaseAffiliate.getRoleType() != null && msCaseAffiliate.getUserId() != null
602
                             && (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4))
553
                             && (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4))
603
                     .findFirst();
554
                     .findFirst();
604
         }
555
         }
605
-        if(appOpt==null || !appOpt.isPresent()){
556
+        if (appOpt == null || !appOpt.isPresent()) {
606
             return AjaxResult.error("未找到案件申请操作人");
557
             return AjaxResult.error("未找到案件申请操作人");
607
         }
558
         }
608
-        if(resOpt==null || !resOpt.isPresent()){
559
+        if (resOpt == null || !resOpt.isPresent()) {
609
             return AjaxResult.error("未找到案件被申请操作人");
560
             return AjaxResult.error("未找到案件被申请操作人");
610
         }
561
         }
611
         MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId);
562
         MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId);
612
 
563
 
613
         Long userId = SecurityUtils.getUserId();
564
         Long userId = SecurityUtils.getUserId();
614
 
565
 
615
-        if(appOpt.get().getUserId()!=null && appOpt.get().getUserId().equals(userId)){
566
+        if (appOpt.get().getUserId() != null && appOpt.get().getUserId().equals(userId)) {
616
             // 申请人链接
567
             // 申请人链接
617
             SealSignRecord sealSignRecordres = new SealSignRecord();
568
             SealSignRecord sealSignRecordres = new SealSignRecord();
618
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
569
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
620
             List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
571
             List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
621
             if (sealSignRecords != null && sealSignRecords.size() > 0) {
572
             if (sealSignRecords != null && sealSignRecords.size() > 0) {
622
                 String signFlowid = sealSignRecords.get(0).getSignFlowId();
573
                 String signFlowid = sealSignRecords.get(0).getSignFlowId();
623
-                    SealSignRecord sealSignRecord = new SealSignRecord();
624
-                    sealSignRecord.setPensonAccount(appOpt.get().getPhone());
625
-                    sealSignRecord.setPensonName(appOpt.get().getName());
626
-                    sealSignRecord.setSignFlowid(signFlowid);
627
-
628
-                    Gson gson = new Gson();
629
-                    EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord);
630
-                    JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
631
-                    if(signUrlJsonObject.get("data")==null||signUrlJsonObject.get("data").isJsonNull()){
632
-                        throw new ServiceException("该用户和流程无关,不能查看当前流程");
633
-                    }else {
634
-                        JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
635
-                        String urlapply = signUrlData.get("shortUrl").getAsString();
636
-                        sealSignRecordres.setSealUrl(urlapply);
637
-                    }
574
+                SealSignRecord sealSignRecord = new SealSignRecord();
575
+                sealSignRecord.setPensonAccount(appOpt.get().getPhone());
576
+                sealSignRecord.setPensonName(appOpt.get().getName());
577
+                sealSignRecord.setSignFlowid(signFlowid);
578
+
579
+                Gson gson = new Gson();
580
+                EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord);
581
+                JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
582
+                if (signUrlJsonObject.get("data") == null || signUrlJsonObject.get("data").isJsonNull()) {
583
+                    throw new ServiceException("该用户和流程无关,不能查看当前流程");
584
+                } else {
585
+                    JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
586
+                    String urlapply = signUrlData.get("shortUrl").getAsString();
587
+                    sealSignRecordres.setSealUrl(urlapply);
588
+                }
638
                 return AjaxResult.success(sealSignRecordres);
589
                 return AjaxResult.success(sealSignRecordres);
639
-            }else {
590
+            } else {
640
                 return AjaxResult.error();
591
                 return AjaxResult.error();
641
             }
592
             }
642
 
593
 
643
 
594
 
644
         }
595
         }
645
-        if(resOpt.get().getUserId()!=null && resOpt.get().getUserId().equals(userId)){
596
+        if (resOpt.get().getUserId() != null && resOpt.get().getUserId().equals(userId)) {
646
             // 被申
597
             // 被申
647
             SealSignRecord sealSignRecordres = new SealSignRecord();
598
             SealSignRecord sealSignRecordres = new SealSignRecord();
648
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
599
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
662
                 String urlapply = signUrlData.get("shortUrl").getAsString();
613
                 String urlapply = signUrlData.get("shortUrl").getAsString();
663
                 sealSignRecordres.setSealUrl(urlapply);
614
                 sealSignRecordres.setSealUrl(urlapply);
664
                 return AjaxResult.success(sealSignRecordres);
615
                 return AjaxResult.success(sealSignRecordres);
665
-            }else {
616
+            } else {
666
                 return AjaxResult.error();
617
                 return AjaxResult.error();
667
             }
618
             }
668
         }
619
         }
669
-        if(mediatorCount>0){
620
+        if (mediatorCount > 0) {
670
             // 调解员
621
             // 调解员
671
             SealSignRecord sealSignRecordres = new SealSignRecord();
622
             SealSignRecord sealSignRecordres = new SealSignRecord();
672
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
623
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
677
                 SealSignRecord sealSignRecord = new SealSignRecord();
628
                 SealSignRecord sealSignRecord = new SealSignRecord();
678
 
629
 
679
                 Long arbitratorId = caseApplication.getMediatorId();
630
                 Long arbitratorId = caseApplication.getMediatorId();
680
-                if (arbitratorId!=null) {
631
+                if (arbitratorId != null) {
681
                     SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
632
                     SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
682
                     if (sysUser == null) {
633
                     if (sysUser == null) {
683
                         return AjaxResult.error();
634
                         return AjaxResult.error();
693
                 String urlapply = signUrlData.get("shortUrl").getAsString();
644
                 String urlapply = signUrlData.get("shortUrl").getAsString();
694
                 sealSignRecordres.setSealUrl(urlapply);
645
                 sealSignRecordres.setSealUrl(urlapply);
695
                 return AjaxResult.success(sealSignRecordres);
646
                 return AjaxResult.success(sealSignRecordres);
696
-            }else {
647
+            } else {
697
                 return AjaxResult.error();
648
                 return AjaxResult.error();
698
             }
649
             }
699
 
650
 
708
         JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr);
659
         JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr);
709
         Gson gson = new Gson();
660
         Gson gson = new Gson();
710
         if (jsonObjectCallback != null) {
661
         if (jsonObjectCallback != null) {
711
-            log.info("签名回调======"+jsonObjectCallback);
662
+            log.info("签名回调======" + jsonObjectCallback);
712
             int signResult = jsonObjectCallback.getIntValue("signResult");
663
             int signResult = jsonObjectCallback.getIntValue("signResult");
713
             String action = jsonObjectCallback.getString("action");
664
             String action = jsonObjectCallback.getString("action");
714
             String signFlowId = jsonObjectCallback.getString("signFlowId");
665
             String signFlowId = jsonObjectCallback.getString("signFlowId");
742
             MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId());
693
             MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId());
743
             Integer caseNode = currentFlow.getNodeId();
694
             Integer caseNode = currentFlow.getNodeId();
744
             String caseStatusName = currentFlow.getCaseStatusName();
695
             String caseStatusName = currentFlow.getCaseStatusName();
745
-            if("SIGN_MISSON_COMPLETE".equals(action) && signResult==2){
746
-                if(mediaResult.equals(1)){
696
+            if ("SIGN_MISSON_COMPLETE".equals(action) && signResult == 2) {
697
+                if (mediaResult.equals(1)) {
747
                     //调解
698
                     //调解
748
-                    if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){
699
+                    if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountApply)) {
749
                         //申请人签名
700
                         //申请人签名
750
                         sealSignRecordsel.setSignStatusApply(1);
701
                         sealSignRecordsel.setSignStatusApply(1);
751
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
702
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
756
                         operLog.setCaseNode(caseNode);
707
                         operLog.setCaseNode(caseNode);
757
                         operLog.setCreateTime(dateOperate);
708
                         operLog.setCreateTime(dateOperate);
758
                         caseLogRecordMapper.insert(operLog);
709
                         caseLogRecordMapper.insert(operLog);
759
-                        if(signStatusResponse!=null&&signStatusResponse.equals(1)&&
760
-                                signStatusMediator!=null&&signStatusMediator.equals(1)){
710
+                        if (signStatusResponse != null && signStatusResponse.equals(1) &&
711
+                                signStatusMediator != null && signStatusMediator.equals(1)) {
761
                             // 根据流程id查找下一个流程节点
712
                             // 根据流程id查找下一个流程节点
762
-                            MsCaseFlow nextFlow=null;
763
-                            if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag().equals(1)) {
713
+                            MsCaseFlow nextFlow = null;
714
+                            if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag().equals(1)) {
764
                                 // 需要用印
715
                                 // 需要用印
765
-                                 nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
766
-                            }else {
716
+                                nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
717
+                            } else {
767
                                 // 不需要用印
718
                                 // 不需要用印
768
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
719
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
769
                             }
720
                             }
774
                             caseApplicationMapper.updateByPrimaryKeySelective(application);
725
                             caseApplicationMapper.updateByPrimaryKeySelective(application);
775
 
726
 
776
                             //修改"签署用印记录表"的状态为待用印
727
                             //修改"签署用印记录表"的状态为待用印
777
-                            if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
728
+                            if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
778
                                 sealSignRecordsel.setSignFlowStatus(2);
729
                                 sealSignRecordsel.setSignFlowStatus(2);
779
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
730
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
780
-                            }else {
731
+                            } else {
781
                                 // 否则为已完成
732
                                 // 否则为已完成
782
                                 sealSignRecordsel.setSignFlowStatus(3);
733
                                 sealSignRecordsel.setSignFlowStatus(3);
783
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
734
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
784
                                 // 下载调解书
735
                                 // 下载调解书
785
-                                downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
736
+                                msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
786
                             }
737
                             }
787
 
738
 
788
                         }
739
                         }
789
-                    }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){
740
+                    } else if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountRes)) {
790
                         //被申请人签名
741
                         //被申请人签名
791
                         sealSignRecordsel.setSignStatusResponse(1);
742
                         sealSignRecordsel.setSignStatusResponse(1);
792
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
743
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
797
                         operLog.setCaseNode(caseNode);
748
                         operLog.setCaseNode(caseNode);
798
                         operLog.setCreateTime(dateOperate);
749
                         operLog.setCreateTime(dateOperate);
799
                         caseLogRecordMapper.insert(operLog);
750
                         caseLogRecordMapper.insert(operLog);
800
-                        if(signStatusApply!=null&&signStatusApply.equals(1)&&
801
-                                signStatusMediator!=null&&signStatusMediator.equals(1)){
751
+                        if (signStatusApply != null && signStatusApply.equals(1) &&
752
+                                signStatusMediator != null && signStatusMediator.equals(1)) {
802
                             // 根据流程id查找下一个流程节点
753
                             // 根据流程id查找下一个流程节点
803
                             // 根据流程id查找下一个流程节点
754
                             // 根据流程id查找下一个流程节点
804
-                            MsCaseFlow nextFlow=null;
805
-                            if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
755
+                            MsCaseFlow nextFlow = null;
756
+                            if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
806
                                 // 需要用印
757
                                 // 需要用印
807
                                 nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
758
                                 nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
808
-                            }else {
759
+                            } else {
809
                                 // 不需要用印
760
                                 // 不需要用印
810
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
761
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
811
                             }
762
                             }
816
                             caseApplicationMapper.updateByPrimaryKeySelective(application);
767
                             caseApplicationMapper.updateByPrimaryKeySelective(application);
817
 
768
 
818
                             //修改"签署用印记录表"的状态为待用印
769
                             //修改"签署用印记录表"的状态为待用印
819
-                            if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
770
+                            if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
820
                                 sealSignRecordsel.setSignFlowStatus(2);
771
                                 sealSignRecordsel.setSignFlowStatus(2);
821
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
772
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
822
-                            }else {
773
+                            } else {
823
                                 // 否则为已完成
774
                                 // 否则为已完成
824
                                 sealSignRecordsel.setSignFlowStatus(3);
775
                                 sealSignRecordsel.setSignFlowStatus(3);
825
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
776
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
826
                                 // 下载调解书
777
                                 // 下载调解书
827
-                                downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
778
+                                msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
828
                             }
779
                             }
829
 
780
 
830
                         }
781
                         }
831
-                    }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountMedi)){
782
+                    } else if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountMedi)) {
832
                         //调解员签名
783
                         //调解员签名
833
                         sealSignRecordsel.setSignStatusMediator(1);
784
                         sealSignRecordsel.setSignStatusMediator(1);
834
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
785
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
839
                         operLog.setCaseNode(caseNode);
790
                         operLog.setCaseNode(caseNode);
840
                         operLog.setCreateTime(dateOperate);
791
                         operLog.setCreateTime(dateOperate);
841
                         caseLogRecordMapper.insert(operLog);
792
                         caseLogRecordMapper.insert(operLog);
842
-                        if(signStatusApply!=null&&signStatusApply.equals(1)&&
843
-                                signStatusResponse!=null&&signStatusResponse.equals(1)){
793
+                        if (signStatusApply != null && signStatusApply.equals(1) &&
794
+                                signStatusResponse != null && signStatusResponse.equals(1)) {
844
                             // 根据流程id查找下一个流程节点
795
                             // 根据流程id查找下一个流程节点
845
                             // 根据流程id查找下一个流程节点
796
                             // 根据流程id查找下一个流程节点
846
-                            MsCaseFlow nextFlow=null;
847
-                            if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
797
+                            MsCaseFlow nextFlow = null;
798
+                            if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
848
                                 // 需要用印
799
                                 // 需要用印
849
                                 nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
800
                                 nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
850
-                            }else {
801
+                            } else {
851
                                 // 不需要用印
802
                                 // 不需要用印
852
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
803
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
853
                             }
804
                             }
858
                             caseApplicationMapper.updateByPrimaryKeySelective(application);
809
                             caseApplicationMapper.updateByPrimaryKeySelective(application);
859
 
810
 
860
                             //修改"签署用印记录表"的状态为待用印
811
                             //修改"签署用印记录表"的状态为待用印
861
-                            if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
812
+                            if (caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
862
                                 sealSignRecordsel.setSignFlowStatus(2);
813
                                 sealSignRecordsel.setSignFlowStatus(2);
863
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
814
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
864
-                            }else {
815
+                            } else {
865
                                 // 否则为已完成
816
                                 // 否则为已完成
866
                                 sealSignRecordsel.setSignFlowStatus(3);
817
                                 sealSignRecordsel.setSignFlowStatus(3);
867
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
818
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
868
                                 // 下载调解书
819
                                 // 下载调解书
869
-                                downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
820
+                                msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
870
                             }
821
                             }
871
 
822
 
872
                         }
823
                         }
873
-                    }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag()!=null && caseApplicationselect.getSealFlag()==1 ){
824
+                    } else if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag() != null && caseApplicationselect.getSealFlag() == 1) {
874
                         //需要用印
825
                         //需要用印
875
                         sealSignRecordsel.setSealStatus(1);
826
                         sealSignRecordsel.setSealStatus(1);
876
                         sealSignRecordsel.setSignFlowStatus(3);
827
                         sealSignRecordsel.setSignFlowStatus(3);
892
                         caseApplicationMapper.updateByPrimaryKeySelective(application);
843
                         caseApplicationMapper.updateByPrimaryKeySelective(application);
893
 
844
 
894
                         //下载审核完成的调解书
845
                         //下载审核完成的调解书
895
-                        downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
846
+                        msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
896
 
847
 
897
                     }
848
                     }
898
 
849
 
899
-                }else if(mediaResult.equals(5)){
850
+                } else if (mediaResult.equals(5)) {
900
                     //和解
851
                     //和解
901
-                    if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountApply)){
852
+                    if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountApply)) {
902
                         //申请人签名
853
                         //申请人签名
903
                         sealSignRecordsel.setSignStatusApply(1);
854
                         sealSignRecordsel.setSignStatusApply(1);
904
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
855
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
909
                         operLog.setCaseNode(caseNode);
860
                         operLog.setCaseNode(caseNode);
910
                         operLog.setCreateTime(dateOperate);
861
                         operLog.setCreateTime(dateOperate);
911
                         caseLogRecordMapper.insert(operLog);
862
                         caseLogRecordMapper.insert(operLog);
912
-                        if(signStatusResponse!=null&&signStatusResponse.equals(1)){
863
+                        if (signStatusResponse != null && signStatusResponse.equals(1)) {
913
                             MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
864
                             MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
914
                             MsCaseApplication application = new MsCaseApplication();
865
                             MsCaseApplication application = new MsCaseApplication();
915
                             application.setId(caseApplicationselect.getId());
866
                             application.setId(caseApplicationselect.getId());
922
                             sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
873
                             sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
923
 
874
 
924
                             //下载审核完成的调解书
875
                             //下载审核完成的调解书
925
-                            downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
876
+                            msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
926
 //                            EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
877
 //                            EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
927
 //                            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
878
 //                            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
928
 //                            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
879
 //                            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
989
 //
940
 //
990
 //                            }
941
 //                            }
991
                         }
942
                         }
992
-                    }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){
943
+                    } else if (StringUtils.isNotEmpty(accountMobile) && accountMobile.equals(pensonAccountRes)) {
993
                         //被申请人签名
944
                         //被申请人签名
994
                         sealSignRecordsel.setSignStatusResponse(1);
945
                         sealSignRecordsel.setSignStatusResponse(1);
995
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
946
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1000
                         operLog.setCaseNode(caseNode);
951
                         operLog.setCaseNode(caseNode);
1001
                         operLog.setCreateTime(dateOperate);
952
                         operLog.setCreateTime(dateOperate);
1002
                         caseLogRecordMapper.insert(operLog);
953
                         caseLogRecordMapper.insert(operLog);
1003
-                        if(signStatusApply!=null&&signStatusApply.equals(1)){
954
+                        if (signStatusApply != null && signStatusApply.equals(1)) {
1004
                             MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
955
                             MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
1005
                             MsCaseApplication application = new MsCaseApplication();
956
                             MsCaseApplication application = new MsCaseApplication();
1006
                             application.setId(caseApplicationselect.getId());
957
                             application.setId(caseApplicationselect.getId());
1013
                             sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
964
                             sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1014
 
965
 
1015
                             //下载审核完成的调解书
966
                             //下载审核完成的调解书
1016
-                            downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
967
+                            msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
1017
 //                            EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
968
 //                            EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
1018
 //                            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
969
 //                            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
1019
 //                            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
970
 //                            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
1084
                 }
1035
                 }
1085
             }
1036
             }
1086
 
1037
 
1087
-        }else{
1038
+        } else {
1088
             return AjaxResult.error("error");
1039
             return AjaxResult.error("error");
1089
         }
1040
         }
1090
         return AjaxResult.success("success");
1041
         return AjaxResult.success("success");
1091
     }
1042
     }
1092
 
1043
 
1093
-    private void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) throws EsignDemoException, IOException {
1094
-        log.info("signFlowId===="+signFlowId);
1095
-        EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
1096
-        log.info("下载成功===="+fileDownload);
1097
-        JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
1098
-        JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
1099
-        JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
1100
-        log.info("下载调解书pdf===="+filesArray);
1101
-        if (filesArray != null && filesArray.size() > 0) {
1102
-            JsonObject fileObject = (JsonObject) filesArray.get(0);
1103
-            String fileDownloadUrl = fileObject.get("downloadUrl").toString();
1104
-            LocalDate now = LocalDate.now();
1105
-            String year = Integer.toString(now.getYear());
1106
-            String month = String.format("%02d", now.getMonthValue());
1107
-            String day = String.format("%02d", now.getDayOfMonth());
1108
-            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
1109
-            String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
1110
-            String saveName = fileName;
1111
-            String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
1112
-
1113
-            // 创建日期目录
1114
-            File saveFolder = new File(saveFolderPath);
1115
-            if (!saveFolder.exists()) {
1116
-                saveFolder.mkdirs();
1117
-            }
1118
-            String resultFilePath = saveFolderPath + "/" + fileName;
1119
-            File resultFilePathFile = new File(resultFilePath);
1120
-            if (!resultFilePathFile.exists()) {
1121
-                resultFilePathFile.createNewFile();
1122
-            }
1044
+    /**
1045
+     * 下载调解书
1046
+     *
1047
+     * @param caseApplicationselect
1048
+     * @param signFlowId
1049
+     * @param gson
1050
+     * @param caseAppliId
1051
+     * @throws EsignDemoException
1052
+     * @throws IOException
1053
+     */
1054
+    @Transactional
1055
+    public void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) {
1056
+        EsignHttpResponse fileDownload = null;
1057
+        try {
1058
+            fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
1059
+
1060
+            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
1061
+            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
1062
+            JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
1063
+            if (filesArray != null && filesArray.size() > 0) {
1064
+                JsonObject fileObject = (JsonObject) filesArray.get(0);
1065
+                String fileDownloadUrl = fileObject.get("downloadUrl").toString();
1066
+                LocalDate now = LocalDate.now();
1067
+                String year = Integer.toString(now.getYear());
1068
+                String month = String.format("%02d", now.getMonthValue());
1069
+                String day = String.format("%02d", now.getDayOfMonth());
1070
+                String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
1071
+                String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
1072
+                String saveName = fileName;
1073
+                String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
1074
+
1075
+                // 创建日期目录
1076
+                File saveFolder = new File(saveFolderPath);
1077
+                if (!saveFolder.exists()) {
1078
+                    saveFolder.mkdirs();
1079
+                }
1080
+                String resultFilePath = saveFolderPath + "/" + fileName;
1081
+                File resultFilePathFile = new File(resultFilePath);
1082
+                if (!resultFilePathFile.exists()) {
1083
+                    resultFilePathFile.createNewFile();
1084
+                }
1123
 
1085
 
1124
-            String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
1125
-            boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
1126
-            log.info("是否下载成功======="+downLoadFile);
1127
-            if (downLoadFile) {
1128
-                // 先删除已经存在的调解书
1129
-                if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
1130
-                    List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
1131
-                    if(CollectionUtil.isNotEmpty(existAttach)){
1132
-                        //  对接北明,同步案件状态,删除
1133
-                        for (MsCaseAttach msCaseAttach : existAttach) {
1134
-                            if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
1135
-                                continue;
1086
+                String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
1087
+                boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
1088
+                if (downLoadFile) {
1089
+                    // 先删除已经存在的pdf调解书
1090
+                    if (StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
1091
+                        List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode());
1092
+                        if (CollectionUtil.isNotEmpty(existAttach)) {
1093
+                            //  对接北明,同步案件状态,删除
1094
+                            for (MsCaseAttach msCaseAttach : existAttach) {
1095
+                                if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
1096
+                                    continue;
1097
+                                }
1098
+                                beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
1136
                             }
1099
                             }
1137
-                            beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
1138
                         }
1100
                         }
1139
                     }
1101
                     }
1140
-                }
1141
-                msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
1142
-
1143
-                MsCaseAttach caseAttach = new MsCaseAttach();
1144
-                caseAttach.setCaseAppliId(caseAppliId);
1145
-                caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
1146
-                caseAttach.setAnnexPath(savePath);
1147
-                caseAttach.setAnnexName(saveName);
1148
-                caseAttach.setSuffix(getFileExtension(caseAttach.getAnnexPath()));
1149
-                log.info("调解书保存======="+downLoadFile);
1150
-                caseAttachMapper.save(caseAttach);
1151
-                //  对接北明,调用上传附件接口
1152
-                if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
1153
-                    String templatePath = "/home/ruoyi" + savePath;
1154
-                    File file = new File(templatePath.replace("/profile", "/uploadPath"));
1155
-                    MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
1156
-                    // 更新附件表
1157
-                    if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
1158
-                        caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
1159
-                        msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
1160
-                    }
1102
+                    msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode());
1103
+
1104
+                    MsCaseAttach caseAttach = new MsCaseAttach();
1105
+                    caseAttach.setCaseAppliId(caseAppliId);
1106
+                    caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode());
1107
+                    caseAttach.setAnnexPath(savePath);
1108
+                    caseAttach.setAnnexName(saveName);
1109
+                    caseAttach.setSuffix(getFileExtension(caseAttach.getAnnexPath()));
1110
+                    caseAttachMapper.save(caseAttach);
1111
+                    //  对接北明,调用上传附件接口
1112
+                    if (StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
1113
+                        String templatePath = "/home/ruoyi" + savePath;
1114
+                        File file = new File(templatePath.replace("/profile", "/uploadPath"));
1115
+                        MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
1116
+                        // 更新附件表
1117
+                        if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
1118
+                            caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
1119
+                            msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
1120
+                        }
1161
 
1121
 
1122
+                    }
1162
                 }
1123
                 }
1163
-            }
1164
 
1124
 
1125
+            }
1126
+        } catch (Exception e) {
1127
+            throw new ServiceException("E签宝下载调解书失败");
1165
         }
1128
         }
1166
     }
1129
     }
1167
 
1130
 
1193
                 }
1156
                 }
1194
             }
1157
             }
1195
 
1158
 
1196
-            if("SEAL_AUDIT".equals(action) && auditStatus==1){
1159
+            if ("SEAL_AUDIT".equals(action) && auditStatus == 1) {
1197
                 EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId);
1160
                 EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId);
1198
                 JSONObject jsonObject = JSONObject.parseObject(response.getBody());
1161
                 JSONObject jsonObject = JSONObject.parseObject(response.getBody());
1199
                 int code = jsonObject.getIntValue("code");
1162
                 int code = jsonObject.getIntValue("code");
1241
                     }
1204
                     }
1242
                 }
1205
                 }
1243
             }
1206
             }
1244
-        }else{
1207
+        } else {
1245
             return AjaxResult.error("error");
1208
             return AjaxResult.error("error");
1246
         }
1209
         }
1247
         return AjaxResult.success("success");
1210
         return AjaxResult.success("success");
1258
         Long fileId = null;
1221
         Long fileId = null;
1259
         if (caseAttachList != null && caseAttachList.size() > 0) {
1222
         if (caseAttachList != null && caseAttachList.size() > 0) {
1260
             for (MsCaseAttach caseAttach : caseAttachList) {
1223
             for (MsCaseAttach caseAttach : caseAttachList) {
1261
-                if (Objects.equals(caseAttach.getAnnexType(), AnnexTypeEnum.MEDIATE_BOOK.getCode())) {
1224
+                if (Objects.equals(caseAttach.getAnnexType(), AnnexTypeEnum.MEDIATE_BOOK_PDF.getCode())) {
1262
                     String prefix = "/profile";
1225
                     String prefix = "/profile";
1263
                     int startIndex = prefix.length();
1226
                     int startIndex = prefix.length();
1264
                     String annexPath = caseAttach.getAnnexPath();
1227
                     String annexPath = caseAttach.getAnnexPath();
1265
-                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
1228
+                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex + 1);
1266
                     file = new File(path);
1229
                     file = new File(path);
1267
                     fileList.add(file);
1230
                     fileList.add(file);
1268
-                    fileId=caseAttach.getAnnexId();
1231
+                    fileId = caseAttach.getAnnexId();
1269
                     System.out.println("文件长度==================:" + file.length());
1232
                     System.out.println("文件长度==================:" + file.length());
1270
                 }
1233
                 }
1271
             }
1234
             }
1279
         sendMailRecord.setSendTime(new Date());
1242
         sendMailRecord.setSendTime(new Date());
1280
         sendMailRecord.setMailSubject("签署后的调解书");
1243
         sendMailRecord.setMailSubject("签署后的调解书");
1281
         sendMailRecord.setMailFromAddress(emailFrom);
1244
         sendMailRecord.setMailFromAddress(emailFrom);
1282
-        sendMailRecord.setFileIds(fileId!=null?fileId.toString():null);
1245
+        sendMailRecord.setFileIds(fileId != null ? fileId.toString() : null);
1283
 //        sendMailRecord.setCreateBy(SecurityUtils.getUsername());
1246
 //        sendMailRecord.setCreateBy(SecurityUtils.getUsername());
1284
         sendMailRecord.setCreateTime(new Date());
1247
         sendMailRecord.setCreateTime(new Date());
1285
         sendMailRecord.setMailFromAddress(emailFrom);
1248
         sendMailRecord.setMailFromAddress(emailFrom);
1315
     }
1278
     }
1316
 
1279
 
1317
 
1280
 
1318
-
1319
-
1320
-
1321
 }
1281
 }