18792927508 пре 2 година
родитељ
комит
cc4d7139dc

+ 2
- 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/miniprogress/IdentityAuthenticationController.java Прегледај датотеку

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

+ 1
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java Прегледај датотеку

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

+ 11
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsSignSealService.java Прегледај датотеку

@@ -1,9 +1,11 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.mscase;
2 2
 
3
+import com.google.gson.Gson;
3 4
 import com.ruoyi.common.core.domain.AjaxResult;
4 5
 import com.ruoyi.common.exception.EsignDemoException;
5 6
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO;
6 7
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
8
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
7 9
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
8 10
 
9 11
 import java.io.IOException;
@@ -32,4 +34,13 @@ public interface MsSignSealService {
32 34
     AjaxResult signSeaalCaseApplicaCallback(String reqbodystr) throws EsignDemoException, IOException;
33 35
 
34 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,19 +3114,21 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
3114 3114
                         .execute();
3115 3115
             }
3116 3116
             MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
3117
-            if (caseFlow != null) {
3117
+            if (caseFlow != null ) {
3118 3118
                 application.setCaseFlowId(caseFlow.getId());
3119 3119
                 application.setCaseStatusName(caseFlow.getCaseStatusName());
3120 3120
                 application.setMediaResult(mediaResult);
3121 3121
                 msCaseApplicationMapper.updateByPrimaryKeySelective(application);
3122
-                // 新增日志
3123
-                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
3124 3122
                 if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {
3125 3123
                     CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null);
3126 3124
                     //  结束对接北明,为调解失败状态
3127 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 3132
             return AjaxResult.success();
3131 3133
         }
3132 3134
 

+ 266
- 306
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java Прегледај датотеку

@@ -78,9 +78,12 @@ import java.util.stream.Collectors;
78 78
 
79 79
 import static com.google.common.io.Files.getFileExtension;
80 80
 import static com.ruoyi.common.core.domain.AjaxResult.success;
81
+
81 82
 @Slf4j
82 83
 @Service
83 84
 public class MsSignSealServiceImpl implements MsSignSealService {
85
+    @Autowired
86
+    private MsSignSealService msSignSealService;
84 87
 
85 88
     @Autowired
86 89
     MsCaseApplicationMapper msCaseApplicationMapper;
@@ -135,8 +138,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
135 138
     ShortMessageService shortMessageService;
136 139
 
137 140
 
138
-
139
-
140 141
     @Override
141 142
     @Transactional
142 143
     public AjaxResult sealApply(MsSignSealDTO dto) {
@@ -161,7 +162,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
161 162
                 application.setCaseFlowId(nextFlow.getId());
162 163
                 application.setCaseStatusName(nextFlow.getCaseStatusName());
163 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 167
         } else {
167 168
             // 单独
@@ -171,7 +172,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
171 172
             application.setCaseFlowId(nextFlow.getId());
172 173
             application.setCaseStatusName(nextFlow.getCaseStatusName());
173 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 177
         return AjaxResult.success("用印申请成功");
177 178
 
@@ -217,13 +218,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
217 218
         if (records != null && records.size() > 0) {
218 219
             for (MsCaseLogRecordVO msCaseLogRecordVO : records) {
219 220
                 String content = msCaseLogRecordVO.getCaseStatusName();
220
-                if(StringUtils.isNotEmpty(content)){
221
-                    if(content.equals("结束")){
221
+                if (StringUtils.isNotEmpty(content)) {
222
+                    if (content.equals("结束")) {
222 223
                         recordsNew.add(msCaseLogRecordVO);
223
-                    }else {
224
-                        if(!content.equals(msCaseFlow.getCaseStatusName())){
224
+                    } else {
225
+                        if (!content.equals(msCaseFlow.getCaseStatusName())) {
225 226
                             recordsNew.add(msCaseLogRecordVO);
226
-                        }else{
227
+                        } else {
227 228
                             break;
228 229
                         }
229 230
                     }
@@ -234,28 +235,28 @@ public class MsSignSealServiceImpl implements MsSignSealService {
234 235
 
235 236
         CaseLogRecord caseLogRecordin = new CaseLogRecord();
236 237
         List<MsCaseLogRecordVO> caseLogRecordsin = new ArrayList<>();
237
-        if(!"结束".equals(msCaseFlow.getNodeName())){
238
+        if (!"结束".equals(msCaseFlow.getNodeName())) {
238 239
             caseLogRecordin.setCaseNodeName(msCaseFlow.getNodeName());
239 240
             List<MsCaseFlowVO> msCaseFlowvos = caseFlowMapper.selectFlowRole(caseFlowId);
240 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 249
             MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
249
-            if(nextFlow!=null){
250
+            if (nextFlow != null) {
250 251
                 String nodeName = nextFlow.getNodeName();
251
-                if(StringUtils.isNotEmpty(nodeName)){
252
-                    if(!"结束".equals(nodeName)){
252
+                if (StringUtils.isNotEmpty(nodeName)) {
253
+                    if (!"结束".equals(nodeName)) {
253 254
                         List<MsCaseFlowVO> nextMsCaseFlowvo = caseFlowMapper.selectFlowRole(nextFlow.getId());
254 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,24 +275,24 @@ public class MsSignSealServiceImpl implements MsSignSealService {
274 275
                 caseLogRecord1.setCaseNodeName(msCaseFlowVOs.get(0).getNodeName());
275 276
 
276 277
                 StringBuilder rolenext = new StringBuilder();
277
-                for(MsCaseFlowVO mscaseFlowVO:msCaseFlowVOs){
278
+                for (MsCaseFlowVO mscaseFlowVO : msCaseFlowVOs) {
278 279
                     String nodeName1 = mscaseFlowVO.getNodeName();
279
-                    if(StringUtils.isNotEmpty(nodeName1)){
280
-                        if("结束".equals(nodeName1)){
280
+                    if (StringUtils.isNotEmpty(nodeName1)) {
281
+                        if ("结束".equals(nodeName1)) {
281 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 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 294
             datas.put("finishCasenode", recordsNew);
294
-        }else {
295
+        } else {
295 296
             MsCaseLogRecordVO msCaseLogRecordVO1 = new MsCaseLogRecordVO();
296 297
             msCaseLogRecordVO1.setContent("结束");
297 298
             recordsNew.add(msCaseLogRecordVO1);
@@ -308,27 +309,27 @@ public class MsSignSealServiceImpl implements MsSignSealService {
308 309
         MsCaseLogRecord caseLogRecord = new MsCaseLogRecord();
309 310
         caseLogRecord.setCaseAppliId(id);
310 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 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 319
                 Integer caseNode = record.getCaseNode();
319 320
                 String createBy = record.getCreateBy();
320
-                if(StrUtil.isNotEmpty(createBy)){
321
+                if (StrUtil.isNotEmpty(createBy)) {
321 322
                     contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("(").append(record.getCreateBy()).append(")").append("于").append(caseNodeTime);
322
-                }else{
323
+                } else {
323 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 328
                     contentBuilder.append(record.getContent());
328
-                }else if(caseNode.intValue() == 0){
329
+                } else if (caseNode.intValue() == 0) {
329 330
                     contentBuilder.append(record.getCaseStatusName());
330 331
                 }
331
-                if(StrUtil.isNotEmpty(record.getNotes())){
332
+                if (StrUtil.isNotEmpty(record.getNotes())) {
332 333
                     contentBuilder.append(",").append(record.getNotes());
333 334
                 }
334 335
                 record.setContent(contentBuilder.toString());
@@ -340,137 +341,86 @@ public class MsSignSealServiceImpl implements MsSignSealService {
340 341
 
341 342
     @Override
342 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 346
         try {
346 347
             for (Long id : ids) {
347 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 415
         } catch (Exception e) {
469 416
             throw new ServiceException("调解书发送失败");
470 417
         }
471
-
418
+        if (error.length() > 0) {
419
+            return AjaxResult.error(error.toString());
420
+        }
472 421
         return AjaxResult.success("");
473 422
     }
423
+
474 424
     public void sendEmail(MsCaseApplication application, SysUser user, String subject, String sendContent) {
475 425
         boolean emailFlag = emailOutUtil.sendMessage(user.getEmail(), subject, sendContent, null, null);
476 426
 
@@ -498,12 +448,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
498 448
         msSendMailHistoryRecord.setId(null);
499 449
         sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord);
500 450
     }
451
+
501 452
     @Override
502 453
     @Transactional
503 454
     public AjaxResult msCaseSign(MsSignSealDTO dto) {
504 455
         Long caseId = dto.getCaseId();
505 456
         MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId);
506
-        if(caseApplicationselect==null){
457
+        if (caseApplicationselect == null) {
507 458
             return AjaxResult.error("当前案件不存在");
508 459
         }
509 460
         // 查询当前节点
@@ -515,20 +466,20 @@ public class MsSignSealServiceImpl implements MsSignSealService {
515 466
         Example example = new Example(MsCaseAffiliate.class);
516 467
         example.createCriteria().andEqualTo("caseAppliId", caseId);
517 468
         List<MsCaseAffiliate> msCaseAffiliates = msCaseAffiliateMapper.selectByExample(example);
518
-        if(CollectionUtil.isEmpty(msCaseAffiliates)){
469
+        if (CollectionUtil.isEmpty(msCaseAffiliates)) {
519 470
             return AjaxResult.error("未找到案件相关人员");
520 471
         }
521 472
         // 被申请操作人
522 473
         Optional<MsCaseAffiliate> resAffiliateOpt = msCaseAffiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
523 474
         ExecutorService executor = ThreadUtil.createThreadPool();
524
-        if(!resAffiliateOpt.isPresent()){
475
+        if (!resAffiliateOpt.isPresent()) {
525 476
             return AjaxResult.error("案件相关人员不完整");
526 477
         }
527 478
         for (MsCaseAffiliate affiliate : msCaseAffiliates) {
528 479
             //  申请人签收,根据流程id查找下一个流程节点
529
-            if(affiliate.getUserId()!=null
480
+            if (affiliate.getUserId() != null
530 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 483
                 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
533 484
                 caseApplicationselect.setCaseFlowId(nextFlow.getId());
534 485
                 caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
@@ -552,19 +503,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
552 503
             }
553 504
 
554 505
             // 被申请人签收
555
-            if(affiliate.getUserId()!=null
506
+            if (affiliate.getUserId() != null
556 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 510
                 // 根据流程id查找下一个流程节点
560 511
                 MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
561 512
                 caseApplicationselect.setCaseFlowId(nextFlow.getId());
562 513
                 caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
563 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 516
                 CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
566 517
                 //  被申请人签收结束对接北明,为调解成功状态
567
-                if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
518
+                if (StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
568 519
                     applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
569 520
                 }
570 521
                 break;
@@ -580,39 +531,39 @@ public class MsSignSealServiceImpl implements MsSignSealService {
580 531
     public AjaxResult msCaseSignUrlApplyPC(MsSignSealDTO dto) throws EsignDemoException {
581 532
         Long caseId = dto.getCaseId();
582 533
         List<MsCaseAffiliate> affiliates = applicationService.selectAffliatesByCaseId(caseId);
583
-        if(CollectionUtil.isEmpty(affiliates)){
534
+        if (CollectionUtil.isEmpty(affiliates)) {
584 535
             return AjaxResult.error("未找到案件相关人员");
585 536
         }
586 537
         SysUser user = sysUserMapper.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId());
587 538
         List<SysRole> roles = user.getRoles();
588
-        if(CollectionUtil.isEmpty(roles)){
539
+        if (CollectionUtil.isEmpty(roles)) {
589 540
             return AjaxResult.error("该用户未绑定角色");
590 541
         }
591 542
         long mediatorCount = roles.stream().filter(sysRole -> sysRole.getRoleName().equals("调解员")).count();
592 543
         List<MsCaseAffiliate> operatorList = affiliates.stream().filter(msCaseAffiliate -> msCaseAffiliate.getOperatorFlag() != null
593 544
                 && msCaseAffiliate.getOperatorFlag() == 1
594 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 550
                             && (msCaseAffiliate.getRoleType() == 1 || msCaseAffiliate.getRoleType() == 2))
600 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 553
                             && (msCaseAffiliate.getRoleType() == 3 || msCaseAffiliate.getRoleType() == 4))
603 554
                     .findFirst();
604 555
         }
605
-        if(appOpt==null || !appOpt.isPresent()){
556
+        if (appOpt == null || !appOpt.isPresent()) {
606 557
             return AjaxResult.error("未找到案件申请操作人");
607 558
         }
608
-        if(resOpt==null || !resOpt.isPresent()){
559
+        if (resOpt == null || !resOpt.isPresent()) {
609 560
             return AjaxResult.error("未找到案件被申请操作人");
610 561
         }
611 562
         MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId);
612 563
 
613 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 568
             SealSignRecord sealSignRecordres = new SealSignRecord();
618 569
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
@@ -620,29 +571,29 @@ public class MsSignSealServiceImpl implements MsSignSealService {
620 571
             List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
621 572
             if (sealSignRecords != null && sealSignRecords.size() > 0) {
622 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 589
                 return AjaxResult.success(sealSignRecordres);
639
-            }else {
590
+            } else {
640 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 598
             SealSignRecord sealSignRecordres = new SealSignRecord();
648 599
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
@@ -662,11 +613,11 @@ public class MsSignSealServiceImpl implements MsSignSealService {
662 613
                 String urlapply = signUrlData.get("shortUrl").getAsString();
663 614
                 sealSignRecordres.setSealUrl(urlapply);
664 615
                 return AjaxResult.success(sealSignRecordres);
665
-            }else {
616
+            } else {
666 617
                 return AjaxResult.error();
667 618
             }
668 619
         }
669
-        if(mediatorCount>0){
620
+        if (mediatorCount > 0) {
670 621
             // 调解员
671 622
             SealSignRecord sealSignRecordres = new SealSignRecord();
672 623
             MsSealSignRecord mssealSignRecord = new MsSealSignRecord();
@@ -677,7 +628,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
677 628
                 SealSignRecord sealSignRecord = new SealSignRecord();
678 629
 
679 630
                 Long arbitratorId = caseApplication.getMediatorId();
680
-                if (arbitratorId!=null) {
631
+                if (arbitratorId != null) {
681 632
                     SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
682 633
                     if (sysUser == null) {
683 634
                         return AjaxResult.error();
@@ -693,7 +644,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
693 644
                 String urlapply = signUrlData.get("shortUrl").getAsString();
694 645
                 sealSignRecordres.setSealUrl(urlapply);
695 646
                 return AjaxResult.success(sealSignRecordres);
696
-            }else {
647
+            } else {
697 648
                 return AjaxResult.error();
698 649
             }
699 650
 
@@ -708,7 +659,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
708 659
         JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr);
709 660
         Gson gson = new Gson();
710 661
         if (jsonObjectCallback != null) {
711
-            log.info("签名回调======"+jsonObjectCallback);
662
+            log.info("签名回调======" + jsonObjectCallback);
712 663
             int signResult = jsonObjectCallback.getIntValue("signResult");
713 664
             String action = jsonObjectCallback.getString("action");
714 665
             String signFlowId = jsonObjectCallback.getString("signFlowId");
@@ -742,10 +693,10 @@ public class MsSignSealServiceImpl implements MsSignSealService {
742 693
             MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId());
743 694
             Integer caseNode = currentFlow.getNodeId();
744 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 701
                         sealSignRecordsel.setSignStatusApply(1);
751 702
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -756,14 +707,14 @@ public class MsSignSealServiceImpl implements MsSignSealService {
756 707
                         operLog.setCaseNode(caseNode);
757 708
                         operLog.setCreateTime(dateOperate);
758 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 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 719
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
769 720
                             }
@@ -774,19 +725,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
774 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 729
                                 sealSignRecordsel.setSignFlowStatus(2);
779 730
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
780
-                            }else {
731
+                            } else {
781 732
                                 // 否则为已完成
782 733
                                 sealSignRecordsel.setSignFlowStatus(3);
783 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 742
                         sealSignRecordsel.setSignStatusResponse(1);
792 743
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -797,15 +748,15 @@ public class MsSignSealServiceImpl implements MsSignSealService {
797 748
                         operLog.setCaseNode(caseNode);
798 749
                         operLog.setCreateTime(dateOperate);
799 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 753
                             // 根据流程id查找下一个流程节点
803 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 758
                                 nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
808
-                            }else {
759
+                            } else {
809 760
                                 // 不需要用印
810 761
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
811 762
                             }
@@ -816,19 +767,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
816 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 771
                                 sealSignRecordsel.setSignFlowStatus(2);
821 772
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
822
-                            }else {
773
+                            } else {
823 774
                                 // 否则为已完成
824 775
                                 sealSignRecordsel.setSignFlowStatus(3);
825 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 784
                         sealSignRecordsel.setSignStatusMediator(1);
834 785
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -839,15 +790,15 @@ public class MsSignSealServiceImpl implements MsSignSealService {
839 790
                         operLog.setCaseNode(caseNode);
840 791
                         operLog.setCreateTime(dateOperate);
841 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 795
                             // 根据流程id查找下一个流程节点
845 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 800
                                 nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
850
-                            }else {
801
+                            } else {
851 802
                                 // 不需要用印
852 803
                                 nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
853 804
                             }
@@ -858,19 +809,19 @@ public class MsSignSealServiceImpl implements MsSignSealService {
858 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 813
                                 sealSignRecordsel.setSignFlowStatus(2);
863 814
                                 sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
864
-                            }else {
815
+                            } else {
865 816
                                 // 否则为已完成
866 817
                                 sealSignRecordsel.setSignFlowStatus(3);
867 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 826
                         sealSignRecordsel.setSealStatus(1);
876 827
                         sealSignRecordsel.setSignFlowStatus(3);
@@ -892,13 +843,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
892 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 854
                         sealSignRecordsel.setSignStatusApply(1);
904 855
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -909,7 +860,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
909 860
                         operLog.setCaseNode(caseNode);
910 861
                         operLog.setCreateTime(dateOperate);
911 862
                         caseLogRecordMapper.insert(operLog);
912
-                        if(signStatusResponse!=null&&signStatusResponse.equals(1)){
863
+                        if (signStatusResponse != null && signStatusResponse.equals(1)) {
913 864
                             MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
914 865
                             MsCaseApplication application = new MsCaseApplication();
915 866
                             application.setId(caseApplicationselect.getId());
@@ -922,7 +873,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
922 873
                             sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
923 874
 
924 875
                             //下载审核完成的调解书
925
-                            downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
876
+                            msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
926 877
 //                            EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
927 878
 //                            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
928 879
 //                            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
@@ -989,7 +940,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
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 945
                         sealSignRecordsel.setSignStatusResponse(1);
995 946
                         sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
@@ -1000,7 +951,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1000 951
                         operLog.setCaseNode(caseNode);
1001 952
                         operLog.setCreateTime(dateOperate);
1002 953
                         caseLogRecordMapper.insert(operLog);
1003
-                        if(signStatusApply!=null&&signStatusApply.equals(1)){
954
+                        if (signStatusApply != null && signStatusApply.equals(1)) {
1004 955
                             MsCaseFlow nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId());
1005 956
                             MsCaseApplication application = new MsCaseApplication();
1006 957
                             application.setId(caseApplicationselect.getId());
@@ -1013,7 +964,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1013 964
                             sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
1014 965
 
1015 966
                             //下载审核完成的调解书
1016
-                            downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
967
+                            msSignSealService.downloadMediationBook(caseApplicationselect, signFlowId, gson, caseAppliId);
1017 968
 //                            EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
1018 969
 //                            JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
1019 970
 //                            JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
@@ -1084,84 +1035,96 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1084 1035
                 }
1085 1036
             }
1086 1037
 
1087
-        }else{
1038
+        } else {
1088 1039
             return AjaxResult.error("error");
1089 1040
         }
1090 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,7 +1156,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1193 1156
                 }
1194 1157
             }
1195 1158
 
1196
-            if("SEAL_AUDIT".equals(action) && auditStatus==1){
1159
+            if ("SEAL_AUDIT".equals(action) && auditStatus == 1) {
1197 1160
                 EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId);
1198 1161
                 JSONObject jsonObject = JSONObject.parseObject(response.getBody());
1199 1162
                 int code = jsonObject.getIntValue("code");
@@ -1241,7 +1204,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1241 1204
                     }
1242 1205
                 }
1243 1206
             }
1244
-        }else{
1207
+        } else {
1245 1208
             return AjaxResult.error("error");
1246 1209
         }
1247 1210
         return AjaxResult.success("success");
@@ -1258,14 +1221,14 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1258 1221
         Long fileId = null;
1259 1222
         if (caseAttachList != null && caseAttachList.size() > 0) {
1260 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 1225
                     String prefix = "/profile";
1263 1226
                     int startIndex = prefix.length();
1264 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 1229
                     file = new File(path);
1267 1230
                     fileList.add(file);
1268
-                    fileId=caseAttach.getAnnexId();
1231
+                    fileId = caseAttach.getAnnexId();
1269 1232
                     System.out.println("文件长度==================:" + file.length());
1270 1233
                 }
1271 1234
             }
@@ -1279,7 +1242,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1279 1242
         sendMailRecord.setSendTime(new Date());
1280 1243
         sendMailRecord.setMailSubject("签署后的调解书");
1281 1244
         sendMailRecord.setMailFromAddress(emailFrom);
1282
-        sendMailRecord.setFileIds(fileId!=null?fileId.toString():null);
1245
+        sendMailRecord.setFileIds(fileId != null ? fileId.toString() : null);
1283 1246
 //        sendMailRecord.setCreateBy(SecurityUtils.getUsername());
1284 1247
         sendMailRecord.setCreateTime(new Date());
1285 1248
         sendMailRecord.setMailFromAddress(emailFrom);
@@ -1315,7 +1278,4 @@ public class MsSignSealServiceImpl implements MsSignSealService {
1315 1278
     }
1316 1279
 
1317 1280
 
1318
-
1319
-
1320
-
1321 1281
 }