Browse Source

Merge branch 'dev' of http://git.xayunmei.com/SH-Arbitrate/Mediation-Backend into bgy

wangqiong 2 years ago
parent
commit
5e544e6d4e

+ 76
- 61
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java View File

@@ -74,6 +74,8 @@ import java.text.SimpleDateFormat;
74 74
 import java.time.LocalDate;
75 75
 import java.time.format.DateTimeFormatter;
76 76
 import java.util.*;
77
+import java.util.concurrent.CompletableFuture;
78
+import java.util.concurrent.ExecutorService;
77 79
 import java.util.function.Function;
78 80
 import java.util.stream.Collectors;
79 81
 
@@ -1609,20 +1611,23 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1609 1611
         application.setUpdateBy(SecurityUtils.getUsername());
1610 1612
         application.setUpdateTime(new Date());
1611 1613
         application.setBatchNumber(null);
1612
-        // 给被申请人发送短信
1613
-        if (affiliateMap.containsKey(application.getId())) {
1614
-            List<MsCaseAffiliate> affiliates = affiliateMap.get(application.getId());
1615
-            // 被申受理分配通知
1616
-            SMSNoticeDO resNotice = new SMSNoticeDO("待缴费通知",
1617
-                    "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信。",
1618
-                    "2074247",
1619
-                    new String[]{application.getCaseNum()}
1620
-            );
1621
-            SMSNotice notice = new SMSNotice(null,resNotice);
1622
-            caseApplicationService.sendNotice(application,affiliates,false,notice);
1623
-        }
1614
+
1624 1615
         msCaseApplicationMapper.updateByPrimaryKeySelective(application);
1625 1616
         caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
1617
+        ExecutorService executor = ThreadUtil.createThreadPool();
1618
+        CompletableFuture.runAsync(() -> {
1619
+            // 给被申请人发送短信
1620
+            if (affiliateMap.containsKey(application.getId())) {
1621
+                List<MsCaseAffiliate> affiliates = affiliateMap.get(application.getId());
1622
+                // 被申受理分配通知
1623
+                SMSNoticeDO resNotice = new SMSNoticeDO("待缴费通知",
1624
+                        "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信。",
1625
+                        "2074247",
1626
+                        new String[]{application.getCaseNum()}
1627
+                );
1628
+                SMSNotice notice = new SMSNotice(null,resNotice);
1629
+                caseApplicationService.sendNotice(application,affiliates,false,notice);
1630
+            }}, executor);
1626 1631
     }
1627 1632
 
1628 1633
     /**
@@ -1639,6 +1644,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1639 1644
         if(selectApplication==null){
1640 1645
             return;
1641 1646
         }
1647
+        ExecutorService executor = ThreadUtil.createThreadPool();
1648
+        CompletableFuture.runAsync(() -> {
1642 1649
         List<String> appPhones=new ArrayList<>();
1643 1650
         List<String> resPhones=new ArrayList<>();
1644 1651
         List<String> appEmails=new ArrayList<>();
@@ -1682,7 +1689,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1682 1689
                     }
1683 1690
                 }
1684 1691
             }
1685
-        }
1692
+        }}, executor);
1686 1693
     }
1687 1694
 
1688 1695
     /**
@@ -2125,54 +2132,58 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2125 2132
         msCaseApplicationMapper.updateByPrimaryKeySelective(application);
2126 2133
         // 根据案件id查询案件
2127 2134
         MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId());
2128
-        // 发送开庭短信
2129
-        if(CollectionUtil.isNotEmpty(vo.getHerDates())) {
2130
-            List<MsCaseAffiliate> affiliates = selectAffliatesByCaseId(application.getId());
2131
-            caseApplication.setHearDate(application.getHearDate());
2132
-            // 申请人发送开庭日期短信
2133
-            sendHearDateSms(caseApplication, affiliates);
2134
-
2135
-            // 调解员发送短信,根据调解员id查询用户
2136
-            if (caseApplication.getMediatorId() != null) {
2137
-               // 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
2138
-                SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId());
2139
-                String  content="尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为"+application.getHearDate()+",请知晓,如非本人操作,请忽略本短信。";
2140
-                String templateId="2077966";
2141
-                String subject="开庭日期通知";
2142
-                MsCaseAffiliate meditorAffliate = new MsCaseAffiliate();
2143
-                meditorAffliate.setPhone(sysUser.getPhonenumber());
2144
-                meditorAffliate.setEmail(sysUser.getEmail());
2145
-                String roomUuid=null;
2146
-                // 线上调解
2147
-                if(StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")){
2148
-                    // 获取短信链接uuid
2149
-                    MeetingInfoVO meetingInfoVO= MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build();
2150
-                     roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
2151
-                    // 短信模板:2130103 线上调解时间和会议通知  尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信.
2152
-
2153
-                    content="尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为"+application.getHearDate()+"会议链接https://txroom.xayunmei.com/#/home?"+roomUuid+",请点击链接参加会议,如非本人操作,请忽略本短信.";
2154
-                    templateId = "2130103";
2155
-                }
2156
-                // 电话号不为空,发送短信,否则发邮箱
2157
-                if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
2158
-                    if(roomUuid==null) {
2159
-                        SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
2160
-                                new String[]{caseApplication.getCaseNum(), application.getHearDate()});
2161
-                    }else {
2162
-                        SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
2163
-                                new String[]{caseApplication.getCaseNum(), application.getHearDate(),roomUuid});
2164
-                    }
2135
+        long l = System.currentTimeMillis();
2136
+        ExecutorService executor = ThreadUtil.createThreadPool();
2137
+        CompletableFuture.runAsync(() -> {
2138
+                    // 发送开庭短信
2139
+                    if (CollectionUtil.isNotEmpty(vo.getHerDates())) {
2140
+                        List<MsCaseAffiliate> affiliates = selectAffliatesByCaseId(application.getId());
2141
+                        caseApplication.setHearDate(application.getHearDate());
2142
+                        // 申请人发送开庭日期短信
2143
+                        sendHearDateSms(caseApplication, affiliates);
2165 2144
 
2166 2145
 
2146
+                    }
2147
+                }, executor);
2148
+        // 调解员发送短信,根据调解员id查询用户
2149
+        CompletableFuture.runAsync(() -> { if (caseApplication.getMediatorId() != null) {
2150
+            // 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
2151
+            SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId());
2152
+            String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + application.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。";
2153
+            String templateId = "2077966";
2154
+            String subject = "开庭日期通知";
2155
+            MsCaseAffiliate meditorAffliate = new MsCaseAffiliate();
2156
+            meditorAffliate.setPhone(sysUser.getPhonenumber());
2157
+            meditorAffliate.setEmail(sysUser.getEmail());
2158
+            String roomUuid = null;
2159
+            // 线上调解
2160
+            if (StrUtil.isNotEmpty(application.getMediationMethod()) && application.getMediationMethod().equals("1")) {
2161
+                // 获取短信链接uuid
2162
+                MeetingInfoVO meetingInfoVO = MeetingInfoVO.builder().userId(sysUser.getUserId()).userName(sysUser.getUserName()).caseId(application.getId()).roomId(application.getRoomId()).build();
2163
+                roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
2164
+                // 短信模板:2130103 线上调解时间和会议通知  尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信.
2165
+
2166
+                content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" + roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信.";
2167
+                templateId = "2130103";
2168
+            }
2169
+            // 电话号不为空,发送短信,否则发邮箱
2170
+            if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
2171
+                if (roomUuid == null) {
2172
+                    SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
2173
+                            new String[]{caseApplication.getCaseNum(), application.getHearDate()});
2167 2174
                 } else {
2168
-                    // 发送邮件
2169
-                    caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content);
2170
-
2175
+                    SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
2176
+                            new String[]{caseApplication.getCaseNum(), application.getHearDate(), roomUuid});
2171 2177
                 }
2178
+
2179
+
2180
+            } else {
2181
+                // 发送邮件
2182
+                caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content);
2183
+
2172 2184
             }
2173
-        }
2185
+        } }, executor);
2174 2186
         // 新增日志
2175
-
2176 2187
         CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2177 2188
 
2178 2189
     }
@@ -2327,7 +2338,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2327 2338
         application.setRejectReason(reason);
2328 2339
         if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){
2329 2340
             // todo 超过五日还没有受理,给申请操作人发送不受理通知,有手机号发短信,没有手机号发邮箱
2330
-            // 申请人不受理分配通知
2341
+            // 申请人不受理分配通知 // todo 短信异步
2342
+            ExecutorService executor = ThreadUtil.createThreadPool();
2343
+            CompletableFuture.runAsync(() -> {
2331 2344
             String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason();
2332 2345
             SMSNoticeDO applicantNotice = new SMSNoticeDO("案件不受理通知",
2333 2346
                     "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于" + rejectReason + "所以不予受理,请知晓,如非本人操作,请忽略本短信。",
@@ -2337,6 +2350,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2337 2350
 
2338 2351
             SMSNotice notice = new SMSNotice(applicantNotice,null);
2339 2352
             caseApplicationService.sendNotice(application,affiliates,true,notice);
2353
+            }, executor);
2340 2354
                 // 修改案件状态为17,结束
2341 2355
                 MsCaseApplication caseApplication = new MsCaseApplication();
2342 2356
                 caseApplication.setId(id);
@@ -2419,6 +2433,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2419 2433
     @Transactional(rollbackFor = Exception.class)
2420 2434
     @Override
2421 2435
     public AjaxResult mediation(MsCaseApplicationReq req) throws EsignDemoException, InterruptedException {
2436
+        req.setSealFlag(null);
2422 2437
         // 查询案件是否存在
2423 2438
         MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
2424 2439
         if (application == null) {
@@ -2709,7 +2724,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2709 2724
                                     if (caseFlow != null) {
2710 2725
                                         application.setCaseFlowId(caseFlow.getId());
2711 2726
                                         application.setCaseStatusName(caseFlow.getCaseStatusName());
2712
-                                        msCaseApplicationMapper.updateByPrimaryKey(application);
2727
+                                        msCaseApplicationMapper.updateByPrimaryKeySelective(application);
2713 2728
                                         // 新增日志
2714 2729
                                         CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2715 2730
                                     }
@@ -2748,7 +2763,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2748 2763
                     application.setCaseFlowId(caseFlow.getId());
2749 2764
                     application.setCaseStatusName(caseFlow.getCaseStatusName());
2750 2765
                     application.setMediaResult(mediaResult);
2751
-                    msCaseApplicationMapper.updateByPrimaryKey(application);
2766
+                    msCaseApplicationMapper.updateByPrimaryKeySelective(application);
2752 2767
                 }
2753 2768
                 return AjaxResult.success();
2754 2769
             } else if (mediaResult == 3) {
@@ -2760,7 +2775,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2760 2775
                     application.setCaseFlowId(caseFlow.getId());
2761 2776
                     application.setCaseStatusName(caseFlow.getCaseStatusName());
2762 2777
                     application.setMediaResult(mediaResult);
2763
-                    msCaseApplicationMapper.updateByPrimaryKey(application);
2778
+                    msCaseApplicationMapper.updateByPrimaryKeySelective(application);
2764 2779
                     // 新增日志
2765 2780
                     CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
2766 2781
                     // 新增结束日志
@@ -2802,7 +2817,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2802 2817
                     application.setCaseFlowId(caseFlow.getId());
2803 2818
                     application.setCaseStatusName(caseFlow.getCaseStatusName());
2804 2819
                     application.setMediaResult(mediaResult);
2805
-                    msCaseApplicationMapper.updateByPrimaryKey(application);
2820
+                    msCaseApplicationMapper.updateByPrimaryKeySelective(application);
2806 2821
                 }
2807 2822
 
2808 2823
                 return AjaxResult.success();
@@ -3051,7 +3066,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
3051 3066
                 application.setCaseFlowId(caseFlow.getId());
3052 3067
                 application.setCaseStatusName(caseFlow.getCaseStatusName());
3053 3068
                 application.setMediaResult(mediaResult);
3054
-                msCaseApplicationMapper.updateByPrimaryKey(application);
3069
+                msCaseApplicationMapper.updateByPrimaryKeySelective(application);
3055 3070
                 // 新增日志
3056 3071
                 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
3057 3072
                 if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) {

+ 9
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java View File

@@ -14,6 +14,7 @@ import com.ruoyi.common.enums.PaymentStatusEnum;
14 14
 import com.ruoyi.common.enums.YesOrNoEnum;
15 15
 import com.ruoyi.common.exception.ServiceException;
16 16
 import com.ruoyi.common.utils.SecurityUtils;
17
+import com.ruoyi.common.utils.ThreadUtil;
17 18
 import com.ruoyi.common.utils.spring.SpringUtils;
18 19
 import com.ruoyi.dto.PayRequest;
19 20
 import com.ruoyi.dto.PayResponse;
@@ -41,6 +42,8 @@ import java.math.BigDecimal;
41 42
 import java.util.ArrayList;
42 43
 import java.util.Date;
43 44
 import java.util.List;
45
+import java.util.concurrent.CompletableFuture;
46
+import java.util.concurrent.ExecutorService;
44 47
 import java.util.concurrent.TimeUnit;
45 48
 import java.util.stream.Collectors;
46 49
 
@@ -339,7 +342,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
339 342
         }
340 343
         casePaymentRecord.setCaseId(application.getId());
341 344
         Example example = new Example(MsCasePaymentRecord.class);
342
-        example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId());casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example);
345
+        example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId());
346
+        casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example);
343 347
         // 更改案件流程id和案件状态
344 348
         application.setCaseFlowId(flow.getId());
345 349
         application.setCaseStatusName(flow.getCaseStatusName());
@@ -379,6 +383,9 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
379 383
         if(CollectionUtil.isEmpty(operatorList)){
380 384
             throw new ServiceException("未找到案件操作人员");
381 385
         }
386
+        // 异步发送短信
387
+        ExecutorService executor = ThreadUtil.createThreadPool();
388
+        CompletableFuture.runAsync(() -> {
382 389
         if(dto.getApplicantConfirm()) {
383 390
             List<String> appPhones=new ArrayList<>();
384 391
 
@@ -427,7 +434,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
427 434
 
428 435
                 }
429 436
             }
430
-        }
437
+        }}, executor);
431 438
     }
432 439
 
433 440
 

+ 2
- 4
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java View File

@@ -522,7 +522,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
522 522
             return AjaxResult.error("未找到案件被申请操作人");
523 523
         }
524 524
         MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(caseId);
525
-        Integer organizeFlag = caseApplication.getOrganizeFlag();
525
+
526 526
         Long userId = SecurityUtils.getUserId();
527 527
 
528 528
         if(appOpt.get().getUserId()!=null && appOpt.get().getUserId().equals(userId)){
@@ -533,7 +533,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
533 533
             List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(mssealSignRecord);
534 534
             if (sealSignRecords != null && sealSignRecords.size() > 0) {
535 535
                 String signFlowid = sealSignRecords.get(0).getSignFlowId();
536
-                if(organizeFlag!=null){
537 536
                     SealSignRecord sealSignRecord = new SealSignRecord();
538 537
                     sealSignRecord.setPensonAccount(appOpt.get().getPhone());
539 538
                     sealSignRecord.setPensonName(appOpt.get().getName());
@@ -549,7 +548,6 @@ public class MsSignSealServiceImpl implements MsSignSealService {
549 548
                         String urlapply = signUrlData.get("shortUrl").getAsString();
550 549
                         sealSignRecordres.setSealUrl(urlapply);
551 550
                     }
552
-                }
553 551
                 return AjaxResult.success(sealSignRecordres);
554 552
             }else {
555 553
                 return AjaxResult.error();
@@ -674,7 +672,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
674 672
                                 signStatusMediator!=null&&signStatusMediator.equals(1)){
675 673
                             // 根据流程id查找下一个流程节点
676 674
                             MsCaseFlow nextFlow=null;
677
-                            if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
675
+                            if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag().equals(1)) {
678 676
                                 // 需要用印
679 677
                                  nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
680 678
                             }else {

+ 9
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/shortmessage/impl/ShortMessageServiceImpl.java View File

@@ -121,11 +121,18 @@ public class ShortMessageServiceImpl implements ShortMessageService {
121 121
             List<String> recordParamList = recordParamContentMap.get(record.getId());
122 122
             if(recordParamContentMap.containsKey(record.getId()) && templateParamMap.containsKey(record.getMsSmsTemplateId())){
123 123
                 List<MsSmsTemplateParam> templateParamList = templateParamMap.get(record.getMsSmsTemplateId());
124
+                ArrayList<MsSmsTemplateParam> copyParamList = new ArrayList<>();
124 125
                 for (int i = 0; i < templateParamList.size(); i++) {
125 126
                     MsSmsTemplateParam templateParam = templateParamList.get(i);
126
-                    templateParam.setParamValue(recordParamContentMap.get(record.getId()).get(i));
127
+                    MsSmsTemplateParam msSmsTemplateParam =new MsSmsTemplateParam();
128
+                    msSmsTemplateParam.setParam(templateParam.getParam());
129
+                    msSmsTemplateParam.setSmsTemplateId(templateParam.getSmsTemplateId());
130
+                    msSmsTemplateParam.setParamName(templateParam.getParamName());
131
+                    msSmsTemplateParam.setId(templateParam.getId());
132
+                    msSmsTemplateParam.setParamValue(recordParamContentMap.get(record.getId()).get(i));
133
+                    copyParamList.add(msSmsTemplateParam);
127 134
                 }
128
-                record.setTemplateParams(templateParamList);
135
+                record.setTemplateParams(copyParamList);
129 136
 
130 137
             }
131 138
             // 按顺序替换占位符