Compare commits
2 Commits
68ce8594fe
...
2318a8ade5
Author | SHA1 | Date | |
---|---|---|---|
2318a8ade5 | |||
d99be5cd18 |
@ -26,19 +26,28 @@ public class AssetServiceImpl implements AssetService {
|
|||||||
@Override
|
@Override
|
||||||
public List<Map<String, String>> countAsset() {
|
public List<Map<String, String>> countAsset() {
|
||||||
List<Asset> assetList = assetRepository.findAll();
|
List<Asset> assetList = assetRepository.findAll();
|
||||||
int[] assetTypeCounts = new int[3];
|
int[] assetTypeCounts = new int[6];
|
||||||
Map<String, String> map = new LinkedHashMap<>();
|
Map<String, String> map = new LinkedHashMap<>();
|
||||||
for (Asset asset : assetList) {
|
for (Asset asset : assetList) {
|
||||||
String assettype = asset.getAssettype();
|
String assettype = asset.getAssettype();
|
||||||
switch (assettype) {
|
switch (assettype) {
|
||||||
case "C":
|
case "C":
|
||||||
assetTypeCounts[0]++;
|
assetTypeCounts[0]++;
|
||||||
|
if ("1".equals(asset.getIsOnline())){
|
||||||
|
assetTypeCounts[3]++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "D":
|
case "D":
|
||||||
assetTypeCounts[1]++;
|
assetTypeCounts[1]++;
|
||||||
|
if ("1".equals(asset.getIsOnline())){
|
||||||
|
assetTypeCounts[4]++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "F":
|
case "F":
|
||||||
assetTypeCounts[2]++;
|
assetTypeCounts[2]++;
|
||||||
|
if ("1".equals(asset.getIsOnline())){
|
||||||
|
assetTypeCounts[5]++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -52,6 +61,15 @@ public class AssetServiceImpl implements AssetService {
|
|||||||
Map<String, String> map1=new LinkedHashMap<>();
|
Map<String, String> map1=new LinkedHashMap<>();
|
||||||
map1.put("assettype",stringStringEntry.getKey());
|
map1.put("assettype",stringStringEntry.getKey());
|
||||||
map1.put("count",stringStringEntry.getValue());
|
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);
|
mapList.add(map1);
|
||||||
}
|
}
|
||||||
return mapList;
|
return mapList;
|
||||||
|
Loading…
Reference in New Issue
Block a user