From d99be5cd1861cf8ceb4e322ffd60961664fd7389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E4=B8=8B?= <484014559@qq.com> Date: Thu, 22 Aug 2024 09:55:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E8=AE=BE=E5=A4=87=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8E=A5=E5=8F=A3bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/asset/AssetServiceImpl.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetServiceImpl.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetServiceImpl.java index 8f6a7488f..51bf51e05 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetServiceImpl.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetServiceImpl.java @@ -26,19 +26,28 @@ public class AssetServiceImpl implements AssetService { @Override public List> countAsset() { List assetList = assetRepository.findAll(); - int[] assetTypeCounts = new int[3]; + int[] assetTypeCounts = new int[6]; Map map = new LinkedHashMap<>(); for (Asset asset : assetList) { String assettype = asset.getAssettype(); switch (assettype) { case "C": assetTypeCounts[0]++; + if ("1".equals(asset.getIsOnline())){ + assetTypeCounts[3]++; + } break; case "D": assetTypeCounts[1]++; + if ("1".equals(asset.getIsOnline())){ + assetTypeCounts[4]++; + } break; case "F": assetTypeCounts[2]++; + if ("1".equals(asset.getIsOnline())){ + assetTypeCounts[5]++; + } break; default: break; @@ -52,6 +61,15 @@ public class AssetServiceImpl implements AssetService { Map map1=new LinkedHashMap<>(); map1.put("assettype",stringStringEntry.getKey()); map1.put("count",stringStringEntry.getValue()); + if ("其他电子设备".equals(stringStringEntry.getKey())){ + map1.put("onlineCount",String.valueOf(assetTypeCounts[3])); + } + if ("运输设备".equals(stringStringEntry.getKey())){ + map1.put("onlineCount",String.valueOf(assetTypeCounts[4])); + } + if ("手持机".equals(stringStringEntry.getKey())){ + map1.put("onlineCount",String.valueOf(assetTypeCounts[5])); + } mapList.add(map1); } return mapList;