|
|
@ -6,6 +6,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
@ -23,6 +24,7 @@ import com.epmet.entity.IcNatEntity; |
|
|
|
import com.epmet.service.IcNatService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -38,61 +40,10 @@ import java.util.Map; |
|
|
|
* @since v1.0.0 2022-03-25 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> implements IcNatService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcNatDTO> page(Map<String, Object> params) { |
|
|
|
IPage<IcNatEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, IcNatDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcNatDTO> list(Map<String, Object> params) { |
|
|
|
List<IcNatEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, IcNatDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<IcNatEntity> getWrapper(Map<String, Object> params) { |
|
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<IcNatEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public IcNatDTO get(String id) { |
|
|
|
IcNatEntity entity = baseDao.selectById(id); |
|
|
|
return ConvertUtils.sourceToTarget(entity, IcNatDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(IcNatDTO dto) { |
|
|
|
IcNatEntity entity = ConvertUtils.sourceToTarget(dto, IcNatEntity.class); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IcNatDTO dto) { |
|
|
|
IcNatEntity entity = ConvertUtils.sourceToTarget(dto, IcNatEntity.class); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 核酸检测-上报核酸记录 |
|
|
@ -158,9 +109,19 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
* @Description 【核酸】核酸检测信息详情 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public NatListResultDTO detail(MyNatListFormDTO formDTO) { |
|
|
|
public IcNatDTO detail(MyNatListFormDTO formDTO) { |
|
|
|
IcNatDTO resultDTO = new IcNatDTO(); |
|
|
|
//1.查询核酸记录信息
|
|
|
|
IcNatEntity entity = baseDao.selectById(formDTO.getIcNatId()); |
|
|
|
if (null == resultDTO) { |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
resultDTO = ConvertUtils.sourceToTarget(entity, IcNatDTO.class); |
|
|
|
|
|
|
|
return null; |
|
|
|
//2.查询对应的通知记录信息
|
|
|
|
//TODO
|
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -168,8 +129,18 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
* @Description 【核酸】核酸检测信息修改 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void edit(MyNatListFormDTO formDTO) { |
|
|
|
public void edit(AddIcNatFormDTO formDTO) { |
|
|
|
//1.更新核酸记录表数据
|
|
|
|
IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); |
|
|
|
if (!updateById(entity)) { |
|
|
|
log.error(String.format("数据修改失败,核酸记录Id->", formDTO.getIcNatId())); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "核酸记录修改失败"); |
|
|
|
} |
|
|
|
|
|
|
|
//3.新增通知表信息
|
|
|
|
if (formDTO.getChannel().size() > NumConstant.ZERO) { |
|
|
|
//TODO
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -178,7 +149,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void del(MyNatListFormDTO formDTO) { |
|
|
|
|
|
|
|
//1.物理删除业务数据
|
|
|
|
if (baseDao.delById(formDTO.getIcNatId())) { |
|
|
|
log.error(String.format("数据删除/取消同步失败,核酸记录Id->", formDTO.getIcNatId())); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据操作失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -187,7 +162,25 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void synchro(MyNatListFormDTO formDTO) { |
|
|
|
|
|
|
|
//1.根据核酸记录Id查询业务数据并进行必要校验
|
|
|
|
IcNatEntity entity = baseDao.selectById(formDTO.getIcNatId()); |
|
|
|
if (null == entity || formDTO.getAgencyId().equals(entity.getAgencyId()) |
|
|
|
|| (!"import".equals(entity.getUserType()) && !"synchro".equals(entity.getUserType()))) { |
|
|
|
log.error(String.format("数据同步失败,核酸记录Id->", 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()); |
|
|
|
entity.setPids(staffInfo.getAgencyPIds()); |
|
|
|
entity.setUserType("synchro"); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
} |