提交 7c151371 authored 作者: zhoushaopan's avatar zhoushaopan

fix(设备管理): 单位去重和排序

单位去重和排序
上级 4f5ebe21
......@@ -383,15 +383,11 @@ public class DeviceLibraryController {
Map<Integer, String> styleMap = configCache.getStyleMap();
Set<Integer> status = new HashSet<>();
// Set<String> models = new HashSet<>();
List<String> models = new ArrayList<>();
//排序
List<String> names = new ArrayList<>();
// Set<String> names = new HashSet<>();
List<String> ownUnits = new ArrayList<>();
// Set<String> ownUnits = new HashSet<>();
List<String> locationUnits = new ArrayList<>();
// Set<String> locationUnits = new HashSet<>();
Set<Integer> matchingRanges = new HashSet<>();
//添加装备形态
Set<Integer> types = new HashSet<>();
......@@ -413,10 +409,10 @@ public class DeviceLibraryController {
map.put("models",modelToSort);
List<String> nameList = names.stream().distinct().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
map.put("names",nameList);
List<String> finalOwnUnits = ownUnits.stream().distinct().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
map.put("ownUnits",finalOwnUnits);
List<String> finalLocationUnits = locationUnits.stream().distinct().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
map.put("locationUnits",finalLocationUnits);
List<String> finalOwnUnits = DeviceModelSort.unitToSort(ownUnits);
map.put("ownUnits",finalOwnUnits.stream().distinct().collect(Collectors.toList()));
List<String> finalLocationUnits = DeviceModelSort.unitToSort(locationUnits);
map.put("locationUnits",finalLocationUnits.stream().distinct().collect(Collectors.toList()));
map.put("lifeStatus",status.stream().map(integer -> new LifeStatusVo(integer,lifeStatusMap.get(integer))).collect(Collectors.toList()));
map.put("matchingRanges",matchingRanges.stream().map(integer -> new LifeStatusVo(integer,matchingRangeMap.get(integer))).collect(Collectors.toList()));
Page<DeviceLibrary> deviceLibraryEntities = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), containList, deviceLibrarySelectVo.getPageable());
......@@ -476,8 +472,8 @@ public class DeviceLibraryController {
List<String> modelToSort = DeviceModelSort.modelToSort(models);
map.put("models",modelToSort);
map.put("names",resultList.stream().map(DeviceLibrary::getName).collect(Collectors.toSet()));
map.put("ownUnits",resultList.stream().map(DeviceLibrary::getOwnUnit).collect(Collectors.toSet()));
map.put("locationUnits",resultList.stream().map(DeviceLibrary::getLocationUnit).collect(Collectors.toSet()));
map.put("ownUnits",DeviceModelSort.unitToSort(resultList.stream().map(DeviceLibrary::getOwnUnit).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList()));
map.put("locationUnits",DeviceModelSort.unitToSort(resultList.stream().map(DeviceLibrary::getLocationUnit).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList()));
map.put("lifeStatus",status.stream().map(integer -> new LifeStatusVo(integer,lifeStatusMap.get(integer))).collect(Collectors.toList()));
return ResultUtil.success(map);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论