|
|
@ -3,6 +3,7 @@ package com.epmet.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
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; |
|
|
@ -12,12 +13,12 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.constant.IcResiUserConstant; |
|
|
|
import com.epmet.dao.IcTripReportRecordDao; |
|
|
|
import com.epmet.dao.UserBaseInfoDao; |
|
|
|
import com.epmet.dto.IcEpidemicSpecialAttentionDTO; |
|
|
|
import com.epmet.dto.IcTripReportRecordDTO; |
|
|
|
import com.epmet.dto.form.IcTripReportFormDTO; |
|
|
|
import com.epmet.dto.form.MyReportedTripFormDTO; |
|
|
|
import com.epmet.dto.form.PageTripReportFormDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.entity.IcTripReportRecordEntity; |
|
|
|
import com.epmet.service.IcEpidemicSpecialAttentionService; |
|
|
|
import com.epmet.service.IcNoticeService; |
|
|
@ -58,10 +59,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR |
|
|
|
@Override |
|
|
|
public PageData<IcTripReportRecordDTO> page(PageTripReportFormDTO formDTO) { |
|
|
|
//1.获取工作人员缓存信息
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(formDTO.getCustomerId(),formDTO.getUserId()); |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
//2.按条件查询业务数据
|
|
|
|
PageInfo<IcTripReportRecordDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) |
|
|
@ -86,6 +84,14 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR |
|
|
|
return new PageData(list, data.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) { |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
return staffInfo; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcTripReportRecordDTO> list(Map<String, Object> params) { |
|
|
|
List<IcTripReportRecordEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
@ -108,11 +114,69 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR |
|
|
|
return ConvertUtils.sourceToTarget(entity, IcTripReportRecordDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* pc: 行程上报-新增 |
|
|
|
* @param formDTO |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(IcTripReportRecordDTO dto) { |
|
|
|
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcTripReportRecordEntity.class); |
|
|
|
public String save(IcTripReportFormDTO formDTO) { |
|
|
|
//如果是单个录入的,默认数据属于当前用户所属组织id
|
|
|
|
if(IcResiUserConstant.USER_TYPE_OTHER.equals(formDTO.getUserType())){ |
|
|
|
//获取当前登录用户所属组织id
|
|
|
|
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(formDTO.getCustomerId(),formDTO.getCurrentStaffId()); |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
} |
|
|
|
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class); |
|
|
|
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId()); |
|
|
|
if (null == agencyInfoCache) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
entity.setPids(agencyInfoCache.getPids()); |
|
|
|
//1.插入行程记录表
|
|
|
|
insert(entity); |
|
|
|
if(formDTO.getHeSuanCheck()){ |
|
|
|
// 2.加入核算检测关注名单
|
|
|
|
vaccinationAdd(formDTO); |
|
|
|
} |
|
|
|
//3.新增通知表信息
|
|
|
|
if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) { |
|
|
|
SendNoticeFormDTO dto = new SendNoticeFormDTO(); |
|
|
|
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>(); |
|
|
|
//注意这里的userId是指的pc平台的居民
|
|
|
|
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class)); |
|
|
|
dto.setCustomerId(formDTO.getCustomerId()); |
|
|
|
dto.setUserList(userList); |
|
|
|
dto.setChannel(formDTO.getChannel()); |
|
|
|
//通知来源 0 行程上报,1 疫苗接种,2 核酸检测
|
|
|
|
dto.setOrigin(NumConstant.ZERO_STR); |
|
|
|
dto.setContent(formDTO.getContent()); |
|
|
|
dto.setOrgName(agencyInfoCache.getOrganizationName()); |
|
|
|
icNoticeService.sendNotice(dto); |
|
|
|
} |
|
|
|
return entity.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加入核算检测关注 |
|
|
|
* @param formDTO |
|
|
|
*/ |
|
|
|
private void vaccinationAdd(IcTripReportFormDTO formDTO) { |
|
|
|
VaccinationAddFormDTO vaccinationAddFormDTO=new VaccinationAddFormDTO(); |
|
|
|
vaccinationAddFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
vaccinationAddFormDTO.setUserId(formDTO.getCurrentStaffId()); |
|
|
|
List<IcEpidemicSpecialAttentionDTO> list =new ArrayList<>(); |
|
|
|
IcEpidemicSpecialAttentionDTO dto=new IcEpidemicSpecialAttentionDTO(); |
|
|
|
dto.setName(formDTO.getName()); |
|
|
|
dto.setIdCard(formDTO.getIdCard()); |
|
|
|
dto.setMobile(formDTO.getMobile()); |
|
|
|
//避免再发通知,赋值个空集合吧
|
|
|
|
dto.setChannel(Collections.emptyList()); |
|
|
|
//关注类型,核酸检测:2,疫苗接种:1;行程上报:0
|
|
|
|
dto.setAttentionType(NumConstant.ZERO); |
|
|
|
list.add(dto); |
|
|
|
vaccinationAddFormDTO.setList(list); |
|
|
|
epidemicSpecialAttentionService.vaccinationAdd( vaccinationAddFormDTO); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|