|
|
@ -3,6 +3,7 @@ package com.epmet.service.impl; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
@ -20,12 +21,14 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.IcNatDao; |
|
|
|
import com.epmet.dao.IcNatRelationDao; |
|
|
|
import com.epmet.dao.UserBaseInfoDao; |
|
|
|
import com.epmet.dto.IcNatDTO; |
|
|
|
import com.epmet.dto.IcNoticeDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcNatEntity; |
|
|
|
import com.epmet.entity.IcNatRelationEntity; |
|
|
|
import com.epmet.excel.data.IcNatImportExcelData; |
|
|
|
import com.epmet.excel.handler.IcNatExcelImportListener; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
@ -69,18 +72,16 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IcNoticeService icNoticeService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OssFeignClient ossFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private UserBaseInfoDao userBaseInfoDao; |
|
|
|
@Autowired |
|
|
|
private IcNatRelationDao icNatRelationDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
@ -90,7 +91,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
@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)); |
|
|
|
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()); |
|
|
|
} |
|
|
@ -99,10 +100,17 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
if (null == agencyInfo) { |
|
|
|
throw new RenException(String.format("获取组织缓存信息失败%s", formDTO.getAgencyId())); |
|
|
|
} |
|
|
|
//2.新增核酸记录表数据
|
|
|
|
//2.新增核酸基础信息数据
|
|
|
|
IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); |
|
|
|
entity.setPids(agencyInfo.getPids()); |
|
|
|
if(StringUtils.isNotBlank(formDTO.getUserId())){ |
|
|
|
entity.setIsResiUser("1"); |
|
|
|
} |
|
|
|
insert(entity); |
|
|
|
//3.核酸记录关系表新增与组织的关系数据
|
|
|
|
IcNatRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcNatRelationEntity.class); |
|
|
|
relationEntity.setIcNatId(entity.getId()); |
|
|
|
relationEntity.setPids(StringUtils.isNotBlank(agencyInfo.getPids())?agencyInfo.getPids()+":"+formDTO.getAgencyId():agencyInfo.getPids()); |
|
|
|
icNatRelationDao.insert(relationEntity); |
|
|
|
|
|
|
|
//3.新增通知表信息
|
|
|
|
if (formDTO.getChannel().size() > NumConstant.ZERO) { |
|
|
@ -129,32 +137,39 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
//1.根据token信息查询居民身份证号
|
|
|
|
UserBaseInfoResultDTO dto = userBaseInfoDao.selectListByUserIdList(formDTO.getUserId()); |
|
|
|
formDTO.setIdCard(dto.getIdNum()); |
|
|
|
//2.查询当前人员创建的或该身份证号录入的核算检测数据(居民端录入、数字平台录入、数字平台导入)
|
|
|
|
//2.查询当前人员创建的或该身份证号录入的核算检测数据(居民端录入、数字平台录入、数字平台导入、数字平台同步的)
|
|
|
|
List<MyNatListResultDTO> resultList = baseDao.getMyNatList(formDTO); |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 【核酸】核酸检测信息列表 |
|
|
|
* @Description 【核酸】本组织及下级核酸检测信息列表 |
|
|
|
* |
|
|
|
* @return*/ |
|
|
|
@Override |
|
|
|
public PageData<NatListResultDTO> natList(MyNatListFormDTO formDTO) { |
|
|
|
//1.根据orgType值判断是查询当前组织下还是整个客户下数据
|
|
|
|
//1.根据是查询客户数据还是本辖区数据走不同逻辑
|
|
|
|
if ("current".equals(formDTO.getOrgType())) { |
|
|
|
//获取工作人员缓存信息
|
|
|
|
//本辖区数据
|
|
|
|
//2.获取工作人员缓存信息
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
|
|
|
} |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
//3.按条件查询业务数据
|
|
|
|
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) |
|
|
|
.doSelectPageInfo(() -> baseDao.getNatList(formDTO)); |
|
|
|
return new PageData(data.getList(),data.getTotal()); |
|
|
|
} else if ("current".equals(formDTO.getOrgType())) { |
|
|
|
//客户下数据
|
|
|
|
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) |
|
|
|
.doSelectPageInfo(() -> baseDao.getCustomerNatList(formDTO)); |
|
|
|
return new PageData(data.getList(),data.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
//2.按条件查询业务数据
|
|
|
|
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) |
|
|
|
.doSelectPageInfo(() -> baseDao.getNatList(formDTO)); |
|
|
|
return new PageData(data.getList(),data.getTotal()); |
|
|
|
return new PageData(new ArrayList(), 0); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -189,7 +204,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
@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)); |
|
|
|
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()); |
|
|
|
} |
|
|
|