|
|
@@ -28,7 +28,10 @@ import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
28
|
28
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
29
|
29
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
30
|
30
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
31
|
+import com.ruoyi.system.domain.SysUserRole;
|
|
|
32
|
+import com.ruoyi.system.mapper.SysRoleMapper;
|
|
31
|
33
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
34
|
+import com.ruoyi.system.mapper.SysUserRoleMapper;
|
|
32
|
35
|
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
|
|
33
|
36
|
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
34
|
37
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
@@ -81,6 +84,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
81
|
84
|
@Autowired
|
|
82
|
85
|
private SysUserMapper sysUserMapper;
|
|
83
|
86
|
@Autowired
|
|
|
87
|
+ private SysUserRoleMapper userRoleMapper;
|
|
|
88
|
+ @Autowired
|
|
|
89
|
+ private SysRoleMapper roleMapper;
|
|
|
90
|
+ @Autowired
|
|
84
|
91
|
private SealSignRecordMapper sealSignRecordMapper;
|
|
85
|
92
|
@Autowired
|
|
86
|
93
|
private CaseLogRecordMapper caseLogRecordMapper;
|
|
|
@@ -126,11 +133,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
126
|
133
|
caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
|
|
127
|
134
|
caseStatusList.add(CaseApplicationConstants.SIGN_ARBITRATION);
|
|
128
|
135
|
caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL);
|
|
129
|
|
- return caseApplicationMapper.selectDeptHeadCaseApplicationList(caseApplication,caseStatusList);
|
|
|
136
|
+ caseApplication.setDeptHeadStatus(caseStatusList);
|
|
130
|
137
|
}
|
|
131
|
138
|
if(role.getRoleName().equals("仲裁员")){
|
|
132
|
139
|
caseApplication.setUserId(String.valueOf(userId));
|
|
133
|
140
|
}
|
|
|
141
|
+ if(role.getRoleName().equals("财务")){
|
|
|
142
|
+ caseApplication.setFinanceStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
|
|
|
143
|
+ }
|
|
134
|
144
|
if(role.getRoleName().equals("法律顾问")){
|
|
135
|
145
|
// 查询角色有关的用户部门
|
|
136
|
146
|
List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
|
|
|
@@ -174,10 +184,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
174
|
184
|
){
|
|
175
|
185
|
return caseApplicationMapper.selectAdminCaseToDoCount();
|
|
176
|
186
|
}
|
|
177
|
|
-
|
|
178
|
|
- // 查看所有案件
|
|
179
|
187
|
if(role.getRoleName().equals("仲裁委")
|
|
180
|
188
|
||role.getRoleName().equals("部门长")){
|
|
|
189
|
+
|
|
181
|
190
|
caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
|
|
182
|
191
|
caseStatusList.add(CaseApplicationConstants.SIGN_ARBITRATION);
|
|
183
|
192
|
caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL);
|
|
|
@@ -205,6 +214,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
205
|
214
|
}
|
|
206
|
215
|
|
|
207
|
216
|
|
|
|
217
|
+
|
|
|
218
|
+
|
|
208
|
219
|
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
|
|
209
|
220
|
return caseApplicationMapper.selectTodoCountByRole(caseApplication);
|
|
210
|
221
|
}
|
|
|
@@ -264,7 +275,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
264
|
275
|
|
|
265
|
276
|
}
|
|
266
|
277
|
// 组装申请代理人信息
|
|
267
|
|
- buildAgentInfo(caseAffiliate);
|
|
|
278
|
+ String agentInfoFlag = buildAgentInfo(caseAffiliate);
|
|
|
279
|
+ if(StrUtil.isNotEmpty(agentInfoFlag)){
|
|
|
280
|
+ throw new ServiceException(agentInfoFlag);
|
|
|
281
|
+ }
|
|
268
|
282
|
}
|
|
269
|
283
|
}
|
|
270
|
284
|
|
|
|
@@ -352,7 +366,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
352
|
366
|
caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
|
|
353
|
367
|
|
|
354
|
368
|
}
|
|
355
|
|
- buildAgentInfo(caseAffiliate);
|
|
|
369
|
+ String agentInfoFlag = buildAgentInfo(caseAffiliate);
|
|
|
370
|
+ if(StrUtil.isNotEmpty(agentInfoFlag)){
|
|
|
371
|
+ throw new ServiceException(agentInfoFlag);
|
|
|
372
|
+ }
|
|
356
|
373
|
|
|
357
|
374
|
}
|
|
358
|
375
|
|
|
|
@@ -376,12 +393,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
376
|
393
|
* 组装申请代理人信息
|
|
377
|
394
|
* @param caseAffiliate
|
|
378
|
395
|
*/
|
|
379
|
|
- private void buildAgentInfo(CaseAffiliate caseAffiliate) {
|
|
380
|
|
- if(StrUtil.isNotEmpty(caseAffiliate.getNameAgent())){
|
|
|
396
|
+ private String buildAgentInfo(CaseAffiliate caseAffiliate) {
|
|
|
397
|
+ if (caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getNameAgent())) {
|
|
|
398
|
+ // 查询申请人角色id
|
|
|
399
|
+ Long roleId = roleMapper.selectRoleIdByName("申请人");
|
|
381
|
400
|
// 组装申请机构代理人信息,用户表新增并且和部门关联
|
|
382
|
401
|
// 根据代理人身份证去用户表查询,有修改,么有新增
|
|
383
|
402
|
SysUser agentUser = sysUserMapper.selectUserByIdCard(caseAffiliate.getIdentityNumAgent());
|
|
384
|
|
- if(agentUser==null){
|
|
|
403
|
+ if (agentUser == null) {
|
|
385
|
404
|
agentUser = new SysUser();
|
|
386
|
405
|
agentUser.setIdCard(caseAffiliate.getIdentityNumAgent());
|
|
387
|
406
|
agentUser.setNickName(caseAffiliate.getNameAgent());
|
|
|
@@ -390,18 +409,46 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
390
|
409
|
agentUser.setPassword(SecurityUtils.encryptPassword(Constants.DEFAULT_PASSWORD));
|
|
391
|
410
|
agentUser.setDeptId(Long.valueOf(caseAffiliate.getApplicationOrganId()));
|
|
392
|
411
|
int insertUserRow = sysUserMapper.insertUser(agentUser);
|
|
393
|
|
- if(insertUserRow>0) {
|
|
|
412
|
+ // 新增角色为申请人
|
|
|
413
|
+ ArrayList<SysUserRole> sysUserRoles = new ArrayList<>();
|
|
|
414
|
+ SysUserRole sysUserRole = new SysUserRole();
|
|
|
415
|
+ sysUserRole.setUserId(agentUser.getUserId());
|
|
|
416
|
+ sysUserRole.setRoleId(roleId);
|
|
|
417
|
+ sysUserRoles.add(sysUserRole);
|
|
|
418
|
+ if(CollectionUtil.isNotEmpty(sysUserRoles)) {
|
|
|
419
|
+ userRoleMapper.batchUserRole(sysUserRoles);
|
|
|
420
|
+ }
|
|
|
421
|
+ if (insertUserRow > 0) {
|
|
394
|
422
|
caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
|
|
395
|
423
|
// 发送短信 todo
|
|
396
|
424
|
}
|
|
397
|
|
- }else {
|
|
|
425
|
+ } else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(caseAffiliate.getApplicationOrganId())) {
|
|
|
426
|
+ return "申请机构与申请代理人不匹配";
|
|
|
427
|
+ } else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(caseAffiliate.getApplicationOrganId())){
|
|
398
|
428
|
// 同步用户表和案件关联人表的手机号和名称
|
|
399
|
429
|
caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber());
|
|
400
|
430
|
caseAffiliate.setNameAgent(agentUser.getNickName());
|
|
401
|
431
|
caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
|
|
|
432
|
+ // 新增角色为申请人
|
|
|
433
|
+ if(agentUser.getRoleIds()!=null) {
|
|
|
434
|
+ List<Long> longList = Arrays.asList(agentUser.getRoleIds());
|
|
|
435
|
+ if(!longList.contains(roleId)) {
|
|
|
436
|
+ ArrayList<SysUserRole> sysUserRoles = new ArrayList<>();
|
|
|
437
|
+ SysUserRole sysUserRole = new SysUserRole();
|
|
|
438
|
+ sysUserRole.setUserId(agentUser.getUserId());
|
|
|
439
|
+ sysUserRole.setRoleId(roleId);
|
|
|
440
|
+ sysUserRoles.add(sysUserRole);
|
|
|
441
|
+ if (CollectionUtil.isNotEmpty(sysUserRoles)) {
|
|
|
442
|
+ userRoleMapper.batchUserRole(sysUserRoles);
|
|
|
443
|
+ }
|
|
|
444
|
+ }
|
|
|
445
|
+ }
|
|
|
446
|
+
|
|
402
|
447
|
}
|
|
403
|
448
|
|
|
|
449
|
+
|
|
404
|
450
|
}
|
|
|
451
|
+ return null;
|
|
405
|
452
|
}
|
|
406
|
453
|
|
|
407
|
454
|
@Override
|
|
|
@@ -529,7 +576,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
529
|
576
|
// }else {
|
|
530
|
577
|
// caseApplicationListinsert.add(caseApplication);
|
|
531
|
578
|
// }
|
|
532
|
|
- caseApplicationListinsert.add(caseApplication);
|
|
|
579
|
+ if(StrUtil.isEmpty(caseApplication.getErrorMsg())) {
|
|
|
580
|
+ caseApplicationListinsert.add(caseApplication);
|
|
|
581
|
+ }else {
|
|
|
582
|
+ // 拼接错误信息
|
|
|
583
|
+ failureMsg.append("<br/>").append("第").append(i+2).append("行:").append(caseApplication.getErrorMsg().toString());
|
|
|
584
|
+
|
|
|
585
|
+ }
|
|
533
|
586
|
}else {
|
|
534
|
587
|
// 拼接错误信息
|
|
535
|
588
|
failureMsg.append("<br/>").append("第").append(i+2).append("行:").append(caseApplication.getErrorMsg().toString());
|
|
|
@@ -577,7 +630,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
577
|
630
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
578
|
631
|
for (CaseAffiliate caseAffiliate : caseAffiliates){
|
|
579
|
632
|
caseAffiliate.setCaseAppliId(caseApplicationItera.getId());
|
|
580
|
|
- buildAgentInfo(caseAffiliate);
|
|
581
|
633
|
|
|
582
|
634
|
}
|
|
583
|
635
|
caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
|
|
|
@@ -1444,6 +1496,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
1444
|
1496
|
if(StrUtil.isNotEmpty(caseApplication.getName())){
|
|
1445
|
1497
|
setApplicantOrganization(caseAffiliate, caseApplication, deptMap);
|
|
1446
|
1498
|
}
|
|
|
1499
|
+ String s = buildAgentInfo(caseAffiliate);
|
|
|
1500
|
+ if(StrUtil.isNotEmpty(s)){
|
|
|
1501
|
+ StringBuilder errorMsg = caseApplication.getErrorMsg();
|
|
|
1502
|
+ if(StrUtil.isEmpty(errorMsg)){
|
|
|
1503
|
+ errorMsg=new StringBuilder();
|
|
|
1504
|
+ }
|
|
|
1505
|
+ errorMsg.append(s);
|
|
|
1506
|
+ caseApplication.setErrorMsg(errorMsg);
|
|
|
1507
|
+ }
|
|
1447
|
1508
|
caseAffiliatesnew.add(caseAffiliate);
|
|
1448
|
1509
|
|
|
1449
|
1510
|
// 组装被申请人信息
|