Explorar el Código

新增修改案件申请代理人关系修改

18792927508 hace 2 años
padre
commit
c8e5e745ce

+ 39
- 25
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Ver fichero

189
                         caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
189
                         caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
190
 
190
 
191
                     }
191
                     }
192
+                    // 组装申请代理人信息
193
+                    buildAgentInfo(caseAffiliate);
192
                 }
194
                 }
193
             }
195
             }
194
 
196
 
276
                         caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
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
         return rows;
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
     @Override
333
     @Override
297
     @Transactional
334
     @Transactional
298
     public int submitCaseApplication(CaseApplication caseApplication) {
335
     public int submitCaseApplication(CaseApplication caseApplication) {
466
                             if(caseAffiliates!=null&&caseAffiliates.size()>0){
503
                             if(caseAffiliates!=null&&caseAffiliates.size()>0){
467
                                 for (CaseAffiliate caseAffiliate : caseAffiliates){
504
                                 for (CaseAffiliate caseAffiliate : caseAffiliates){
468
                                     caseAffiliate.setCaseAppliId(caseApplicationItera.getId());
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
                                 caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
509
                                 caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);

+ 1
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml Ver fichero

71
         identity_type= #{identityType},
71
         identity_type= #{identityType},
72
         application_organ_id= #{applicationOrganId},
72
         application_organ_id= #{applicationOrganId},
73
         application_organ_name= #{applicationOrganName},
73
         application_organ_name= #{applicationOrganName},
74
+        applicant_agent_user_id= #{applicantAgentUserId},
74
         name = #{name},
75
         name = #{name},
75
         identity_num = #{identityNum},
76
         identity_num = #{identityNum},
76
         contact_telphone = #{contactTelphone},
77
         contact_telphone = #{contactTelphone},