Browse Source

业务调整引起的

dev
sunyuchao 3 years ago
parent
commit
a49b6672d0
  1. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  2. 50
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

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

@ -90,7 +90,7 @@ 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) {
//0.先根据身份证号和检查时间校验数据是否存在 //0.先根据身份证号和检查时间以及检测结果校验数据是否存在
IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult()); 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) { if (null != icNatDTO) {
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());
@ -161,12 +161,12 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
//3.按条件查询业务数据 //3.按条件查询业务数据
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage())
.doSelectPageInfo(() -> baseDao.getNatList(formDTO)); .doSelectPageInfo(() -> baseDao.getNatList(formDTO));
return new PageData(data.getList(),data.getTotal()); return new PageData(data.getList(), data.getTotal());
} else if ("current".equals(formDTO.getOrgType())) { } else if ("current".equals(formDTO.getOrgType())) {
//客户下数据 //客户下数据
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage())
.doSelectPageInfo(() -> baseDao.getCustomerNatList(formDTO)); .doSelectPageInfo(() -> baseDao.getCustomerNatList(formDTO));
return new PageData(data.getList(),data.getTotal()); return new PageData(data.getList(), data.getTotal());
} }
return new PageData(new ArrayList(), 0); return new PageData(new ArrayList(), 0);
@ -203,12 +203,12 @@ 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) {
//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(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult());
if (null != icNatDTO) { if (null != icNatDTO) {
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());
} }
//1.更新核酸记录表数据 //1.更新核酸记录基础信息表数据
IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class);
entity.setId(formDTO.getIcNatId()); entity.setId(formDTO.getIcNatId());
if (!updateById(entity)) { if (!updateById(entity)) {
@ -216,6 +216,17 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "核酸记录修改失败"); 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<IcNatRelationEntity> 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.新增通知表信息 //3.新增通知表信息
if (CollectionUtils.isNotEmpty(formDTO.getChannel())) { if (CollectionUtils.isNotEmpty(formDTO.getChannel())) {
SendNoticeFormDTO dto = new SendNoticeFormDTO(); SendNoticeFormDTO dto = new SendNoticeFormDTO();
@ -229,6 +240,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
dto.setStaffId(formDTO.getStaffId()); dto.setStaffId(formDTO.getStaffId());
icNoticeService.sendNotice(dto); icNoticeService.sendNotice(dto);
} }
} }
/** /**

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

@ -31,10 +31,52 @@
</select> </select>
<select id="getNatList" resultType="com.epmet.dto.result.NatListResultDTO"> <select id="getNatList" resultType="com.epmet.dto.result.NatListResultDTO">
SELECT
a.ic_nat_id icNatId,
a.agency_id agencyId,
a.user_type userType,
b.user_id userId,
b.is_resi_user isResiUser,
b.`name` `name`,
b.mobile mobile,
b.id_card idCard,
b.nat_time natTime,
b.nat_result natResult,
b.nat_address natAddress
FROM
ic_nat_relation a
INNER JOIN ic_nat b ON a.IC_NAT_ID = b.ID
WHERE
a.DEL_FLAG = '0'
AND b.DEL_FLAG = '0'
AND a.customer_id = #{customerId}
AND a.pids like concat('%', #{agencyId}, '%')
<if test='null != name and "" != name'>
AND b.name like concat('%', #{name}, '%')
</if>
<if test='null != mobile and "" != mobile'>
AND b.mobile = #{mobile}
</if>
<if test='null != idCard and "" != idCard'>
AND b.id_card = #{idCard}
</if>
<if test='null != startTime and "" != startTime'>
AND b.nat_time <![CDATA[ >= ]]> #{startTime}
</if>
<if test='null != endTime and "" != endTime'>
AND b.nat_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test='null != isResiUser and "" != isResiUser'>
AND b.is_resi_user = #{isResiUser}
</if>
ORDER BY b.nat_time DESC
</select>
<select id="getCustomerNatList" resultType="com.epmet.dto.result.NatListResultDTO">
SELECT SELECT
id icNatId, id icNatId,
agency_id agencyId,
user_id userId, user_id userId,
is_resi_user isResiUser,
user_type userType, user_type userType,
`name` `name`, `name` `name`,
mobile mobile, mobile mobile,
@ -47,9 +89,6 @@
WHERE WHERE
del_flag = '0' del_flag = '0'
AND customer_id = #{customerId} AND customer_id = #{customerId}
<if test='null != agencyId and "" != agencyId'>
AND (agency_id = #{agencyId} OR pids like concat('%', #{agencyId}, '%'))
</if>
<if test='null != name and "" != name'> <if test='null != name and "" != name'>
AND name like concat('%', #{name}, '%') AND name like concat('%', #{name}, '%')
</if> </if>
@ -87,6 +126,9 @@
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') AND DATE_FORMAT(nat_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{natTime}, '%Y-%m-%d %h:%i')
<if test='null != natResult and "" != natResult'>
AND nat_result = #{natResult}
</if>
<if test='null != icNatId and "" != icNatId'> <if test='null != icNatId and "" != icNatId'>
AND id != #{icNatId} AND id != #{icNatId}
</if> </if>

Loading…
Cancel
Save