|
@@ -509,17 +509,33 @@ public class IotStaticController {
|
|
|
IotDevicePageReqVO iotDevicePageReqVO = new IotDevicePageReqVO();
|
|
|
iotDevicePageReqVO.setDeviceIds(new ArrayList<>(ids));
|
|
|
List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectList(iotDevicePageReqVO);
|
|
|
- List<Map.Entry<Long, Long>> collect = iotDeviceDOS.stream().collect(Collectors.groupingBy(IotDeviceDO::getAssetClass, Collectors.counting())).entrySet().stream().sorted(Map.Entry.<Long, Long>comparingByValue().reversed())
|
|
|
- .limit(5)
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<Map<String, Object>> results = new ArrayList<>(collect.size());
|
|
|
- collect.forEach(e ->{
|
|
|
- IotProductClassifyDO iotProductClassifyDO = iotProductClassifyMapper.selectById(e.getKey());
|
|
|
- Map<String, Object> map = new HashMap<>(4);
|
|
|
- map.put("category", iotProductClassifyDO.getName());
|
|
|
- map.put("value", e.getValue());
|
|
|
- results.add(map);
|
|
|
- });
|
|
|
+ LinkedList<Map<String, Object>> results = new LinkedList<>();
|
|
|
+ if ("rh".equals(dept)) {
|
|
|
+ List<Map.Entry<Long, Long>> collect = iotDeviceDOS.stream().collect(Collectors.groupingBy(IotDeviceDO::getAssetClass, Collectors.counting())).entrySet().stream().sorted(Map.Entry.<Long, Long>comparingByValue().reversed()).collect(Collectors.toList());
|
|
|
+ collect.forEach(e->{
|
|
|
+ IotProductClassifyDO iotProductClassifyDO = iotProductClassifyMapper.selectById(e.getKey());
|
|
|
+ if ("电驱增压机".equals(iotProductClassifyDO.getName())||"柴驱增压机".equals(iotProductClassifyDO.getName())||"电驱空压机".equals(iotProductClassifyDO.getName())||"柴驱空压机".equals(iotProductClassifyDO.getName())
|
|
|
+ ||"空气处理撬".equals(iotProductClassifyDO.getName())||"提纯撬".equals(iotProductClassifyDO.getName()) ||"膜组".equals(iotProductClassifyDO.getName())||"注水泵".equals(iotProductClassifyDO.getName())
|
|
|
+ ||"箱变".equals(iotProductClassifyDO.getName())) {
|
|
|
+ Map<String, Object> map = new HashMap<>(4);
|
|
|
+ map.put("category", iotProductClassifyDO.getName());
|
|
|
+ map.put("value", e.getValue());
|
|
|
+ results.add(map);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ List<Map.Entry<Long, Long>> collect = iotDeviceDOS.stream().collect(Collectors.groupingBy(IotDeviceDO::getAssetClass, Collectors.counting())).entrySet().stream().sorted(Map.Entry.<Long, Long>comparingByValue().reversed())
|
|
|
+ .limit(5)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ collect.forEach(e ->{
|
|
|
+ IotProductClassifyDO iotProductClassifyDO = iotProductClassifyMapper.selectById(e.getKey());
|
|
|
+ Map<String, Object> map = new HashMap<>(4);
|
|
|
+ map.put("category", iotProductClassifyDO.getName());
|
|
|
+ map.put("value", e.getValue());
|
|
|
+ results.add(map);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
return CommonResult.success(results);
|
|
|
}
|
|
|
|