申请人用手机号关联

This commit is contained in:
18792927508
2023-12-01 13:25:58 +08:00
parent fde91ebba5
commit 98200d775c
6 changed files with 106 additions and 86 deletions
@@ -148,6 +148,12 @@ public interface SysUserMapper
* @return * @return
*/ */
SysUser selectUserByIdCard(@Param("idCard")String identityNo); SysUser selectUserByIdCard(@Param("idCard")String identityNo);
/**
* 根据手机号查询用户信息
* @param phone
* @return
*/
SysUser selectUserByPhone(@Param("phone")String phone);
/** /**
* 根据部门和角色查询用户 * 根据部门和角色查询用户
@@ -158,4 +164,6 @@ public interface SysUserMapper
List<SysUser> selectByDeptIdAndRole(@Param("deptId")String applicationOrganId, @Param("roleName")String roleName); List<SysUser> selectByDeptIdAndRole(@Param("deptId")String applicationOrganId, @Param("roleName")String roleName);
List<SysUser> selectRoleUserByDeptId(@Param("deptId")Long deptId,@Param("roleId") Long roleId ); List<SysUser> selectRoleUserByDeptId(@Param("deptId")Long deptId,@Param("roleId") Long roleId );
} }
@@ -50,6 +50,13 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
private SmsRecordMapper smsRecordMapper; private SmsRecordMapper smsRecordMapper;
@Autowired @Autowired
private ICaseApplicationService caseApplicationService; private ICaseApplicationService caseApplicationService;
// 对比两个版本修改的字段,基本字段对比
private static final String[] columns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
"claimPrinciOwed","arbitratClaims","properPreser","requestRule"};
// 人员字段对比
private static final String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress","email",
"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
"compLegalperPost","responSex","responBirth"};
@Override @Override
public int insert(CaseApplication caseApplicationLog) { public int insert(CaseApplication caseApplicationLog) {
return caseApplicationLogMapper.insert(caseApplicationLog); return caseApplicationLogMapper.insert(caseApplicationLog);
@@ -146,40 +153,28 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication); List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication);
// 更新记录附件表 // 更新记录附件表
if(CollectionUtil.isNotEmpty(attachLogList)){ if(CollectionUtil.isNotEmpty(attachLogList)){
// caseAttachMapper.deleteByCasedIdAndType(vo.getCaseId(), 2,0);
for (CaseAttach caseAttach : attachLogList) { for (CaseAttach caseAttach : attachLogList) {
caseAttach.setCaseAppliId(vo.getCaseId()); caseAttach.setCaseAppliId(vo.getCaseId());
caseAttachMapper.updateCaseAttach(caseAttach); caseAttachMapper.updateCaseAttach(caseAttach);
} }
} }
// caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
} else { } else {
// 拒绝,将日志表改版本的状态改为拒绝 // 拒绝,将日志表改版本的状态改为拒绝
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE.getCode()); vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE.getCode());
caseApplicationLogMapper.updateStatus(vo); caseApplicationLogMapper.updateStatus(vo);
return sendAuditMessage(vo); return sendAuditMessage(vo);
// 修改案件表的版本号
// caseApplicationMapper.updateVersionById(vo.getCaseId(),vo.getVersion());
} }
return AjaxResult.success(); return AjaxResult.success();
} else if (Objects.equals(vo.getUpdateSubmitStatus(), UpdateSubmitStatus.REVOKE.getCode())) { } else if (Objects.equals(vo.getUpdateSubmitStatus(), UpdateSubmitStatus.REVOKE.getCode())) {
// 如果版本号为1,则直接返回
// 审核修改撤销状态 // 审核修改撤销状态
if (Objects.equals(vo.getIsAgree(), YesOrNoEnum.YES.getCode())) { if (Objects.equals(vo.getIsAgree(), YesOrNoEnum.YES.getCode())) {
// 同意撤销
agreeRevoke(vo); agreeRevoke(vo);
// 同意撤销,查询日志记录表上个版本数据,将数据更新到主表,并将日志表改版本的状态改为同意撤销
} else { } else {
// 拒绝撤销,将日志表改版本的状态改为拒绝撤销 // 拒绝撤销,将日志表改版本的状态改为拒绝撤销
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE_REVOKE.getCode()); vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE_REVOKE.getCode());
caseApplicationLogMapper.updateStatus(vo); caseApplicationLogMapper.updateStatus(vo);
return sendAuditMessage(vo); return sendAuditMessage(vo);
// 修改案件表的版本号
// caseApplicationMapper.updateVersionById(vo.getCaseId(),vo.getVersion());
} }
return AjaxResult.success(); return AjaxResult.success();
} }
@@ -231,34 +226,43 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
@Override @Override
public AjaxResult selectCompareCase(UpdateSubmitVO vo) { public AjaxResult selectCompareCase(UpdateSubmitVO vo) {
// 查询当前版本号和上一个版本号的案件 // 查询当前版本号和主表的案件
CaseApplication afterCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion()); CaseApplication afterCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
// CaseApplication beforeCase = caseApplicationLogMapper.selectBeforeCase(vo.getCaseId(), vo.getVersion());
CaseApplication caseApplication = new CaseApplication(); CaseApplication caseApplication = new CaseApplication();
caseApplication.setCaseAppliId(vo.getCaseId()); caseApplication.setCaseAppliId(vo.getCaseId());
caseApplication.setId(vo.getCaseId()); caseApplication.setId(vo.getCaseId());
CaseApplication beforeCase= caseApplicationService.selectCaseApplication(caseApplication); CaseApplication beforeCase= caseApplicationService.selectCaseApplication(caseApplication);
// 查询案件关联人员 // 查询案件关联人员
// beforeCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(beforeCase.getCaseLogId()));
afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId())); afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId()));
// 查询附件 // 查询附件
CaseAttach caseAttach = new CaseAttach(); CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliLogId(beforeCase.getCaseLogId()); caseAttach.setCaseAppliLogId(beforeCase.getCaseLogId());
caseAttach.setAnnexType(2); caseAttach.setAnnexType(2);
caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach); caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
// beforeCase.setCaseAttachList(caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach));
caseAttach.setCaseAppliLogId(afterCase.getCaseLogId()); caseAttach.setCaseAppliLogId(afterCase.getCaseLogId());
afterCase.setCaseAttachList(caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach)); List<CaseAttach> afterAttachList = caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
if(CollectionUtil.isNotEmpty(afterAttachList)){
for (CaseAttach attach : afterAttachList) {
String annexName = attach.getAnnexName();
String prefix = "/profile";
int startIndex = annexName.indexOf(prefix);
startIndex += prefix.length();
String annexPath = "/uploadPath" + annexName.substring(startIndex);
attach.setAnnexPath(annexPath);
int startIndexnew = annexName.lastIndexOf("/");
if (startIndexnew != -1) {
String annexNamenew = annexName.substring(startIndexnew + 1);
attach.setAnnexName(annexNamenew);
}
}
afterCase.setCaseAttachList(afterAttachList);
}
afterCase.setCaseAttachList(afterAttachList);
CompareCaseVO compareCaseVO = new CompareCaseVO(); CompareCaseVO compareCaseVO = new CompareCaseVO();
compareCaseVO.setBeforeCase(beforeCase); compareCaseVO.setBeforeCase(beforeCase);
compareCaseVO.setAfterCase(afterCase); compareCaseVO.setAfterCase(afterCase);
// 对比两个版本修改的字段
String[] columns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
"claimPrinciOwed","arbitratClaims","properPreser","requestRule"};
String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress","email",
"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
"compLegalperPost","responSex","responBirth"};
StringBuilder changeColumn = new StringBuilder(); StringBuilder changeColumn = new StringBuilder();
// 对比基本字段 // 对比基本字段
for (String column : columns) { for (String column : columns) {
@@ -279,6 +283,54 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
} }
} }
// 对比案件人员字段
compareAffilate(beforeCase,afterCase);
// 对比申请人证据资料
compareCaseVO.setChangeColumn(compareApplicantFile(beforeCase,afterCase,changeColumn).toString());
return AjaxResult.success(compareCaseVO);
}
/**
* 对比申请人证据资料
* @param beforeCase
* @param afterCase
* @param changeColumn
* @return
*/
private StringBuilder compareApplicantFile(CaseApplication beforeCase, CaseApplication afterCase, StringBuilder changeColumn) {
List<CaseAttach> beforeAttachFilter =new ArrayList<>();
List<CaseAttach> afterAttachFilter =new ArrayList<>();
if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList())){
beforeAttachFilter = beforeCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList());
}
if(CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){
afterAttachFilter = afterCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList());
}
if(CollectionUtil.isNotEmpty(beforeAttachFilter)&& CollectionUtil.isNotEmpty(afterAttachFilter)){
if(beforeAttachFilter.size()!=afterAttachFilter.size()){
changeColumn.append("fileColumn");
}else {
Map<String, CaseAttach> afterAttachMap = afterAttachFilter.stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2));
for (CaseAttach beforeCaseAttach : beforeAttachFilter) {
if(!afterAttachMap.containsKey(beforeCaseAttach.getAnnexPath())) {
changeColumn.append("fileColumn");
break;
}
}
}
}
return changeColumn;
}
/**
* 对比案件人员字段
* @param beforeCase
* @param afterCase
*/
private void compareAffilate(CaseApplication beforeCase, CaseApplication afterCase) {
// 对比人员字段 // 对比人员字段
List<CaseAffiliate> beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates(); List<CaseAffiliate> beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates();
List<CaseAffiliate> afterCaseCaseAffiliates = afterCase.getCaseAffiliates(); List<CaseAffiliate> afterCaseCaseAffiliates = afterCase.getCaseAffiliates();
@@ -341,51 +393,6 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
} }
List<CaseAttach> beforeAttachFilter =new ArrayList<>();
List<CaseAttach> afterAttachFilter =new ArrayList<>();
if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList())){
beforeAttachFilter = beforeCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList());
}
if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList())){
afterAttachFilter = afterCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList());
}
if(CollectionUtil.isNotEmpty(beforeAttachFilter)&& CollectionUtil.isNotEmpty(afterAttachFilter)){
if(beforeAttachFilter.size()!=afterAttachFilter.size()){
changeColumn.append("fileColumn");
}else {
Map<String, CaseAttach> afterAttachMap = afterAttachFilter.stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2));
for (CaseAttach beforeCaseAttach : beforeAttachFilter) {
if(!afterAttachMap.containsKey(beforeCaseAttach.getAnnexPath())) {
changeColumn.append("fileColumn");
break;
}
}
}
}
compareCaseVO.setChangeColumn(changeColumn.toString());
if(CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){
List<CaseAttach> caseAttachList = afterCase.getCaseAttachList();
for (CaseAttach attach : caseAttachList) {
String annexName = attach.getAnnexName();
String prefix = "/profile";
int startIndex = annexName.indexOf(prefix);
startIndex += prefix.length();
String annexPath = "/uploadPath" + annexName.substring(startIndex);
attach.setAnnexPath(annexPath);
int startIndexnew = annexName.lastIndexOf("/");
if (startIndexnew != -1) {
String annexNamenew = annexName.substring(startIndexnew + 1);
attach.setAnnexName(annexNamenew);
}
}
afterCase.setCaseAttachList(caseAttachList);
}
return AjaxResult.success(compareCaseVO);
} }
/** /**
@@ -430,12 +437,10 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication); List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication);
// 更新记录附件表 // 更新记录附件表
if(CollectionUtil.isNotEmpty(attachLogList)){ if(CollectionUtil.isNotEmpty(attachLogList)){
// caseAttachMapper.deleteByCasedIdAndType(vo.getCaseId(), 2,0);
for (CaseAttach caseAttach : attachLogList) { for (CaseAttach caseAttach : attachLogList) {
caseAttach.setCaseAppliId(vo.getCaseId()); caseAttach.setCaseAppliId(vo.getCaseId());
caseAttachMapper.updateCaseAttach(caseAttach); caseAttachMapper.updateCaseAttach(caseAttach);
} }
} }
// caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
} }
} }
@@ -1189,13 +1189,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getNameAgent())) { if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getNameAgent())) {
// 组装申请机构代理人信息,用户表新增并且和部门关联 // 组装申请机构代理人信息,用户表新增并且和部门关联
// 根据代理人身份证去用户表查询,有修改,么有新增 // 根据代理人手机号去用户表查询,有修改,么有新增
SysUser agentUser = sysUserMapper.selectUserByIdCard(caseAffiliate.getIdentityNumAgent()); SysUser agentUser = sysUserMapper.selectUserByPhone(caseAffiliate.getContactTelphoneAgent());
if (agentUser == null) { if (agentUser == null) {
agentUser = new SysUser(); agentUser = new SysUser();
agentUser.setIdCard(caseAffiliate.getIdentityNumAgent()); agentUser.setIdCard(caseAffiliate.getIdentityNumAgent());
agentUser.setNickName(caseAffiliate.getNameAgent()); agentUser.setNickName(caseAffiliate.getNameAgent());
agentUser.setUserName(caseAffiliate.getIdentityNumAgent()); agentUser.setUserName(caseAffiliate.getContactTelphoneAgent());
agentUser.setPhonenumber(caseAffiliate.getContactTelphoneAgent()); agentUser.setPhonenumber(caseAffiliate.getContactTelphoneAgent());
// agentUser.setPassword(SecurityUtils.encryptPassword(Constants.DEFAULT_PASSWORD)); // agentUser.setPassword(SecurityUtils.encryptPassword(Constants.DEFAULT_PASSWORD));
agentUser.setDeptId(Long.valueOf(caseAffiliate.getApplicationOrganId())); agentUser.setDeptId(Long.valueOf(caseAffiliate.getApplicationOrganId()));
@@ -1248,6 +1248,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber()); caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber());
caseAffiliate.setNameAgent(agentUser.getNickName()); caseAffiliate.setNameAgent(agentUser.getNickName());
caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId())); caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
if(StrUtil.isNotEmpty(agentUser.getIdCard())){
caseAffiliate.setIdentityNumAgent(agentUser.getIdCard());
}else {
caseAffiliate.setIdentityNumAgent(caseAffiliate.getIdentityNumAgent());
}
List<Long> longList = new ArrayList<>(); List<Long> longList = new ArrayList<>();
// 新增角色为申请人 // 新增角色为申请人
if (CollectionUtil.isNotEmpty(agentUser.getRoles())) { if (CollectionUtil.isNotEmpty(agentUser.getRoles())) {
@@ -2985,12 +2990,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setIdentityNum(map.get("统一社会信用代码").get(0)); caseAffiliate.setIdentityNum(map.get("统一社会信用代码").get(0));
caseAffiliate.setCompLegalPerson(map.get("负责人").get(0)); caseAffiliate.setCompLegalPerson(map.get("负责人").get(0));
caseAffiliate.setNameAgent(map.get("委托代理人").get(0)); caseAffiliate.setNameAgent(map.get("委托代理人").get(0));
caseAffiliate.setContactTelphone(map.get("联系电话").get(0)); caseAffiliate.setContactTelphoneAgent(map.get("联系电话").get(0));
caseAffiliate.setResidenAffili(map.get("住所").get(0)); caseAffiliate.setResidenAffili(map.get("住所").get(0));
caseAffiliate.setContactAddress(map.get("联系地址").get(0)); caseAffiliate.setContactAddress(map.get("联系地址").get(0));
caseAffiliate.setEmail(map.get("电子邮件").get(0).replaceAll("\\s", "")); caseAffiliate.setEmail(map.get("电子邮件").get(0).replaceAll("\\s", ""));
//设置默认代理人的身份证号码,暂时写死 要不然新增方法报错 //设置默认代理人的身份证号码,暂时写死 要不然新增方法报错
caseAffiliate.setIdentityNumAgent("610423199603171716"); // caseAffiliate.setIdentityNumAgent("610423199603171716");
caseAffiliates.add(caseAffiliate); caseAffiliates.add(caseAffiliate);
CaseAffiliate caseAffiliate1 = new CaseAffiliate(); CaseAffiliate caseAffiliate1 = new CaseAffiliate();
caseAffiliate1.setIdentityType(2); caseAffiliate1.setIdentityType(2);
@@ -329,7 +329,7 @@ public class VideoServiceImpl implements VideoService {
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
String htmlContent = "<html><body style=\"font-size:12.0pt; font-family:SimSun;\">" +reservedConferenceVO.getHtmlContent()+"</body></html>"; String htmlContent = "<html><head> <title>庭审笔录</title></head><body style=\"font-size:12.0pt; font-family:SimSun;\"><h1 align=\"center\">庭审笔录</h1>" +reservedConferenceVO.getHtmlContent()+"</body></html>";
// html转pdf并上传到服务器 // html转pdf并上传到服务器
boolean convertFlag = PdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() +"/"+ currentFileName, htmlContent); boolean convertFlag = PdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() +"/"+ currentFileName, htmlContent);
@@ -194,6 +194,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_role r on r.role_id = ur.role_id left join sys_role r on r.role_id = ur.role_id
where u.id_card = #{idCard} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1 where u.id_card = #{idCard} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1
</select> </select>
<select id="selectUserByPhone" parameterType="String" resultMap="SysUserResult">
select u.*,d.dept_name,ur.role_id
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
where u.phonenumber = #{phone} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1
</select>
<select id="selectByDeptIdAndRole" resultMap="SysUserResult"> <select id="selectByDeptIdAndRole" resultMap="SysUserResult">
select u.* from select u.* from
sys_user u sys_user u
@@ -166,7 +166,7 @@
<!--申请人案件--> <!--申请人案件-->
select c.id ,l.id AS caseLogId,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method , select c.id ,'' AS caseLogId,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理' CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
ELSE '无审理方式' ELSE '无审理方式'
END arbitratMethodName, END arbitratMethodName,
@@ -192,8 +192,7 @@
update_submit_status from case_application_log where case_appli_id=c.id order by version desc limit 1) update_submit_status from case_application_log where case_appli_id=c.id order by version desc limit 1)
as updateSubmitStatus as updateSubmitStatus
from case_application c from case_application c
JOIN case_application_log l ON c.id = l.case_appli_id and c.version=l.version JOIN case_affiliate ca ON ca.case_appli_id =c.id AND ca.identity_type = 1
JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1
<where> <where>
(c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1 (c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1
@@ -471,12 +470,7 @@
) tt2 ) tt2
<where> <where>
<if test="caseStatusList != null and caseStatusList.size() > 0">
and tt2.case_status in
<foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">
#{caseStatus}
</foreach>
</if>
<if test="caseStatus != null"> <if test="caseStatus != null">
AND tt2.case_status = #{caseStatus} AND tt2.case_status = #{caseStatus}
</if> </if>