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); } }