Browse Source

Merge remote-tracking branch 'origin/dev_compare_data' into dev_compare_data

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

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHscyResDTO.java

@ -23,7 +23,7 @@ public class YtHscyResDTO {
private int total; private int total;
@Data @Data
class YtHscyResDetail { public static class YtHscyResDetail {
private String id; private String id;
private String name; private String name;
private String card_type; private String card_type;

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;
/** /**
* 检测结果 * 检测结果
*/ */

12
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DataSyncTaskParam.java

@ -1,5 +1,6 @@
package com.epmet.dto.form; package com.epmet.dto.form;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dto.DataSyncScopeDTO; import com.epmet.dto.DataSyncScopeDTO;
import lombok.Data; import lombok.Data;
@ -35,4 +36,15 @@ public class DataSyncTaskParam implements Serializable {
* 类别字段 * 类别字段
*/ */
public String categoryColumn; public String categoryColumn;
/**
* 是否同步 10
*/
private String isSync = NumConstant.ZERO_STR;
/**
* 核酸检测信息列表 点击同步时使用此字段 不使用数据配置的范围
*/
private String agencyId = null;
private String dataCode;
} }

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));
} }

134
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java

@ -8,11 +8,13 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.dto.result.YtDataSyncResDTO; import com.epmet.commons.tools.dto.result.YtDataSyncResDTO;
import com.epmet.commons.tools.dto.result.YtHscyResDTO;
import com.epmet.commons.tools.dto.result.YtHsjcResDTO; import com.epmet.commons.tools.dto.result.YtHsjcResDTO;
import com.epmet.commons.tools.enums.GenderEnum; import com.epmet.commons.tools.enums.GenderEnum;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
@ -178,58 +180,66 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
return; return;
} }
//TODO 根据dataCode 调用不同的方法 抽取数据 //TODO 根据dataCode 调用不同的方法 抽取数据
if (CollectionUtils.isEmpty(allConfigList)) { if (CollectionUtils.isEmpty(allConfigList)) {
log.warn("dataSyncForYanTaiTask don't have any resi data to pull data form YanTai interface"); log.warn("dataSyncForYanTaiTask don't have any resi data to pull data form YanTai interface");
return; return;
} }
for (DataSyncConfigDTO config : allConfigList) { if (StringUtils.isNotBlank(formDTO.getDataCode())){
allConfigList.forEach(c -> {
//没有配置 数据拉取范围 继续下次循环 if (c.getDataCode().equals(formDTO.getDataCode())){
if (CollectionUtils.isEmpty(config.getScopeList())) { disAllData(c,formDTO);
continue; return;
}
//没传具体参数 则 按照
int pageNo = NumConstant.ONE;
int pageSize = 1;//todo fangkaita NumConstant.ONE_THOUSAND;
//ToDo 去掉
formDTO.setIdCards(Collections.singletonList("370283199912010302"));
List<NatUserInfoResultDTO> dbResiList = null;
//设置查询数据范围
formDTO.setOrgList(config.getScopeList());
DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode());
do {
switch (anEnum) {
case HE_SUAN:
//查询正常状态的居民
dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize);
if (CollectionUtils.isEmpty(dbResiList)) {
break;
}
hsjc(dbResiList, config.getCustomerId());
break;
case CAN_JI:
//查询正常状态的居民 并回显 残疾状态
formDTO.setCategoryColumn("IS_CJ");
dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize);
canJi(dbResiList);
break;
case SI_WANG:
//查询正常状态的居民
dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize);
siWang(dbResiList);
break;
default:
log.warn("没有要处理的数据");
} }
pageNo++; });
} while (false);//todo fangkaita(dbResiList != null && dbResiList.size() == pageSize); }else {
for (DataSyncConfigDTO config : allConfigList) {
//没有配置 数据拉取范围 继续下次循环
if (CollectionUtils.isEmpty(config.getScopeList())) {
continue;
}
disAllData(config,formDTO);
}
} }
}
private void disAllData(DataSyncConfigDTO config,DataSyncTaskParam formDTO){
//没传具体参数 则 按照
int pageNo = NumConstant.ONE;
int pageSize = 1;//todo fangkaita NumConstant.ONE_THOUSAND;
//ToDo 去掉
formDTO.setIdCards(Collections.singletonList("370283199912010302"));
List<NatUserInfoResultDTO> dbResiList = null;
//设置查询数据范围
formDTO.setOrgList(config.getScopeList());
DataSyncEnum anEnum = DataSyncEnum.getEnum(config.getDataCode());
do {
switch (anEnum) {
case HE_SUAN:
//查询正常状态的居民
dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize);
if (CollectionUtils.isEmpty(dbResiList)) {
break;
}
hsjc(dbResiList, config.getCustomerId());
break;
case CAN_JI:
//查询正常状态的居民 并回显 残疾状态
formDTO.setCategoryColumn("IS_CJ");
dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize);
canJi(dbResiList);
break;
case SI_WANG:
//查询正常状态的居民
dbResiList = getNatUserInfoFromDb(formDTO, pageNo, pageSize);
siWang(dbResiList);
break;
default:
log.warn("没有要处理的数据");
}
pageNo++;
} while (false);//todo fangkaita(dbResiList != null && dbResiList.size() == pageSize);
} }
private void siWang(List<NatUserInfoResultDTO> dbResiList) { private void siWang(List<NatUserInfoResultDTO> dbResiList) {
@ -446,8 +456,15 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
try { try {
List<IcNatEntity> entities = new ArrayList<>(); List<IcNatEntity> entities = new ArrayList<>();
idCards.forEach(idCard -> { idCards.forEach(idCard -> {
YtHscyResDTO sampleResult = YtHsResUtils.hscy(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
if (CollectionUtils.isNotEmpty(natInfoResult.getData())) { Boolean aBoolean = CollectionUtils.isEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData());
Boolean bBoolean = CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData());
/**
* 1.采样结果 检测结果 都不为空以检测结果为准
* 2.采样结果为空检测结果不为空
*/
if (aBoolean || bBoolean) {
natInfoResult.getData().forEach(natInfo -> { natInfoResult.getData().forEach(natInfo -> {
IcNatEntity e = new IcNatEntity(); IcNatEntity e = new IcNatEntity();
e.setCustomerId(customerId); e.setCustomerId(customerId);
@ -458,6 +475,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : ""); e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : "");
e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : ""); e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : "");
e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN)); e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN));
e.setSampleTime(DateUtils.parseDate(natInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN));
String resultPcr = natInfo.getSample_result_pcr(); String resultPcr = natInfo.getSample_result_pcr();
//检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性 //检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性
e.setNatResult(NumConstant.ZERO_STR); e.setNatResult(NumConstant.ZERO_STR);
@ -472,6 +490,32 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
entities.add(e); entities.add(e);
}); });
} }
if (CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isEmpty(natInfoResult.getData())){
/*sampleResult.getData().forEach(sampleInfo -> {
IcNatEntity e = new IcNatEntity();
e.setCustomerId(customerId);
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR);
e.setUserId(idCard.getUserId());
e.setUserType("sync");
e.setName(StringUtils.isNotBlank(sampleInfo.getName()) ? sampleInfo.getName() : "");
e.setMobile(StringUtils.isNotBlank(sampleInfo.getTelephone()) ? sampleInfo.getTelephone() : "");
e.setIdCard(StringUtils.isNotBlank(sampleInfo.getCard_no()) ? sampleInfo.getCard_no() : "");
e.setNatTime(DateUtils.parseDate(sampleInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN));
e.setSampleTime(DateUtils.parseDate(sampleInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN));
String resultPcr = sampleInfo.getSample_result_pcr();
//检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性
e.setNatResult(NumConstant.ZERO_STR);
if (NumConstant.ONE_STR.equals(resultPcr)){
e.setNatResult(NumConstant.ONE_STR);
}
e.setNatAddress(sampleInfo.getSampling_org_pcr());
e.setAgencyId(idCard.getAgencyId());
e.setPids(idCard.getPids());
e.setAttachmentType("");
e.setAttachmentUrl("");
entities.add(e);
});*/
}
}); });
if (CollectionUtils.isNotEmpty(entities)) { if (CollectionUtils.isNotEmpty(entities)) {
List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities); List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities);

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);
} }
}); });

6
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.

23
epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml

@ -86,14 +86,21 @@
#{idCard} #{idCard}
</foreach> </foreach>
</if> </if>
AND ( <choose>
<foreach collection="orgList" item="l" separator="OR"> <when test='null == agencyId'>
<choose> AND (
<when test='"grid" == l.orgType'>GRID_ID = #{l.orgId}</when> <foreach collection="orgList" item="l" separator="OR">
<otherwise>PIDS LIKE CONCAT(#{l.orgIdPath},'%')</otherwise> <choose>
</choose> <when test='"grid" == l.orgType'>GRID_ID = #{l.orgId}</when>
</foreach> <otherwise>PIDS LIKE CONCAT(#{l.orgIdPath},'%')</otherwise>
) </choose>
</foreach>
)
</when>
<otherwise>
AND PIDS LIKE CONCAT(#{agencyId},'%')
</otherwise>
</choose>
ORDER BY CREATED_TIME ORDER BY CREATED_TIME
</select> </select>
</mapper> </mapper>

22
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}
AND DATE_FORMAT(nat_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{natTime}, '%Y-%m-%d %h:%i') <if test='null != natTime'>
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