From 8530a9c72ea5dd65cc3170ac2671c0431bdbcc6b Mon Sep 17 00:00:00 2001 From: niujiyi <18272501226@163.com> Date: Thu, 28 May 2026 10:56:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A7=E6=B3=95=E7=AB=AF-=E9=9D=9E=E8=A1=8C?= =?UTF-8?q?=E6=94=BF=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...NonEnforcementRegistrationServiceImpl.java | 94 +++++++++++-------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/NonEnforcementRegistrationServiceImpl.java b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/NonEnforcementRegistrationServiceImpl.java index 29ab6ed7..37506215 100644 --- a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/NonEnforcementRegistrationServiceImpl.java +++ b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/NonEnforcementRegistrationServiceImpl.java @@ -15,6 +15,7 @@ import com.zdxt.enforcementcode.mapper.ZdxtFileMapper; import com.zdxt.enforcementcode.service.INonEnforcementRegistrationService; import jakarta.servlet.ServletOutputStream; import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.*; import org.dromara.common.core.enums.FormatsType; @@ -43,6 +44,7 @@ import java.util.stream.Collectors; * @author kylin * @date 2025-06-19 */ +@Slf4j @Service public class NonEnforcementRegistrationServiceImpl implements INonEnforcementRegistrationService { @@ -65,33 +67,41 @@ public class NonEnforcementRegistrationServiceImpl implements INonEnforcementReg if (nonReg != null && nonReg.getId() != null) { // 处理主执法人员信息 if (StringUtils.isNotEmpty(nonReg.getLawEnforcerId())) { - SysUserVo user = sysUserMapper.selectUserById(Long.valueOf(nonReg.getLawEnforcerId())); - if (user != null) { - String temp = user.getLawCertificateNum(); - if (StringUtils.isEmpty(temp)) { - temp = CommonUtil.encryptPhone(user.getPhonenumber()); + try { + SysUserVo user = sysUserMapper.selectUserById(Long.valueOf(nonReg.getLawEnforcerId())); + if (user != null) { + String temp = user.getLawCertificateNum(); + if (StringUtils.isEmpty(temp)) { + temp = CommonUtil.encryptPhone(user.getPhonenumber()); + } + nonReg.setLawEnforcer(user.getUserName() + " " + temp); } - nonReg.setLawEnforcer(user.getUserName() + " " + temp); + } catch (NumberFormatException e) { + log.warn("无效的执法人员ID: {}", nonReg.getLawEnforcerId()); } } if(StringUtils.isNotEmpty(nonReg.getLawEnforcerOther())){ - List list = sysUserMapper.selectUserByIds(Convert.toStrArray(nonReg.getLawEnforcerIdOther())); - if(list != null && list.size() != 0){ - String tmpUserShow = ""; - for (SysUserVo ub : list) { - if (ub != null) { - String t = ub.getLawCertificateNum(); - if(StringUtils.isEmpty(t)){ - t = CommonUtil.encryptPhone(ub.getPhonenumber()); + try { + List list = sysUserMapper.selectUserByIds(Convert.toStrArray(nonReg.getLawEnforcerIdOther())); + if(list != null && list.size() != 0){ + String tmpUserShow = ""; + for (SysUserVo ub : list) { + if (ub != null) { + String t = ub.getLawCertificateNum(); + if(StringUtils.isEmpty(t)){ + t = CommonUtil.encryptPhone(ub.getPhonenumber()); + } + tmpUserShow += ub.getUserName() + " " + t + ","; } - tmpUserShow += ub.getUserName() + " " + t + ","; } + if (tmpUserShow.length() > 0) { + tmpUserShow = tmpUserShow.substring(0, tmpUserShow.length() - 1); + } + nonReg.setLawEnforcerOther(tmpUserShow); } - if (tmpUserShow.length() > 0) { - tmpUserShow = tmpUserShow.substring(0, tmpUserShow.length() - 1); - } - nonReg.setLawEnforcerOther(tmpUserShow); + } catch (NumberFormatException e) { + log.warn("无效的其他执法人员ID: {}", nonReg.getLawEnforcerIdOther()); } } @@ -252,33 +262,41 @@ public class NonEnforcementRegistrationServiceImpl implements INonEnforcementReg list.forEach(li -> { // 处理主执法人员信息 if (StringUtils.isNotEmpty(li.getLawEnforcerId())) { - SysUserVo sysUserVo = sysUserMapper.selectUserById(Long.valueOf(li.getLawEnforcerId())); - if (sysUserVo != null) { - String lawCN = sysUserVo.getLawCertificateNum(); - if (StringUtils.isEmpty(lawCN)) { - lawCN = CommonUtil.encryptPhone(sysUserVo.getPhonenumber()); + try { + SysUserVo sysUserVo = sysUserMapper.selectUserById(Long.valueOf(li.getLawEnforcerId())); + if (sysUserVo != null) { + String lawCN = sysUserVo.getLawCertificateNum(); + if (StringUtils.isEmpty(lawCN)) { + lawCN = CommonUtil.encryptPhone(sysUserVo.getPhonenumber()); + } + li.setLawEnforcer(sysUserVo.getUserName() + " " + lawCN); + } else { + li.setLawEnforcer(li.getLawEnforcer()); } - li.setLawEnforcer(sysUserVo.getUserName() + " " + lawCN); - } else { - li.setLawEnforcer(li.getLawEnforcer()); + } catch (NumberFormatException e) { + log.warn("无效的执法人员ID: {}", li.getLawEnforcerId()); } } // 处理其他执法人员信息 List lawTwoList = new ArrayList<>(); if (StringUtils.isNotEmpty(li.getLawEnforcerOther()) && StringUtils.isNotEmpty(li.getLawEnforcerIdOther())) { - List userBeans = sysUserMapper.selectUserByIds(Convert.toStrArray(li.getLawEnforcerIdOther())); - if (userBeans != null && !userBeans.isEmpty()) { - userBeans.forEach(u -> { - if (u != null) { - String temp = u.getLawCertificateNum(); - if (StringUtils.isEmpty(temp)) { - temp = CommonUtil.encryptPhone(u.getPhonenumber()); + try { + List userBeans = sysUserMapper.selectUserByIds(Convert.toStrArray(li.getLawEnforcerIdOther())); + if (userBeans != null && !userBeans.isEmpty()) { + userBeans.forEach(u -> { + if (u != null) { + String temp = u.getLawCertificateNum(); + if (StringUtils.isEmpty(temp)) { + temp = CommonUtil.encryptPhone(u.getPhonenumber()); + } + lawTwoList.add(u.getUserName() + " " + temp); } - lawTwoList.add(u.getUserName() + " " + temp); - } - }); - li.setLawEnforcerOtherList(lawTwoList); + }); + li.setLawEnforcerOtherList(lawTwoList); + } + } catch (NumberFormatException e) { + log.warn("无效的其他执法人员ID: {}", li.getLawEnforcerIdOther()); } } });