Compare commits
No commits in common. "2318a8ade59ed78b37ce3160b24354e832992b2b" and "68ce8594fef9400926647c80df9cea6df39b39eb" have entirely different histories.
2318a8ade5
...
68ce8594fe
@ -26,28 +26,19 @@ public class AssetServiceImpl implements AssetService {
|
||||
@Override
|
||||
public List<Map<String, String>> countAsset() {
|
||||
List<Asset> assetList = assetRepository.findAll();
|
||||
int[] assetTypeCounts = new int[6];
|
||||
int[] assetTypeCounts = new int[3];
|
||||
Map<String, String> 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;
|
||||
@ -61,15 +52,6 @@ public class AssetServiceImpl implements AssetService {
|
||||
Map<String, String> 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;
|
||||
|
Loading…
Reference in New Issue
Block a user