|
|
@@ -189,6 +189,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
189
|
189
|
caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
|
|
190
|
190
|
|
|
191
|
191
|
}
|
|
|
192
|
+ // 组装申请代理人信息
|
|
|
193
|
+ buildAgentInfo(caseAffiliate);
|
|
192
|
194
|
}
|
|
193
|
195
|
}
|
|
194
|
196
|
|
|
|
@@ -276,8 +278,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
276
|
278
|
caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
|
|
277
|
279
|
|
|
278
|
280
|
}
|
|
|
281
|
+ buildAgentInfo(caseAffiliate);
|
|
|
282
|
+
|
|
279
|
283
|
}
|
|
280
|
|
- caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
|
|
|
284
|
+
|
|
|
285
|
+ caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
|
|
281
|
286
|
}
|
|
282
|
287
|
|
|
283
|
288
|
}
|
|
|
@@ -293,6 +298,38 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
293
|
298
|
return rows;
|
|
294
|
299
|
}
|
|
295
|
300
|
|
|
|
301
|
+ /**
|
|
|
302
|
+ * 组装申请代理人信息
|
|
|
303
|
+ * @param caseAffiliate
|
|
|
304
|
+ */
|
|
|
305
|
+ private void buildAgentInfo(CaseAffiliate caseAffiliate) {
|
|
|
306
|
+ if(StrUtil.isNotEmpty(caseAffiliate.getNameAgent())){
|
|
|
307
|
+ // 组装申请机构代理人信息,用户表新增并且和部门关联
|
|
|
308
|
+ // 根据代理人身份证去用户表查询,有修改,么有新增
|
|
|
309
|
+ SysUser agentUser = sysUserMapper.selectUserByIdCard(caseAffiliate.getIdentityNumAgent());
|
|
|
310
|
+ if(agentUser==null){
|
|
|
311
|
+ agentUser = new SysUser();
|
|
|
312
|
+ agentUser.setIdCard(caseAffiliate.getIdentityNumAgent());
|
|
|
313
|
+ agentUser.setNickName(caseAffiliate.getNameAgent());
|
|
|
314
|
+ agentUser.setUserName(caseAffiliate.getIdentityNumAgent());
|
|
|
315
|
+ agentUser.setPhonenumber(caseAffiliate.getContactTelphoneAgent());
|
|
|
316
|
+ agentUser.setPassword(SecurityUtils.encryptPassword(Constants.DEFAULT_PASSWORD));
|
|
|
317
|
+ agentUser.setDeptId(Long.valueOf(caseAffiliate.getApplicationOrganId()));
|
|
|
318
|
+ int insertUserRow = sysUserMapper.insertUser(agentUser);
|
|
|
319
|
+ if(insertUserRow>0) {
|
|
|
320
|
+ caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
|
|
|
321
|
+ // 发送短信 todo
|
|
|
322
|
+ }
|
|
|
323
|
+ }else {
|
|
|
324
|
+ // 同步用户表和案件关联人表的手机号和名称
|
|
|
325
|
+ caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber());
|
|
|
326
|
+ caseAffiliate.setNameAgent(agentUser.getNickName());
|
|
|
327
|
+ caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
|
|
|
328
|
+ }
|
|
|
329
|
+
|
|
|
330
|
+ }
|
|
|
331
|
+ }
|
|
|
332
|
+
|
|
296
|
333
|
@Override
|
|
297
|
334
|
@Transactional
|
|
298
|
335
|
public int submitCaseApplication(CaseApplication caseApplication) {
|
|
|
@@ -466,30 +503,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
466
|
503
|
if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
467
|
504
|
for (CaseAffiliate caseAffiliate : caseAffiliates){
|
|
468
|
505
|
caseAffiliate.setCaseAppliId(caseApplicationItera.getId());
|
|
469
|
|
- // 组装申请机构代理人信息,用户表新增并且和部门关联
|
|
470
|
|
- // 根据代理人身份证去用户表查询,有修改,么有新增
|
|
471
|
|
- if(caseAffiliate.getIdentityType()==1) {
|
|
472
|
|
- SysUser agentUser = sysUserMapper.selectUserByIdCard(caseAffiliate.getIdentityNumAgent());
|
|
473
|
|
- if(agentUser==null){
|
|
474
|
|
- agentUser = new SysUser();
|
|
475
|
|
- agentUser.setIdCard(caseAffiliate.getIdentityNumAgent());
|
|
476
|
|
- agentUser.setNickName(caseAffiliate.getNameAgent());
|
|
477
|
|
- agentUser.setUserName(caseAffiliate.getIdentityNumAgent());
|
|
478
|
|
- agentUser.setPhonenumber(caseAffiliate.getContactTelphoneAgent());
|
|
479
|
|
- agentUser.setPassword(SecurityUtils.encryptPassword(Constants.DEFAULT_PASSWORD));
|
|
480
|
|
- agentUser.setDeptId(Long.valueOf(caseAffiliate.getApplicationOrganId()));
|
|
481
|
|
- int insertUserRow = sysUserMapper.insertUser(agentUser);
|
|
482
|
|
- if(insertUserRow>0) {
|
|
483
|
|
- caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
|
|
484
|
|
- // 发送短信 todo
|
|
485
|
|
- }
|
|
486
|
|
- }else {
|
|
487
|
|
- // 同步用户表和案件关联人表的手机号和名称
|
|
488
|
|
- caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber());
|
|
489
|
|
- caseAffiliate.setNameAgent(agentUser.getNickName());
|
|
490
|
|
- caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
|
|
491
|
|
- }
|
|
492
|
|
- }
|
|
|
506
|
+ buildAgentInfo(caseAffiliate);
|
|
493
|
507
|
|
|
494
|
508
|
}
|
|
495
|
509
|
caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
|