Browse Source

代理人角色查询

18792927508 2 years ago
parent
commit
8906d10451

+ 12
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java View File

@@ -394,11 +394,23 @@ public class CaseApplication  extends BaseEntity {
394 394
      * 部门长状态
395 395
      */
396 396
     private List<Integer> deptHeadStatus;
397
+    /**
398
+     * 代理人角色有关部门
399
+     */
400
+    private List<Long> agentDeptIds;
397 401
     /**
398 402
      * 财务状态
399 403
      */
400 404
     private Integer financeStatus;
401 405
 
406
+    public List<Long> getAgentDeptIds() {
407
+        return agentDeptIds;
408
+    }
409
+
410
+    public void setAgentDeptIds(List<Long> agentDeptIds) {
411
+        this.agentDeptIds = agentDeptIds;
412
+    }
413
+
402 414
     public String getLoginUserName() {
403 415
         return loginUserName;
404 416
     }

+ 56
- 18
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java View File

@@ -33,13 +33,6 @@ import com.ruoyi.wisdomarbitrate.mapper.*;
33 33
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
34 34
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
35 35
 import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
36
-import com.tencentcloudapi.common.Credential;
37
-import com.tencentcloudapi.common.exception.TencentCloudSDKException;
38
-import com.tencentcloudapi.common.profile.ClientProfile;
39
-import com.tencentcloudapi.common.profile.HttpProfile;
40
-import com.tencentcloudapi.trtc.v20190722.TrtcClient;
41
-import com.tencentcloudapi.trtc.v20190722.models.DismissRoomByStrRoomIdRequest;
42
-import com.tencentcloudapi.trtc.v20190722.models.DismissRoomByStrRoomIdResponse;
43 36
 import com.tencentyun.TLSSigAPIv2;
44 37
 import org.apache.http.HttpEntity;
45 38
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -53,8 +46,6 @@ import org.springframework.beans.factory.annotation.Value;
53 46
 import org.springframework.stereotype.Service;
54 47
 import org.springframework.transaction.annotation.Transactional;
55 48
 import org.springframework.web.multipart.MultipartFile;
56
-
57
-import javax.servlet.http.HttpServletRequest;
58 49
 import java.io.*;
59 50
 import java.math.BigDecimal;
60 51
 import java.math.RoundingMode;
@@ -121,7 +112,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
121 112
     private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
122 113
    // 邮箱正则
123 114
     private static final Pattern EMAIL_PATTERN = Pattern.compile("^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$");
124
-
115
+    // 身份证号码正则表达式
116
+    private static final String ID_REGEX = "^(\\d{14}|\\d{17})(\\d|[Xx])$";
125 117
 
126 118
     /**
127 119
      * 数据权限:1.每个人不同的角色,而每个角色可以操作不同的案件状态
@@ -182,14 +174,18 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
182 174
                     caseApplication.setDeptIds(deptIds);
183 175
                 }
184 176
                 if (role.getRoleName().equals("申请人")) {
185
-                    // 查询角色有关的用户部门
177
+                    // 查询有关的用户部门
186 178
                     caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
187 179
                 }
188 180
                 if (role.getRoleName().equals("被申请人")) {
189 181
                     //
190 182
                     caseApplication.setIdCard(String.valueOf(sysUser.getIdCard()));
191 183
                 }
192
-
184
+                if (role.getRoleName().equals("代理人")) {
185
+                    // 查询角色有关的用户部门
186
+                         List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
187
+                         caseApplication.setAgentDeptIds(agentDeptIds);
188
+                }
193 189
             }
194 190
 
195 191
 
@@ -1337,6 +1333,48 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1337 1333
         validDebtorApplicationAgentColumn(caseApplication, failureMsg);
1338 1334
     }
1339 1335
 
1336
+    /**
1337
+     * 验证身份证号码是否合法
1338
+     * @param idCard
1339
+     * @return
1340
+     */
1341
+    public static boolean validateIdCard(String idCard) {
1342
+        if (idCard == null || idCard.trim().isEmpty()) {
1343
+            return false;
1344
+        }
1345
+
1346
+        if (!Pattern.matches(ID_REGEX, idCard)) {
1347
+            return false;
1348
+        }
1349
+
1350
+        // 根据身份证号码的长度,采取不同的校验位计算方式
1351
+        if (idCard.length() == 15) {
1352
+            // 旧版身份证校验位计算
1353
+            int sum = 0;
1354
+            int[] weights = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8};
1355
+            String idDigits = idCard.substring(0, 14);
1356
+            for (int i = 0; i < idDigits.length(); i++) {
1357
+                sum += Integer.parseInt(idDigits.substring(i, i + 1)) * weights[i];
1358
+            }
1359
+            int checkCode = 11 - (sum % 11);
1360
+            if (checkCode == 10) {
1361
+                checkCode = 0;
1362
+            }
1363
+            return idCard.substring(idCard.length() - 1).equals(String.valueOf(checkCode));
1364
+        } else if (idCard.length() == 18) {
1365
+            // 新版身份证校验位计算
1366
+            int sum = 0;
1367
+            int[] weights = {6, 7, 8, 4, 5, 6, 3, 2, 1, 0, 9, 7, 3, 4, 5, 6, 2, 8};
1368
+            String idDigits = idCard.substring(0, 17);
1369
+            for (int i = 0; i < idDigits.length(); i++) {
1370
+                sum += Integer.parseInt(idDigits.substring(i, i + 1)) * weights[i];
1371
+            }
1372
+            int checkCode = sum % 10;
1373
+            return idCard.substring(idCard.length() - 1).equals(String.valueOf(checkCode));
1374
+        }
1375
+
1376
+        return false;
1377
+    }
1340 1378
     /**
1341 1379
      * 校验被申请人代理信息
1342 1380
      *
@@ -1351,8 +1389,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1351 1389
         }
1352 1390
         if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())) {
1353 1391
             failureMsg.append("【被申请人主体信息-代理人身份证号】字段不能为空;");
1354
-        } else if (caseApplication.getDebtorIdentityNumAgent().length() > 50) {
1355
-            failureMsg.append("【被申请人主体信息-代理人身份证号】字段超出指定长度,最大长度为50;");
1392
+        } else if (validateIdCard(caseApplication.getDebtorIdentityNumAgent())) {
1393
+            failureMsg.append("【被申请人主体信息-代理人身份证号】不合法;");
1356 1394
         }
1357 1395
         String debtorContactTelphoneAgent = caseApplication.getDebtorContactTelphoneAgent();
1358 1396
         if (StrUtil.isEmpty(debtorContactTelphoneAgent)) {
@@ -1381,8 +1419,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1381 1419
         }
1382 1420
         if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())) {
1383 1421
             failureMsg.append("【被申请人主体信息-身份证号】字段不能为空;");
1384
-        } else if (caseApplication.getDebtorIdentityNum().length() > 50) {
1385
-            failureMsg.append("【被申请人主体信息-身份证号】字段超出指定长度,最大长度为50;");
1422
+        } else if (validateIdCard(caseApplication.getDebtorIdentityNum())) {
1423
+            failureMsg.append("【被申请人主体信息-身份证号】不合法;");
1386 1424
         }
1387 1425
         String debtorContactTelphone = caseApplication.getDebtorContactTelphone();
1388 1426
         if (StrUtil.isEmpty(debtorContactTelphone)) {
@@ -1438,8 +1476,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1438 1476
         }
1439 1477
         if (StrUtil.isEmpty(caseApplication.getIdentityNumAgent())) {
1440 1478
             failureMsg.append("【申请人主体信息-代理人身份证号】字段不能为空;");
1441
-        } else if (caseApplication.getIdentityNumAgent().length() > 50) {
1442
-            failureMsg.append("【申请人主体信息-代理人身份证号】字段超出指定长度,最大长度为50;");
1479
+        } else if (!validateIdCard(caseApplication.getIdentityNumAgent())) {
1480
+            failureMsg.append("【申请人主体信息-代理人身份证号】不合法;");
1443 1481
         }
1444 1482
         validAgentInfo(caseApplication, failureMsg, deptMap);
1445 1483
         String contactTelphoneAgent = caseApplication.getContactTelphoneAgent();

+ 9
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml View File

@@ -187,7 +187,16 @@
187 187
 
188 188
 
189 189
             </if>
190
+            <!--代理人-->
191
+            <if test="agentDeptIds != null and agentDeptIds.size()>0">
192
+                or (
193
+                t.application_organ_id in
194
+                <foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
195
+                </foreach>
196
+                 AND t.identity_type=1
197
+                and t.case_status in (0,9))
190 198
 
199
+            </if>
191 200
         </where>
192 201
         ) t1
193 202