查询用户关注台站列表数据,排班任务台站与关注台站过滤逻辑修改

This commit is contained in:
qiaoqinzheng 2024-02-20 18:16:59 +08:00
parent c38584c138
commit eccb0480d1

View File

@ -241,16 +241,19 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
if (Objects.nonNull(stationInfoMap.get(item.getStationId()))){ if (Objects.nonNull(stationInfoMap.get(item.getStationId()))){
//获取台站信息 //获取台站信息
GardsStations stations = (GardsStations) stationInfoMap.get(item.getStationId()); GardsStations stations = (GardsStations) stationInfoMap.get(item.getStationId());
//获取台站类型 //如果排班任务台站id数组中 不包含当前关注台站id 则关注台站正常存储
String stationType = stationTypeUtil.getStationType(stations.getStationId()); if (!taskStation.contains(stations.getStationId().toString())) {
item.setStationType(stationType); //获取台站类型
item.setStationCode(stations.getStationCode()); String stationType = stationTypeUtil.getStationType(stations.getStationId());
item.setLon(stations.getLon()); item.setStationType(stationType);
item.setLat(stations.getLat()); item.setStationCode(stations.getStationCode());
item.setStatus(stations.getStatus()); item.setLon(stations.getLon());
item.setAltitude(Objects.isNull(stations.getElevation())?"--":stations.getElevation()+"m"); item.setLat(stations.getLat());
item.setScheduling(false); item.setStatus(stations.getStatus());
resultList.add(item); item.setAltitude(Objects.isNull(stations.getElevation())?"--":stations.getElevation()+"m");
item.setScheduling(false);
resultList.add(item);
}
} }
} }
} }
@ -282,27 +285,6 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
} }
} }
} }
List<Integer> removeIndex = new LinkedList<>();
for (int i=0; i<resultList.size(); i++) {
SysUserFocusStationStation nowStation = resultList.get(i);
for (int j=i+1; j<resultList.size(); j++) {
SysUserFocusStationStation compareStation = resultList.get(j);
//如果当前台站与对比台站的台站编码一致
if (nowStation.getStationCode().equals(compareStation.getStationCode())) {
//如果当前台站不是排班任务的台站 对比的台站是排班任务台站 将当前台站的下标记录用于移除处理
if (!nowStation.isScheduling() && compareStation.isScheduling()) {
removeIndex.add(i);
} else {//否则移除对比台站 将对比台站下标记录用于移除处理
removeIndex.add(j);
}
}
}
}
if (CollectionUtils.isNotEmpty(removeIndex)) {
for (int index:removeIndex) {
resultList.remove(index);
}
}
if (CollectionUtils.isNotEmpty(resultList)) { if (CollectionUtils.isNotEmpty(resultList)) {
resultList = resultList.stream().distinct().sorted(Comparator.comparing(SysUserFocusStationStation::getStationCode)).collect(Collectors.toList()); resultList = resultList.stream().distinct().sorted(Comparator.comparing(SysUserFocusStationStation::getStationCode)).collect(Collectors.toList());
} }