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
      * @return
165
      * @return
166
      */
166
      */
167
     @PostMapping("/accept")
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
                 || req.getPaperFlag() == null
171
                 || req.getPaperFlag() == null
171
                 || req.getCaseFlowId() == null
172
                 || req.getCaseFlowId() == null
172
                 || req.getArbitrateConfirm() == null
173
                 || req.getArbitrateConfirm() == null

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

76
      * 验证码有效期(分钟)
76
      * 验证码有效期(分钟)
77
      */
77
      */
78
     public static final Integer CAPTCHA_EXPIRATION = 2;
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
     APPLICATION(1, "仲裁申请书"),
13
     APPLICATION(1, "仲裁申请书"),
14
     APPLICATION_EVIDENCE(2, "申请人证据"),
14
     APPLICATION_EVIDENCE(2, "申请人证据"),
15
     MEDIATION_APPLICATION(3, "调解申请书"),
15
     MEDIATION_APPLICATION(3, "调解申请书"),
16
-    PAYMENT_RECEIPT(4, "缴费单"),
16
+    PAYMENT_RECEIPT(4, "申请人缴费单"),
17
     MEETING_VIDEO(5, "会议视频"),
17
     MEETING_VIDEO(5, "会议视频"),
18
     MEDIATE(6, "庭审笔录"),
18
     MEDIATE(6, "庭审笔录"),
19
     MEDIATE_BOOK(7, "调解书"),
19
     MEDIATE_BOOK(7, "调解书"),
20
     MEDIATION_FILES(8, "调解资料"),
20
     MEDIATION_FILES(8, "调解资料"),
21
-
21
+    RES_PAYMENT_RECEIPT(9, "被申请人缴费单"),
22
     SEAL_PICTURE(10, "印章图片"),
22
     SEAL_PICTURE(10, "印章图片"),
23
 
23
 
24
 
24
 

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

1
 package com.ruoyi.framework.config;
1
 package com.ruoyi.framework.config;
2
 
2
 
3
+import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
3
 import org.springframework.cache.annotation.CachingConfigurerSupport;
4
 import org.springframework.cache.annotation.CachingConfigurerSupport;
4
 import org.springframework.cache.annotation.EnableCaching;
5
 import org.springframework.cache.annotation.EnableCaching;
6
+import org.springframework.context.ApplicationListener;
5
 import org.springframework.context.annotation.Bean;
7
 import org.springframework.context.annotation.Bean;
6
 import org.springframework.context.annotation.Configuration;
8
 import org.springframework.context.annotation.Configuration;
7
 import org.springframework.data.redis.connection.RedisConnectionFactory;
9
 import org.springframework.data.redis.connection.RedisConnectionFactory;
10
+import org.springframework.data.redis.core.RedisKeyExpiredEvent;
8
 import org.springframework.data.redis.core.RedisTemplate;
11
 import org.springframework.data.redis.core.RedisTemplate;
9
 import org.springframework.data.redis.core.script.DefaultRedisScript;
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
 import org.springframework.data.redis.serializer.StringRedisSerializer;
15
 import org.springframework.data.redis.serializer.StringRedisSerializer;
11
 
16
 
17
+import javax.annotation.Resource;
18
+
12
 /**
19
 /**
13
  * redis配置
20
  * redis配置
14
  * 
21
  * 
18
 @EnableCaching
25
 @EnableCaching
19
 public class RedisConfig extends CachingConfigurerSupport
26
 public class RedisConfig extends CachingConfigurerSupport
20
 {
27
 {
28
+    @Resource
29
+     MsCaseApplicationService caseApplicationService;
30
+
21
     @Bean
31
     @Bean
22
     @SuppressWarnings(value = { "unchecked", "rawtypes" })
32
     @SuppressWarnings(value = { "unchecked", "rawtypes" })
23
     public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
33
     public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
47
         redisScript.setResultType(Long.class);
57
         redisScript.setResultType(Long.class);
48
         return redisScript;
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
     /**
173
     /**
174
      * 版本号
174
      * 版本号
175
      */
175
      */
176
+    @Column(name = "version")
176
     private Integer version;
177
     private Integer version;
177
 
178
 
178
     /**
179
     /**
184
     /**
185
     /**
185
      * 事实和理由
186
      * 事实和理由
186
      */
187
      */
188
+    @Column(name = "facts")
187
     private String facts;
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
      * 待办状态,0-待办,1-已办
57
      * 待办状态,0-待办,1-已办
58
      */
58
      */
59
     private Integer pendingStatus;
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
      * @param req
117
      * @param req
118
      * @return
118
      * @return
119
      */
119
      */
120
-    AjaxResult accept(MsCaseApplication req);
120
+    AjaxResult accept(MsCaseApplicationVO req);
121
 
121
 
122
     /**
122
     /**
123
      * 案件提交
123
      * 案件提交
189
      * @param req
189
      * @param req
190
      * @param affiliateMap
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
      * @param vo
195
      * @param vo
202
      * @return
202
      * @return
203
      */
203
      */
204
      void verifyMediator(MsCaseApplication application,BookingVO vo);
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
 package com.ruoyi.wisdomarbitrate.service.mscase;
1
 package com.ruoyi.wisdomarbitrate.service.mscase;
2
 
2
 
3
 import com.ruoyi.common.core.domain.AjaxResult;
3
 import com.ruoyi.common.core.domain.AjaxResult;
4
+import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
4
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
5
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
5
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
6
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
7
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
6
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO;
8
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO;
7
 
9
 
8
 public interface MsCasePaymentService {
10
 public interface MsCasePaymentService {
32
      */
34
      */
33
     PaymentDetailVO selectPaymentDetail(Long id);
35
     PaymentDetailVO selectPaymentDetail(Long id);
34
 
36
 
37
+    /**
38
+     * 确认已缴费
39
+     * @param dto
40
+     * @return
41
+     */
35
     AjaxResult confirmPaid(CaseConfirmPayDTO dto);
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
                     // 生成调解申请书
331
                     // 生成调解申请书
332
                         req.setTemplateId(String.valueOf(templateManage.getId()));
332
                         req.setTemplateId(String.valueOf(templateManage.getId()));
333
                     // todo 部署放开
333
                     // todo 部署放开
334
-                   // caseApplicationService.generateApplication(req);
334
+                    caseApplicationService.generateApplication(req);
335
 
335
 
336
                 }
336
                 }
337
 
337
 
523
     @Override
523
     @Override
524
     public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) {
524
     public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) {
525
         UUID uuid = UUID.randomUUID();
525
         UUID uuid = UUID.randomUUID();
526
-        // todo 压缩包解压路径
526
+        // 压缩包解压路径
527
         String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/";
527
         String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/";
528
-//        String targetPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
529
         File zipFile = null;
528
         File zipFile = null;
530
         InputStream ins = null;
529
         InputStream ins = null;
531
         try {
530
         try {
532
             ins = file.getInputStream();
531
             ins = file.getInputStream();
533
             //上传的压缩包保存的路径
532
             //上传的压缩包保存的路径
534
-            // todo
535
             String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
533
             String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
536
-//           String savePath = "D:/home/ruoyi/uploadPath/upload/zipFile/";
537
             String saveName = uuid + "_" + file.getOriginalFilename();
534
             String saveName = uuid + "_" + file.getOriginalFilename();
538
             zipFile = new File(savePath + saveName);
535
             zipFile = new File(savePath + saveName);
539
             inputChangeToFile(ins, zipFile);
536
             inputChangeToFile(ins, zipFile);
813
      */
810
      */
814
     @Transactional
811
     @Transactional
815
     @Override
812
     @Override
816
-    public AjaxResult accept(MsCaseApplication req) {
813
+    public AjaxResult accept(MsCaseApplicationVO req) {
817
         if (StrUtil.isNotEmpty(req.getBatchNumber())) {
814
         if (StrUtil.isNotEmpty(req.getBatchNumber())) {
818
             // 根据批号查询未锁定的案件
815
             // 根据批号查询未锁定的案件
819
             List<MsCaseApplication> applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId());
816
             List<MsCaseApplication> applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId());
829
             }
826
             }
830
             Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity()));
827
             Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity()));
831
             for (MsCaseApplication application : applicationList) {
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
         } else {
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
      * @param affiliateMap
871
      * @param affiliateMap
857
      */
872
      */
858
     @Transactional
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
         application.setPaperFlag(req.getPaperFlag());
877
         application.setPaperFlag(req.getPaperFlag());
861
         application.setArbitrateConfirm(req.getArbitrateConfirm());
878
         application.setArbitrateConfirm(req.getArbitrateConfirm());
862
         application.setMediationMethod(req.getMediationMethod());
879
         application.setMediationMethod(req.getMediationMethod());
870
             MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
887
             MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
871
 
888
 
872
             if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
889
             if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
873
-                String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
890
+                String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
874
                 // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
891
                 // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
875
                 Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()});
892
                 Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()});
876
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent);
893
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent);
885
             }
902
             }
886
             // 给申请人被申请人发送短信
903
             // 给申请人被申请人发送短信
887
             if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
904
             if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
888
-                String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
905
+                String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
889
                 // 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
906
                 // 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
890
                 Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
907
                 Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
891
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
908
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
1167
         CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
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
      * @param id
1247
      * @param id

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

5
 import cn.hutool.core.util.StrUtil;
5
 import cn.hutool.core.util.StrUtil;
6
 import cn.hutool.json.JSONObject;
6
 import cn.hutool.json.JSONObject;
7
 import com.ruoyi.ElegentPay;
7
 import com.ruoyi.ElegentPay;
8
+import com.ruoyi.common.constant.Constants;
8
 import com.ruoyi.common.core.domain.AjaxResult;
9
 import com.ruoyi.common.core.domain.AjaxResult;
10
+import com.ruoyi.common.core.redis.RedisCache;
9
 import com.ruoyi.common.enums.AnnexTypeEnum;
11
 import com.ruoyi.common.enums.AnnexTypeEnum;
10
 import com.ruoyi.common.enums.PaymentStatusEnum;
12
 import com.ruoyi.common.enums.PaymentStatusEnum;
11
 import com.ruoyi.common.enums.YesOrNoEnum;
13
 import com.ruoyi.common.enums.YesOrNoEnum;
14
+import com.ruoyi.common.utils.SmsUtils;
12
 import com.ruoyi.dto.PayRequest;
15
 import com.ruoyi.dto.PayRequest;
13
 import com.ruoyi.dto.PayResponse;
16
 import com.ruoyi.dto.PayResponse;
14
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
17
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
15
 import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
18
 import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
16
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
19
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
17
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
20
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
21
+import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
18
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
22
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
19
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
23
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
20
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
24
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
38
 import java.util.ArrayList;
42
 import java.util.ArrayList;
39
 import java.util.Date;
43
 import java.util.Date;
40
 import java.util.List;
44
 import java.util.List;
45
+import java.util.concurrent.TimeUnit;
41
 
46
 
42
 @Service
47
 @Service
43
 public class MsCasePaymentServiceImpl implements MsCasePaymentService {
48
 public class MsCasePaymentServiceImpl implements MsCasePaymentService {
57
     MsCaseFlowMapper caseFlowMapper;
62
     MsCaseFlowMapper caseFlowMapper;
58
     @Autowired
63
     @Autowired
59
     MsCaseAffiliateMapper caseAffiliateMapper;
64
     MsCaseAffiliateMapper caseAffiliateMapper;
65
+    @Autowired
66
+    MsCasePaymentService casePaymentService;
67
+    @Autowired
68
+    private RedisCache redisCache;
60
 
69
 
61
 
70
 
62
     @Override
71
     @Override
161
                 return AjaxResult.error("该批号下未找到案件");
170
                 return AjaxResult.error("该批号下未找到案件");
162
             }
171
             }
163
             for (MsCaseApplication application : applicationList) {
172
             for (MsCaseApplication application : applicationList) {
164
-                confirmPayment(currentFlow,nextFlow, application, dto);
173
+                casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto);
165
 
174
 
166
             }
175
             }
167
         } else {
176
         } else {
169
             MsCaseApplication application = new MsCaseApplication();
178
             MsCaseApplication application = new MsCaseApplication();
170
             application.setId(dto.getCaseId());
179
             application.setId(dto.getCaseId());
171
             application.setLockStatus(YesOrNoEnum.YES.getCode());
180
             application.setLockStatus(YesOrNoEnum.YES.getCode());
172
-            confirmPayment(currentFlow,nextFlow, application, dto);
181
+            casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto);
173
 
182
 
174
         }
183
         }
175
         return AjaxResult.success("确认缴费成功");
184
         return AjaxResult.success("确认缴费成功");
277
                 return AjaxResult.error("该批号下未找到案件");
286
                 return AjaxResult.error("该批号下未找到案件");
278
             }
287
             }
279
             for (MsCaseApplication application : applicationList) {
288
             for (MsCaseApplication application : applicationList) {
280
-                confirmPaid(currentFlow,nextFlow, application);
289
+                casePaymentService.confirmPaid(currentFlow,nextFlow, application);
281
             }
290
             }
282
         }else {
291
         }else {
283
             MsCaseApplication caseApplication=new MsCaseApplication();
292
             MsCaseApplication caseApplication=new MsCaseApplication();
284
             caseApplication.setId(dto.getCaseId());
293
             caseApplication.setId(dto.getCaseId());
285
             caseApplication.setLockStatus(YesOrNoEnum.YES.getCode());
294
             caseApplication.setLockStatus(YesOrNoEnum.YES.getCode());
286
-            confirmPaid(currentFlow,nextFlow,caseApplication );
295
+            casePaymentService.confirmPaid(currentFlow,nextFlow,caseApplication );
287
         }
296
         }
288
 
297
 
289
 
298
 
296
      * @param application
305
      * @param application
297
      * @param
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
         MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord();
316
         MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord();
302
         casePaymentRecord.setPaymentStatus(1);
317
         casePaymentRecord.setPaymentStatus(1);
310
         application.setCaseFlowId(nextFlow.getId());
325
         application.setCaseFlowId(nextFlow.getId());
311
         application.setCaseStatusName(nextFlow.getCaseStatusName());
326
         application.setCaseStatusName(nextFlow.getCaseStatusName());
312
         caseApplicationMapper.updateByPrimaryKeySelective(application);
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
         CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费");
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
      * @param application
374
      * @param application
325
      * @param dto
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
         application.setPayType(dto.getPayType());
379
         application.setPayType(dto.getPayType());
330
         // 修改缴费附件
380
         // 修改缴费附件
331
         if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {
381
         if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {