|
|
@ -711,12 +711,11 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
if (JSON.isValidArray(jsonString)) { |
|
|
|
JSONArray jsonArray = JSON.parseArray(jsonString); |
|
|
|
Map<String, Integer> sumByName = new LinkedHashMap<>(); |
|
|
|
Integer totalFlow1 = 0; |
|
|
|
|
|
|
|
List<Map<String, String>> list = new ArrayList(); |
|
|
|
for (Object item : jsonArray) { // 这里做了微调,直接遍历jsonArray的Object
|
|
|
|
JSONObject jsonObject = (JSONObject) item; |
|
|
|
|
|
|
|
totalFlow1 = totalFlow1 + jsonObject.getInteger("total_flow"); |
|
|
|
|
|
|
|
// 获取当前时间
|
|
|
|
LocalTime now = LocalTime.now(); |
|
|
@ -729,7 +728,6 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
sumByName.put(name, totalFlow); |
|
|
|
} |
|
|
|
} |
|
|
|
System.out.println("总数===:" + totalFlow1); |
|
|
|
// 正确创建新的映射对象并添加到list中
|
|
|
|
for (Map.Entry<String, Integer> entry : sumByName.entrySet()) { |
|
|
|
Map<String, String> singleResult = new LinkedHashMap<>(); // 每次循环都创建一个新的映射
|
|
|
|