From e2870a44c3c27df62f24d6ffd395857d08057379 Mon Sep 17 00:00:00 2001 From: gongzhenkun <1658878546@qq.com> Date: Wed, 7 Sep 2022 15:55:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=82=A3=E8=80=85=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E6=95=B0=E6=8D=AE=E5=9B=BE=E8=A1=A8=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E9=94=99=E4=B9=B1=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/resp/RecordHistoryDataResp.java | 14 +++++++------- .../system/service/impl/TRecordServiceImpl.java | 17 +++++++++++------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/RecordHistoryDataResp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/RecordHistoryDataResp.java index 524bd5d..d468485 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/RecordHistoryDataResp.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/RecordHistoryDataResp.java @@ -9,20 +9,20 @@ public class RecordHistoryDataResp private List shexiaList; private List dateList; - private HashMap> historyDataMap; + private HashMap> historyDataMap; - public RecordHistoryDataResp() - { - } - - public HashMap> getHistoryDataMap() { + public HashMap> getHistoryDataMap() { return historyDataMap; } - public void setHistoryDataMap(HashMap> historyDataMap) { + public void setHistoryDataMap(HashMap> historyDataMap) { this.historyDataMap = historyDataMap; } + public RecordHistoryDataResp() + { + } + public List getShezhiList() { return shezhiList; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java index 37b367d..5e8cadb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java @@ -178,7 +178,7 @@ public class TRecordServiceImpl implements ITRecordService return jsonObject; }).filter(Objects::nonNull).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(result)){ - HashMap> map = new HashMap<>(); + HashMap> map = new HashMap<>(); result.forEach(jsonObject -> { getJsonData(jsonObject.getJSONObject("data"), "data", map, jsonKeyList); }); @@ -195,24 +195,29 @@ public class TRecordServiceImpl implements ITRecordService * @param historyDataMap 历史数据 * @param removeKeyList 删除键列表 */ - private static void getJsonData(Object obj, String listName, HashMap> historyDataMap, List removeKeyList) { + private static void getJsonData(Object obj, String listName, HashMap> historyDataMap, List removeKeyList) { // aiResult结果集中只包括JSONObject,不包括JSONArray if (obj instanceof JSONObject) { for (Map.Entry entry : ((JSONObject) obj).entrySet()) { - if (!(entry.getValue() instanceof String)) { + if ((entry.getValue() instanceof JSONObject)) { getJsonData(entry.getValue(), entry.getKey(), historyDataMap, removeKeyList); } else { - // 去除 + // 去除带图片字段 if (removeKeyList.contains(listName)) { continue; } - ArrayList list; + //sz_avg_purple: { "anomaly": 0, "v": "正常" } + // anomaly属于预留字段,暂时无用; 各个任务中的字段v是任务实际值 + if (!"v".equals(entry.getKey())) { + continue; + } + ArrayList list; if (null == historyDataMap.get(listName)) { list = new ArrayList<>(); } else { list = historyDataMap.get(listName); } - list.add((String) entry.getValue()); + list.add(entry.getValue()); historyDataMap.put(listName, list); } }