From 400038da9798ee772248b76c13da17f911f848fe Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Wed, 30 Mar 2022 15:48:25 +0800
Subject: [PATCH 1/2] SOURCE_ADDRESS
---
.../main/java/com/epmet/dto/form/PageTripReportFormDTO.java | 5 ++++-
.../src/main/resources/mapper/IcTripReportRecordDao.xml | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java
index b5c4aa2462..af23243c03 100644
--- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java
@@ -28,7 +28,10 @@ public class PageTripReportFormDTO extends PageFormDTO implements Serializable {
* 来源地区编码
*/
private String sourceAddressCode;
-
+ /**
+ * 来源地区名称
+ */
+ private String sourceAddress;
/**
* 来到本地时间
*/
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml
index 0e55cceb05..f667e9826d 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml
@@ -47,6 +47,9 @@
AND SOURCE_ADDRESS_CODE like concat(#{sourceAddressCode},'%')
+
+ AND SOURCE_ADDRESS like concat('%',#{sourceAddress},'%')
+
AND ARRIVE_DATE = ]]> #{startDate}
From bc4a7d39e60229df99b17f16177b2832af523e1a Mon Sep 17 00:00:00 2001
From: sunyuchao
Date: Wed, 30 Mar 2022 15:52:50 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E8=B0=83=E6=95=B4-?=
=?UTF-8?q?=E5=BD=95=E5=85=A5=E6=95=B0=E6=8D=AE=E5=90=8C=E4=B8=80=E8=BA=AB?=
=?UTF-8?q?=E4=BB=BD=E8=AF=81=E5=8F=B7=E7=9B=B8=E5=90=8C=E6=A3=80=E6=B5=8B?=
=?UTF-8?q?=E6=97=B6=E9=97=B4=E5=8F=AA=E8=83=BD=E5=AD=98=E5=9C=A8=E4=B8=80?=
=?UTF-8?q?=E6=9D=A1=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tools/exception/EpmetErrorCode.java | 1 +
.../src/main/java/com/epmet/dao/IcNatDao.java | 7 ++++++
.../epmet/service/impl/IcNatServiceImpl.java | 10 ++++++++
.../db/migration/V0.0.31__update_ic_nat.sql | 3 +++
.../src/main/resources/mapper/IcNatDao.xml | 25 +++++++++++++++++++
5 files changed, 46 insertions(+)
create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.31__update_ic_nat.sql
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 4614beb5ba..bf8bcdc86b 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
@@ -251,6 +251,7 @@ public enum EpmetErrorCode {
ORG_EDIT_FAILED(8920,"编辑失败"),
ORG_DEL_FAILED(8921,"删除失败"),
NEIGHBORHOOD_DEL_FAILED(8922,""),
+ IC_NAT_IDCARD_NATTIME(8923,"核酸检测时间已存在相同记录"),
//通用错误码 start
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java
index 97b365bb6f..22afc94f76 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java
@@ -1,6 +1,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.IcNatDTO;
import com.epmet.dto.form.MyNatListFormDTO;
import com.epmet.dto.result.MyNatListResultDTO;
import com.epmet.dto.result.NatListResultDTO;
@@ -42,4 +43,10 @@ public interface IcNatDao extends BaseDao {
* @param e
*/
void insertOrUpdate(IcNatEntity e);
+
+ /**
+ * @Author sun
+ * @Description 按条件查询业务数据
+ **/
+ IcNatDTO getNatDTO(@Param("customerId") String customerId, @Param("icNatId") String icNatId, @Param("idCard") String idCard, @Param("natTime") String natTime);
}
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 9efdb959ce..f07bb78df9 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
@@ -89,6 +89,11 @@ public class IcNatServiceImpl extends BaseServiceImpl imp
@Override
@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));
+ if (null != icNatDTO) {
+ throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg());
+ }
//1.获取所填居民所属组织缓存信息
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId());
if (null == agencyInfo) {
@@ -183,6 +188,11 @@ public class IcNatServiceImpl extends BaseServiceImpl imp
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(AddIcNatFormDTO formDTO) {
+ //0.先根据身份证号和检测时间校验除当前数据是否还存在相同数据
+ IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE));
+ if (null != icNatDTO) {
+ throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg());
+ }
//1.更新核酸记录表数据
IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class);
entity.setId(formDTO.getIcNatId());
diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.31__update_ic_nat.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.31__update_ic_nat.sql
new file mode 100644
index 0000000000..30d6bd9ac1
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.31__update_ic_nat.sql
@@ -0,0 +1,3 @@
+ ALTER TABLE `ic_nat`
+ DROP INDEX `unq_nat` ,
+ ADD UNIQUE INDEX `unq_nat` (`ID_CARD`, `NAT_TIME`, `AGENCY_ID`) USING BTREE ;
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
index 84e3739081..06cbc05a85 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
@@ -68,6 +68,31 @@
ORDER BY nat_time DESC
+
+
DELETE FROM ic_nat WHERE id = #{icNatId}