From 0f3e0cc0e1a44b32aa62d422ea47b7437ae33765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E4=B8=89=E7=82=AE?= <15856818120@163.com> Date: Tue, 3 Jun 2025 16:53:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E9=BE=84=E8=BE=93=E5=85=A5=E5=88=A0?= =?UTF-8?q?=E9=99=A4=EF=BC=8C=E5=B9=B4=E9=BE=84=E6=A0=B9=E6=8D=AE=E8=BA=AB?= =?UTF-8?q?=E4=BB=BD=E8=AF=81=E5=8F=B7=E5=9C=A8=E5=90=8E=E5=8F=B0=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E8=AE=A1=E7=AE=97=EF=BC=8C=E8=B5=84=E6=A0=BC=E8=AF=81?= =?UTF-8?q?=E4=B9=A6=E5=92=8C=E8=AF=81=E4=B9=A6=E7=BC=96=E5=8F=B7=E9=9D=9E?= =?UTF-8?q?=E5=BF=85=E5=A1=AB=EF=BC=8C=E5=8F=AF=E4=BB=A5=E6=9C=89=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/common/enums/TableType.java | 7 +- .../com/bonus/common/utils/StringUtils.java | 109 +++++++++++++----- .../com/bonus/tool/dto/TbCertificationVo.java | 50 ++++++++ .../com/bonus/tool/dto/TbKeyPeopleVo.java | 5 + .../com/bonus/tool/dto/TbOtherPeopleVo.java | 5 + .../tool/mapper/TbCertificationMapper.java | 18 +++ .../tool/service/TbCertificationService.java | 31 +++++ .../impl/TbCertificationServiceImpl.java | 98 ++++++++++++++++ .../service/impl/TbKeyPeopleServiceImpl.java | 27 ++++- .../impl/TbOtherPeopleServiceImpl.java | 24 +++- .../mapper/TbCertificationMapper.xml | 33 ++++++ 11 files changed, 367 insertions(+), 40 deletions(-) create mode 100644 search-tool/src/main/java/com/bonus/tool/dto/TbCertificationVo.java create mode 100644 search-tool/src/main/java/com/bonus/tool/mapper/TbCertificationMapper.java create mode 100644 search-tool/src/main/java/com/bonus/tool/service/TbCertificationService.java create mode 100644 search-tool/src/main/java/com/bonus/tool/service/impl/TbCertificationServiceImpl.java create mode 100644 search-tool/src/main/resources/mapper/TbCertificationMapper.xml diff --git a/bonus-common/src/main/java/com/bonus/common/enums/TableType.java b/bonus-common/src/main/java/com/bonus/common/enums/TableType.java index a01adcb..85d1875 100644 --- a/bonus-common/src/main/java/com/bonus/common/enums/TableType.java +++ b/bonus-common/src/main/java/com/bonus/common/enums/TableType.java @@ -34,7 +34,12 @@ public enum TableType { /** * 分包商业绩信息 */ - TB_SUB_PERF("tb_sub_perf", "分包商业绩信息"); + TB_SUB_PERF("tb_sub_perf", "分包商业绩信息"), + + /** + * 资格证书 + */ + TB_CERTIFICATION("tb_certification", "资格证书"); private final String code; private final String info; diff --git a/bonus-common/src/main/java/com/bonus/common/utils/StringUtils.java b/bonus-common/src/main/java/com/bonus/common/utils/StringUtils.java index f46ef27..69a40bb 100644 --- a/bonus-common/src/main/java/com/bonus/common/utils/StringUtils.java +++ b/bonus-common/src/main/java/com/bonus/common/utils/StringUtils.java @@ -1,5 +1,9 @@ package com.bonus.common.utils; +import java.time.LocalDate; +import java.time.Period; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -12,7 +16,7 @@ import com.bonus.common.core.text.StrFormatter; /** * 字符串工具类 - * + * * @author ruoyi */ public class StringUtils extends org.apache.commons.lang3.StringUtils @@ -28,7 +32,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 获取参数不为空值 - * + * * @param value defaultValue 要判断的value * @return value 返回值 */ @@ -39,7 +43,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个Collection是否为空, 包含List,Set,Queue - * + * * @param coll 要判断的Collection * @return true:为空 false:非空 */ @@ -50,7 +54,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个Collection是否非空,包含List,Set,Queue - * + * * @param coll 要判断的Collection * @return true:非空 false:空 */ @@ -61,7 +65,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个对象数组是否为空 - * + * * @param objects 要判断的对象数组 ** @return true:为空 false:非空 */ @@ -72,7 +76,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个对象数组是否非空 - * + * * @param objects 要判断的对象数组 * @return true:非空 false:空 */ @@ -83,7 +87,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个Map是否为空 - * + * * @param map 要判断的Map * @return true:为空 false:非空 */ @@ -94,7 +98,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个Map是否为空 - * + * * @param map 要判断的Map * @return true:非空 false:空 */ @@ -105,7 +109,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个字符串是否为空串 - * + * * @param str String * @return true:为空 false:非空 */ @@ -116,7 +120,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个字符串是否为非空串 - * + * * @param str String * @return true:非空串 false:空串 */ @@ -127,7 +131,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个对象是否为空 - * + * * @param object Object * @return true:为空 false:非空 */ @@ -138,7 +142,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个对象是否非空 - * + * * @param object Object * @return true:非空 false:空 */ @@ -149,7 +153,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * * 判断一个对象是否是数组类型(Java基本型别的数组) - * + * * @param object 对象 * @return true:是数组 false:不是数组 */ @@ -211,7 +215,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 截取字符串 - * + * * @param str 字符串 * @param start 开始 * @return 结果 @@ -242,7 +246,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 截取字符串 - * + * * @param str 字符串 * @param start 开始 * @param end 结束 @@ -288,7 +292,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串 - * + * * @param str 要截取的字符串 * @param open 起始字符串 * @param close 结束字符串 @@ -314,7 +318,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 判断是否为空,并且不是空白字符 - * + * * @param str 要判断的value * @return 结果 */ @@ -344,7 +348,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
- * + * * @param template 文本模板,被替换的部分用 {} 表示 * @param params 参数值 * @return 格式化后的文本 @@ -360,7 +364,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 是否为http(s)://开头 - * + * * @param link 链接 * @return 结果 */ @@ -371,7 +375,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 字符串转set - * + * * @param str 字符串 * @param sep 分隔符 * @return set集合 @@ -383,7 +387,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 字符串转list - * + * * @param str 字符串 * @param sep 分隔符 * @param filterBlank 过滤纯空白 @@ -520,7 +524,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 是否包含字符串 - * + * * @param str 验证字符串 * @param strs 字符串组 * @return 包含返回true @@ -542,7 +546,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld - * + * * @param name 转换前的下划线大写方式命名的字符串 * @return 转换后的驼峰式命名的字符串 */ @@ -616,7 +620,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 - * + * * @param str 指定字符串 * @param strs 需要检查的字符串数组 * @return 是否匹配 @@ -638,11 +642,11 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils } /** - * 判断url是否与规则配置: - * ? 表示单个字符; - * * 表示一层路径内的任意字符串,不可跨层级; + * 判断url是否与规则配置: + * ? 表示单个字符; + * * 表示一层路径内的任意字符串,不可跨层级; * ** 表示任意层路径; - * + * * @param pattern 匹配规则 * @param url 需要匹配的url * @return @@ -661,7 +665,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。 - * + * * @param num 数字对象 * @param size 字符串指定长度 * @return 返回数字的字符串格式,该字符串为指定长度。 @@ -673,7 +677,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils /** * 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。 - * + * * @param s 原始字符串 * @param size 字符串指定长度 * @param c 用于补齐的字符 @@ -707,4 +711,47 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils } return sb.toString(); } -} \ No newline at end of file + + /** + * 根据身份证号码计算年龄 + * @param idCard 身份证号码(15位或18位) + * @return 年龄(周岁),若身份证格式错误返回 -1 + */ + public static int calculateAge(String idCard) { + if (idCard == null || idCard.isEmpty()) { + return -1; + } + + // 去除空格 + idCard = idCard.trim(); + + try { + LocalDate birthDate; + if (idCard.length() == 18) { + // 18位身份证:提取 YYYYMMDD + String birthStr = idCard.substring(6, 14); + birthDate = LocalDate.parse(birthStr, DateTimeFormatter.BASIC_ISO_DATE); + } else if (idCard.length() == 15) { + // 15位身份证:提取 YYMMDD,补全为 19YYMMDD + String birthStr = "19" + idCard.substring(6, 12); + birthDate = LocalDate.parse(birthStr, DateTimeFormatter.BASIC_ISO_DATE); + } else { + return -1; // 长度错误 + } + + // 计算当前日期与出生日期的差值 + LocalDate now = LocalDate.now(); + Period period = Period.between(birthDate, now); + + // 若还未到今年生日,年龄减1 + int age = period.getYears(); + if (now.isBefore(birthDate.withYear(now.getYear()))) { + age--; + } + + return Math.max(age, 0); // 防止负数(如未来日期) + } catch (DateTimeParseException | IndexOutOfBoundsException e) { + return -1; // 解析错误 + } + } +} diff --git a/search-tool/src/main/java/com/bonus/tool/dto/TbCertificationVo.java b/search-tool/src/main/java/com/bonus/tool/dto/TbCertificationVo.java new file mode 100644 index 0000000..7447408 --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/dto/TbCertificationVo.java @@ -0,0 +1,50 @@ +package com.bonus.tool.dto; + +import lombok.Data; + +import java.util.List; + +/** + * 资格证书 + * @author 马三炮 + * @date 2025/6/3 + */ +@Data +public class TbCertificationVo { + + /** + * 主键id + */ + private Long id; + + /** + * 表名称(每个主表的表名称) + */ + private String tableName; + + /** + * 资源表id + */ + private Long tableId; + + /** + * 资格证书 + */ + private String diploma; + + /** + * 证书编号 + */ + private String diplomaNum; + + + /** + * 级别 + */ + private String level; + + /*** + * 附件集合 + */ + private List tbFileSourceVoList; +} diff --git a/search-tool/src/main/java/com/bonus/tool/dto/TbKeyPeopleVo.java b/search-tool/src/main/java/com/bonus/tool/dto/TbKeyPeopleVo.java index d287681..0786628 100644 --- a/search-tool/src/main/java/com/bonus/tool/dto/TbKeyPeopleVo.java +++ b/search-tool/src/main/java/com/bonus/tool/dto/TbKeyPeopleVo.java @@ -117,6 +117,11 @@ public class TbKeyPeopleVo { */ private String updateUser; + /** + *资格证书集合 + */ + private List certificateList; + /*** * 附件集合 */ diff --git a/search-tool/src/main/java/com/bonus/tool/dto/TbOtherPeopleVo.java b/search-tool/src/main/java/com/bonus/tool/dto/TbOtherPeopleVo.java index 701a374..e7939f2 100644 --- a/search-tool/src/main/java/com/bonus/tool/dto/TbOtherPeopleVo.java +++ b/search-tool/src/main/java/com/bonus/tool/dto/TbOtherPeopleVo.java @@ -105,6 +105,11 @@ public class TbOtherPeopleVo { */ private String updateUser; + /** + *资格证书集合 + */ + private List certificateList; + /*** * 附件集合 */ diff --git a/search-tool/src/main/java/com/bonus/tool/mapper/TbCertificationMapper.java b/search-tool/src/main/java/com/bonus/tool/mapper/TbCertificationMapper.java new file mode 100644 index 0000000..396f473 --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/mapper/TbCertificationMapper.java @@ -0,0 +1,18 @@ +package com.bonus.tool.mapper; + +import com.bonus.tool.dto.TbCertificationVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface TbCertificationMapper { + /** + * 新增资格证书 + * @param tbCertificationVo + */ + void addTbCertification(TbCertificationVo tbCertificationVo); + + List getTbCertificateList(@Param("tableId") Long tableId, @Param("tableName")String tableName); + + void delTbCertification(@Param("tableId") Long tableId, @Param("tableName")String tableName); +} diff --git a/search-tool/src/main/java/com/bonus/tool/service/TbCertificationService.java b/search-tool/src/main/java/com/bonus/tool/service/TbCertificationService.java new file mode 100644 index 0000000..3f0ceee --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/service/TbCertificationService.java @@ -0,0 +1,31 @@ +package com.bonus.tool.service; + +import com.bonus.tool.dto.TbCertificationVo; + +import java.util.List; + +public interface TbCertificationService { + + /** + * 新增资格证书 + * @param certificateList + * @param tableId + * @param tableName + */ + void addTbCertification(List certificateList, Long tableId, String tableName); + + /** + * 获取资格证书列表 + * @param tableId + * @param tableName + * @return + */ + List getTbCertificateList(Long tableId, String tableName); + + /** + * 删除资格证书 + * @param tableId + * @param tableName + */ + void delTbCertification(Long tableId, String tableName); +} diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbCertificationServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbCertificationServiceImpl.java new file mode 100644 index 0000000..5d491a4 --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbCertificationServiceImpl.java @@ -0,0 +1,98 @@ +package com.bonus.tool.service.impl; + +import com.bonus.common.enums.TableType; +import com.bonus.common.utils.SecurityUtils; +import com.bonus.system.service.ISysFileService; +import com.bonus.tool.dto.TbCertificationVo; +import com.bonus.tool.dto.TbFileSourceVo; +import com.bonus.tool.mapper.TbCertificationMapper; +import com.bonus.tool.service.TbCertificationService; +import com.bonus.tool.service.TbFileSourceService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * @author 马三炮 + * @date 2025/6/3 + */ +@Service +@Slf4j +public class TbCertificationServiceImpl implements TbCertificationService { + + @Resource + private TbCertificationMapper tbCertificationMapper; + + @Resource + private TbFileSourceService tbFileSourceService; + + @Resource + private ISysFileService iSysFileService; + + /** + * 新增资格证书 + * @param certificateList + * @param tableId + * @param tableName + */ + @Override + public void addTbCertification(List certificateList, Long tableId, String tableName) { + if (certificateList!=null){ + for (TbCertificationVo tbCertificationVo:certificateList) { + tbCertificationVo.setTableId(tableId); + tbCertificationVo.setTableName(tableName); + tbCertificationMapper.addTbCertification(tbCertificationVo); + //新增附件信息 + tbFileSourceService.addTbFileSource(tbCertificationVo.getTbFileSourceVoList(),tbCertificationVo.getId(), TableType.TB_CERTIFICATION.getCode()); + } + } + } + + /** + * 获取资格证书列表 + * @param tableId + * @param tableName + * @return + */ + @Override + public List getTbCertificateList(Long tableId, String tableName) { + List TbCertificationVoList = tbCertificationMapper.getTbCertificateList(tableId,tableName); + for (TbCertificationVo tbCertificationVo: TbCertificationVoList) { + //获取人员附件 + List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbCertificationVo.getId(),TableType.TB_CERTIFICATION.getCode()); + tbCertificationVo.setTbFileSourceVoList(tbFileSourceVoList); + } + return TbCertificationVoList; + } + + /** + * 删除资格证书 + * @param tableId + * @param tableName + */ + @Override + public void delTbCertification(Long tableId, String tableName) { + + List TbCertificationVoList = tbCertificationMapper.getTbCertificateList(tableId,tableName); + for (TbCertificationVo tbCertificationVo: TbCertificationVoList) { + //获取人员附件 + List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbCertificationVo.getId(),TableType.TB_CERTIFICATION.getCode()); + //删除服务器图片 + if (tbFileSourceVoList.size()>0){ + for (TbFileSourceVo TbFileSource:tbFileSourceVoList) { + try { + iSysFileService.deleteFile(TbFileSource.getFilePath()); + }catch (Exception e){ + log.error("删除照片失败!"); + } + } + } + //删除附件信息表中信息 + tbFileSourceService.delTbFileSource(tbCertificationVo.getId(),TableType.TB_KEY_PEOPLE.getCode()); + } + tbCertificationMapper.delTbCertification(tableId,tableName); + } +} diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbKeyPeopleServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbKeyPeopleServiceImpl.java index 4a42fb9..d22a7fc 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbKeyPeopleServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbKeyPeopleServiceImpl.java @@ -6,14 +6,12 @@ import com.bonus.common.exception.ServiceException; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.system.service.ISysFileService; -import com.bonus.tool.dto.ComCorePersonBean; -import com.bonus.tool.dto.TbCompanyPerfRelVo; -import com.bonus.tool.dto.TbKeyPeopleVo; -import com.bonus.tool.dto.TbFileSourceVo; +import com.bonus.tool.dto.*; import com.bonus.tool.mapper.EpcMapper; import com.bonus.tool.mapper.SouthMapper; import com.bonus.tool.mapper.StateGridMapper; import com.bonus.tool.mapper.TbKeyPeopleMapper; +import com.bonus.tool.service.TbCertificationService; import com.bonus.tool.service.TbCompanyPerfRelService; import com.bonus.tool.service.TbFileSourceService; import com.bonus.tool.service.TbKeyPeopleServcie; @@ -55,6 +53,9 @@ public class TbKeyPeopleServiceImpl implements TbKeyPeopleServcie { @Resource private SouthMapper southMapper; + @Resource + private TbCertificationService tbCertificationService; + /** * 关键人员列表 @@ -67,6 +68,9 @@ public class TbKeyPeopleServiceImpl implements TbKeyPeopleServcie { List tbKeyPeopleVoList = tbKeyPeopleMapper.getTbKeyPeopleList(tbKeyPeopleVo); if (tbKeyPeopleVoList.size()>0){ for (TbKeyPeopleVo tbKeyPeople: tbKeyPeopleVoList) { + //获取资格证书信息 + List certificateList = tbCertificationService.getTbCertificateList(tbKeyPeople.getId(),TableType.TB_KEY_PEOPLE.getCode()); + tbKeyPeople.setCertificateList(certificateList); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbKeyPeople.getId(),TableType.TB_KEY_PEOPLE.getCode()); tbKeyPeople.setTbFileSourceVoList(tbFileSourceVoList); @@ -84,6 +88,9 @@ public class TbKeyPeopleServiceImpl implements TbKeyPeopleServcie { public TbKeyPeopleVo getTbKeyPeopleById(TbKeyPeopleVo tbKeyPeopleVo) { TbKeyPeopleVo tbKeyPeople = tbKeyPeopleMapper.getTbKeyPeopleById(tbKeyPeopleVo); + //获取资格证书信息 + List certificateList = tbCertificationService.getTbCertificateList(tbKeyPeople.getId(),TableType.TB_KEY_PEOPLE.getCode()); + tbKeyPeople.setCertificateList(certificateList); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbKeyPeople.getId(),TableType.TB_KEY_PEOPLE.getCode()); tbKeyPeople.setTbFileSourceVoList(tbFileSourceVoList); @@ -104,8 +111,13 @@ public class TbKeyPeopleServiceImpl implements TbKeyPeopleServcie { } tbKeyPeopleVo.setCreateUser(SecurityUtils.getLoginUser().getUsername()); tbKeyPeopleVo.setCreateTime(new Date()); + tbKeyPeopleVo.setAge(String.valueOf(StringUtils.calculateAge(tbKeyPeopleVo.getIdCard()))); log.info("对象信息{}",tbKeyPeopleVo); + //新增关键人员 tbKeyPeopleMapper.addTbKeyPeople(tbKeyPeopleVo); + //新增资格证书 + tbCertificationService.addTbCertification(tbKeyPeopleVo.getCertificateList(),tbKeyPeopleVo.getId(), TableType.TB_KEY_PEOPLE.getCode()); + //新增附件信息 tbFileSourceService.addTbFileSource(tbKeyPeopleVo.getTbFileSourceVoList(),tbKeyPeopleVo.getId(), TableType.TB_KEY_PEOPLE.getCode()); } @@ -121,7 +133,12 @@ public class TbKeyPeopleServiceImpl implements TbKeyPeopleServcie { throw new ServiceException("身份证已存在"); } tbKeyPeopleVo.setUpdateUser(SecurityUtils.getLoginUser().getUsername()); + tbKeyPeopleVo.setAge(String.valueOf(StringUtils.calculateAge(tbKeyPeopleVo.getIdCard()))); tbKeyPeopleMapper.updateTbKeyPeople(tbKeyPeopleVo); + //先删后增资格证书信息 + tbCertificationService.delTbCertification(tbKeyPeopleVo.getId(),TableType.TB_KEY_PEOPLE.getCode()); + tbCertificationService.addTbCertification(tbKeyPeopleVo.getCertificateList(),tbKeyPeopleVo.getId(), TableType.TB_KEY_PEOPLE.getCode()); + //先删后增附件信息 tbFileSourceService.delTbFileSource(tbKeyPeopleVo.getId(),TableType.TB_KEY_PEOPLE.getCode()); tbFileSourceService.addTbFileSource(tbKeyPeopleVo.getTbFileSourceVoList(),tbKeyPeopleVo.getId(),TableType.TB_KEY_PEOPLE.getCode()); } @@ -156,6 +173,8 @@ public class TbKeyPeopleServiceImpl implements TbKeyPeopleServcie { throw new ServiceException("关键人员已绑定南网模板"); } tbKeyPeopleMapper.delTbKeyPeople(tbKeyPeopleVo); + //删除资格证书信息 + tbCertificationService.delTbCertification(tbKeyPeopleVo.getId(),TableType.TB_KEY_PEOPLE.getCode()); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbKeyPeopleVo.getId(),TableType.TB_KEY_PEOPLE.getCode()); //删除服务器图片 diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbOtherPeopleServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbOtherPeopleServiceImpl.java index bdc56ff..a827a25 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbOtherPeopleServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbOtherPeopleServiceImpl.java @@ -5,14 +5,12 @@ import com.bonus.common.exception.ServiceException; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.system.service.ISysFileService; -import com.bonus.tool.dto.ComCorePersonBean; -import com.bonus.tool.dto.ComOtherPersonBean; -import com.bonus.tool.dto.TbFileSourceVo; -import com.bonus.tool.dto.TbOtherPeopleVo; +import com.bonus.tool.dto.*; import com.bonus.tool.mapper.EpcMapper; import com.bonus.tool.mapper.SouthMapper; import com.bonus.tool.mapper.StateGridMapper; import com.bonus.tool.mapper.TbOtherPeopleMapper; +import com.bonus.tool.service.TbCertificationService; import com.bonus.tool.service.TbFileSourceService; import com.bonus.tool.service.TbOtherPeopleService; import lombok.extern.slf4j.Slf4j; @@ -50,6 +48,11 @@ public class TbOtherPeopleServiceImpl implements TbOtherPeopleService { @Resource private SouthMapper southMapper; + @Resource + private TbCertificationService tbCertificationService; + + + /** * 其他人员列表查询 * @param @@ -61,6 +64,9 @@ public class TbOtherPeopleServiceImpl implements TbOtherPeopleService { List tbOtherPeopleVoList = tbOtherPeopleMapper.getTbOtherPeopleList(tbOtherPeopleVo); if (tbOtherPeopleVoList.size()>0){ for (TbOtherPeopleVo tbOtherPeople: tbOtherPeopleVoList) { + //获取资格证书信息 + List certificateList = tbCertificationService.getTbCertificateList(tbOtherPeople.getId(),TableType.TB_OTHER_PEOPLE.getCode()); + tbOtherPeople.setCertificateList(certificateList); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbOtherPeople.getId(), TableType.TB_OTHER_PEOPLE.getCode()); tbOtherPeople.setTbFileSourceVoList(tbFileSourceVoList); @@ -77,6 +83,9 @@ public class TbOtherPeopleServiceImpl implements TbOtherPeopleService { @Override public TbOtherPeopleVo getTbOtherPeopleById(TbOtherPeopleVo tbOtherPeopleVo) { TbOtherPeopleVo tbOtherPeople = tbOtherPeopleMapper.getTbOtherPeopleById(tbOtherPeopleVo); + //获取资格证书信息 + List certificateList = tbCertificationService.getTbCertificateList(tbOtherPeople.getId(),TableType.TB_OTHER_PEOPLE.getCode()); + tbOtherPeople.setCertificateList(certificateList); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbOtherPeople.getId(),TableType.TB_OTHER_PEOPLE.getCode()); tbOtherPeople.setTbFileSourceVoList(tbFileSourceVoList); @@ -98,6 +107,8 @@ public class TbOtherPeopleServiceImpl implements TbOtherPeopleService { tbOtherPeopleVo.setCreateUser(SecurityUtils.getLoginUser().getUsername()); tbOtherPeopleVo.setCreateTime(new Date()); tbOtherPeopleMapper.addTbOtherPeople(tbOtherPeopleVo); + //新增资格证书 + tbCertificationService.addTbCertification(tbOtherPeopleVo.getCertificateList(),tbOtherPeopleVo.getId(), TableType.TB_OTHER_PEOPLE.getCode()); tbFileSourceService.addTbFileSource(tbOtherPeopleVo.getTbFileSourceVoList(),tbOtherPeopleVo.getId(), TableType.TB_OTHER_PEOPLE.getCode()); } @@ -116,6 +127,9 @@ public class TbOtherPeopleServiceImpl implements TbOtherPeopleService { } tbOtherPeopleVo.setUpdateUser(SecurityUtils.getLoginUser().getUsername()); tbOtherPeopleMapper.updateTbOtherPeople(tbOtherPeopleVo); + //先删后增资格证书信息 + tbCertificationService.delTbCertification(tbOtherPeopleVo.getId(),TableType.TB_OTHER_PEOPLE.getCode()); + tbCertificationService.addTbCertification(tbOtherPeopleVo.getCertificateList(),tbOtherPeopleVo.getId(), TableType.TB_OTHER_PEOPLE.getCode()); tbFileSourceService.delTbFileSource(tbOtherPeopleVo.getId(),TableType.TB_OTHER_PEOPLE.getCode()); tbFileSourceService.addTbFileSource(tbOtherPeopleVo.getTbFileSourceVoList(),tbOtherPeopleVo.getId(),TableType.TB_OTHER_PEOPLE.getCode()); @@ -147,6 +161,8 @@ public class TbOtherPeopleServiceImpl implements TbOtherPeopleService { throw new ServiceException("关键人员已绑定南网模板"); } tbOtherPeopleMapper.delTbOtherPeople(tbOtherPeopleVo); + //删除资格证书信息 + tbCertificationService.delTbCertification(tbOtherPeopleVo.getId(),TableType.TB_OTHER_PEOPLE.getCode()); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbOtherPeopleVo.getId(),TableType.TB_OTHER_PEOPLE.getCode()); //删除服务器图片 diff --git a/search-tool/src/main/resources/mapper/TbCertificationMapper.xml b/search-tool/src/main/resources/mapper/TbCertificationMapper.xml new file mode 100644 index 0000000..dbd9743 --- /dev/null +++ b/search-tool/src/main/resources/mapper/TbCertificationMapper.xml @@ -0,0 +1,33 @@ + + + + + + insert into tb_certification + + table_name, + table_id, + diploma, + diploma_num, + level, + del_flag + + + #{tableName}, + #{tableId}, + #{diploma}, + #{diplomaNum}, + #{level}, + 0 + + + + update tb_certification set del_flag=1 where table_id = #{tableId} and table_name = #{tableName} + + +