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

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

View File

@ -241,6 +241,8 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
if (Objects.nonNull(stationInfoMap.get(item.getStationId()))){
//获取台站信息
GardsStations stations = (GardsStations) stationInfoMap.get(item.getStationId());
//如果排班任务台站id数组中 不包含当前关注台站id 则关注台站正常存储
if (!taskStation.contains(stations.getStationId().toString())) {
//获取台站类型
String stationType = stationTypeUtil.getStationType(stations.getStationId());
item.setStationType(stationType);
@ -255,6 +257,7 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
}
}
}
}
if (CollectionUtils.isNotEmpty(taskStation)) {
//遍历排班任务id
for (String stationId:taskStation) {
@ -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)) {
resultList = resultList.stream().distinct().sorted(Comparator.comparing(SysUserFocusStationStation::getStationCode)).collect(Collectors.toList());
}