diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java index 266475e9..78b64813 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java @@ -711,12 +711,11 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi if (JSON.isValidArray(jsonString)) { JSONArray jsonArray = JSON.parseArray(jsonString); Map sumByName = new LinkedHashMap<>(); - Integer totalFlow1 = 0; + List> 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 entry : sumByName.entrySet()) { Map singleResult = new LinkedHashMap<>(); // 每次循环都创建一个新的映射