From a49b6672d001b8111652b4bf523190814d214f77 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 1 Apr 2022 09:18:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E8=B0=83=E6=95=B4=E5=BC=95?= =?UTF-8?q?=E8=B5=B7=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/IcNatServiceImpl.java | 22 ++++++-- .../src/main/resources/mapper/IcNatDao.xml | 50 +++++++++++++++++-- 2 files changed, 63 insertions(+), 9 deletions(-) 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 d4a334a24e..734d31b40c 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 @@ -90,7 +90,7 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void add(AddIcNatFormDTO formDTO) { - //0.先根据身份证号和检查时间校验数据是否存在 + //0.先根据身份证号和检查时间以及检测结果校验数据是否存在 IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult()); if (null != icNatDTO) { throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); @@ -161,12 +161,12 @@ public class IcNatServiceImpl extends BaseServiceImpl imp //3.按条件查询业务数据 PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) .doSelectPageInfo(() -> baseDao.getNatList(formDTO)); - return new PageData(data.getList(),data.getTotal()); + return new PageData(data.getList(), data.getTotal()); } else if ("current".equals(formDTO.getOrgType())) { //客户下数据 PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) .doSelectPageInfo(() -> baseDao.getCustomerNatList(formDTO)); - return new PageData(data.getList(),data.getTotal()); + return new PageData(data.getList(), data.getTotal()); } return new PageData(new ArrayList(), 0); @@ -203,12 +203,12 @@ public class IcNatServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void edit(AddIcNatFormDTO 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()); if (null != icNatDTO) { throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); } - //1.更新核酸记录表数据 + //1.更新核酸记录基础信息表数据 IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); entity.setId(formDTO.getIcNatId()); if (!updateById(entity)) { @@ -216,6 +216,17 @@ public class IcNatServiceImpl extends BaseServiceImpl imp throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "核酸记录修改失败"); } + //2.更新与组织的关系表数据 + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); + if (null == agencyInfo) { + throw new RenException(String.format("获取组织缓存信息失败%s", formDTO.getAgencyId())); + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcNatRelationEntity::getIcNatId, formDTO.getIcNatId()); + IcNatRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcNatRelationEntity.class); + relationEntity.setPids(StringUtils.isNotBlank(agencyInfo.getPids()) ? agencyInfo.getPids() + ":" + formDTO.getAgencyId() : agencyInfo.getPids()); + icNatRelationDao.update(relationEntity, wrapper); + //3.新增通知表信息 if (CollectionUtils.isNotEmpty(formDTO.getChannel())) { SendNoticeFormDTO dto = new SendNoticeFormDTO(); @@ -229,6 +240,7 @@ public class IcNatServiceImpl extends BaseServiceImpl imp dto.setStaffId(formDTO.getStaffId()); icNoticeService.sendNotice(dto); } + } /** 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 06cbc05a85..0c011b7e19 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 @@ -31,10 +31,52 @@ + +