|
|
@@ -21,6 +21,7 @@ import com.ruoyi.common.exception.ServiceException;
|
|
21
|
21
|
import com.ruoyi.common.utils.EmailOutUtil;
|
|
22
|
22
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
23
|
23
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
24
|
+import com.ruoyi.common.utils.ThreadUtil;
|
|
24
|
25
|
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
25
|
26
|
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
|
|
26
|
27
|
import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord;
|
|
|
@@ -43,6 +44,7 @@ import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
|
|
43
|
44
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
|
44
|
45
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo;
|
|
45
|
46
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
|
|
|
47
|
+import com.ruoyi.wisdomarbitrate.domain.vo.shortmessage.MeetingInfoVO;
|
|
46
|
48
|
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
|
|
47
|
49
|
import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper;
|
|
48
|
50
|
import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper;
|
|
|
@@ -53,8 +55,10 @@ import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseLogRecordMapper;
|
|
53
|
55
|
import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SendMailRecordMapper;
|
|
54
|
56
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
|
|
55
|
57
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService;
|
|
|
58
|
+import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService;
|
|
56
|
59
|
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
57
|
60
|
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
|
|
61
|
+import com.ruoyi.wisdomarbitrate.utils.SmsUtils;
|
|
58
|
62
|
import org.springframework.beans.BeanUtils;
|
|
59
|
63
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
60
|
64
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -67,6 +71,8 @@ import java.io.File;
|
|
67
|
71
|
import java.io.IOException;
|
|
68
|
72
|
import java.time.LocalDate;
|
|
69
|
73
|
import java.util.*;
|
|
|
74
|
+import java.util.concurrent.CompletableFuture;
|
|
|
75
|
+import java.util.concurrent.ExecutorService;
|
|
70
|
76
|
import java.util.stream.Collectors;
|
|
71
|
77
|
|
|
72
|
78
|
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
|
|
@@ -123,7 +129,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
123
|
129
|
BeiMingInterfaceService beiMingInterfaceService;
|
|
124
|
130
|
@Autowired
|
|
125
|
131
|
private MsSendMailHistoryRecordMapper sendMailHistoryRecordMapper;
|
|
126
|
|
-
|
|
|
132
|
+ @Autowired
|
|
|
133
|
+ ShortMessageService shortMessageService;
|
|
127
|
134
|
|
|
128
|
135
|
|
|
129
|
136
|
|
|
|
@@ -423,21 +430,48 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
423
|
430
|
if(CollectionUtil.isEmpty(affiliates)){
|
|
424
|
431
|
return AjaxResult.error("未找到案件相关人员");
|
|
425
|
432
|
}
|
|
426
|
|
- List<MsCaseAffiliate> oprratorList = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() != null
|
|
427
|
|
- && affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getEmail()))
|
|
428
|
|
- .collect(Collectors.toList());
|
|
429
|
|
- if(CollectionUtil.isEmpty(oprratorList)){
|
|
430
|
|
- return AjaxResult.error("未找到案件操作人员");
|
|
|
433
|
+ // 申请操作人
|
|
|
434
|
+ Optional<MsCaseAffiliate> applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst();
|
|
|
435
|
+ // 被申请操作人
|
|
|
436
|
+ Optional<MsCaseAffiliate> resAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4))).findFirst();
|
|
|
437
|
+ if (!applicantAffiliateOpt.isPresent() || !resAffiliateOpt.isPresent()) {
|
|
|
438
|
+ throw new ServiceException("未找到案件操作人员");
|
|
431
|
439
|
}
|
|
432
|
|
-
|
|
433
|
|
- for (MsCaseAffiliate affiliate : oprratorList) {
|
|
434
|
|
- if(affiliate.getRoleType()==null){
|
|
435
|
|
- continue;
|
|
436
|
|
- }
|
|
437
|
|
- boolean appEmailFlag = sendCaseEmail(caseApplication1, affiliate.getEmail(), caseAttachList);
|
|
438
|
|
-
|
|
439
|
|
-
|
|
|
440
|
+ ExecutorService executor = ThreadUtil.createThreadPool();
|
|
|
441
|
+ // 发送邮件
|
|
|
442
|
+ CompletableFuture.runAsync(() -> {
|
|
|
443
|
+ if (StrUtil.isNotEmpty(applicantAffiliateOpt.get().getEmail())) {
|
|
|
444
|
+ boolean appEmailFlag = sendCaseEmail(caseApplication1, applicantAffiliateOpt.get().getEmail(), caseAttachList);
|
|
|
445
|
+ }
|
|
|
446
|
+ if (!StrUtil.isEmpty(resAffiliateOpt.get().getEmail())) {
|
|
|
447
|
+ boolean appEmailFlag = sendCaseEmail(caseApplication1, resAffiliateOpt.get().getEmail(), caseAttachList);
|
|
|
448
|
+ } }, executor);
|
|
|
449
|
+ // 发送签收短信,2126313 尊敬的{1}用户,您的{2}文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?{3},如非本人操作,请忽略本短信
|
|
|
450
|
+ CompletableFuture.runAsync(() -> {
|
|
|
451
|
+ SysUser sysUser = sysUserMapper.selectUserById(applicantAffiliateOpt.get().getUserId());
|
|
|
452
|
+ // 获取短信链接uuid
|
|
|
453
|
+ MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build();
|
|
|
454
|
+ String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
|
|
|
455
|
+ if (!StrUtil.isEmpty(sysUser.getPhonenumber())) {
|
|
|
456
|
+ SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid});
|
|
|
457
|
+ }else if(StrUtil.isNotEmpty(sysUser.getEmail())){
|
|
|
458
|
+ String content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信";
|
|
|
459
|
+ sendEmail(caseApplication1, sysUser, "调解系统文件签收", content);
|
|
440
|
460
|
}
|
|
|
461
|
+ }, executor);
|
|
|
462
|
+ CompletableFuture.runAsync(() -> {
|
|
|
463
|
+ SysUser sysUser = sysUserMapper.selectUserById(resAffiliateOpt.get().getUserId());
|
|
|
464
|
+ MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(caseApplication1.getId()).systemType("TJ").build();
|
|
|
465
|
+ String roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
|
|
|
466
|
+ if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
|
|
|
467
|
+ SmsUtils.sendSms(caseApplication1,"2126313", sysUser.getPhonenumber(),new String[]{sysUser.getNickName(),caseApplication1.getCaseNum(),"authId="+ roomUuid});
|
|
|
468
|
+ }else if(StrUtil.isNotEmpty(sysUser.getEmail())){
|
|
|
469
|
+ String content = "尊敬的"+sysUser.getNickName()+"用户,您的" + caseApplication1.getCaseNum() + "文件已发送至邮箱,请点击链接进行确认签收https://txroom.xayunmei.com/#/sign?" + "authId="+ roomUuid + ",如非本人操作,请忽略本短信";
|
|
|
470
|
+ emailOutUtil.sendMessage(sysUser.getEmail(), "调解系统文件签收", content, null, null);
|
|
|
471
|
+ sendEmail(caseApplication1, sysUser, "调解系统文件签收", content);
|
|
|
472
|
+ }
|
|
|
473
|
+ }, executor);
|
|
|
474
|
+
|
|
441
|
475
|
|
|
442
|
476
|
CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
|
|
443
|
477
|
|
|
|
@@ -449,42 +483,85 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
449
|
483
|
|
|
450
|
484
|
return AjaxResult.success("");
|
|
451
|
485
|
}
|
|
|
486
|
+ public void sendEmail(MsCaseApplication application, SysUser user, String subject, String sendContent) {
|
|
|
487
|
+ boolean emailFlag = emailOutUtil.sendMessage(user.getEmail(), subject, sendContent, null, null);
|
|
452
|
488
|
|
|
|
489
|
+ SendMailRecord sendMailRecord = new SendMailRecord();
|
|
|
490
|
+ sendMailRecord.setCaseId(application.getId());
|
|
|
491
|
+ sendMailRecord.setMailAddress(user.getEmail());
|
|
|
492
|
+ sendMailRecord.setMailContent(sendContent);
|
|
|
493
|
+ sendMailRecord.setMailName(subject);
|
|
|
494
|
+ sendMailRecord.setSendTime(new Date());
|
|
|
495
|
+// sendMailRecord.setCreateBy(SecurityUtils.getUsername());
|
|
|
496
|
+ sendMailRecord.setCreateTime(new Date());
|
|
|
497
|
+ sendMailRecord.setMailSubject(subject);
|
|
|
498
|
+ sendMailRecord.setMailFromAddress(emailFrom);
|
|
|
499
|
+ if (emailFlag) {
|
|
|
500
|
+ sendMailRecord.setSendStatus(1);
|
|
|
501
|
+ } else {
|
|
|
502
|
+ sendMailRecord.setSendStatus(0);
|
|
|
503
|
+ }
|
|
|
504
|
+ sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
|
|
|
505
|
+ // 新增历史记录
|
|
|
506
|
+ MsSendMailHistoryRecord msSendMailHistoryRecord = new MsSendMailHistoryRecord();
|
|
|
507
|
+ BeanUtils.copyProperties(sendMailRecord, msSendMailHistoryRecord);
|
|
|
508
|
+ msSendMailHistoryRecord.setParentId(sendMailRecord.getId());
|
|
|
509
|
+ msSendMailHistoryRecord.setId(null);
|
|
|
510
|
+ sendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord);
|
|
|
511
|
+ }
|
|
453
|
512
|
@Override
|
|
454
|
513
|
@Transactional
|
|
455
|
514
|
public AjaxResult msCaseSign(MsSignSealDTO dto) {
|
|
456
|
515
|
Long caseId = dto.getCaseId();
|
|
457
|
|
- // MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(caseId);
|
|
458
|
516
|
MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(caseId);
|
|
|
517
|
+ if(caseApplicationselect==null){
|
|
|
518
|
+ return AjaxResult.error("当前案件不存在");
|
|
|
519
|
+ }
|
|
459
|
520
|
// 查询当前节点
|
|
460
|
521
|
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseApplicationselect.getCaseFlowId());
|
|
461
|
522
|
if (currentFlow == null) {
|
|
462
|
523
|
return AjaxResult.error("当前流程不存在");
|
|
463
|
524
|
}
|
|
464
|
|
- if (dto.getIsSignApply() != null && dto.getIsSignApply().equals(1) ) {
|
|
465
|
|
- // 根据流程id查找下一个流程节点
|
|
466
|
|
- MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
|
|
467
|
|
- caseApplicationselect.setCaseFlowId(nextFlow.getId());
|
|
468
|
|
- caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
469
|
|
- caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
|
|
470
|
|
- CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
|
|
|
525
|
+ Long loginUserId = SecurityUtils.getUserId();
|
|
|
526
|
+ Example example = new Example(MsCaseAffiliate.class);
|
|
|
527
|
+ example.createCriteria().andEqualTo("caseAppliId", caseId);
|
|
|
528
|
+ List<MsCaseAffiliate> msCaseAffiliates = msCaseAffiliateMapper.selectByExample(example);
|
|
|
529
|
+ if(CollectionUtil.isEmpty(msCaseAffiliates)){
|
|
|
530
|
+ return AjaxResult.error("未找到案件相关人员");
|
|
471
|
531
|
}
|
|
472
|
532
|
|
|
473
|
|
- if (dto.getIsSignRespon() != null && dto.getIsSignRespon().equals(1)) {
|
|
474
|
|
-
|
|
475
|
|
- // 根据流程id查找下一个流程节点
|
|
476
|
|
- MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
|
|
477
|
|
- caseApplicationselect.setCaseFlowId(nextFlow.getId());
|
|
478
|
|
- caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
479
|
|
- caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
|
|
480
|
|
- CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
|
|
481
|
|
- CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
|
|
482
|
|
- // 被申请人签收结束对接北明,为调解成功状态
|
|
483
|
|
- if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
|
|
484
|
|
- applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
|
|
|
533
|
+ for (MsCaseAffiliate affiliate : msCaseAffiliates) {
|
|
|
534
|
+ // 申请人签收,根据流程id查找下一个流程节点
|
|
|
535
|
+ if(affiliate.getUserId()!=null
|
|
|
536
|
+ && loginUserId.equals(affiliate.getUserId())
|
|
|
537
|
+ &&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(1)||affiliate.getRoleType().equals(2))) {
|
|
|
538
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
|
|
|
539
|
+ caseApplicationselect.setCaseFlowId(nextFlow.getId());
|
|
|
540
|
+ caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
541
|
+ caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
|
|
|
542
|
+ CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), null);
|
|
|
543
|
+ }
|
|
|
544
|
+
|
|
|
545
|
+ // 被申请人签收
|
|
|
546
|
+ if(affiliate.getUserId()!=null
|
|
|
547
|
+ && loginUserId.equals(affiliate.getUserId())
|
|
|
548
|
+ &&affiliate.getRoleType()!=null&&(affiliate.getRoleType().equals(3)||affiliate.getRoleType().equals(4))) {
|
|
|
549
|
+
|
|
|
550
|
+ // 根据流程id查找下一个流程节点
|
|
|
551
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
|
|
|
552
|
+ caseApplicationselect.setCaseFlowId(nextFlow.getId());
|
|
|
553
|
+ caseApplicationselect.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
554
|
+ caseApplicationMapper.updateByPrimaryKeySelective(caseApplicationselect);
|
|
|
555
|
+ CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),null);
|
|
|
556
|
+ CaseLogUtils.insertCaseLog(caseApplicationselect.getId(), 17, "结束", null);
|
|
|
557
|
+ // 被申请人签收结束对接北明,为调解成功状态
|
|
|
558
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())) {
|
|
|
559
|
+ applicationService.pushStatusToBM(caseApplicationselect, PushCaseStatusEnum.SUCCESS);
|
|
|
560
|
+ }
|
|
485
|
561
|
}
|
|
486
|
562
|
}
|
|
487
|
563
|
|
|
|
564
|
+
|
|
488
|
565
|
return AjaxResult.success("签收成功");
|
|
489
|
566
|
|
|
490
|
567
|
}
|
|
|
@@ -1156,7 +1233,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
1156
|
1233
|
Long fileId = null;
|
|
1157
|
1234
|
if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
1158
|
1235
|
for (MsCaseAttach caseAttach : caseAttachList) {
|
|
1159
|
|
- if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
|
|
|
1236
|
+ if (Objects.equals(caseAttach.getAnnexType(), AnnexTypeEnum.MEDIATE_BOOK.getCode())) {
|
|
1160
|
1237
|
String prefix = "/profile";
|
|
1161
|
1238
|
int startIndex = prefix.length();
|
|
1162
|
1239
|
String annexPath = caseAttach.getAnnexPath();
|