|
|
@ -1,13 +1,14 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
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.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
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; |
|
|
@ -16,18 +17,22 @@ import com.epmet.dao.UserBaseInfoDao; |
|
|
|
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.entity.IcTripReportRecordEntity; |
|
|
|
import com.epmet.service.IcEpidemicSpecialAttentionService; |
|
|
|
import com.epmet.service.IcNoticeService; |
|
|
|
import com.epmet.service.IcTripReportRecordService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 行程上报信息 |
|
|
@ -39,14 +44,46 @@ import java.util.Map; |
|
|
|
public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportRecordDao, IcTripReportRecordEntity> implements IcTripReportRecordService { |
|
|
|
@Autowired |
|
|
|
private UserBaseInfoDao userBaseInfoDao; |
|
|
|
|
|
|
|
//关注
|
|
|
|
@Autowired |
|
|
|
private IcEpidemicSpecialAttentionService epidemicSpecialAttentionService; |
|
|
|
//通知
|
|
|
|
@Autowired |
|
|
|
private IcNoticeService icNoticeService; |
|
|
|
/** |
|
|
|
* pc: 行程上报-列表 |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<IcTripReportRecordDTO> page(Map<String, Object> params) { |
|
|
|
IPage<IcTripReportRecordEntity> page = baseDao.selectPage( |
|
|
|
getPage(params, FieldConstant.CREATED_TIME, false), |
|
|
|
getWrapper(params) |
|
|
|
); |
|
|
|
return getPageData(page, IcTripReportRecordDTO.class); |
|
|
|
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()); |
|
|
|
} |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
//2.按条件查询业务数据
|
|
|
|
PageInfo<IcTripReportRecordDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) |
|
|
|
.doSelectPageInfo(() -> baseDao.pageList(formDTO)); |
|
|
|
List<IcTripReportRecordDTO> list = data.getList(); |
|
|
|
//3.查询最近一次通知时间、核算检测关注名单
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
Set<String> idCardSet = list.stream().map(m -> m.getIdCard()).collect(Collectors.toSet()); |
|
|
|
Map<String, Date> latestNotice = icNoticeService.getUserLatestNoticeTime(formDTO.getCustomerId(),idCardSet); |
|
|
|
List<String> gzIdCardList = epidemicSpecialAttentionService.getHeSuanIdCardList(formDTO.getCustomerId(),idCardSet); |
|
|
|
for (IcTripReportRecordDTO dto : list) { |
|
|
|
//默认未加入
|
|
|
|
dto.setHeSuanCheck(false); |
|
|
|
if (CollectionUtils.isNotEmpty(gzIdCardList) && gzIdCardList.contains(dto.getIdCard())) { |
|
|
|
dto.setHeSuanCheck(true); |
|
|
|
} |
|
|
|
if (MapUtils.isNotEmpty(latestNotice) && latestNotice.containsKey(dto.getIdCard())) { |
|
|
|
dto.setLatestNoticeTime(latestNotice.get(dto.getIdCard())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new PageData(list, data.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|