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 64688c8990..ec9ee8c209 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 @@ -263,6 +263,10 @@ public enum EpmetErrorCode { UNIT_EXIST_HOUSES_ERROR(8928,"单元下存在房屋,不可修改单元数"), IC_VACCINE(8929,"已存在相同记录,请去修改原有记录"), NOT_MATCH_IC_USER_ERROR(8930,"请联系社区工作人员"), + NAT_TIME_IS_NULL_ERROR(8931,"检测时间不能为空"), + NAT_RESULT_IS_NULL_ERROR(8932,"检测结果不能为空"), + SAMPLE_TIME_IS_NULL_ERROR(8933,"采样时间不能为空"), + SAMPLE_TIME_AND_RESULT_IS_NULL_ERROR(8934,"检测时间或结果不能为空"), MISMATCH(10086,"人员与房屋信息不匹配,请与工作人员联系。"), diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java index dbd32f4463..66c9828dfd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java @@ -67,6 +67,12 @@ public class IcNatDTO implements Serializable { @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date natTime; + /** + * 采样时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date sampleTime; + /** * 检测结果(0:阴性 1:阳性) */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java index 258f28c66b..1d7ba24673 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java @@ -61,9 +61,14 @@ public class AddIcNatFormDTO implements Serializable { /** * 检测时间 */ - @NotNull(message = "检测时间不能为空", groups = Nat.class) +// @NotNull(message = "检测时间不能为空", groups = Nat.class) @JsonFormat(pattern="yyyy-MM-dd HH:mm") private Date natTime; + +// @NotNull(message = "采样时间不能为空", groups = Nat.class) + @JsonFormat(pattern="yyyy-MM-dd HH:mm") + private Date sampleTime; + /** * 检测结果 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java index 0272a30799..88f8359222 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java @@ -51,6 +51,12 @@ public class MyNatListFormDTO extends PageFormDTO { */ private String endTime; + /** + * 采样开始/结束时间yyyy-MM-dd HH:mm + */ + private String sampleStartTime; + private String sampleEndTime; + /** * 核酸记录Id */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java index cbeb66e482..43f9582b8c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java @@ -71,6 +71,11 @@ public class NatListResultDTO implements Serializable { @ExcelProperty(value = "检测时间",order = 4) private Date natTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + @ColumnWidth(25) + @ExcelProperty(value = "采样时间",order = 4) + private Date sampleTime; + /** * 检测结果 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java index 55a2fe580a..d890ff812c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java @@ -1,6 +1,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; @@ -35,6 +36,7 @@ public class DataSyncRecordDisabilityController { private DataSyncRecordDisabilityService dataSyncRecordDisabilityService; @PostMapping("page") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) public Result> page(@LoginUser TokenDto tokenDto,@RequestBody DataSyncRecordDisabilityFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); 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 3507473187..b2419b09f5 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 @@ -49,7 +49,9 @@ public interface IcNatDao extends BaseDao { * @Author sun * @Description 按条件查询业务数据 **/ - IcNatDTO getNatDTO(@Param("customerId") String customerId, @Param("icNatId") String icNatId, @Param("idCard") String idCard, @Param("natTime") String natTime, @Param("natResult") String natResult); + IcNatDTO getNatDTO(@Param("customerId") String customerId, @Param("icNatId") String icNatId, + @Param("idCard") String idCard, @Param("natTime") String natTime, + @Param("natResult") String natResult, @Param("sampleTime") String sampleTime); /** * desc:根据客户id 更新是否居民状态 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java index 50a9eed8e7..7cbe8cdd66 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java @@ -64,6 +64,11 @@ public class IcNatEntity extends BaseEpmetEntity { */ private Date natTime; + /** + * 采样时间 + */ + private Date sampleTime; + /** * 检测结果(0:阴性 1:阳性) */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java index 052b0cb1eb..ae0cb210d7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java @@ -29,14 +29,17 @@ public class IcNatImportExcelData { @Length(max = 18, message = "身份证号长度不正确,应小于18位") private String idCard; - @NotNull(message = "检测时间为必填项") +// @NotNull(message = "检测时间为必填项") @ExcelProperty("检测时间") private Date natTime; + @ExcelProperty("采样时间") + private Date sampleTime; + @ExcelProperty("检测地点") private String natAddress; - @NotBlank(message = "检测结果为必填项") +// @NotBlank(message = "检测结果为必填项") @ExcelProperty("检测结果") private String natResultZh; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java index 1f09a5142f..59f5eaab7b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java @@ -2,6 +2,8 @@ package com.epmet.excel.handler; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.ConvertUtils; @@ -66,6 +68,16 @@ public class IcNatExcelImportListener implements ReadListener imp //@Autowired //private UserService userService; + public void disposeIsNull(AddIcNatFormDTO formDTO){ + /** + * 根据产品要求 不同情况提示不同错误 + * 1.采样时间为空,检测时间和结果有一个为空就报错 + * 2.采样时间不为空,检测时间和结果可以为空【如果不为空 检测时间和结果都不为空】 + */ + if ((null == formDTO.getSampleTime() && null == formDTO.getNatTime() || org.apache.commons.lang3.StringUtils.isBlank(formDTO.getNatResult()))){ + throw new EpmetException(EpmetErrorCode.SAMPLE_TIME_AND_RESULT_IS_NULL_ERROR.getCode()); + } + if(null != formDTO.getSampleTime() && org.apache.commons.lang3.StringUtils.isNotBlank(formDTO.getNatResult()) && null == formDTO.getNatTime()){ + throw new EpmetException(EpmetErrorCode.NAT_TIME_IS_NULL_ERROR.getCode()); + } + if (null != formDTO.getSampleTime() && org.apache.commons.lang3.StringUtils.isBlank(formDTO.getNatResult()) && null != formDTO.getNatTime()){ + throw new EpmetException(EpmetErrorCode.NAT_RESULT_IS_NULL_ERROR.getCode()); + } + } + /** * @Author sun * @Description 核酸检测-上报核酸记录 @@ -95,8 +112,9 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void add(AddIcNatFormDTO formDTO) { + disposeIsNull(formDTO); //0.先根据身份证号和检查时间以及检测结果校验数据是否存在 - IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), null); + IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), null != formDTO.getNatTime() ? DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null, null, null != formDTO.getSampleTime() ? DateUtils.format(formDTO.getSampleTime(), 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()); @@ -216,8 +234,9 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void edit(AddIcNatFormDTO formDTO) { + disposeIsNull(formDTO); //0.先根据身份证号和检测时间以及检测结果校验除当前数据是否还存在相同数据 - IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult()); + IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), null != formDTO.getNatTime() ? DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null, formDTO.getNatResult(), null != formDTO.getSampleTime() ? DateUtils.format(formDTO.getSampleTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE) : null); if (null != icNatDTO) { throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg()); } @@ -464,7 +483,7 @@ public class IcNatServiceImpl extends BaseServiceImpl imp errorRow.setName(e.getName()); errorRow.setMobile(e.getMobile()); errorRow.setIdCard(e.getIdCard()); - errorRow.setErrorInfo("未知系统错误"); + errorRow.setErrorInfo(exception.getMessage()); listener.getErrorRows().add(errorRow); } }); diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.76__alter_ic_nat.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.76__alter_ic_nat.sql index 4c58646746..136596160f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.76__alter_ic_nat.sql +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.76__alter_ic_nat.sql @@ -1,3 +1,7 @@ alter table ic_nat add COLUMN `SAMPLE_TIME` datetime COMMENT '采样时间'after ID_CARD; -ALTER TABLE ic_nat MODIFY COLUMN NAT_TIME datetime COMMENT '检测时间,精确到分钟'; \ No newline at end of file +ALTER TABLE ic_nat MODIFY COLUMN NAT_TIME datetime COMMENT '检测时间,精确到分钟'; + +UPDATE ic_nat +SET SAMPLE_TIME = NAT_TIME, + UPDATED_TIME = NOW(); \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx index d9038bfdc4..31cc19219b 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx differ 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 e6dd5b0417..0295d92f3f 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 @@ -42,6 +42,7 @@ b.mobile mobile, b.id_card idCard, b.nat_time natTime, + b.sample_time sampleTime, b.nat_result natResult, b.nat_address natAddress FROM @@ -67,6 +68,12 @@ AND b.nat_time #{endTime} + + AND b.sample_time = ]]> #{sampleStartTime} + + + AND b.sample_time #{sampleEndTime} + AND b.is_resi_user = #{isResiUser} @@ -83,6 +90,7 @@ mobile mobile, id_card idCard, nat_time natTime, + sample_time sampleTime, nat_result natResult, nat_address natAddress FROM @@ -105,6 +113,12 @@ AND nat_time #{endTime} + + AND sample_time = ]]> #{sampleStartTime} + + + AND sample_time #{sampleEndTime} + ORDER BY nat_time DESC, id ASC @@ -117,6 +131,7 @@ mobile, id_card, nat_time, + sample_time, nat_result, nat_address FROM @@ -125,7 +140,12 @@ del_flag = '0' AND customer_id = #{customerId} AND id_card = #{idCard} - AND DATE_FORMAT(nat_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{natTime}, '%Y-%m-%d %h:%i') + + AND DATE_FORMAT(nat_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{natTime}, '%Y-%m-%d %h:%i') + + + AND DATE_FORMAT(sample_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{sampleTime}, '%Y-%m-%d %h:%i') + AND nat_result = #{natResult}