Browse Source

删除无用

dev
zxc 3 years ago
parent
commit
65b9d84449
  1. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java
  2. 43
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java
  3. 202
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java

11
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java

@ -75,17 +75,6 @@ public class IcVaccineController implements ResultDataResolver {
return new Result<PageData<IcVaccineListResultDTO>>().ok(icVaccineService.icVaccineList(formDTO));
}
/**
* @Author sun
* @Description 核酸核酸检测信息详情
**/
@NoRepeatSubmit
@PostMapping("detail")
public Result<IcNatDTO> detail(@RequestBody VaccineListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, VaccineListFormDTO.Detail.class);
return new Result<IcNatDTO>().ok(icVaccineService.detail(formDTO));
}
/**
* @Author sun
* @Description 核酸核酸检测信息同步

43
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java

@ -22,12 +22,6 @@ import java.util.List;
*/
public interface IcVaccineService extends BaseService<IcVaccineEntity> {
/**
* @Author sun
* @Description 核酸检测-上报核酸记录
**/
void add(AddIcNatFormDTO formDTO);
/**
* @Author sun
* @Description 核酸检测-居民端我的上报
@ -42,30 +36,11 @@ public interface IcVaccineService extends BaseService<IcVaccineEntity> {
* @return*/
PageData<IcVaccineListResultDTO> icVaccineList(VaccineListFormDTO formDTO);
/**
* @Author sun
* @Description 核酸核酸检测信息详情
*
* @param formDTO*/
IcNatDTO detail(VaccineListFormDTO formDTO);
/**
* @Author sun
* @Description 核酸核酸检测信息修改
**/
void edit(AddIcNatFormDTO formDTO);
/**
* @Author sun
* @Description 核酸核酸检测信息删除/取消同步
**/
void del(MyNatListFormDTO formDTO);
/**
* @Author sun
* @Description 核酸核酸检测信息同步
**/
void synchro(MyNatListFormDTO formDTO);
void synchro(VaccineListFormDTO formDTO);
/**
* @Author sun
@ -79,20 +54,4 @@ public interface IcVaccineService extends BaseService<IcVaccineEntity> {
*/
void execAsyncExcelImport(Path filePath, String importTaskId);
/**
* 核酸检测信息
* @Param idCard
* @Return {@link List<NatListDTO>}
* @Author zhaoqifeng
* @Date 2022/3/29 16:29
*/
List<NatListDTO> getNatList(String customerId, String idCard);
/**
* desc:根据用户id 更新核酸中是否居民状态
* @param customerId
* @param icResiUserId 如果为空则更新全部
* @return
*/
Integer updateIsResiFlag(String customerId, String icResiUserId);
}

202
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java

@ -88,55 +88,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
/**
* @Author sun
* @Description 核酸检测-上报核酸记录
**/
@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), 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());
if (null == agencyInfo) {
throw new RenException(String.format("获取组织缓存信息失败%s", formDTO.getAgencyId()));
}
//2.新增核酸基础信息数据
IcVaccineEntity entity = ConvertUtils.sourceToTarget(formDTO, IcVaccineEntity.class);
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(formDTO.getUserId())) {
entity.setIsResiUser("1");
}
insert(entity);
//3.核酸记录关系表新增与组织的关系数据
IcNatRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcNatRelationEntity.class);
relationEntity.setIcNatId(entity.getId());
relationEntity.setPids(com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(agencyInfo.getPids()) ? agencyInfo.getPids() + ":" + formDTO.getAgencyId() : formDTO.getAgencyId());
icNatRelationDao.insert(relationEntity);
//3.新增通知表信息
if (formDTO.getChannel().size() > NumConstant.ZERO) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
dto.setOrigin("2");
dto.setContent(formDTO.getContent());
dto.setStaffId(formDTO.getStaffId());
icNoticeService.sendNotice(dto);
}
}
/**
* @Author sun
* @Description 核酸检测-居民端我的上报
* @Description 疫苗接种-居民端我的上报
**/
@Override
public List<MyNatListResultDTO> myNatList(MyNatListFormDTO formDTO) {
@ -152,7 +104,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
/**
* @Author sun
* @Description 核酸本组织及下级核酸检测信息列表
* @Description 疫苗本组织及下级疫苗接种信息列表
*
* @param formDTO
* @return*/
@ -182,94 +134,17 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
}
/**
* @Author sun
* @Description 核酸核酸检测信息详情
*
* @param formDTO*/
@Override
public IcNatDTO detail(VaccineListFormDTO formDTO) {
IcNatDTO resultDTO = new IcNatDTO();
//1.查询核酸记录信息
IcVaccineEntity entity = baseDao.selectById(formDTO.getIcNatId());
if (null == resultDTO) {
return resultDTO;
}
resultDTO = ConvertUtils.sourceToTarget(entity, IcNatDTO.class);
//2.查询对应的通知记录信息
IcNoticeDTO dto = icNoticeService.getNotice(entity.getCustomerId(), entity.getIdCard());
if (null != dto) {
resultDTO.setChannel(dto.getChannelList());
resultDTO.setContent(dto.getContent());
}
return resultDTO;
}
/**
* @Author sun
* @Description 核酸核酸检测信息修改
* @Author zxc
* @Description 疫苗疫苗接种信息同步
**/
@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), formDTO.getNatResult());
if (null != icNatDTO) {
throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg());
}
//1.更新核酸记录基础信息表数据
IcVaccineEntity entity = ConvertUtils.sourceToTarget(formDTO, IcVaccineEntity.class);
entity.setId(formDTO.getIcNatId());
if (!updateById(entity)) {
log.error(String.format("数据修改失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "核酸记录修改失败");
}
//修改只涉及到基础信息的修改 不会修改关系数据 关系表不涉及更新
//3.新增通知表信息
if (CollectionUtils.isNotEmpty(formDTO.getChannel())) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
dto.setOrigin("2");
dto.setContent(formDTO.getContent());
dto.setStaffId(formDTO.getStaffId());
icNoticeService.sendNotice(dto);
}
}
/**
* @Author sun
* @Description 核酸核酸检测信息删除/取消同步
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void del(MyNatListFormDTO formDTO) {
//1.确定删除则需要删除基础数据以及所有可能存在的关系数据,物理删除业务数据
if (baseDao.delById(formDTO.getIcNatId()) < NumConstant.ONE) {
log.error(String.format("数据删除失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据删除失败");
}
//关系数据删除
icNatRelationDao.delRelation(formDTO.getIcNatId(), null);
}
/**
* @Author sun
* @Description 核酸核酸检测信息同步
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void synchro(MyNatListFormDTO formDTO) {
//1.检验核酸基础信息是否存在
IcVaccineEntity entity = baseDao.selectById(formDTO.getIcNatId());
public void synchro(VaccineListFormDTO formDTO) {
//1.检验疫苗基础信息是否存在
IcVaccineEntity entity = baseDao.selectById(formDTO.getIcVaccineId());
if (null == entity) {
log.error(String.format("核酸记录数据不存在同步失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据同步失败,核酸记录数据不存在");
log.error(String.format("疫苗记录数据不存在同步失败,疫苗记录Id->%s", formDTO.getIcVaccineId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据同步失败,疫苗记录数据不存在");
}
//获取工作人员缓存数据
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
@ -277,7 +152,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
//2.不管是否已存在关系数据都是先删后增
icNatRelationDao.delRelation(formDTO.getIcNatId(), staffInfo.getAgencyId());
icNatRelationDao.delRelation(formDTO.getIcVaccineId(), staffInfo.getAgencyId());
//3.新增关系数据
IcNatRelationEntity relationEntity = new IcNatRelationEntity();
relationEntity.setCustomerId(formDTO.getCustomerId());
@ -290,7 +165,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
/**
* @Author sun
* @Description 核酸核酸检测信息取消同步
* @Description 疫苗疫苗接种信息取消同步
**/
@Override
@Transactional(rollbackFor = Exception.class)
@ -302,7 +177,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
}
//1.物理删除关系数据
if (icNatRelationDao.delRelation(formDTO.getIcNatId(), staffInfo.getAgencyId()) < NumConstant.ONE) {
log.error(String.format("数据取消同步失败,核酸记录Id->%s", formDTO.getIcNatId()));
log.error(String.format("数据取消同步失败,疫苗记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "取消同步操作失败");
}
}
@ -370,11 +245,11 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (!result.success()) {
log.error("【核酸检测导入】finishImportTask失败");
log.error("【疫苗接种导入】finishImportTask失败");
}
} catch (Exception e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【核酸检测导入】出错:{}", errorMsg);
log.error("【疫苗接种导入】出错:{}", errorMsg);
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO();
importFinishTaskForm.setTaskId(importTaskId);
@ -384,7 +259,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (!result.success()) {
log.error("【核酸检测导入】导入记录状态修改为'完成'失败");
log.error("【疫苗接种导入】导入记录状态修改为'完成'失败");
}
} finally {
// 删除临时文件
@ -399,49 +274,6 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
}
/**
* 核酸检测信息
*
* @param idCard
* @Param idCard
* @Return {@link List< NatListDTO >}
* @Author zhaoqifeng
* @Date 2022/3/29 16:29
*/
@Override
public List<NatListDTO> getNatList(String customerId, String idCard) {
LambdaQueryWrapper<IcVaccineEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcVaccineEntity::getCustomerId, customerId);
wrapper.eq(IcVaccineEntity::getIdCard, idCard);
wrapper.orderByDesc(IcVaccineEntity::getNatTime);
List<IcVaccineEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
NatListDTO dto = new NatListDTO();
dto.setAddress(item.getNatAddress());
dto.setTestTime(DateUtils.format(item.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE));
switch (item.getNatResult())
{
case NumConstant.ZERO_STR:
dto.setResult("阴性");
break;
case NumConstant.ONE_STR:
dto.setResult("阳性");
break;
default:
dto.setResult("未知");
}
return dto;
}).collect(Collectors.toList());
}
@Override
public Integer updateIsResiFlag(String customerId, String icResiUserId) {
return baseDao.updateIsResiFlag(customerId,icResiUserId);
}
/**
* 批量持久化
* @param entities
@ -491,7 +323,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
IcVaccineEntity resiNat = getResiNat(customerId, idCard, natTime);
if (resiNat != null && !"import".equals(resiNat.getUserType())) {
// 有这个人,并且不是导入的
String message = "已存在该次核酸检测录入记录,请到系统中修改";
String message = "已存在该次疫苗接种录入记录,请到系统中修改";
IcNatImportExcelData.RowRemarkMessage errorRow = new IcNatImportExcelData.RowRemarkMessage();
errorRow.setName(name);
@ -533,7 +365,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
if (changedFieldNames.size() > 0) {
String fieldsStr = String.join(",", changedFieldNames);
String message = "该次核酸检测记录已存在,执行更新动作," + fieldsStr + "已成功更新";
String message = "该次疫苗接种记录已存在,执行更新动作," + fieldsStr + "已成功更新";
IcNatImportExcelData.RowRemarkMessage errorRow = new IcNatImportExcelData.RowRemarkMessage();
errorRow.setName(name);
errorRow.setMobile(mobile);

Loading…
Cancel
Save