|
|
@ -25,11 +25,13 @@ import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.IcNatDao; |
|
|
|
import com.epmet.dto.IcNatDTO; |
|
|
|
import com.epmet.dto.IcNoticeDTO; |
|
|
|
import com.epmet.dto.form.AddIcNatFormDTO; |
|
|
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
|
import com.epmet.dto.form.LoginUserDetailsFormDTO; |
|
|
|
import com.epmet.dto.form.MyNatListFormDTO; |
|
|
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|
|
|
import com.epmet.dto.form.SendNoticeFormDTO; |
|
|
|
import com.epmet.dto.result.MyNatListResultDTO; |
|
|
|
import com.epmet.dto.result.NatListResultDTO; |
|
|
|
import com.epmet.dto.result.UploadImgResultDTO; |
|
|
@ -40,9 +42,11 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.OssFeignClient; |
|
|
|
import com.epmet.service.IcNatService; |
|
|
|
import com.epmet.service.IcNoticeService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
import org.apache.commons.fileupload.FileItemFactory; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
@ -54,6 +58,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.nio.file.Files; |
|
|
@ -79,6 +84,9 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IcNoticeService icNoticeService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OssFeignClient ossFeignClient; |
|
|
|
|
|
|
@ -87,6 +95,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
* @Description 核酸检测-上报核酸记录 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void add(AddIcNatFormDTO formDTO) { |
|
|
|
//1.获取所填居民所属组织缓存信息
|
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); |
|
|
@ -100,7 +109,16 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
|
|
|
|
//3.新增通知表信息
|
|
|
|
if (formDTO.getChannel().size() > NumConstant.ZERO) { |
|
|
|
//TODO
|
|
|
|
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.setOrgName(agencyInfo.getOrganizationName()); |
|
|
|
icNoticeService.sendNotice(dto); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -119,10 +137,10 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 【核酸】核酸检测信息列表 |
|
|
|
**/ |
|
|
|
* |
|
|
|
* @return*/ |
|
|
|
@Override |
|
|
|
public NatListResultDTO natList(MyNatListFormDTO formDTO) { |
|
|
|
NatListResultDTO resultDTO = new NatListResultDTO(); |
|
|
|
public PageData<NatListResultDTO> natList(MyNatListFormDTO formDTO) { |
|
|
|
//1.根据orgType值判断是查询当前组织下还是整个客户下数据
|
|
|
|
if ("current".equals(formDTO.getOrgType())) { |
|
|
|
//获取工作人员缓存信息
|
|
|
@ -134,12 +152,9 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
} |
|
|
|
|
|
|
|
//2.按条件查询业务数据
|
|
|
|
PageInfo<NatListResultDTO.NatListDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()) |
|
|
|
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) |
|
|
|
.doSelectPageInfo(() -> baseDao.getNatList(formDTO)); |
|
|
|
resultDTO.setTotal((int) data.getTotal()); |
|
|
|
resultDTO.setList(data.getList()); |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
return new PageData(data.getList(),data.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -157,7 +172,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
resultDTO = ConvertUtils.sourceToTarget(entity, IcNatDTO.class); |
|
|
|
|
|
|
|
//2.查询对应的通知记录信息
|
|
|
|
//TODO
|
|
|
|
IcNoticeDTO dto = icNoticeService.getNotice(entity.getCustomerId(), entity.getIdCard()); |
|
|
|
if (null != dto) { |
|
|
|
resultDTO.setChannel(dto.getChannelList()); |
|
|
|
resultDTO.setContent(dto.getContent()); |
|
|
|
} |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
@ -167,17 +186,34 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
* @Description 【核酸】核酸检测信息修改 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void edit(AddIcNatFormDTO formDTO) { |
|
|
|
//1.更新核酸记录表数据
|
|
|
|
IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); |
|
|
|
entity.setId(formDTO.getIcNatId()); |
|
|
|
if (!updateById(entity)) { |
|
|
|
log.error(String.format("数据修改失败,核酸记录Id->", formDTO.getIcNatId())); |
|
|
|
log.error(String.format("数据修改失败,核酸记录Id->%s", formDTO.getIcNatId())); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "核酸记录修改失败"); |
|
|
|
} |
|
|
|
|
|
|
|
//3.新增通知表信息
|
|
|
|
if (formDTO.getChannel().size() > NumConstant.ZERO) { |
|
|
|
//TODO
|
|
|
|
IcNatEntity icNatEntity = baseDao.selectById(formDTO.getIcNatId()); |
|
|
|
//1.获取所填居民所属组织缓存信息
|
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(icNatEntity.getAgencyId()); |
|
|
|
if (null == agencyInfo) { |
|
|
|
throw new RenException(String.format("获取组织缓存信息失败%s", icNatEntity.getAgencyId())); |
|
|
|
} |
|
|
|
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.setOrgName(agencyInfo.getOrganizationName()); |
|
|
|
icNoticeService.sendNotice(dto); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -186,10 +222,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
* @Description 【核酸】核酸检测信息删除/取消同步 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void del(MyNatListFormDTO formDTO) { |
|
|
|
//1.物理删除业务数据
|
|
|
|
if (baseDao.delById(formDTO.getIcNatId())) { |
|
|
|
log.error(String.format("数据删除/取消同步失败,核酸记录Id->", formDTO.getIcNatId())); |
|
|
|
if (baseDao.delById(formDTO.getIcNatId()) < NumConstant.ONE) { |
|
|
|
log.error(String.format("数据删除/取消同步失败,核酸记录Id->%s", formDTO.getIcNatId())); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据操作失败"); |
|
|
|
} |
|
|
|
} |
|
|
@ -199,20 +236,21 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
* @Description 【核酸】核酸检测信息同步 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void synchro(MyNatListFormDTO formDTO) { |
|
|
|
//1.获取工作人员缓存数据
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
|
|
|
} |
|
|
|
//1.根据核酸记录Id查询业务数据并进行必要校验
|
|
|
|
IcNatEntity entity = baseDao.selectById(formDTO.getIcNatId()); |
|
|
|
if (null == entity || formDTO.getAgencyId().equals(entity.getAgencyId()) |
|
|
|
if (null == entity || staffInfo.getAgencyId().equals(entity.getAgencyId()) |
|
|
|
|| (!"import".equals(entity.getUserType()) && !"synchro".equals(entity.getUserType()))) { |
|
|
|
log.error(String.format("数据同步失败,核酸记录Id->", formDTO.getIcNatId())); |
|
|
|
log.error(String.format("数据同步失败,核酸记录Id->%s", formDTO.getIcNatId())); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据同步失败,不是导入数据或非本组织数据"); |
|
|
|
} |
|
|
|
//2.获取工作人员缓存数据
|
|
|
|
//获取工作人员缓存信息
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
|
|
|
} |
|
|
|
|
|
|
|
//3.待同步组织新增业务数据
|
|
|
|
entity.setId(""); |
|
|
|
entity.setAgencyId(staffInfo.getAgencyId()); |
|
|
@ -312,4 +350,4 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
public void batchPersist(List<IcNatEntity> entities) { |
|
|
|
insertBatch(entities); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|