Browse Source

user

master
zxc 3 years ago
parent
commit
858daf7b12
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java
  3. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java
  4. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java
  5. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java
  6. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java
  7. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java
  8. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java
  9. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatImportExcelData.java
  10. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java
  11. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  12. 4
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.76__alter_ic_nat.sql
  13. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx
  14. 20
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

4
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,"单元下存在房屋,不可修改单元数"), UNIT_EXIST_HOUSES_ERROR(8928,"单元下存在房屋,不可修改单元数"),
IC_VACCINE(8929,"已存在相同记录,请去修改原有记录"), IC_VACCINE(8929,"已存在相同记录,请去修改原有记录"),
NOT_MATCH_IC_USER_ERROR(8930,"请联系社区工作人员"), 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,"人员与房屋信息不匹配,请与工作人员联系。"), MISMATCH(10086,"人员与房屋信息不匹配,请与工作人员联系。"),

6
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") @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date natTime; private Date natTime;
/**
* 采样时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date sampleTime;
/** /**
* 检测结果(0:阴性 1:阳性) * 检测结果(0:阴性 1:阳性)
*/ */

7
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") @JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date natTime; private Date natTime;
// @NotNull(message = "采样时间不能为空", groups = Nat.class)
@JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date sampleTime;
/** /**
* 检测结果 * 检测结果
*/ */

6
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; private String endTime;
/**
* 采样开始/结束时间yyyy-MM-dd HH:mm
*/
private String sampleStartTime;
private String sampleEndTime;
/** /**
* 核酸记录Id * 核酸记录Id
*/ */

5
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) @ExcelProperty(value = "检测时间",order = 4)
private Date natTime; private Date natTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@ColumnWidth(25)
@ExcelProperty(value = "采样时间",order = 4)
private Date sampleTime;
/** /**
* 检测结果 * 检测结果
*/ */

2
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncRecordDisabilityController.java

@ -1,6 +1,7 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser; 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.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
@ -35,6 +36,7 @@ public class DataSyncRecordDisabilityController {
private DataSyncRecordDisabilityService dataSyncRecordDisabilityService; private DataSyncRecordDisabilityService dataSyncRecordDisabilityService;
@PostMapping("page") @PostMapping("page")
@MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD })
public Result<PageData<DataSyncRecordDisabilityDTO>> page(@LoginUser TokenDto tokenDto,@RequestBody DataSyncRecordDisabilityFormDTO formDTO){ public Result<PageData<DataSyncRecordDisabilityDTO>> page(@LoginUser TokenDto tokenDto,@RequestBody DataSyncRecordDisabilityFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserId(tokenDto.getUserId());

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java

@ -49,7 +49,9 @@ public interface IcNatDao extends BaseDao<IcNatEntity> {
* @Author sun * @Author sun
* @Description 按条件查询业务数据 * @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 更新是否居民状态 * desc:根据客户id 更新是否居民状态

5
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 natTime;
/**
* 采样时间
*/
private Date sampleTime;
/** /**
* 检测结果(0:阴性 1:阳性) * 检测结果(0:阴性 1:阳性)
*/ */

7
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位") @Length(max = 18, message = "身份证号长度不正确,应小于18位")
private String idCard; private String idCard;
@NotNull(message = "检测时间为必填项") // @NotNull(message = "检测时间为必填项")
@ExcelProperty("检测时间") @ExcelProperty("检测时间")
private Date natTime; private Date natTime;
@ExcelProperty("采样时间")
private Date sampleTime;
@ExcelProperty("检测地点") @ExcelProperty("检测地点")
private String natAddress; private String natAddress;
@NotBlank(message = "检测结果为必填项") // @NotBlank(message = "检测结果为必填项")
@ExcelProperty("检测结果") @ExcelProperty("检测结果")
private String natResultZh; private String natResultZh;

14
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.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener; 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.ExceptionUtils;
import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
@ -66,6 +68,16 @@ public class IcNatExcelImportListener implements ReadListener<IcNatImportExcelDa
// 先校验数据 // 先校验数据
ValidatorUtils.validateEntity(data); ValidatorUtils.validateEntity(data);
if ((null == data.getSampleTime() && null == data.getNatTime() || org.apache.commons.lang3.StringUtils.isBlank(data.getNatResultZh()))){
throw new EpmetException(EpmetErrorCode.SAMPLE_TIME_AND_RESULT_IS_NULL_ERROR.getCode());
}
if(null != data.getSampleTime() && org.apache.commons.lang3.StringUtils.isNotBlank(data.getNatResultZh()) && null == data.getNatTime()){
throw new EpmetException(EpmetErrorCode.NAT_TIME_IS_NULL_ERROR.getCode());
}
if (null != data.getSampleTime() && org.apache.commons.lang3.StringUtils.isBlank(data.getNatResultZh()) && null != data.getNatTime()){
throw new EpmetException(EpmetErrorCode.NAT_RESULT_IS_NULL_ERROR.getCode());
}
if (StringUtils.isNotBlank(data.getName())) { if (StringUtils.isNotBlank(data.getName())) {
data.setName(data.getName().trim()); data.setName(data.getName().trim());
} }
@ -104,7 +116,7 @@ public class IcNatExcelImportListener implements ReadListener<IcNatImportExcelDa
if (e instanceof ValidateException) { if (e instanceof ValidateException) {
errorMsg = ((ValidateException) e).getMsg(); errorMsg = ((ValidateException) e).getMsg();
} else { } else {
errorMsg = "未知错误"; errorMsg = ((EpmetException)e).getInternalMsg();
log.error("【核酸检测信息导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); log.error("【核酸检测信息导入】出错:{}", ExceptionUtils.getErrorStackTrace(e));
} }

25
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

@ -88,6 +88,23 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
//@Autowired //@Autowired
//private UserService userService; //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 * @Author sun
* @Description 核酸检测-上报核酸记录 * @Description 核酸检测-上报核酸记录
@ -95,8 +112,9 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void add(AddIcNatFormDTO formDTO) { public void add(AddIcNatFormDTO formDTO) {
disposeIsNull(formDTO);
//0.先根据身份证号和检查时间以及检测结果校验数据是否存在 //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())) { if (null != icNatDTO && icNatDTO.getNatResult().equals(formDTO.getNatResult())) {
throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg());
@ -216,8 +234,9 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void edit(AddIcNatFormDTO formDTO) { public void edit(AddIcNatFormDTO formDTO) {
disposeIsNull(formDTO);
//0.先根据身份证号和检测时间以及检测结果校验除当前数据是否还存在相同数据 //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) { if (null != icNatDTO) {
throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg()); throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg());
} }
@ -464,7 +483,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
errorRow.setName(e.getName()); errorRow.setName(e.getName());
errorRow.setMobile(e.getMobile()); errorRow.setMobile(e.getMobile());
errorRow.setIdCard(e.getIdCard()); errorRow.setIdCard(e.getIdCard());
errorRow.setErrorInfo("未知系统错误"); errorRow.setErrorInfo(exception.getMessage());
listener.getErrorRows().add(errorRow); listener.getErrorRows().add(errorRow);
} }
}); });

4
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 add COLUMN `SAMPLE_TIME` datetime COMMENT '采样时间'after ID_CARD;
ALTER TABLE ic_nat MODIFY COLUMN NAT_TIME datetime COMMENT '检测时间,精确到分钟'; ALTER TABLE ic_nat MODIFY COLUMN NAT_TIME datetime COMMENT '检测时间,精确到分钟';
UPDATE ic_nat
SET SAMPLE_TIME = NAT_TIME,
UPDATED_TIME = NOW();

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx

Binary file not shown.

20
epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

@ -42,6 +42,7 @@
b.mobile mobile, b.mobile mobile,
b.id_card idCard, b.id_card idCard,
b.nat_time natTime, b.nat_time natTime,
b.sample_time sampleTime,
b.nat_result natResult, b.nat_result natResult,
b.nat_address natAddress b.nat_address natAddress
FROM FROM
@ -67,6 +68,12 @@
<if test='null != endTime and "" != endTime'> <if test='null != endTime and "" != endTime'>
AND b.nat_time <![CDATA[ <= ]]> #{endTime} AND b.nat_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test='null != sampleStartTime and "" != sampleStartTime'>
AND b.sample_time <![CDATA[ >= ]]> #{sampleStartTime}
</if>
<if test='null != sampleEndTime and "" != sampleEndTime'>
AND b.sample_time <![CDATA[ <= ]]> #{sampleEndTime}
</if>
<if test='null != isResiUser and "" != isResiUser'> <if test='null != isResiUser and "" != isResiUser'>
AND b.is_resi_user = #{isResiUser} AND b.is_resi_user = #{isResiUser}
</if> </if>
@ -83,6 +90,7 @@
mobile mobile, mobile mobile,
id_card idCard, id_card idCard,
nat_time natTime, nat_time natTime,
sample_time sampleTime,
nat_result natResult, nat_result natResult,
nat_address natAddress nat_address natAddress
FROM FROM
@ -105,6 +113,12 @@
<if test='null != endTime and "" != endTime'> <if test='null != endTime and "" != endTime'>
AND nat_time <![CDATA[ <= ]]> #{endTime} AND nat_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test='null != sampleStartTime and "" != sampleStartTime'>
AND sample_time <![CDATA[ >= ]]> #{sampleStartTime}
</if>
<if test='null != sampleEndTime and "" != sampleEndTime'>
AND sample_time <![CDATA[ <= ]]> #{sampleEndTime}
</if>
ORDER BY nat_time DESC, id ASC ORDER BY nat_time DESC, id ASC
</select> </select>
@ -117,6 +131,7 @@
mobile, mobile,
id_card, id_card,
nat_time, nat_time,
sample_time,
nat_result, nat_result,
nat_address nat_address
FROM FROM
@ -125,7 +140,12 @@
del_flag = '0' del_flag = '0'
AND customer_id = #{customerId} AND customer_id = #{customerId}
AND id_card = #{idCard} AND id_card = #{idCard}
<if test='null != natTime'>
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')
</if>
<if test='null != sampleTime'>
AND DATE_FORMAT(sample_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{sampleTime}, '%Y-%m-%d %h:%i')
</if>
<if test='null != natResult and "" != natResult'> <if test='null != natResult and "" != natResult'>
AND nat_result = #{natResult} AND nat_result = #{natResult}
</if> </if>

Loading…
Cancel
Save