From 703abd3c6a089de068b3ff62fcdd2ed86b5a4013 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 1 Apr 2022 16:34:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=9C=80=E6=B1=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/exception/EpmetErrorCode.java | 1 + .../java/com/epmet/service/impl/IcNatServiceImpl.java | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index e0623c7648..a059504d2e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -252,6 +252,7 @@ public enum EpmetErrorCode { ORG_DEL_FAILED(8921,"删除失败"), NEIGHBORHOOD_DEL_FAILED(8922,""), IC_NAT_IDCARD_NATTIME(8923,"已存在相同记录"), + IC_NAT(8924,"平台已存在记录,请去修改原有记录"), //通用错误码 start diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java index 51e22193de..cbb234aa0d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java @@ -92,9 +92,12 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Transactional(rollbackFor = Exception.class) public void add(AddIcNatFormDTO formDTO) { //0.先根据身份证号和检查时间以及检测结果校验数据是否存在 - IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult()); - if (null != icNatDTO) { + IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), null); + //按身份证号核酸时间存在记录的 核酸结果相同的提示已存在相同记录核酸结果不同的提示已存在去修改【业务要求的】 + if (null != icNatDTO && icNatDTO.getNatResult().equals(formDTO.getNatResult())) { throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); + } else if (null != icNatDTO && !icNatDTO.getNatResult().equals(formDTO.getNatResult())) { + throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg()); } //1.获取所填居民所属组织缓存信息 AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); @@ -209,7 +212,7 @@ public class IcNatServiceImpl extends BaseServiceImpl imp //0.先根据身份证号和检测时间以及检测结果校验除当前数据是否还存在相同数据 IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult()); if (null != icNatDTO) { - throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); + throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg()); } //1.更新核酸记录基础信息表数据 IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); From d8f723a873b6e0b67bcf2b4ac42c769bcc8e3ed6 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 1 Apr 2022 17:02:07 +0800 Subject: [PATCH 2/2] redis --- .../epmet/commons/tools/redis/RedisKeys.java | 10 ++++++++++ .../java/com/epmet/redis/AreaCodeRedis.java | 11 +++++++++++ .../service/impl/AreaCodeServiceImpl.java | 19 +++++++++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 7bc68a4842..04db67cfed 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -753,4 +753,14 @@ public class RedisKeys { public static String getCustomerMenuListPrefix() { return rootPrefix.concat("oper:access:nav:customerId:"); } + + /** + * 如果是省列表:epmet:areacode:parentCode:0 + * 山东省的下一级:epmet:areacode:parentCode:37 + * @param areaCode + * @return + */ + public static String getNextAreaCodeKey(String areaCode) { + return rootPrefix.concat("areaCode:parentCode:").concat(areaCode); + } } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/redis/AreaCodeRedis.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/redis/AreaCodeRedis.java index d1c6218ea0..1743dcb3d4 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/redis/AreaCodeRedis.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/redis/AreaCodeRedis.java @@ -19,9 +19,12 @@ package com.epmet.redis; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dto.result.AreaCodeResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.List; + /** * 大陆省市区地区码 * @@ -49,4 +52,12 @@ public class AreaCodeRedis { return null; } + public List getNextAreaCodeKey(String key) { + List list = (List) redisUtils.get(key); + return list; + } + + public void setNextAreaCodeKey(String key, List list) { + redisUtils.set(key, list); + } } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java index f300c4bb4e..6f4ad9f000 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java @@ -29,6 +29,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.AreaCodeConstant; import com.epmet.dao.AreaCodeChildDao; @@ -693,9 +694,20 @@ public class AreaCodeServiceImpl extends BaseServiceImpl nextArea(AreaCodeFormDTO formDTO) { if(StringUtils.isBlank(formDTO.getParentAreaCode())&&StringUtils.isBlank(formDTO.getParentLevel())){ - return baseDao.selectProvince(); + String pKey=RedisKeys.getNextAreaCodeKey(NumConstant.ZERO_STR); + List list=areaCodeRedis.getNextAreaCodeKey(pKey); + if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)){ + return list; + } + List pList=baseDao.selectProvince(); + areaCodeRedis.setNextAreaCodeKey(pKey,pList); + return pList; + } + String key=RedisKeys.getNextAreaCodeKey(formDTO.getParentAreaCode()); + List list=areaCodeRedis.getNextAreaCodeKey(key); + if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)){ + return list; } - List list=new ArrayList<>(); switch (formDTO.getParentLevel()) { case AreaCodeConstant.PROVINCE: list = baseDao.selectCity(formDTO.getParentAreaCode()); @@ -716,6 +728,9 @@ public class AreaCodeServiceImpl extends BaseServiceImpl