diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 6e6ef6f957..ad2c35ec1c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -113,28 +113,26 @@ public class EpmetUserServiceImpl implements EpmetUserService { formDTO.setPatrolStartTime(DateUtils.getBeforeMonthDate(formDTO.getTime())); List staffPatrolList = staffPatrolRecordDao.selectPatrolList(formDTO); - //5.封装数据并做分页处理 + //5.封装数据 + Map map = new HashMap<>(); result.forEach(re -> { staffPatrolList.forEach(st -> { if (re.getGridId().equals(st.getGridId()) && re.getStaffId().equals(st.getStaffId())) { re.setPatrolStartTime(st.getPatrolStartTime()); re.setPatrolTotal(st.getPatrolTotal()); re.setStatus(st.getStatus()); + map.put(re.getGridId()+re.getStaffId(),re.getStaffId()); } }); }); - int num = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); - int size = num + formDTO.getPageSize(); - if (num > result.size()) { - return resultList; - } - resultList = result.subList(num, (size > result.size() ? result.size() : size)); - - //6.赋值网格名称 - resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()))); - - //7.按条件排序并返回 - Collections.sort(resultList, new Comparator() { + //可能存在的在a网格有记录后在a网格将该人员移除 + staffPatrolList.forEach(st->{ + if(!map.containsKey(st.getGridId()+st.getStaffId())){ + result.add(st); + } + }); + //6.按条件排序 + Collections.sort(result, new Comparator() { @Override public int compare(StaffListResultDTO o1, StaffListResultDTO o2) { if ("latestPatrolledTime".equals(formDTO.getSortCode())) { @@ -145,6 +143,18 @@ public class EpmetUserServiceImpl implements EpmetUserService { } }); + //7.按分页抽取数据 + int num = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + int size = num + formDTO.getPageSize(); + if (num > result.size()) { + return resultList; + } + resultList = result.subList(num, (size > result.size() ? result.size() : size)); + + //8.赋值网格名称 + resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()))); + + return resultList; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml index 22034f1d13..662ce08625 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml @@ -32,7 +32,7 @@ AND spr.patrol_start_time = ]]> #{patrolStartTime} - AND cs.real_name LIKE CONCAT('%',#{staffName},'%') + AND cs.real_name = #{staffName} spr.GRID = #{gridId}