瀏覽代碼

bug修改

wangb 1 周之前
父節點
當前提交
c64c92790b

+ 8 - 0
data-adapter/src/main/java/com/gyee/dataadapter/controller/AdapterController.java

@@ -48,6 +48,10 @@ public class AdapterController {
     public Map<String, PointData> getLatest(@RequestBody List<String> keys) {
         return tsDataService.getLatest(keys);
     }
+    @PostMapping("/latestp")
+    public Map<String, PointData> getLatestp(@RequestBody String keys) {
+        return tsDataService.getLatest(keys);
+    }
 
     @GetMapping("/history/raw")
     public List<PointData> getHistoryRaw(@RequestParam("tagName") String tagName,
@@ -127,6 +131,10 @@ public class AdapterController {
     public Map<String, PointData> getHistorySection(@RequestParam("tagNames") String tagNames, @RequestParam("ts") Long ts) {
         return tsDataService.getHistorySection(ts, tagNames);
     }
+    @PostMapping("/history/section")
+    public Map<String, PointData> getHistorySectionp(@RequestBody String tagNames, @RequestParam("ts") Long ts) {
+        return tsDataService.getHistorySection(ts, tagNames);
+    }
 
     @PostMapping("/save/batch")
     public boolean writeLatestBatch(@RequestBody List<PointData> pointDataList) {

+ 3 - 1
data-adapter/src/main/java/com/gyee/dataadapter/service/TsDataService.java

@@ -3,6 +3,7 @@ package com.gyee.dataadapter.service;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import com.gyee.dataadapter.dao.IHistoryDao;
 import com.gyee.dataadapter.dao.ILatestDao;
 import com.gyee.dataadapter.entity.PointData;
@@ -147,9 +148,10 @@ public class TsDataService {
     }
 
     public Map<String, PointData> getHistorySection(Date time, String tagNames) {
+        Map<String, PointData> result = new HashMap<>();
+        if(StrUtil.isBlank(tagNames)) return result;
         Map<Boolean, List<String>> nxFgs = Arrays.stream(tagNames.split(",")).collect(
                 Collectors.groupingBy(tn -> tn.startsWith("NX_FGS_")));
-        Map<String, PointData> result = new HashMap<>();
         try {
             Map<String, PointData> latest = historyDao.getHistorySection(time, nxFgs.get(true));
             result.putAll(latest);