Просмотр исходного кода

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

wangqiong123 2 лет назад
Родитель
Сommit
ed8b4d5ae9

+ 12
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java Просмотреть файл

@@ -29,6 +29,10 @@ public class MsCaseApplicationReq {
29 29
      * 申请机构
30 30
      */
31 31
     private String applicationOrganId;
32
+    /**
33
+     * 是否申请人,不为空则是申请人
34
+     */
35
+    private Integer applicantFlag ;
32 36
     /**
33 37
      * 案件状态ID
34 38
      */
@@ -64,5 +68,13 @@ public class MsCaseApplicationReq {
64 68
      * 模板类型,1调解书,2调解申请书
65 69
      */
66 70
     private Integer templateType=2;
71
+    /**
72
+     * 被申请人身份证
73
+     */
74
+    private String respondentIdentityNum;
75
+    /**
76
+     * 是否在线开庭,空-书面
77
+     */
78
+    private Integer hearDateFlag ;
67 79
 
68 80
 }

+ 34
- 8
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseApplicationMapper.java Просмотреть файл

@@ -34,7 +34,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
34 34
      * @param caseStatusNames
35 35
      * @return
36 36
      */
37
-    @Select("<script> select t.* from (select c.id,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," +
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 38
             "a.application_organ_name applicationOrganName,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> " +
@@ -53,15 +53,23 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
53 53
             "    AND c.case_num = #{req.caseNum} " +
54 54
             "</if> " +
55 55
 
56
-            "<if test=\"req.applicationOrganId != null and req.applicationOrganId != ''\">" +
56
+            "<if test=\"req.applicantFlag != null \">" +
57 57
             "    AND a.application_organ_id = #{req.applicationOrganId} " +
58
-            "</if> " +
58
+            "</if> "
59
+            + "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
60
+            "    AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
61
+            "</if> "
62
+            +
63
+            "<if test=\"req.hearDateFlag != null \">" +
64
+            "    AND a.mediation_method = '1'" +
65
+            "</if> "
66
+            +
59 67
             "<if test=\"req.startTime != null and req.startTime != ''\">"  +
60 68
             "and c.create_time &gt;= #{req.startTime}</if>" +
61 69
             "<if test=\"req.endTime != null and req.endTime != ''\">" +
62 70
             "and c.create_time &lt;= #{req.endTime}</if>" +
63 71
             "        </where> " +
64
-            "union  select c.id id,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," +
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," +
65 73
             "a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
66 74
             "c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_log_record r " +
67 75
             "join ms_case_application c on r.case_appli_id=c.id and r.case_status_name!=c.case_status_name " +
@@ -83,9 +91,18 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
83 91
             "<if test=\"req.caseNum != null and req.caseNum != ''\">" +
84 92
             "    AND c1.case_num = #{req.caseNum} " +
85 93
             "</if> " +
86
-            "<if test=\"req.applicationOrganId != null and req.applicationOrganId != ''\">" +
94
+            "<if test=\"req.applicantFlag != null \">" +
87 95
             "    AND a1.application_organ_id = #{req.applicationOrganId} " +
88
-            "</if> " +
96
+            "</if> "
97
+            + "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
98
+            "    AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
99
+            "</if> "
100
+            +
101
+            "<if test=\"req.hearDateFlag != null \">" +
102
+            "    AND a.mediation_method = '1'" +
103
+            "</if> "
104
+            +
105
+
89 106
             "<if test=\"req.startTime != null and req.startTime != ''\">"  +
90 107
             "and c1.create_time &gt;= #{req.startTime}</if>" +
91 108
             "<if test=\"req.endTime != null and req.endTime != ''\">"  +
@@ -108,9 +125,18 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
108 125
             "<if test=\"req.caseNum != null and req.caseNum != ''\">" +
109 126
             "    AND c.case_num = #{req.caseNum} " +
110 127
             "</if> " +
111
-            "<if test=\"req.applicationOrganId != null and req.applicationOrganId != ''\">" +
128
+            "<if test=\"req.applicantFlag != null \">" +
112 129
             "    AND a.application_organ_id = #{req.applicationOrganId} " +
113
-            "</if> " +
130
+            "</if> "
131
+            + "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
132
+            "    AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
133
+            "</if> "
134
+            +
135
+            "<if test=\"req.hearDateFlag != null \">" +
136
+            "    AND a.mediation_method = '1'" +
137
+            "</if> "
138
+            +
139
+
114 140
             "<if test=\"req.startTime != null and req.startTime != ''\">"  +
115 141
             "and c.create_time &gt;= #{req.startTime}</if>" +
116 142
             "<if test=\"req.endTime != null and req.endTime != ''\">" +

+ 33
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java Просмотреть файл

@@ -1,15 +1,19 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.miniprogress.impl;
2 2
 
3
+import cn.hutool.core.collection.CollectionUtil;
3 4
 import cn.hutool.core.util.StrUtil;
4 5
 import com.ruoyi.common.constant.CacheConstants;
5 6
 import com.ruoyi.common.core.domain.AjaxResult;
7
+import com.ruoyi.common.core.domain.entity.SysRole;
6 8
 import com.ruoyi.common.core.domain.entity.SysUser;
7 9
 import com.ruoyi.common.core.redis.RedisCache;
8 10
 import com.ruoyi.common.utils.SecurityUtils;
9 11
 import com.ruoyi.common.utils.SmsUtils;
10 12
 import com.ruoyi.common.utils.StringUtils;
11 13
 import com.ruoyi.common.utils.spring.SpringUtils;
14
+import com.ruoyi.system.mapper.SysRoleMapper;
12 15
 import com.ruoyi.system.mapper.SysUserMapper;
16
+import com.ruoyi.system.mapper.SysUserRoleMapper;
13 17
 import com.ruoyi.wisdomarbitrate.domain.dto.miniprogress.IdentityAuthentication;
14 18
 import com.ruoyi.wisdomarbitrate.domain.vo.miniprogress.WeChatUserVO;
15 19
 import com.ruoyi.wisdomarbitrate.mapper.miniprogress.IdentityAuthenticationMapper;
@@ -18,6 +22,8 @@ import lombok.extern.slf4j.Slf4j;
18 22
 import org.springframework.beans.factory.annotation.Autowired;
19 23
 import org.springframework.stereotype.Service;
20 24
 import org.springframework.transaction.annotation.Transactional;
25
+
26
+import java.util.Objects;
21 27
 import java.util.Random;
22 28
 import java.util.concurrent.TimeUnit;
23 29
 
@@ -32,6 +38,10 @@ public class WeChatUserServiceImpl implements WeChatUserService {
32 38
     @Autowired
33 39
     private SysUserMapper sysUserMapper;
34 40
     @Autowired
41
+    private SysRoleMapper roleMapper;
42
+    @Autowired
43
+    private SysUserRoleMapper userRoleMapper;
44
+    @Autowired
35 45
     private IdentityAuthenticationMapper identityAuthenticationMapper;
36 46
 
37 47
     @Override
@@ -112,6 +122,11 @@ public class WeChatUserServiceImpl implements WeChatUserService {
112 122
 
113 123
         // 根据身份证查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增
114 124
         SysUser sysUser=sysUserMapper.selectUserByIdCard(ientityAuthentication.getIdentityNo());
125
+        // 查询角色
126
+        Long roleIdByName = roleMapper.selectRoleIdByName("被申请人");
127
+        if(roleIdByName==null){
128
+            return AjaxResult.warn("被申请人角色不存在,请联系系统管理员新增角色");
129
+        }
115 130
         if(sysUser!=null){
116 131
             sysUser.setIdCard(ientityAuthentication.getIdentityNo());
117 132
             sysUser.setNickName(ientityAuthentication.getName());
@@ -121,6 +136,21 @@ public class WeChatUserServiceImpl implements WeChatUserService {
121 136
             sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord()));
122 137
             sysUserMapper.updateUser(sysUser);
123 138
             ientityAuthentication.setUserId(sysUser.getUserId());
139
+            int count=0;
140
+           if(CollectionUtil.isNotEmpty(sysUser.getRoles()) ){
141
+
142
+               for (SysRole role : sysUser.getRoles()) {
143
+                   if(Objects.equals(role.getRoleId(), roleIdByName)){
144
+                       count++;
145
+                       break;
146
+                   }
147
+               }
148
+           }
149
+           if(CollectionUtil.isEmpty(sysUser.getRoles())||count==0){
150
+                   // 用户未关联被申请人角色,关联角色
151
+                   userRoleMapper.insertUserRole(sysUser.getUserId(), roleIdByName);
152
+           }
153
+
124 154
         }else {
125 155
             sysUser=new SysUser();
126 156
             sysUser.setIdCard(ientityAuthentication.getIdentityNo());
@@ -134,12 +164,15 @@ public class WeChatUserServiceImpl implements WeChatUserService {
134 164
             if(row<1) {
135 165
                 return AjaxResult.warn("注册失败");
136 166
             }
167
+            // 用户关联被申请人角色
168
+            userRoleMapper.insertUserRole(sysUser.getUserId(), roleIdByName);
137 169
         }
138 170
 
139 171
         ientityAuthentication.setUserId(sysUser.getUserId());
140 172
         ientityAuthentication.setUserName(sysUser.getUserName());
141 173
         // 已经认证过的用户才能注册,认证表中已经有该数据
142 174
         identityAuthenticationMapper.updateIdentityAuthentication(ientityAuthentication);
175
+        // 查询角色
143 176
         return AjaxResult.success("注册成功");
144 177
     }
145 178
 

+ 27
- 14
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Просмотреть файл

@@ -150,7 +150,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
150 150
         }
151 151
         // 根据用户查询角色
152 152
         LoginUser loginUser = SecurityUtils.getLoginUser();
153
-        List<SysRole> roles = loginUser.getUser().getRoles();
153
+        SysUser sysUser = loginUser.getUser();
154
+        List<SysRole> roles = sysUser.getRoles();
154 155
         if (CollectionUtil.isEmpty(roles)) {
155 156
             throw new ServiceException("该用户未指定角色");
156 157
         }
@@ -169,6 +170,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
169 170
         if (CollectionUtil.isEmpty(caseFlows)) {
170 171
             throw new ServiceException("该角色为绑定案件流程");
171 172
         }
173
+        for (SysRole role : roles) {
174
+            if(StrUtil.isNotEmpty(role.getRoleName())&&StrUtil.equals(role.getRoleName(),"申请人")){
175
+                if(loginUser.getDeptId()!=null) {
176
+                    req.setApplicationOrganId(String.valueOf(loginUser.getDeptId()));
177
+                }
178
+                req.setApplicantFlag(1);
179
+            }
180
+            if(StrUtil.isNotEmpty(role.getRoleName())&&StrUtil.equals(role.getRoleName(),"被申请人")){
181
+                // todo 被申请人案件根据被申请人身份证号查询案件列表
182
+                req.setRespondentIdentityNum(sysUser.getIdCard());
183
+            }
184
+        }
172 185
         startPage();
173 186
         // 查询案件列表
174 187
         List<MsCaseApplicationVO> caseApplicationList = msCaseApplicationMapper.list(req, caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList()));
@@ -264,7 +277,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
264 277
                 }
265 278
                 affiliate.setCaseAppliId(caseApplication.getId());
266 279
                 msCaseAffiliateMapper.insert(affiliate);
267
-                // 生成调解申请书
268 280
                 // 查询调解申请书模板id
269 281
                 TemplateManage templateManage=templateManageMapper.selectByType(2);
270 282
                 if(templateManage!=null) {
@@ -277,6 +289,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
277 289
                         // 压缩包导入
278 290
                         req.setBatchNumber(caseApplication.getBatchNumber());
279 291
                     }
292
+                    // 生成调解申请书
280 293
                         req.setTemplateId(String.valueOf(templateManage.getId()));
281 294
                         generateApplication(req);
282 295
 
@@ -589,7 +602,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
589 602
             List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList());
590 603
             // 根据ids查询案件关联人员
591 604
             Example afflicateExample = new Example(MsCaseAffiliate.class);
592
-            afflicateExample.createCriteria().andIn("case_appli_id", caseIds);
605
+            afflicateExample.createCriteria().andIn("caseAppliId", caseIds);
593 606
             List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(afflicateExample);
594 607
             if(CollectionUtil.isEmpty(affiliateList)){
595 608
                 throw new ServiceException("该批次号下未找到案件关联人员");
@@ -712,7 +725,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
712 725
             }
713 726
             // 查询案件关联人员
714 727
             Example example = new Example(MsCaseAffiliate.class);
715
-            example.createCriteria().andIn("case_appli_id", applicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList()));
728
+            example.createCriteria().andIn("caseAppliId", applicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList()));
716 729
             List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(example);
717 730
             if (CollectionUtil.isEmpty(affiliateList)) {
718 731
                 return AjaxResult.error("该批次号下未找到案件");
@@ -841,10 +854,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
841 854
                 // 查询日志中是否有该节点的被申请人操作
842 855
                 Example example = new Example(MsCaseLogRecord.class);
843 856
                 Example.Criteria criteria = example.createCriteria();
844
-                criteria.andEqualTo("case_appli_id", vo.getId());
845
-                criteria.andEqualTo("case_node", nextFlow.getNodeId());
846
-                criteria.andEqualTo("case_status_name", nextFlow.getCaseStatusName());
847
-                criteria.andEqualTo("create_by", user.getUserName());
857
+                criteria.andEqualTo("caseAppliId", vo.getId());
858
+                criteria.andEqualTo("caseNode", nextFlow.getNodeId());
859
+                criteria.andEqualTo("caseStatusName", nextFlow.getCaseStatusName());
860
+                criteria.andEqualTo("createBy", user.getUserName());
848 861
                 int count = caseLogRecordMapper.selectCountByExample(example);
849 862
                 if(count>0){
850 863
                     // 被申请人已预约,更新流程节点
@@ -1092,8 +1105,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1092 1105
             // 查询调解书模板是否存在
1093 1106
             Example example = new Example(MsCaseApplication.class);
1094 1107
             Example.Criteria criteria = example.createCriteria();
1095
-            criteria.andEqualTo("batch_number", req.getBatchNumber());
1096
-            criteria.andIsNotNull("template_id");
1108
+            criteria.andEqualTo("batchNumber", req.getBatchNumber());
1109
+            criteria.andIsNotNull("templateId");
1097 1110
             MsCaseApplication caseApplication = msCaseApplicationMapper.selectOneByExample(example);
1098 1111
             if(caseApplication==null||caseApplication.getTemplateId()==null){
1099 1112
                 return AjaxResult.error("未找到模板");
@@ -1558,9 +1571,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1558 1571
         // todo
1559 1572
         String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day;
1560 1573
         Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
1561
-        String orgFileName = "调解申请书.docx";
1574
+        String orgFileName = "调解申请书";
1562 1575
         if(templateType!=null&&templateType==1) {
1563
-            orgFileName = "调解书.docx";
1576
+            orgFileName = "调解书";
1564 1577
             annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode();
1565 1578
         }
1566 1579
         String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx";
@@ -1570,7 +1583,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1570 1583
 
1571 1584
         MsCaseAttach caseAttach = MsCaseAttach.builder()
1572 1585
                 .caseAppliId(application.getId())
1573
-                .annexName(orgFileName)
1586
+                .annexName(orgFileName+".docx")
1574 1587
                 .annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX))
1575 1588
                 .annexType(annexType)
1576 1589
                 .build();
@@ -1653,7 +1666,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1653 1666
             //  String filePath = RuoYiConfig.getUploadPath();
1654 1667
             MsCaseAttach caseAttach = new MsCaseAttach();
1655 1668
             caseAttach.setCaseAppliId(caseApplication.getId());
1656
-            caseAttach.setAnnexPath(entry.getValue());
1669
+            caseAttach.setAnnexPath(fileUrl.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX));
1657 1670
             caseAttach.setAnnexName(entry.getKey());
1658 1671
             // todo
1659 1672
 //                                    if (StrUtil.isNotEmpty(fileUrl)) {

+ 15
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseMediatorMapper.xml Просмотреть файл

@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseMediatorMapper">
4
+  <resultMap id="BaseResultMap" type="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseMediator">
5
+    <!--
6
+      WARNING - @mbg.generated
7
+    -->
8
+    <id column="id" jdbcType="BIGINT" property="id" />
9
+    <result column="case_appli_id" jdbcType="BIGINT" property="caseAppliId" />
10
+    <result column="mediator_id" jdbcType="VARCHAR" property="mediatorId" />
11
+    <result column="mediator_name" jdbcType="VARCHAR" property="mediatorName" />
12
+    <result column="hear_date" jdbcType="VARCHAR" property="hearDate" />
13
+    <result column="identity_type" jdbcType="INTEGER" property="identityType" />
14
+  </resultMap>
15
+</mapper>