|
|
@ -1,13 +1,17 @@ |
|
|
package com.epmet.service.impl; |
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; |
|
|
import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
@ -20,6 +24,7 @@ import com.epmet.dao.StatsStaffPatrolRecordDailyDao; |
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
import com.epmet.dto.StaffPatrolDetailDTO; |
|
|
import com.epmet.dto.StaffPatrolDetailDTO; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.*; |
|
|
|
|
|
import com.epmet.dto.form.patrol.PcworkRecordListFormDTO; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.entity.StaffPatrolDetailEntity; |
|
|
import com.epmet.entity.StaffPatrolDetailEntity; |
|
|
import com.epmet.entity.StaffPatrolRecordEntity; |
|
|
import com.epmet.entity.StaffPatrolRecordEntity; |
|
|
@ -31,6 +36,8 @@ import com.epmet.send.SendMqMsgUtil; |
|
|
import com.epmet.service.StaffPatrolDetailService; |
|
|
import com.epmet.service.StaffPatrolDetailService; |
|
|
import com.epmet.service.StaffPatrolRecordService; |
|
|
import com.epmet.service.StaffPatrolRecordService; |
|
|
import com.epmet.util.DimIdGenerator; |
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -39,9 +46,7 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.util.ArrayList; |
|
|
import java.util.*; |
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -70,6 +75,8 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec |
|
|
private GovProjectOpenFeignClient govProjectOpenFeignClient; |
|
|
private GovProjectOpenFeignClient govProjectOpenFeignClient; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -451,4 +458,49 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec |
|
|
} |
|
|
} |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Author sun |
|
|
|
|
|
* @Description 【网格员工作统计】巡查记录列表 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public PcworkRecordListResultDTO pcworkRecordList(PcworkRecordListFormDTO formDTO) { |
|
|
|
|
|
PcworkRecordListResultDTO resultDTO = new PcworkRecordListResultDTO(); |
|
|
|
|
|
//1.按条件查询网格员巡查数据
|
|
|
|
|
|
PageInfo<PcworkRecordListResultDTO.StaffPatrol> result = |
|
|
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> staffPatrolRecordDao.pcworkRecordList(formDTO)); |
|
|
|
|
|
if (org.springframework.util.CollectionUtils.isEmpty(result.getList())) { |
|
|
|
|
|
return resultDTO; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//2.查询网格信息并赋值
|
|
|
|
|
|
Map<String, CustomerGridDTO> map = new HashMap<>(); |
|
|
|
|
|
for (PcworkRecordListResultDTO.StaffPatrol r : result.getList()) { |
|
|
|
|
|
if (map.containsKey(r.getGridId())) { |
|
|
|
|
|
r.setGridName(map.get(r.getGridId()).getGridName()); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
String redisKey = RedisKeys.getGridInfoKey(r.getGridId()); |
|
|
|
|
|
Map<String, Object> gridCache = redisUtils.hGetAll(redisKey); |
|
|
|
|
|
if (gridCache != null && gridCache.size() > 0) { |
|
|
|
|
|
// 直接取缓存中的
|
|
|
|
|
|
CustomerGridDTO dto = BeanUtil.mapToBean(gridCache, CustomerGridDTO.class, true); |
|
|
|
|
|
r.setGridName(dto.getGridName()); |
|
|
|
|
|
map.put(r.getGridId(), dto); |
|
|
|
|
|
} else { |
|
|
|
|
|
CustomerGridFormDTO form = new CustomerGridFormDTO(); |
|
|
|
|
|
form.setGridId(r.getGridId()); |
|
|
|
|
|
Result<CustomerGridDTO> resultGrid = govOrgOpenFeignClient.getGridBaseInfoByGridId(form); |
|
|
|
|
|
if (!resultGrid.success()) { |
|
|
|
|
|
throw new RenException("调用org服务获取网格基础信息失败......"); |
|
|
|
|
|
} |
|
|
|
|
|
r.setGridName(resultGrid.getData().getGridName()); |
|
|
|
|
|
map.put(r.getGridId(), resultGrid.getData()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//3.封装数据并返回
|
|
|
|
|
|
resultDTO.setTotal((int)result.getTotal()); |
|
|
|
|
|
resultDTO.setList(result.getList()); |
|
|
|
|
|
return resultDTO; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|