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

Merged
wangqiong123 merged 1 commits from wq into dev 2023-10-16 10:48:13 +00:00
2 changed files with 40 additions and 25 deletions
@@ -189,6 +189,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
}
// 组装申请代理人信息
buildAgentInfo(caseAffiliate);
}
}
@@ -276,7 +278,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
}
buildAgentInfo(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);
@@ -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},