Browse Source

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

qitz 2 years ago
parent
commit
9fe19ae74c
18 changed files with 307 additions and 253 deletions
  1. 0
    18
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/dept/DeptIdentifyController.java
  2. 4
    1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java
  3. 63
    0
      ruoyi-common/src/main/java/com/ruoyi/common/enums/MediatorTypeEnum.java
  4. 15
    9
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java
  5. 3
    29
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java
  6. 1
    1
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseMediator.java
  7. 16
    3
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/BookingVO.java
  8. 9
    9
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java
  9. 2
    1
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseLogRecordMapper.java
  10. 0
    3
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/template/FatchRuleMapper.java
  11. 0
    3
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/IDeptIdentifyService.java
  12. 0
    15
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java
  13. 164
    103
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java
  14. 21
    10
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java
  15. 7
    10
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java
  16. 2
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java
  17. 0
    5
      ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml
  18. 0
    33
      ruoyi-system/src/main/resources/mapper/wisdomarbitrate/template/FatchRuleMapper.xml

+ 0
- 18
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/dept/DeptIdentifyController.java View File

@@ -201,25 +201,7 @@ public class DeptIdentifyController extends BaseController {
201 201
         return deptIdentifyService.saveFatchRules(templateManage);
202 202
     }
203 203
 
204
-    /**
205
-     * 查询column和注释
206
-     * @return
207
-     */
208
-    @PostMapping("/selectColumnandComment")
209
-    public AjaxResult selectColumnandComment(){
210
-        List<FatchRule> fatchRuleList = deptIdentifyService.selectColumnandComment();
211
-        return AjaxResult.success(fatchRuleList);
212
-    }
213 204
 
214
-    /**
215
-     * 查询column
216
-     * @return
217
-     */
218
-    @PostMapping("/selectColumnbycomment")
219
-    public AjaxResult selectColumnbycomment(@RequestBody  FatchRule fatchRule){
220
-        FatchRule fatchRulesel = deptIdentifyService.selectColumnbycomment(fatchRule);
221
-        return AjaxResult.success(fatchRulesel);
222
-    }
223 205
 
224 206
     /**
225 207
      * 根据模板id查询模板字段列表

+ 4
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java View File

@@ -51,6 +51,9 @@ public class MsCaseApplicationController extends BaseController {
51 51
     @PostMapping("/insert")
52 52
     public AjaxResult insert(@RequestBody MsCaseApplicationVO caseApplication )
53 53
     {
54
+        if(caseApplication.getAffiliate()==null||caseApplication.getAffiliate().getOrganizeFlag()==null){
55
+            error("参数校验失败");
56
+        }
54 57
 
55 58
         return success(caseApplicationService.insert(caseApplication));
56 59
     }
@@ -165,7 +168,7 @@ public class MsCaseApplicationController extends BaseController {
165 168
      */
166 169
     @PostMapping("/updateBooking")
167 170
     public AjaxResult updateBooking(@RequestBody BookingVO vo ) {
168
-        if(vo.getId()==null || CollectionUtil.isEmpty(vo.getHerDates())|| CollectionUtil.isEmpty(vo.getUserList())){
171
+        if(vo.getId()==null || CollectionUtil.isEmpty(vo.getUserList())){
169 172
             return error("参数校验失败");
170 173
         }
171 174
         return caseApplicationService.updateBooking(vo);

+ 63
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/MediatorTypeEnum.java View File

@@ -0,0 +1,63 @@
1
+package com.ruoyi.common.enums;
2
+
3
+import com.ruoyi.common.interfaces.EnumsInterface;
4
+
5
+/**
6
+ * @author wangqiong
7
+ * @description 选择调解员入口枚举
8
+ * @date 2023-11-17 14:05
9
+ */
10
+public enum MediatorTypeEnum implements EnumsInterface
11
+{
12
+    PC(0, "PC"),
13
+    MI_NI_PROGRESS(1, "小程序"),
14
+
15
+    ;
16
+
17
+    private final Integer code;
18
+    private final String text;
19
+
20
+    MediatorTypeEnum(Integer code, String text)
21
+    {
22
+        this.code = code;
23
+        this.text = text;
24
+    }
25
+
26
+    public Integer getCode()
27
+    {
28
+        return code;
29
+    }
30
+
31
+    public String getText()
32
+    {
33
+        return text;
34
+    }
35
+
36
+    /**
37
+     * 根据code获取text
38
+     * @param codeNo
39
+     * @return
40
+     */
41
+    public static String getTextByCode(Integer codeNo){
42
+        for (MediatorTypeEnum value : MediatorTypeEnum.values()) {
43
+            if (value.getCode().equals(codeNo)){
44
+                return value.getText();
45
+            }
46
+        }
47
+        return codeNo.toString();
48
+    }
49
+
50
+    /**
51
+     * 根据text获取code
52
+     * @param textStr
53
+     * @return
54
+     */
55
+    public static String getCodeByText(String textStr){
56
+        for (MediatorTypeEnum value : MediatorTypeEnum.values()) {
57
+            if (value.getText().equals(textStr)){
58
+                return value.getText();
59
+            }
60
+        }
61
+        return textStr;
62
+    }
63
+}

+ 15
- 9
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java View File

@@ -20,24 +20,30 @@ public class MsCaseAffiliate {
20 20
     @Id
21 21
     @Column(name = "case_appli_id")
22 22
     private Long caseAppliId;
23
+    /**
24
+     * 是否机构申请,0-自然人,1-申请机构,默认0
25
+     */
26
+    @Column(name = "organize_flag")
27
+    private Integer organizeFlag;
28
+
23 29
 
24 30
     /**
25
-     * 申请机构
31
+     * 申请人id
26 32
      */
27
-    @Column(name = "application_organ_id")
28
-    private String applicationOrganId;
33
+    @Column(name = "application_id")
34
+    private String applicationId;
29 35
 
30 36
     /**
31
-     * 申请机构名称
37
+     * 申请名称
32 38
      */
33
-    @Column(name = "application_organ_name")
34
-    private String applicationOrganName;
39
+    @Column(name = "application_name")
40
+    private String  applicationName;
35 41
 
36 42
     /**
37
-     * 统一社会信用代码
43
+     * 代码(统一社会信用代码或者身份证号)
38 44
      */
39
-    @Column(name = "credit_code")
40
-    private String creditCode;
45
+    @Column(name = "code")
46
+    private String code;
41 47
 
42 48
     /**
43 49
      * 法定代表人

+ 3
- 29
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java View File

@@ -51,7 +51,7 @@ public class MsCaseApplication {
51 51
     private BigDecimal caseSubjectAmount;
52 52
 
53 53
     /**
54
-     * 调解方式,1-开庭调解,2-书面调解
54
+     * 调解方式,1-线上调解,2-线下调解
55 55
      */
56 56
     @Column(name = "mediation_method")
57 57
     private String mediationMethod;
@@ -84,7 +84,7 @@ public class MsCaseApplication {
84 84
      * 调解员id
85 85
      */
86 86
     @Column(name = "mediator_id")
87
-    private String mediatorId;
87
+    private Long mediatorId;
88 88
 
89 89
     /**
90 90
      * 调解员名称
@@ -92,23 +92,12 @@ public class MsCaseApplication {
92 92
     @Column(name = "mediator_name")
93 93
     private String mediatorName;
94 94
 
95
-    /**
96
-     * 是否同意组庭,0否,1是
97
-     */
98
-    @Column(name = "is_agree_pend_tral")
99
-    private Integer isAgreePendTral;
100
-
101 95
     /**
102 96
      * 支付方式(0线上支付,1线下支付)
103 97
      */
104 98
     @Column(name = "pay_type")
105 99
     private String payType;
106 100
 
107
-    /**
108
-     * 是否仲裁反请求,1是,0否
109
-     */
110
-    @Column(name = "adjudica_counter")
111
-    private Integer adjudicaCounter;
112 101
 
113 102
     /**
114 103
      * 被申请人是否缺席,1是,0否
@@ -192,17 +181,6 @@ public class MsCaseApplication {
192 181
      */
193 182
     private String facts;
194 183
 
195
-    /**
196
-     * 申请人请求仲裁庭裁决
197
-     */
198
-    @Column(name = "request_rule")
199
-    private String requestRule;
200
-
201
-    /**
202
-     * 案件描述
203
-     */
204
-    @Column(name = "case_describe")
205
-    private String caseDescribe;
206 184
 
207 185
     /**
208 186
      * 调解书URL
@@ -210,11 +188,7 @@ public class MsCaseApplication {
210 188
     @Column(name = "mediation_url")
211 189
     private String mediationUrl;
212 190
 
213
-    /**
214
-     * 仲裁反请求原因
215
-     */
216
-    @Column(name = "adjudica_counter_reason")
217
-    private String adjudicaCounterReason;
191
+
218 192
 
219 193
     /**
220 194
      * 调解内容

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseMediator.java View File

@@ -31,7 +31,7 @@ public class MsCaseMediator {
31 31
      * 调解员id
32 32
      */
33 33
     @Column(name = "mediator_id")
34
-    private String mediatorId;
34
+    private Long mediatorId;
35 35
 
36 36
     /**
37 37
      * 调解员名称

+ 16
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/BookingVO.java View File

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
2 2
 
3 3
 import com.ruoyi.common.core.domain.entity.SysUser;
4
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseMediator;
4 5
 import lombok.Data;
5 6
 
6 7
 import java.util.List;
@@ -15,13 +16,17 @@ import java.util.List;
15 16
 @Data
16 17
 public class BookingVO {
17 18
     /**
18
-     * 调解员列表
19
+     * 申请人调解员列表
19 20
      */
20 21
     private List<SysUser> userList;
21 22
     /**
22
-     * 调解员列表
23
+     * 申请人调解员列表
23 24
      */
24
-    private List<MediatorVO> mediatorList;
25
+    private List<MsCaseMediator> mediatorList;
26
+    /**
27
+     * 被申请人调解员列表
28
+     */
29
+    private List<MsCaseMediator>resMediatorList;
25 30
     /**
26 31
      * 开庭日期集合
27 32
      */
@@ -38,6 +43,14 @@ public class BookingVO {
38 43
      * 批次
39 44
      */
40 45
     private String batchNumber;
46
+    /**
47
+     * 调解员id
48
+     */
49
+    private Long mediatorId;
50
+    /**
51
+     * 调解员
52
+     */
53
+    private String mediatorName;
41 54
     /**
42 55
      * 是否被申请人,1-被申请人,空为申请人
43 56
      */

+ 9
- 9
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java View File

@@ -35,7 +35,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
35 35
      * @return
36 36
      */
37 37
     @Select("<script> select t.* from (select c.id,c.room_id roomId,c.mediation_method mediationMethod,0 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
38
-            "a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
38
+            "a.application_name applicationName,a.respondent_name respondentName,c.mediator_name mediatorName," +
39 39
             "c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_application c " +
40 40
             "join ms_case_affiliate a on c.id=a.case_appli_id <where> " +
41 41
             "<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and  c.case_status_name in" +
@@ -54,7 +54,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
54 54
             "</if> " +
55 55
 
56 56
             "<if test=\"req.applicantFlag != null \">" +
57
-            "    AND a.application_organ_id = #{req.applicationOrganId} " +
57
+            "    AND a.application_id = #{req.applicationId} " +
58 58
             "</if> "
59 59
             + "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
60 60
             "    AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
@@ -70,13 +70,13 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
70 70
             "and c.create_time &lt;= #{req.endTime}</if>" +
71 71
             "        </where> " +
72 72
             "union  select c.id id,c.room_id roomId,c.mediation_method mediationMethod,1 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
73
-            "a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
73
+            "a.application_name applicationName,a.respondent_name respondentName,c.mediator_name mediatorName," +
74 74
             "c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_log_record r " +
75
-            "join ms_case_application c on r.case_appli_id=c.id and r.case_status_name!=c.case_status_name " +
75
+            "join ms_case_application c on r.case_appli_id=c.id  " +
76 76
             "join ms_case_affiliate a on c.id=a.case_appli_id  <where> r.create_by=#{req.userName}  and c.id not in (" +
77 77
             "select c1.id from  ms_case_application c1 JOIN ms_case_affiliate a1 ON a1.case_appli_id = c1.id"
78 78
             +
79
-            "<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and  c.case_status_name in" +
79
+            "<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and  c1.case_status_name in" +
80 80
             "<foreach item='caseStatus' index='index' collection='caseStatusNames' open='(' separator=',' close=')'>" +
81 81
             "#{caseStatus}" +
82 82
             "</foreach>" +
@@ -92,14 +92,14 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
92 92
             "    AND c1.case_num = #{req.caseNum} " +
93 93
             "</if> " +
94 94
             "<if test=\"req.applicantFlag != null \">" +
95
-            "    AND a1.application_organ_id = #{req.applicationOrganId} " +
95
+            "    AND a1.application_id = #{req.applicationId} " +
96 96
             "</if> "
97 97
             + "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
98
-            "    AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
98
+            "    AND a1.respondent_identity_num = #{req.respondentIdentityNum} " +
99 99
             "</if> "
100 100
             +
101 101
             "<if test=\"req.hearDateFlag != null \">" +
102
-            "    AND c.mediation_method = '1'" +
102
+            "    AND c1.mediation_method = '1'" +
103 103
             "</if> "
104 104
             +
105 105
 
@@ -126,7 +126,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
126 126
             "    AND c.case_num = #{req.caseNum} " +
127 127
             "</if> " +
128 128
             "<if test=\"req.applicantFlag != null \">" +
129
-            "    AND a.application_organ_id = #{req.applicationOrganId} " +
129
+            "    AND a.application_id = #{req.applicationId} " +
130 130
             "</if> "
131 131
             + "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
132 132
             "    AND a.respondent_identity_num = #{req.respondentIdentityNum} " +

+ 2
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseLogRecordMapper.java View File

@@ -18,7 +18,8 @@ public interface MsCaseLogRecordMapper extends Mapper<MsCaseLogRecord> {
18 18
 
19 19
     @Select("<script> select cl.case_node caseNode ,cl.case_node_time caseNodeTime ,cl.notes  ,cl.id ,cl.case_appli_id caseAppliId," +
20 20
             "    cl.create_by createBy,cl.create_nick_name createNickName,cl.create_time createTime, " +
21
-            "   CASE cl.case_node when 1 then '提交案件' when 2 then '缴费'  " +
21
+            "   CASE cl.case_node when 0 then '新增案件' " +
22
+            "when 1 then '提交案件' when 2 then '缴费'  " +
22 23
             "   when 3 then '确认缴费' when 4 then '受理分配' when 5 then '选择调解员'  " +
23 24
             "   when 6 then '核实调解员' when 7 then '确认调解员' when 8 then '确定调解时间'  " +
24 25
             "   when 9 then '调解' when 10 then '确认调解书' when 11 then '签名'  " +

+ 0
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/template/FatchRuleMapper.java View File

@@ -24,7 +24,4 @@ public interface FatchRuleMapper {
24 24
 
25 25
    int insertFatchRule(FatchRule fatchRule);
26 26
 
27
-   List<FatchRule> selectColumnandComment(FatchRule fatchRuleselect);
28
-
29
-   FatchRule selectColumnbycomment(FatchRule fatchRule);
30 27
 }

+ 0
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/IDeptIdentifyService.java View File

@@ -55,9 +55,6 @@ public interface IDeptIdentifyService {
55 55
 
56 56
     AjaxResult saveFatchRules(TemplateManage templateManage);
57 57
 
58
-    List<FatchRule> selectColumnandComment();
59
-
60
-    FatchRule selectColumnbycomment(FatchRule fatchRule);
61 58
 
62 59
     /**
63 60
      * 根据模板id查询模板字段列表

+ 0
- 15
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java View File

@@ -586,21 +586,6 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
586 586
         return AjaxResult.error();
587 587
     }
588 588
 
589
-    @Override
590
-    public List<FatchRule> selectColumnandComment() {
591
-        List<FatchRule>  fatchRules = new ArrayList<>();
592
-        FatchRule fatchRuleselect = new FatchRule();
593
-        fatchRuleselect.setDatabaseName("test_smart_arbitration");
594
-        fatchRules = fatchRuleMapper.selectColumnandComment(fatchRuleselect);
595
-        return fatchRules;
596
-    }
597
-
598
-    @Override
599
-    public FatchRule selectColumnbycomment(FatchRule fatchRule) {
600
-        fatchRule.setDatabaseName("test_smart_arbitration");
601
-        FatchRule fatchRulesel = fatchRuleMapper.selectColumnbycomment(fatchRule);
602
-        return fatchRulesel;
603
-    }
604 589
 
605 590
     /**
606 591
      * 根据模板id查询模板字段列表

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

@@ -13,6 +13,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
13 13
 import com.ruoyi.common.core.domain.entity.*;
14 14
 import com.ruoyi.common.core.domain.model.LoginUser;
15 15
 import com.ruoyi.common.enums.AnnexTypeEnum;
16
+import com.ruoyi.common.enums.MediatorTypeEnum;
16 17
 import com.ruoyi.common.enums.YesOrNoEnum;
17 18
 import com.ruoyi.common.exception.EsignDemoException;
18 19
 import com.ruoyi.common.exception.ServiceException;
@@ -271,7 +272,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
271 272
             // 保存案件相关人员
272 273
             if (affiliate != null) {
273 274
                 // 设置申请人
274
-                if (StrUtil.isNotEmpty(affiliate.getApplicationOrganName())) {
275
+                if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
275 276
                     // 组装申请机构
276 277
                     insertDept(affiliate);
277 278
                     // 新增申请机构代理人
@@ -344,7 +345,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
344 345
                 columnValueMapper.batchSave(columnValueList);
345 346
             }
346 347
             // todo 发送短信
347
-            CaseLogUtils.insertCaseLog(caseApplication.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "");
348
+            CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "新增案件", "");
348 349
             return 1;
349 350
         }
350 351
 
@@ -410,7 +411,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
410 411
         if (affiliate != null) {
411 412
             affiliate.setCaseAppliId(caseApplication.getId());
412 413
             // 设置申请人
413
-            if (StrUtil.isNotEmpty(affiliate.getApplicationOrganName())) {
414
+            if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
414 415
                 // 组装申请机构
415 416
                 insertDept(affiliate);
416 417
                 // 新增申请机构代理人
@@ -786,6 +787,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
786 787
      * @param affiliateMap
787 788
      */
788 789
     private void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
790
+        application.setPaperFlag(req.getPaperFlag());
791
+        application.setArbitrateConfirm(req.getArbitrateConfirm());
792
+        application.setMediationMethod(req.getMediationMethod());
789 793
         application.setUpdateBy(SecurityUtils.getUsername());
790 794
         application.setUpdateTime(new Date());
791 795
         application.setBatchNumber(null);
@@ -866,8 +870,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
866 870
             return AjaxResult.error("暂无调解员");
867 871
         }
868 872
         List<Long> userIds = users.stream().map(SysUser::getUserId).collect(Collectors.toList());
869
-        // todo 状态为未结束的是待办数量,结束的是已办数量
870
-        Map<String, List<MsCaseApplication>> caseMap=null;
873
+        //  状态为未结束的是待办数量,结束的是已办数量
874
+        Map<Long, List<MsCaseApplication>> caseMap=null;
871 875
 
872 876
         List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds);
873 877
         if (CollectionUtil.isNotEmpty(caseApplicationList)) {
@@ -879,9 +883,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
879 883
             mediatorVO.setMediatorId(user.getUserId());
880 884
             mediatorVO.setMediatorName(user.getNickName());
881 885
             mediatorVO.setSpecialty(user.getSpecialty());
882
-
883
-            if(caseMap!=null&&caseMap.containsKey(String.valueOf(user.getUserId()))) {
884
-                List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
886
+            if(caseMap==null){
887
+                mediatorVO.setTodoAmount(0L);
888
+                mediatorVO.setCompleteAmount(0L);
889
+            } else if(caseMap.containsKey(user.getUserId())) {
890
+                List<MsCaseApplication> applications = caseMap.get(user.getUserId());
885 891
                 // 已办案件
886 892
                 long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
887 893
                 mediatorVO.setTodoAmount(applications.size()-count);
@@ -909,14 +915,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
909 915
         if (currentFlow == null) {
910 916
             return AjaxResult.error("当前流程不存在");
911 917
         }
918
+        // 获取选择的调解员id
919
+        List<Long> userIds = vo.getUserList().stream().map(SysUser::getUserId).collect(Collectors.toList());
912 920
         // 新增案件预约表
913
-        MsCaseMediator mediator = new MsCaseMediator();
914
-        mediator.setCaseAppliId(vo.getId());
915
-        mediator.setMediatorId(String.valueOf(vo.getUserList().get(0).getUserId()));
916
-        mediator.setMediatorName(String.valueOf(vo.getUserList().get(0).getUserName()));
917
-        mediator.setHearDate(String.valueOf(vo.getHerDates().get(0)));
918
-        mediator.setType(vo.getMiniProgressFlag());
919
-        msCaseMediatorMapper.insert(mediator);
921
+        for (SysUser sysUser : vo.getUserList()) {
922
+            MsCaseMediator mediator = new MsCaseMediator();
923
+            mediator.setCaseAppliId(vo.getId());
924
+            mediator.setMediatorId(sysUser.getUserId());
925
+            mediator.setMediatorName(sysUser.getNickName());
926
+            mediator.setType(vo.getMiniProgressFlag()==null?MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag());
927
+            msCaseMediatorMapper.insert(mediator);
928
+        }
929
+
920 930
         // 申请人预约
921 931
         if (vo.getMiniProgressFlag() == null) {
922 932
             // 新增日志
@@ -926,12 +936,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
926 936
                 return AjaxResult.error("被申请人身份证为空");
927 937
             }
928 938
 
929
-            SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
939
+         //   SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
930 940
             // 被申请人存在
931
-            if (user != null) {
941
+        //    if (user != null) {
932 942
                 // 判断被申请人信息查询案件预约表
933
-                isReservation( vo,user);
934
-            }
943
+                isReservation( vo,userIds);
944
+         //   }
935 945
 
936 946
         } else {
937 947
             // 被申请人预约
@@ -941,11 +951,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
941 951
                 return AjaxResult.error("申请代理人手机号为空");
942 952
             }
943 953
 
944
-            SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
945
-            if(user!=null){
954
+         //   SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
955
+          //  if(user!=null){
946 956
                 // 判断申请人是否预约
947
-                isReservation( vo,user);
948
-            }
957
+                isReservation( vo,userIds);
958
+         //   }
949 959
 
950 960
         }
951 961
         return AjaxResult.success();
@@ -954,9 +964,15 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
954 964
     /**
955 965
      * 判断申请人/被申请人是否预约
956 966
      * @param vo
957
-     * @param user
967
+     * @param userIds 选择的调解员ids
958 968
      */
959
-    private void isReservation( BookingVO vo, SysUser user) {
969
+    private void isReservation( BookingVO vo,  List<Long> userIds ) {
970
+        // 查询所有调解员
971
+        List<SysUser> mediatorUsers = sysUserMapper.selectUserByRole("调解员");
972
+        if (CollectionUtil.isEmpty(mediatorUsers)) {
973
+            throw new ServiceException("暂无调解员");
974
+        }
975
+        Map<Long, SysUser> userMap = mediatorUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity()));
960 976
         Example example = new Example(MsCaseMediator.class);
961 977
         Example.Criteria criteria = example.createCriteria();
962 978
         if(vo.getMiniProgressFlag() == null) {
@@ -968,14 +984,50 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
968 984
         }
969 985
         criteria.andEqualTo("caseAppliId", vo.getId());
970 986
      //   criteria.andEqualTo("mediatorId", user.getUserId());
971
-        int count = msCaseMediatorMapper.selectCountByExample(example);
972
-        if (count > 0) {
973
-            // 申请人已预约,更新主表流程节点
987
+        List<MsCaseMediator> msCaseMediators = msCaseMediatorMapper.selectByExample(example);
988
+        if (CollectionUtil.isNotEmpty(msCaseMediators)) {
989
+            MsCaseApplication application = new MsCaseApplication();
990
+            // 申请人或者被申请人已预约,更新主表流程节点
974 991
             MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
975 992
             if (nextFlow == null) {
976 993
                throw new ServiceException("未找到下一个流程");
977 994
             }
978
-            MsCaseApplication application = new MsCaseApplication();
995
+            // 取出另一方的调解员id
996
+            List<Long> mediatorIds = msCaseMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList());
997
+            // 取出申请人和被申请人选择调解员交集,交集>1,根据优先级确定调解员(优先级查调解员已结束的案件)
998
+            List<Long> intersectionWithoutModifyOriginal = new ArrayList<>(userIds);
999
+            // 交集
1000
+            List<Long> intersection = new ArrayList<>(intersectionWithoutModifyOriginal);
1001
+            intersection.retainAll(mediatorIds);
1002
+            // 有一个交集,则直接更新主表调解员
1003
+            if(intersection.size()==1){
1004
+                application.setMediatorId(intersection.get(0));
1005
+                application.setMediatorName(userMap.get(intersection.get(0)).getNickName());
1006
+            }else if(intersection.size()>1){
1007
+                // 查询调解员的案件,有多个交集,根据优先级获取
1008
+                List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds);
1009
+                if (CollectionUtil.isNotEmpty(caseApplicationList)) {
1010
+                    Map<Long, List<MsCaseApplication>> caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
1011
+                    long maxCount=0;
1012
+                    for (Long userId : intersection) {
1013
+                        if (caseMap.containsKey(userId)) {
1014
+                            List<MsCaseApplication> applications = caseMap.get(userId);
1015
+                            // 已办案件
1016
+                            long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
1017
+                            if(count>=maxCount){
1018
+                                maxCount=count;
1019
+                                application.setMediatorId(userId);
1020
+                                application.setMediatorName(userMap.get(userId).getNickName());
1021
+                            }
1022
+                        }
1023
+                    }
1024
+
1025
+                }else {
1026
+                    // 没有案件,则随机取一个调解员
1027
+                    application.setMediatorId(intersection.get(0));
1028
+                    application.setMediatorName(userMap.get(intersection.get(0)).getNickName());
1029
+                }
1030
+            }
979 1031
             application.setId(vo.getId());
980 1032
             application.setCaseFlowId(nextFlow.getId());
981 1033
             application.setCaseStatusName(nextFlow.getCaseStatusName());
@@ -997,21 +1049,21 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
997 1049
      * @param application
998 1050
      * @param vo
999 1051
      */
1000
-    private void setMediatorAndDate(MsCaseApplication application, BookingVO vo) {
1001
-        if(CollectionUtil.isNotEmpty(vo.getUserList())) {
1002
-            List<SysUser> userList = vo.getUserList();
1003
-            List<Long> userIds = userList.stream().map(SysUser::getUserId).collect(Collectors.toList());
1004
-            List<String> userNames = userList.stream().map(SysUser::getUserName).collect(Collectors.toList());
1005
-            String mediatorIds = StrUtil.join(",", userIds);
1006
-            String mediatorNames = StrUtil.join(",", userNames);
1007
-            application.setMediatorId(mediatorIds);
1008
-            application.setMediatorName(mediatorNames);
1009
-        }
1010
-        if(CollectionUtil.isNotEmpty( vo.getHerDates())) {
1011
-            String herDates = StrUtil.join(",", vo.getHerDates());
1012
-            application.setHearDate(herDates);
1013
-        }
1014
-    }
1052
+//    private void setMediatorAndDate(MsCaseApplication application, BookingVO vo) {
1053
+//        if(CollectionUtil.isNotEmpty(vo.getUserList())) {
1054
+//            List<SysUser> userList = vo.getUserList();
1055
+//            List<Long> userIds = userList.stream().map(SysUser::getUserId).collect(Collectors.toList());
1056
+//            List<String> userNames = userList.stream().map(SysUser::getUserName).collect(Collectors.toList());
1057
+//            String mediatorIds = StrUtil.join(",", userIds);
1058
+//            String mediatorNames = StrUtil.join(",", userNames);
1059
+//            application.setMediatorId(mediatorIds);
1060
+//            application.setMediatorName(mediatorNames);
1061
+//        }
1062
+//        if(CollectionUtil.isNotEmpty( vo.getHerDates())) {
1063
+//            String herDates = StrUtil.join(",", vo.getHerDates());
1064
+//            application.setHearDate(herDates);
1065
+//        }
1066
+//    }
1015 1067
 
1016 1068
     /**
1017 1069
      * 核实调解员
@@ -1044,56 +1096,58 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1044 1096
      */
1045 1097
     @Override
1046 1098
     public AjaxResult selectReservation(Long id) {
1099
+        // 查询案件主表
1100
+        MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id);
1101
+        if (application == null) {
1102
+            return AjaxResult.error("该案件不存在");
1103
+        }
1047 1104
         BookingVO result = new BookingVO();
1048
-
1049
-      //  MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
1050
-        // todo 返回申请人预约信息,预约信息查预约表
1051
-    //    criteria.andEqualTo("mediatorId", SecurityUtils.getUserId());
1052
-        MsCaseMediator msCaseMediator = msCaseMediatorMapper.selectLastApplicant(id);
1053
-        if(msCaseMediator==null){
1105
+        result.setMediatorId(application.getMediatorId());
1106
+        result.setMediatorName(application.getMediatorName());
1107
+        Example example = new Example(MsCaseAffiliate.class);
1108
+        example.createCriteria().andEqualTo("caseAppliId", id);
1109
+        List<MsCaseMediator> msCaseMediators = msCaseMediatorMapper.selectByExample(example);
1110
+        if(CollectionUtil.isEmpty(msCaseMediators)){
1054 1111
             return AjaxResult.success(result);
1055 1112
         }
1056
-//        if(caseApplication == null){
1057
-//            return AjaxResult.error("该案件不存在");
1058
-//        }
1113
+        Map<Integer, List<MsCaseMediator>> mediatorMap = msCaseMediators.stream().collect(Collectors.groupingBy(MsCaseMediator::getType));
1114
+        // 申请人
1115
+        result.setMediatorList(mediatorMap.get(MediatorTypeEnum.PC.getCode()));
1116
+        result.setResMediatorList(mediatorMap.get(MediatorTypeEnum.MI_NI_PROGRESS.getCode()));
1059 1117
 
1060
-        // 调解员是一个的处理
1061
-        if( StrUtil.isNotEmpty(msCaseMediator.getMediatorId()) && StrUtil.isNotEmpty(msCaseMediator.getMediatorName())){
1062 1118
             // 查询用户
1063
-            SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
1064
-            if(user==null){
1065
-                return AjaxResult.error("调解员已被删除");
1066
-            }
1067
-            // 查询待办数量
1068
-            List<Long> mediatorIds = new ArrayList<>();
1069
-            mediatorIds.add(user.getUserId());
1070
-            Map<String, List<MsCaseApplication>> caseMap=null;
1071
-            List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds);
1072
-            if (CollectionUtil.isNotEmpty(caseApplicationList)) {
1073
-                caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
1119
+//            SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
1120
+//            if(user==null){
1121
+//                return AjaxResult.error("调解员已被删除");
1122
+//            }
1123
+//            // 查询待办数量
1124
+//            List<Long> mediatorIds = new ArrayList<>();
1125
+//            mediatorIds.add(user.getUserId());
1126
+//            Map<Long, List<MsCaseApplication>> caseMap=null;
1127
+//            List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds);
1128
+//            if (CollectionUtil.isNotEmpty(caseApplicationList)) {
1129
+//                caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
1130
+//
1131
+//            }
1132
+//            MediatorVO mediatorVO = new MediatorVO();
1133
+//            mediatorVO.setMediatorId(user.getUserId());
1134
+//            mediatorVO.setMediatorName(user.getNickName());
1135
+//            mediatorVO.setSpecialty(user.getSpecialty());
1136
+//            if(caseMap==null){
1137
+//                mediatorVO.setTodoAmount(0L);
1138
+//                mediatorVO.setCompleteAmount(0L);
1139
+//            }
1140
+//
1141
+//            else if(caseMap.containsKey(String.valueOf(user.getUserId()))) {
1142
+//                List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
1143
+//                // 已办案件
1144
+//                long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
1145
+//                mediatorVO.setTodoAmount(applications.size()-count);
1146
+//                mediatorVO.setCompleteAmount(count);
1147
+//            }
1148
+
1074 1149
 
1075
-            }
1076
-            MediatorVO mediatorVO = new MediatorVO();
1077
-            mediatorVO.setMediatorId(user.getUserId());
1078
-            mediatorVO.setMediatorName(user.getNickName());
1079
-            mediatorVO.setSpecialty(user.getSpecialty());
1080 1150
 
1081
-            if(caseMap!=null&&caseMap.containsKey(String.valueOf(user.getUserId()))) {
1082
-                List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
1083
-                // 已办案件
1084
-                long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
1085
-                mediatorVO.setTodoAmount(applications.size()-count);
1086
-                mediatorVO.setCompleteAmount(count);
1087
-            }
1088
-            List<MediatorVO> mediatorVOS = new ArrayList<>();
1089
-            mediatorVOS.add(mediatorVO);
1090
-            result.setMediatorList(mediatorVOS);
1091
-        }
1092
-        if(StrUtil.isNotEmpty(msCaseMediator.getHearDate())){
1093
-            List<String> herdates = new ArrayList<>();
1094
-            herdates.add(msCaseMediator.getHearDate());
1095
-            result.setHerDates(herdates);
1096
-        }
1097 1151
         return AjaxResult.success(result);
1098 1152
     }
1099 1153
 
@@ -1211,9 +1265,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1211 1265
                             //发起签署
1212 1266
                             sealSignRecord.setFilename(fileName);
1213 1267
 
1214
-                            String arbitratorId = caseApplication.getMediatorId();
1215
-                            if (StringUtils.isNotEmpty(arbitratorId)) {
1216
-                                SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
1268
+                            Long arbitratorId = caseApplication.getMediatorId();
1269
+                            if (null!=arbitratorId) {
1270
+                                SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
1217 1271
                                 if (sysUser == null) {
1218 1272
                                     return AjaxResult.error();
1219 1273
                                 }
@@ -1537,9 +1591,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1537 1591
                                     //发起签署
1538 1592
                                     sealSignRecord.setFilename(fileName);
1539 1593
 
1540
-                                    String arbitratorId = caseApplication.getMediatorId();
1541
-                                    if (StringUtils.isNotEmpty(arbitratorId)) {
1542
-                                        SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
1594
+                                    Long arbitratorId = caseApplication.getMediatorId();
1595
+                                    if (arbitratorId!=null) {
1596
+                                        SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
1543 1597
                                         if (sysUser == null) {
1544 1598
                                             return AjaxResult.error();
1545 1599
                                         }
@@ -1781,7 +1835,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1781 1835
         if (nextFlow == null) {
1782 1836
             throw new ServiceException("未找到下一个流程节点");
1783 1837
         }
1784
-        setMediatorAndDate(application,vo);
1838
+     //   setMediatorAndDate(application,vo);
1839
+        application.setMediatorId(vo.getUserList().get(0).getUserId());
1840
+        application.setMediatorName(vo.getUserList().get(0).getNickName());
1785 1841
         application.setCaseFlowId(nextFlow.getNodeId());
1786 1842
         application.setCaseStatusName(nextFlow.getCaseStatusName());
1787 1843
         msCaseApplicationMapper.updateByPrimaryKeySelective(application);
@@ -1802,6 +1858,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1802 1858
      */
1803 1859
     @Override
1804 1860
     public MsCaseFlow nextFlow(Long caseId,Integer caseFlowId,Integer lockStatus) {
1861
+        // 查询当前流程节点
1862
+        MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
1863
+        if (currentFlow == null) {
1864
+            throw new ServiceException("未找到当前流程节点");
1865
+        }
1805 1866
         MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
1806 1867
         if (nextFlow == null) {
1807 1868
             throw new ServiceException("未找到下一个流程节点");
@@ -1815,7 +1876,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1815 1876
         application.setLockStatus(lockStatus);
1816 1877
         msCaseApplicationMapper.updateByPrimaryKeySelective(application);
1817 1878
         // 新增日志
1818
-        CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"");
1879
+        CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
1819 1880
         return nextFlow;
1820 1881
     }
1821 1882
 
@@ -2126,20 +2187,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2126 2187
             agentUser.setNickName(affiliate.getNameAgent());
2127 2188
             agentUser.setPhonenumber(affiliate.getContactTelphoneAgent());
2128 2189
             agentUser.setPassword(SecurityUtils.encryptPassword("abc123456"));
2129
-            agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
2190
+            agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
2130 2191
             userMapper.insertUser(agentUser);
2131 2192
             userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
2132 2193
         } else if (null == agentUser.getDeptId() ) {
2133 2194
             // todo 未关联部门,关联部门
2134
-            agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
2195
+            agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
2135 2196
             userMapper.updateUser(agentUser);
2136
-        }else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
2197
+        }else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationId())) {
2137 2198
             if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) {
2138 2199
                 throw new ServiceException("该申请代理人已在【" + agentUser.getDept().getDeptName() + "】申请机构下存在,请检查填写信息是否正确");
2139 2200
             } else {
2140 2201
                 throw new ServiceException("该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确");
2141 2202
             }
2142
-        } else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
2203
+        } else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationId())) {
2143 2204
             // 同步用户表和案件关联人表的手机号和名称
2144 2205
             affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent());
2145 2206
             affiliate.setNameAgent(agentUser.getNickName());
@@ -2173,13 +2234,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2173 2234
         Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV));
2174 2235
 
2175 2236
         // 将组织机构id设为申请人名称
2176
-        if (deptMap.containsKey(affiliate.getApplicationOrganName())) {
2177
-            affiliate.setApplicationOrganId(String.valueOf(deptMap.get(affiliate.getApplicationOrganName())));
2237
+        if (deptMap.containsKey(affiliate.getApplicationName())) {
2238
+            affiliate.setApplicationId(String.valueOf(deptMap.get(affiliate.getApplicationName())));
2178 2239
         } else {
2179 2240
             // 如果不存在则新增
2180 2241
             SysDept dept = new SysDept();
2181 2242
             dept.setParentId(0L);
2182
-            dept.setDeptName(affiliate.getApplicationOrganName());
2243
+            dept.setDeptName(affiliate.getApplicationName());
2183 2244
             dept.setAncestors("0");
2184 2245
             dept.setOrderNum(1);
2185 2246
             dept.setStatus("0");
@@ -2188,7 +2249,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
2188 2249
             dept.setUpdateBy(getUsername());
2189 2250
             sysDeptMapper.insertDept(dept);
2190 2251
             deptMap.put(dept.getDeptName(), dept.getDeptId());
2191
-            affiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
2252
+            affiliate.setApplicationId(String.valueOf(dept.getDeptId()));
2192 2253
         }
2193 2254
     }
2194 2255
 

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

@@ -143,6 +143,11 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
143 143
     @Transactional
144 144
     @Override
145 145
     public AjaxResult confirmPayment(CaseConfirmPayDTO dto) {
146
+        // 根据流程id查找当前流程节点
147
+        MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(dto.getCaseFlowId());
148
+        if (currentFlow == null) {
149
+            return AjaxResult.error("未找到当前流程节点");
150
+        }
146 151
         // 根据流程id查找下一个流程节点
147 152
         MsCaseFlow nextFlow = caseFlowMapper.nextFlow(dto.getCaseFlowId());
148 153
         if (nextFlow == null) {
@@ -156,7 +161,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
156 161
                 return AjaxResult.error("该批号下未找到案件");
157 162
             }
158 163
             for (MsCaseApplication application : applicationList) {
159
-                confirmPayment(nextFlow, application, dto);
164
+                confirmPayment(currentFlow,nextFlow, application, dto);
160 165
 
161 166
             }
162 167
         } else {
@@ -164,7 +169,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
164 169
             MsCaseApplication application = new MsCaseApplication();
165 170
             application.setId(dto.getCaseId());
166 171
             application.setLockStatus(YesOrNoEnum.YES.getCode());
167
-            confirmPayment(nextFlow, application, dto);
172
+            confirmPayment(currentFlow,nextFlow, application, dto);
168 173
 
169 174
         }
170 175
         return AjaxResult.success("确认缴费成功");
@@ -213,7 +218,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
213 218
         }
214 219
         JSONObject jsonObject = new JSONObject();
215 220
         jsonObject.set("totalFee", totalFee);
216
-        jsonObject.set("applicationOrganName", affiliate.getApplicationOrganName());
221
+        jsonObject.set("applicationOrganName", affiliate.getApplicationName());
217 222
         return AjaxResult.success(jsonObject);
218 223
     }
219 224
 
@@ -237,7 +242,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
237 242
         result.setCaseStatusName(application.getCaseStatusName());
238 243
         MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId());
239 244
         if(affiliate != null) {
240
-            result.setApplicationOrganName(affiliate.getApplicationOrganName());
245
+            result.setApplicationOrganName(affiliate.getApplicationName());
241 246
         }
242 247
         // 查询缴费单
243 248
         result.setCaseAttachList(caseAttachMapper.listCaseAttachByCaseIdAndType(id, AnnexTypeEnum.PAYMENT_RECEIPT.getCode()));
@@ -253,6 +258,12 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
253 258
     @Transactional
254 259
     @Override
255 260
     public AjaxResult confirmPaid(CaseConfirmPayDTO dto) {
261
+        // 根据流程id查找当前流程节点
262
+        MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(dto.getCaseFlowId());
263
+        if (currentFlow == null) {
264
+            return AjaxResult.error("未找到当前流程节点");
265
+        }
266
+
256 267
         // 根据流程id查找下一个流程节点
257 268
         MsCaseFlow nextFlow = caseFlowMapper.nextFlow(dto.getCaseFlowId());
258 269
         if (nextFlow == null) {
@@ -266,13 +277,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
266 277
                 return AjaxResult.error("该批号下未找到案件");
267 278
             }
268 279
             for (MsCaseApplication application : applicationList) {
269
-                confirmPaid(nextFlow, application);
280
+                confirmPaid(currentFlow,nextFlow, application);
270 281
             }
271 282
         }else {
272 283
             MsCaseApplication caseApplication=new MsCaseApplication();
273 284
             caseApplication.setId(dto.getCaseId());
274 285
             caseApplication.setLockStatus(YesOrNoEnum.YES.getCode());
275
-            confirmPaid(nextFlow,caseApplication );
286
+            confirmPaid(currentFlow,nextFlow,caseApplication );
276 287
         }
277 288
 
278 289
 
@@ -285,7 +296,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
285 296
      * @param application
286 297
      * @param
287 298
      */
288
-    private void confirmPaid(MsCaseFlow nextFlow, MsCaseApplication application) {
299
+    private void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) {
289 300
         //更改记录表里的支付状态和支付时间
290 301
         MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord();
291 302
         casePaymentRecord.setPaymentStatus(1);
@@ -300,7 +311,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
300 311
         application.setCaseStatusName(nextFlow.getCaseStatusName());
301 312
         caseApplicationMapper.updateByPrimaryKeySelective(application);
302 313
         // 新增日志
303
-        CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"确认已缴费");
314
+        CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费");
304 315
         // todo 发送短信
305 316
 
306 317
 
@@ -314,7 +325,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
314 325
      * @param dto
315 326
      */
316 327
 
317
-    private void confirmPayment(MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
328
+    private void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
318 329
         application.setPayType(dto.getPayType());
319 330
         // 修改缴费附件
320 331
         if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {
@@ -327,7 +338,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
327 338
         application.setCaseFlowId(nextFlow.getId());
328 339
         application.setCaseStatusName(nextFlow.getCaseStatusName());
329 340
         caseApplicationMapper.updateByPrimaryKeySelective(application);
330
-        CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"确认缴费");
341
+        CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认缴费");
331 342
     }
332 343
 
333 344
 

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

@@ -10,7 +10,6 @@ import com.alibaba.fastjson.JSONObject;
10 10
 import com.google.gson.Gson;
11 11
 import com.google.gson.JsonArray;
12 12
 import com.google.gson.JsonObject;
13
-import com.ruoyi.common.constant.CaseApplicationConstants;
14 13
 import com.ruoyi.common.constant.FileTransformation;
15 14
 import com.ruoyi.common.core.domain.AjaxResult;
16 15
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
@@ -21,7 +20,6 @@ import com.ruoyi.common.exception.EsignDemoException;
21 20
 import com.ruoyi.common.exception.ServiceException;
22 21
 import com.ruoyi.common.utils.EmailOutUtil;
23 22
 import com.ruoyi.common.utils.SmsUtils;
24
-import com.ruoyi.common.utils.StringUtils;
25 23
 import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
26 24
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
27 25
 import com.ruoyi.system.mapper.SysUserMapper;
@@ -31,9 +29,11 @@ import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
31 29
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseLogRecord;
32 30
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO;
33 31
 import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
34
-import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord;
35 32
 import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
36
-import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*;
33
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
34
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
35
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
36
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
37 37
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
38 38
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
39 39
 import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
@@ -53,13 +53,10 @@ import org.springframework.stereotype.Service;
53 53
 import org.springframework.transaction.annotation.Transactional;
54 54
 import tk.mybatis.mapper.entity.Example;
55 55
 
56
-import static com.ruoyi.common.utils.SecurityUtils.getUsername;
57
-
58 56
 import javax.annotation.Resource;
59 57
 import java.io.File;
60 58
 import java.time.LocalDate;
61 59
 import java.util.*;
62
-import java.util.stream.Collectors;
63 60
 
64 61
 import static com.ruoyi.common.core.domain.AjaxResult.success;
65 62
 
@@ -151,9 +148,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
151 148
                                 //发起签署
152 149
                                 sealSignRecord.setFilename(fileName);
153 150
 
154
-                                String arbitratorId = caseApplication.getMediatorId();
155
-                                if (StringUtils.isNotEmpty(arbitratorId)) {
156
-                                    SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
151
+                                Long arbitratorId = caseApplication.getMediatorId();
152
+                                if (arbitratorId!=null) {
153
+                                    SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
157 154
                                     if (sysUser == null) {
158 155
                                         return AjaxResult.error();
159 156
                                     }

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

@@ -186,6 +186,8 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
186 186
                 null, null);
187 187
         // 先删除之前的会议
188 188
         reservedConferenceMapper.deletByCaseId(caseId);
189
+        // 新增会议
190
+        reservedConferenceMapper.insert(conference);
189 191
         return String.valueOf(roomId);
190 192
     }
191 193
 

+ 0
- 5
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseApplicationMapper.xml View File

@@ -17,9 +17,7 @@
17 17
     <result column="fee_payable" jdbcType="DECIMAL" property="feePayable" />
18 18
     <result column="mediator_id" jdbcType="BIGINT" property="mediatorId" />
19 19
     <result column="mediator_name" jdbcType="VARCHAR" property="mediatorName" />
20
-    <result column="is_agree_pend_tral" jdbcType="INTEGER" property="isAgreePendTral" />
21 20
     <result column="pay_type" jdbcType="CHAR" property="payType" />
22
-    <result column="adjudica_counter" jdbcType="INTEGER" property="adjudicaCounter" />
23 21
     <result column="is_absence" jdbcType="INTEGER" property="isAbsence" />
24 22
     <result column="lock_status" jdbcType="INTEGER" property="lockStatus" />
25 23
     <result column="room_id" jdbcType="VARCHAR" property="roomId" />
@@ -32,10 +30,7 @@
32 30
     <result column="version" jdbcType="INTEGER" property="version" />
33 31
     <result column="arbitrat_claims" jdbcType="LONGVARCHAR" property="arbitratClaims" />
34 32
     <result column="facts" jdbcType="LONGVARCHAR" property="facts" />
35
-    <result column="request_rule" jdbcType="LONGVARCHAR" property="requestRule" />
36
-    <result column="case_describe" jdbcType="LONGVARCHAR" property="caseDescribe" />
37 33
     <result column="mediation_url" jdbcType="LONGVARCHAR" property="mediationUrl" />
38
-    <result column="adjudica_counter_reason" jdbcType="LONGVARCHAR" property="adjudicaCounterReason" />
39 34
     <result column="mediation_agreement" jdbcType="LONGVARCHAR" property="mediationAgreement" />
40 35
     <result column="is_reconci" jdbcType="INTEGER" property="isReconci" />
41 36
   </resultMap>

+ 0
- 33
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/template/FatchRuleMapper.xml View File

@@ -36,39 +36,6 @@
36 36
         </where>
37 37
     </select>
38 38
 
39
-    <select id="selectColumnandComment"  parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule"  resultMap="BaseResultMap">
40
-        select
41
-            a.COLUMN_name as `column`,
42
-            a.COLumn_comment as column_name
43
-        from
44
-            information_schema.COLUMNS a
45
-        where
46
-            TABLE_schema =  #{databaseName}
47
-            and TABLE_name in('case_application','case_affiliate')
48
-            and COLUMN_NAME  not in('id','case_appli_id','case_num','case_subject_amount',
49
-        'register_date','arbitrat_method','case_status','hear_date','begin_video_date',
50
-        'online_video_person','create_time','update_by','update_time','create_by',
51
-        'arbitrator_id','arbitrator_name','pended_trial_arbitorid','pending_appoint_arbotrar',
52
-        'case_name','case_result','is_agree_pend_tral','objection_add_eviden','open_court_hear',
53
-        'paid_expenses','filearbitra_url','pay_type','adjudica_counter','proper_preser','objecti_juris',
54
-        'is_absence','respon_cross_opin','applica_cross_opin','respon_defen_opini','appli_is_absen',
55
-        'lock_status','room_id','import_flag','version','batch_number','template_id','applicant_agent_user_id','contract_number','identity_type','application_organ_id')
56
-
57
-    </select>
58
-
59
-    <select id="selectColumnbycomment"  parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule"  resultMap="BaseResultMap">
60
-        select
61
-              COLUMN_NAME
62
-        from
63
-            information_schema.COLUMNS
64
-        where
65
-            TABLE_schema =  #{databaseName}
66
-            and TABLE_name in('case_application','case_affiliate')
67
-            and  COLumn_comment  = #{columnName}
68
-
69
-    </select>
70
-
71
-
72 39
     <select id="selectFatchRuleListIsDefault" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule" resultMap="BaseResultMap">
73 40
         SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
74 41
         f.`column` ,f.is_default ,f.`column_name`