Procházet zdrojové kódy

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

wangqiong123 před 2 roky
rodič
revize
9b9e52d13d

+ 3
- 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java Zobrazit soubor

@@ -165,8 +165,9 @@ public class MsCaseApplicationController extends BaseController {
165 165
      * @return
166 166
      */
167 167
     @PostMapping("/accept")
168
-    public AjaxResult accept(@RequestBody MsCaseApplication req ) {
169
-        if (StrUtil.isEmpty(req.getMediationMethod())
168
+    public AjaxResult accept(@RequestBody MsCaseApplicationVO req ) {
169
+        if (StrUtil.isEmpty(req.getMediationMethod() )
170
+                || req.getAgreeFlag()==null
170 171
                 || req.getPaperFlag() == null
171 172
                 || req.getCaseFlowId() == null
172 173
                 || req.getArbitrateConfirm() == null

+ 4
- 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java Zobrazit soubor

@@ -76,6 +76,10 @@ public class Constants
76 76
      * 验证码有效期(分钟)
77 77
      */
78 78
     public static final Integer CAPTCHA_EXPIRATION = 2;
79
+    /**
80
+     * 案件受理有效期(日)
81
+     */
82
+    public static final Integer CASE_ACCEPT_EXPIRATION = 5;
79 83
 
80 84
     /**
81 85
      * 令牌

+ 2
- 2
ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java Zobrazit soubor

@@ -13,12 +13,12 @@ public enum AnnexTypeEnum implements EnumsInterface {
13 13
     APPLICATION(1, "仲裁申请书"),
14 14
     APPLICATION_EVIDENCE(2, "申请人证据"),
15 15
     MEDIATION_APPLICATION(3, "调解申请书"),
16
-    PAYMENT_RECEIPT(4, "缴费单"),
16
+    PAYMENT_RECEIPT(4, "申请人缴费单"),
17 17
     MEETING_VIDEO(5, "会议视频"),
18 18
     MEDIATE(6, "庭审笔录"),
19 19
     MEDIATE_BOOK(7, "调解书"),
20 20
     MEDIATION_FILES(8, "调解资料"),
21
-
21
+    RES_PAYMENT_RECEIPT(9, "被申请人缴费单"),
22 22
     SEAL_PICTURE(10, "印章图片"),
23 23
 
24 24
 

+ 31
- 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java Zobrazit soubor

@@ -1,14 +1,21 @@
1 1
 package com.ruoyi.framework.config;
2 2
 
3
+import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
3 4
 import org.springframework.cache.annotation.CachingConfigurerSupport;
4 5
 import org.springframework.cache.annotation.EnableCaching;
6
+import org.springframework.context.ApplicationListener;
5 7
 import org.springframework.context.annotation.Bean;
6 8
 import org.springframework.context.annotation.Configuration;
7 9
 import org.springframework.data.redis.connection.RedisConnectionFactory;
10
+import org.springframework.data.redis.core.RedisKeyExpiredEvent;
8 11
 import org.springframework.data.redis.core.RedisTemplate;
9 12
 import org.springframework.data.redis.core.script.DefaultRedisScript;
13
+import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
14
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
10 15
 import org.springframework.data.redis.serializer.StringRedisSerializer;
11 16
 
17
+import javax.annotation.Resource;
18
+
12 19
 /**
13 20
  * redis配置
14 21
  * 
@@ -18,6 +25,9 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
18 25
 @EnableCaching
19 26
 public class RedisConfig extends CachingConfigurerSupport
20 27
 {
28
+    @Resource
29
+     MsCaseApplicationService caseApplicationService;
30
+
21 31
     @Bean
22 32
     @SuppressWarnings(value = { "unchecked", "rawtypes" })
23 33
     public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
@@ -47,7 +57,28 @@ public class RedisConfig extends CachingConfigurerSupport
47 57
         redisScript.setResultType(Long.class);
48 58
         return redisScript;
49 59
     }
60
+    @Bean
61
+    public RedisMessageListenerContainer listenerContainer(RedisConnectionFactory connectionFactory) {
62
+        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
63
+        container.setConnectionFactory(connectionFactory);
64
+        //container.addMessageListener(new KeyExpirationMessageListener(), new PatternTopic("__keyevent@0__:expired"));
65
+        return container;
66
+    }
67
+
68
+
69
+    @Bean
70
+    public KeyExpirationEventMessageListener keyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer) {
71
+        return new KeyExpirationEventMessageListener(listenerContainer);
72
+    }
50 73
 
74
+    @Bean
75
+    public ApplicationListener applicationListener() {
76
+        return (ApplicationListener<RedisKeyExpiredEvent>) event -> {
77
+            String key = new String(event.getSource());
78
+           // 根据key查询案件表
79
+            caseApplicationService.notAccept(key,"已超过案件受理期限五日,");
80
+        };
81
+    }
51 82
     /**
52 83
      * 限流脚本
53 84
      */

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java Zobrazit soubor

@@ -173,6 +173,7 @@ public class MsCaseApplication {
173 173
     /**
174 174
      * 版本号
175 175
      */
176
+    @Column(name = "version")
176 177
     private Integer version;
177 178
 
178 179
     /**
@@ -184,6 +185,7 @@ public class MsCaseApplication {
184 185
     /**
185 186
      * 事实和理由
186 187
      */
188
+    @Column(name = "facts")
187 189
     private String facts;
188 190
 
189 191
 

+ 8
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java Zobrazit soubor

@@ -57,5 +57,13 @@ public class MsCaseApplicationVO extends MsCaseApplication {
57 57
      * 待办状态,0-待办,1-已办
58 58
      */
59 59
     private Integer pendingStatus;
60
+    /**
61
+     * 是否同意。0-拒绝,1-同意
62
+     */
63
+    private Integer agreeFlag;
64
+    /**
65
+     * 拒绝原因
66
+     */
67
+    private String rejectReason;
60 68
 
61 69
 }

+ 8
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java Zobrazit soubor

@@ -117,7 +117,7 @@ public interface MsCaseApplicationService {
117 117
      * @param req
118 118
      * @return
119 119
      */
120
-    AjaxResult accept(MsCaseApplication req);
120
+    AjaxResult accept(MsCaseApplicationVO req);
121 121
 
122 122
     /**
123 123
      * 案件提交
@@ -189,7 +189,7 @@ public interface MsCaseApplicationService {
189 189
      * @param req
190 190
      * @param affiliateMap
191 191
      */
192
-     void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) ;
192
+     void accept(MsCaseApplication application, MsCaseApplicationVO req, Map<Long, MsCaseAffiliate> affiliateMap) ;
193 193
     /**
194 194
      * 判断申请人/被申请人是否预约
195 195
      * @param vo
@@ -202,4 +202,10 @@ public interface MsCaseApplicationService {
202 202
      * @return
203 203
      */
204 204
      void verifyMediator(MsCaseApplication application,BookingVO vo);
205
+
206
+    /**
207
+     * 案件不予受理
208
+     * @param caseId
209
+     */
210
+     void notAccept(String caseId,String reason);
205 211
 }

+ 24
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCasePaymentService.java Zobrazit soubor

@@ -1,8 +1,10 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.mscase;
2 2
 
3 3
 import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
4 5
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
5 6
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
7
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
6 8
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO;
7 9
 
8 10
 public interface MsCasePaymentService {
@@ -32,5 +34,27 @@ public interface MsCasePaymentService {
32 34
      */
33 35
     PaymentDetailVO selectPaymentDetail(Long id);
34 36
 
37
+    /**
38
+     * 确认已缴费
39
+     * @param dto
40
+     * @return
41
+     */
35 42
     AjaxResult confirmPaid(CaseConfirmPayDTO dto);
43
+
44
+    /**
45
+     * 确认已缴费
46
+     * @param currentFlow
47
+     * @param nextFlow
48
+     * @param application
49
+     */
50
+    public void confirmPaid(MsCaseFlow currentFlow, MsCaseFlow nextFlow, MsCaseApplication application);
51
+    /**
52
+     * 确认缴费
53
+     *
54
+     * @param nextFlow
55
+     * @param application
56
+     * @param dto
57
+     */
58
+
59
+    public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto);
36 60
 }

+ 97
- 22
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Zobrazit soubor

@@ -331,7 +331,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
331 331
                     // 生成调解申请书
332 332
                         req.setTemplateId(String.valueOf(templateManage.getId()));
333 333
                     // todo 部署放开
334
-                   // caseApplicationService.generateApplication(req);
334
+                    caseApplicationService.generateApplication(req);
335 335
 
336 336
                 }
337 337
 
@@ -523,17 +523,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
523 523
     @Override
524 524
     public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) {
525 525
         UUID uuid = UUID.randomUUID();
526
-        // todo 压缩包解压路径
526
+        // 压缩包解压路径
527 527
         String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/";
528
-//        String targetPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
529 528
         File zipFile = null;
530 529
         InputStream ins = null;
531 530
         try {
532 531
             ins = file.getInputStream();
533 532
             //上传的压缩包保存的路径
534
-            // todo
535 533
             String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
536
-//           String savePath = "D:/home/ruoyi/uploadPath/upload/zipFile/";
537 534
             String saveName = uuid + "_" + file.getOriginalFilename();
538 535
             zipFile = new File(savePath + saveName);
539 536
             inputChangeToFile(ins, zipFile);
@@ -813,7 +810,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
813 810
      */
814 811
     @Transactional
815 812
     @Override
816
-    public AjaxResult accept(MsCaseApplication req) {
813
+    public AjaxResult accept(MsCaseApplicationVO req) {
817 814
         if (StrUtil.isNotEmpty(req.getBatchNumber())) {
818 815
             // 根据批号查询未锁定的案件
819 816
             List<MsCaseApplication> applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId());
@@ -829,25 +826,43 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
829 826
             }
830 827
             Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity()));
831 828
             for (MsCaseApplication application : applicationList) {
832
-                caseApplicationService.accept(application,req,affiliateMap);
829
+                // 不受理
830
+                if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){
831
+                    if(StrUtil.isEmpty(req.getRejectReason())){
832
+                        throw new ServiceException("请填写拒绝原因");
833
+                    }
834
+                    caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason());
835
+                }else {
836
+                    caseApplicationService.accept(application,req,affiliateMap);
837
+                }
838
+
833 839
             }
834 840
 
835 841
         } else {
836
-            // 查询案件信息
837
-            MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
838
-            // 根据案件id查询案件相关人
839
-            MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId());
840
-            if (application==null||caseAffiliate == null) {
841
-                return AjaxResult.error("该案件不存在");
842
+            // 不受理
843
+            if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){
844
+                if(StrUtil.isEmpty(req.getRejectReason())){
845
+                    throw new ServiceException("请填写拒绝原因");
846
+                }
847
+                caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason());
848
+            }else {
849
+                // 查询案件信息
850
+                MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
851
+                // 根据案件id查询案件相关人
852
+                MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId());
853
+                if (application==null||caseAffiliate == null) {
854
+                    return AjaxResult.error("该案件不存在");
855
+                }
856
+                // 锁定该案件
857
+                application.setLockStatus(YesOrNoEnum.YES.getCode());
858
+                Map<Long, MsCaseAffiliate> affiliateMap=new HashMap<>();
859
+                affiliateMap.put(req.getId(),caseAffiliate);
860
+                caseApplicationService.accept(application,req,affiliateMap);
842 861
             }
843
-            // 锁定该案件
844
-            application.setLockStatus(YesOrNoEnum.YES.getCode());
845
-            Map<Long, MsCaseAffiliate> affiliateMap=new HashMap<>();
846
-            affiliateMap.put(req.getId(),caseAffiliate);
847
-            caseApplicationService.accept(application,req,affiliateMap);
862
+
848 863
         }
849 864
 
850
-        return AjaxResult.success("受理成功");
865
+        return AjaxResult.success();
851 866
     }
852 867
     /**
853 868
      * 案件受理
@@ -856,7 +871,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
856 871
      * @param affiliateMap
857 872
      */
858 873
     @Transactional
859
-    public void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
874
+    public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map<Long, MsCaseAffiliate> affiliateMap) {
875
+
876
+
860 877
         application.setPaperFlag(req.getPaperFlag());
861 878
         application.setArbitrateConfirm(req.getArbitrateConfirm());
862 879
         application.setMediationMethod(req.getMediationMethod());
@@ -870,7 +887,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
870 887
             MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
871 888
 
872 889
             if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
873
-                String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
890
+                String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
874 891
                 // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
875 892
                 Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()});
876 893
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent);
@@ -885,7 +902,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
885 902
             }
886 903
             // 给申请人被申请人发送短信
887 904
             if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
888
-                String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
905
+                String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
889 906
                 // 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
890 907
                 Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
891 908
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
@@ -1167,6 +1184,64 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1167 1184
         CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
1168 1185
 
1169 1186
     }
1187
+
1188
+    /**
1189
+     * 案件不予受理
1190
+     * @param caseId
1191
+     */
1192
+    @Transactional
1193
+    @Override
1194
+    public void notAccept(String caseId,String reason) {
1195
+        if(StrUtil.isEmpty(caseId)){
1196
+            return;
1197
+        }
1198
+        Long id = Long.valueOf(caseId);
1199
+        // 根据案件id查询案件
1200
+        MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id);
1201
+        MsCaseAffiliate affiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
1202
+        if(application==null || affiliate==null){
1203
+            return;
1204
+        }
1205
+        if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){
1206
+            // 超过五日还没有受理,给申请人发送不受理通知
1207
+                String phone="";
1208
+                if(affiliate.getOrganizeFlag().equals(0)){
1209
+                    // 自然人
1210
+                    if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){
1211
+                        phone=affiliate.getContactTelphoneAgent();
1212
+                    }else {
1213
+                        phone=affiliate.getApplicationPhone();
1214
+                    }
1215
+
1216
+                }else {
1217
+                    phone=affiliate.getContactTelphoneAgent();
1218
+                }
1219
+                if(StrUtil.isNotEmpty(phone)) {
1220
+                    // 发送短信 2065809 案件不予受理通知    尊敬的用户,您编号为{1}的案件由于{2}所以不予受理,请知晓,如非本人操作,请忽略本短信。
1221
+                    Boolean smsFlag = SmsUtils.sendSms(id, "2065809", phone, new String[]{application.getCaseNum(),reason});
1222
+                    String sendContent = "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于"+reason+"所以不予受理,请知晓,如非本人操作,请忽略本短信。";
1223
+                    CaseLogUtils.insertCaseLog(application.getId(), application.getCaseFlowId(), application.getCaseStatusName(), sendContent);
1224
+
1225
+                    // 新增短信记录
1226
+                    SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), phone, new Date(), sendContent);
1227
+                    if(smsFlag){
1228
+                        smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
1229
+                    }else {
1230
+                        smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
1231
+                    }
1232
+                    smsRecordMapper.saveSmsSendRecord(smsSendRecord);
1233
+                }
1234
+                // 修改案件状态为17,结束
1235
+                MsCaseApplication caseApplication = new MsCaseApplication();
1236
+                caseApplication.setId(id);
1237
+                caseApplication.setCaseFlowId(17);
1238
+                caseApplication.setCaseStatusName("结束");
1239
+                msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication);
1240
+                CaseLogUtils.insertCaseLog(application.getId(), 17, "结束", null);
1241
+
1242
+        }
1243
+    }
1244
+
1170 1245
     /**
1171 1246
      * 查询预约信息
1172 1247
      * @param id

+ 58
- 8
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java Zobrazit soubor

@@ -5,16 +5,20 @@ import cn.hutool.core.collection.CollectionUtil;
5 5
 import cn.hutool.core.util.StrUtil;
6 6
 import cn.hutool.json.JSONObject;
7 7
 import com.ruoyi.ElegentPay;
8
+import com.ruoyi.common.constant.Constants;
8 9
 import com.ruoyi.common.core.domain.AjaxResult;
10
+import com.ruoyi.common.core.redis.RedisCache;
9 11
 import com.ruoyi.common.enums.AnnexTypeEnum;
10 12
 import com.ruoyi.common.enums.PaymentStatusEnum;
11 13
 import com.ruoyi.common.enums.YesOrNoEnum;
14
+import com.ruoyi.common.utils.SmsUtils;
12 15
 import com.ruoyi.dto.PayRequest;
13 16
 import com.ruoyi.dto.PayResponse;
14 17
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
15 18
 import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
16 19
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
17 20
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
21
+import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
18 22
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
19 23
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
20 24
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
@@ -38,6 +42,7 @@ import java.math.BigDecimal;
38 42
 import java.util.ArrayList;
39 43
 import java.util.Date;
40 44
 import java.util.List;
45
+import java.util.concurrent.TimeUnit;
41 46
 
42 47
 @Service
43 48
 public class MsCasePaymentServiceImpl implements MsCasePaymentService {
@@ -57,6 +62,10 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
57 62
     MsCaseFlowMapper caseFlowMapper;
58 63
     @Autowired
59 64
     MsCaseAffiliateMapper caseAffiliateMapper;
65
+    @Autowired
66
+    MsCasePaymentService casePaymentService;
67
+    @Autowired
68
+    private RedisCache redisCache;
60 69
 
61 70
 
62 71
     @Override
@@ -161,7 +170,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
161 170
                 return AjaxResult.error("该批号下未找到案件");
162 171
             }
163 172
             for (MsCaseApplication application : applicationList) {
164
-                confirmPayment(currentFlow,nextFlow, application, dto);
173
+                casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto);
165 174
 
166 175
             }
167 176
         } else {
@@ -169,7 +178,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
169 178
             MsCaseApplication application = new MsCaseApplication();
170 179
             application.setId(dto.getCaseId());
171 180
             application.setLockStatus(YesOrNoEnum.YES.getCode());
172
-            confirmPayment(currentFlow,nextFlow, application, dto);
181
+            casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto);
173 182
 
174 183
         }
175 184
         return AjaxResult.success("确认缴费成功");
@@ -277,13 +286,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
277 286
                 return AjaxResult.error("该批号下未找到案件");
278 287
             }
279 288
             for (MsCaseApplication application : applicationList) {
280
-                confirmPaid(currentFlow,nextFlow, application);
289
+                casePaymentService.confirmPaid(currentFlow,nextFlow, application);
281 290
             }
282 291
         }else {
283 292
             MsCaseApplication caseApplication=new MsCaseApplication();
284 293
             caseApplication.setId(dto.getCaseId());
285 294
             caseApplication.setLockStatus(YesOrNoEnum.YES.getCode());
286
-            confirmPaid(currentFlow,nextFlow,caseApplication );
295
+            casePaymentService.confirmPaid(currentFlow,nextFlow,caseApplication );
287 296
         }
288 297
 
289 298
 
@@ -296,7 +305,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
296 305
      * @param application
297 306
      * @param
298 307
      */
299
-    private void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) {
308
+    @Transactional
309
+    public void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) {
310
+        // 查询案件
311
+        MsCaseApplication caseAppllication = caseApplicationMapper.selectByPrimaryKey(application.getId());
312
+        if(caseAppllication==null){
313
+            throw new RuntimeException("未找到该案件");
314
+        }
300 315
         //更改记录表里的支付状态和支付时间
301 316
         MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord();
302 317
         casePaymentRecord.setPaymentStatus(1);
@@ -310,11 +325,46 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
310 325
         application.setCaseFlowId(nextFlow.getId());
311 326
         application.setCaseStatusName(nextFlow.getCaseStatusName());
312 327
         caseApplicationMapper.updateByPrimaryKeySelective(application);
328
+        // 将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束
329
+        redisCache.setCacheObject(String.valueOf(application.getId()), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS);
330
+
313 331
         // 新增日志
314 332
         CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费");
315
-        // todo 发送短信
316 333
 
334
+        // 查询申请人电话,如果是自然人,代理人不为空,则给代理人发短信,代理人为空,给申请人发短信
335
+        MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId());
336
+        if(affiliate != null) {
337
+            String phone="";
338
+            String userName="";
339
+            if(affiliate.getOrganizeFlag().equals(0)){
340
+                // 自然人
341
+                if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){
342
+                    phone=affiliate.getContactTelphoneAgent();
343
+                    userName=affiliate.getNameAgent();
344
+                }else {
345
+                    phone=affiliate.getApplicationPhone();
346
+                    userName=affiliate.getApplicationName();
347
+                }
317 348
 
349
+            }else {
350
+                phone=affiliate.getContactTelphoneAgent();
351
+                userName=affiliate.getNameAgent();
352
+            }
353
+            if(StrUtil.isNotEmpty(phone)) {
354
+                // 发送短信 2051914 调解缴费成功通知   尊敬的{1},您的调解申请费用已缴费成功。
355
+                Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", phone, new String[]{userName});
356
+                CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "申请人调解缴费成功通知短信,尊敬的" + userName + ",您的调解申请费用已缴费成功。");
357
+
358
+                // 新增短信记录
359
+                SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + ",您的调解申请费用已缴费成功。");
360
+                if(smsFlag){
361
+                    smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
362
+                }else {
363
+                    smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
364
+                }
365
+                smsRecordMapper.saveSmsSendRecord(smsSendRecord);
366
+            }
367
+        }
318 368
     }
319 369
 
320 370
     /**
@@ -324,8 +374,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
324 374
      * @param application
325 375
      * @param dto
326 376
      */
327
-
328
-    private void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
377
+    @Transactional
378
+    public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
329 379
         application.setPayType(dto.getPayType());
330 380
         // 修改缴费附件
331 381
         if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {