|
|
@ -254,7 +254,9 @@ public class NonEnforcementRegistrationServiceImpl implements INonEnforcementReg |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 补充执法人员信息 |
|
|
* 补充执法人员信息(批量优化版) |
|
|
|
|
|
* <p>先收集整页执法人员ID一次性批量查询用户,再在内存中填充, |
|
|
|
|
|
* 消除逐行 selectUserById / selectUserByIds 的 N+1 查询。</p> |
|
|
* |
|
|
* |
|
|
* @param list 记录列表 |
|
|
* @param list 记录列表 |
|
|
*/ |
|
|
*/ |
|
|
@ -263,52 +265,83 @@ public class NonEnforcementRegistrationServiceImpl implements INonEnforcementReg |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 执法人员 没有执法证件号展示加密手机号
|
|
|
// 1. 收集整页所有执法人员ID(主执法人员 + 其他执法人员),去重
|
|
|
|
|
|
java.util.Set<String> userIdStrSet = new java.util.LinkedHashSet<>(); |
|
|
|
|
|
for (NonEnforcementRegistrationVo li : list) { |
|
|
|
|
|
if (StringUtils.isNotEmpty(li.getLawEnforcerId())) { |
|
|
|
|
|
userIdStrSet.add(li.getLawEnforcerId().trim()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotEmpty(li.getLawEnforcerIdOther())) { |
|
|
|
|
|
for (String id : li.getLawEnforcerIdOther().split(",")) { |
|
|
|
|
|
if (StringUtils.isNotEmpty(id.trim())) { |
|
|
|
|
|
userIdStrSet.add(id.trim()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (userIdStrSet.isEmpty()) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 2. 一次批量查询用户(含 crypto_remark_two 备份字段)
|
|
|
|
|
|
Map<Long, SysUserVo> userMap = new HashMap<>(); |
|
|
|
|
|
List<SysUserVo> userBeans = sysUserMapper.selectUserByIds(Convert.toStrArray(userIdStrSet)); |
|
|
|
|
|
if (userBeans != null) { |
|
|
|
|
|
for (SysUserVo u : userBeans) { |
|
|
|
|
|
if (u != null && u.getUserId() != null) { |
|
|
|
|
|
userMap.put(u.getUserId(), u); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 3. 在内存中填充执法人员信息(无数据库查询)
|
|
|
list.forEach(li -> { |
|
|
list.forEach(li -> { |
|
|
// 处理主执法人员信息
|
|
|
// 处理主执法人员信息
|
|
|
if (StringUtils.isNotEmpty(li.getLawEnforcerId())) { |
|
|
if (StringUtils.isNotEmpty(li.getLawEnforcerId())) { |
|
|
try { |
|
|
SysUserVo sysUserVo = userMap.get(parseUserId(li.getLawEnforcerId())); |
|
|
SysUserVo sysUserVo = sysUserMapper.selectUserById(Long.valueOf(li.getLawEnforcerId())); |
|
|
if (sysUserVo != null) { |
|
|
if (sysUserVo != null) { |
|
|
String lawCN = sysUserVo.getLawCertificateNum(); |
|
|
String lawCN = sysUserVo.getLawCertificateNum(); |
|
|
if (StringUtils.isEmpty(lawCN)) { |
|
|
if (StringUtils.isEmpty(lawCN)) { |
|
|
// 双轨改造后 phonenumber 为 HSM 密文, 走备份字段解密后脱敏
|
|
|
// 修复: 双轨改造后 phonenumber 为 HSM 密文, 走备份字段解密后脱敏
|
|
|
lawCN = CommonUtil.encryptPhone(sysUserVo.getPhonenumber(), sysUserVo.getCryptoRemarkTwo()); |
|
|
lawCN = CommonUtil.encryptPhone(sysUserVo.getPhonenumber(), sysUserVo.getCryptoRemarkTwo()); |
|
|
|
|
|
} |
|
|
|
|
|
li.setLawEnforcer(sysUserVo.getUserName() + " " + lawCN); |
|
|
|
|
|
} else { |
|
|
|
|
|
li.setLawEnforcer(li.getLawEnforcer()); |
|
|
|
|
|
} |
|
|
} |
|
|
} catch (NumberFormatException e) { |
|
|
li.setLawEnforcer(sysUserVo.getUserName() + " " + lawCN); |
|
|
log.warn("无效的执法人员ID: {}", li.getLawEnforcerId()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 处理其他执法人员信息
|
|
|
// 处理其他执法人员信息
|
|
|
List<String> lawTwoList = new ArrayList<>(); |
|
|
if (StringUtils.isNotEmpty(li.getLawEnforcerIdOther())) { |
|
|
if (StringUtils.isNotEmpty(li.getLawEnforcerOther()) && StringUtils.isNotEmpty(li.getLawEnforcerIdOther())) { |
|
|
List<String> lawTwoList = new ArrayList<>(); |
|
|
try { |
|
|
for (String id : li.getLawEnforcerIdOther().split(",")) { |
|
|
List<SysUserVo> userBeans = sysUserMapper.selectUserByIds(Convert.toStrArray(li.getLawEnforcerIdOther())); |
|
|
SysUserVo u = userMap.get(parseUserId(id)); |
|
|
if (userBeans != null && !userBeans.isEmpty()) { |
|
|
if (u != null) { |
|
|
userBeans.forEach(u -> { |
|
|
String temp = u.getLawCertificateNum(); |
|
|
if (u != null) { |
|
|
if (StringUtils.isEmpty(temp)) { |
|
|
String temp = u.getLawCertificateNum(); |
|
|
// 双轨改造后 phonenumber 为 HSM 密文, 走备份字段解密后脱敏
|
|
|
if (StringUtils.isEmpty(temp)) { |
|
|
temp = CommonUtil.encryptPhone(u.getPhonenumber(), u.getCryptoRemarkTwo()); |
|
|
// 修复: 双轨改造后 phonenumber 为 HSM 密文, 走备份字段解密后脱敏
|
|
|
} |
|
|
temp = CommonUtil.encryptPhone(u.getPhonenumber(), u.getCryptoRemarkTwo()); |
|
|
lawTwoList.add(u.getUserName() + " " + temp); |
|
|
} |
|
|
|
|
|
lawTwoList.add(u.getUserName() + " " + temp); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
li.setLawEnforcerOtherList(lawTwoList); |
|
|
|
|
|
} |
|
|
} |
|
|
} catch (NumberFormatException e) { |
|
|
} |
|
|
log.warn("无效的其他执法人员ID: {}", li.getLawEnforcerIdOther()); |
|
|
if (!lawTwoList.isEmpty()) { |
|
|
|
|
|
li.setLawEnforcerOtherList(lawTwoList); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 安全解析用户ID(无效ID返回null并记日志) |
|
|
|
|
|
*/ |
|
|
|
|
|
private Long parseUserId(String id) { |
|
|
|
|
|
try { |
|
|
|
|
|
return Long.parseLong(id.trim()); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
log.warn("无效的执法人员ID: {}", id); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询非行政执法登记列表 |
|
|
* 查询非行政执法登记列表 |
|
|
* |
|
|
* |
|
|
|