diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 412e592..d1c739b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -189,6 +189,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setApplicationOrganName(caseAffiliate.getName()); } + // 组装申请代理人信息 + buildAgentInfo(caseAffiliate); } } @@ -276,8 +278,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId())); } + buildAgentInfo(caseAffiliate); + } - caseAffiliateMapper.updataCaseAffiliate(caseAffiliate); + + caseAffiliateMapper.updataCaseAffiliate(caseAffiliate); } } @@ -293,6 +298,38 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return rows; } + /** + * 组装申请代理人信息 + * @param caseAffiliate + */ + private void buildAgentInfo(CaseAffiliate caseAffiliate) { + if(StrUtil.isNotEmpty(caseAffiliate.getNameAgent())){ + // 组装申请机构代理人信息,用户表新增并且和部门关联 + // 根据代理人身份证去用户表查询,有修改,么有新增 + SysUser agentUser = sysUserMapper.selectUserByIdCard(caseAffiliate.getIdentityNumAgent()); + if(agentUser==null){ + agentUser = new SysUser(); + agentUser.setIdCard(caseAffiliate.getIdentityNumAgent()); + agentUser.setNickName(caseAffiliate.getNameAgent()); + agentUser.setUserName(caseAffiliate.getIdentityNumAgent()); + agentUser.setPhonenumber(caseAffiliate.getContactTelphoneAgent()); + agentUser.setPassword(SecurityUtils.encryptPassword(Constants.DEFAULT_PASSWORD)); + agentUser.setDeptId(Long.valueOf(caseAffiliate.getApplicationOrganId())); + int insertUserRow = sysUserMapper.insertUser(agentUser); + if(insertUserRow>0) { + caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId())); + // 发送短信 todo + } + }else { + // 同步用户表和案件关联人表的手机号和名称 + caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber()); + caseAffiliate.setNameAgent(agentUser.getNickName()); + caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId())); + } + + } + } + @Override @Transactional public int submitCaseApplication(CaseApplication caseApplication) { @@ -466,30 +503,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { if(caseAffiliates!=null&&caseAffiliates.size()>0){ for (CaseAffiliate caseAffiliate : caseAffiliates){ caseAffiliate.setCaseAppliId(caseApplicationItera.getId()); - // 组装申请机构代理人信息,用户表新增并且和部门关联 - // 根据代理人身份证去用户表查询,有修改,么有新增 - if(caseAffiliate.getIdentityType()==1) { - SysUser agentUser = sysUserMapper.selectUserByIdCard(caseAffiliate.getIdentityNumAgent()); - if(agentUser==null){ - agentUser = new SysUser(); - agentUser.setIdCard(caseAffiliate.getIdentityNumAgent()); - agentUser.setNickName(caseAffiliate.getNameAgent()); - agentUser.setUserName(caseAffiliate.getIdentityNumAgent()); - agentUser.setPhonenumber(caseAffiliate.getContactTelphoneAgent()); - agentUser.setPassword(SecurityUtils.encryptPassword(Constants.DEFAULT_PASSWORD)); - agentUser.setDeptId(Long.valueOf(caseAffiliate.getApplicationOrganId())); - int insertUserRow = sysUserMapper.insertUser(agentUser); - if(insertUserRow>0) { - caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId())); - // 发送短信 todo - } - }else { - // 同步用户表和案件关联人表的手机号和名称 - caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber()); - caseAffiliate.setNameAgent(agentUser.getNickName()); - caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId())); - } - } + buildAgentInfo(caseAffiliate); } caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml index 4e861c4..05bbf48 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml @@ -71,6 +71,7 @@ identity_type= #{identityType}, application_organ_id= #{applicationOrganId}, application_organ_name= #{applicationOrganName}, + applicant_agent_user_id= #{applicantAgentUserId}, name = #{name}, identity_num = #{identityNum}, contact_telphone = #{contactTelphone},