|
@@ -0,0 +1,61 @@
|
|
|
+package com.usky.backend.controller;
|
|
|
+import com.usky.backend.domain.vo.HistoryQueryVo;
|
|
|
+import com.usky.backend.domain.vo.HistoryResultVo;
|
|
|
+import com.usky.backend.domain.vo.LastQueryVo;
|
|
|
+import com.usky.backend.domain.vo.MetricItemVo;
|
|
|
+import com.usky.common.core.bean.ApiResult;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 数据统一查询 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@Api(tags = "数据统一查询")
|
|
|
+@RequestMapping("/dataQuery")
|
|
|
+public class DataQueryController {
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/history")
|
|
|
+ @ApiOperation("获取单个设备单属性历史数据")
|
|
|
+ public ApiResult<HistoryResultVo> history(@RequestParam("startTime") String startTime,
|
|
|
+ @RequestParam("endTime") String endTime,
|
|
|
+ @RequestParam("deviceId") String deviceId,
|
|
|
+ @RequestParam("metric") String metric ) {
|
|
|
+ //以下是mock模拟数据
|
|
|
+ List<MetricItemVo> items = new ArrayList<>();
|
|
|
+ items.add(new MetricItemVo(new Date(),12.3));
|
|
|
+ HistoryResultVo historyResultVo = new HistoryResultVo(deviceId,metric,items);
|
|
|
+ return ApiResult.success(historyResultVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/history")
|
|
|
+ @ApiOperation("获取单个设备多属性历史数据")
|
|
|
+ public ApiResult<List<HistoryResultVo>> history(@RequestBody HistoryQueryVo historyQueryVo) {
|
|
|
+ List<HistoryResultVo> result = new ArrayList<>();
|
|
|
+ List<MetricItemVo> items = new ArrayList<>();
|
|
|
+ items.add(new MetricItemVo(new Date(),12.3));
|
|
|
+ HistoryResultVo historyResultVo = new HistoryResultVo(historyQueryVo.getDeviceId(),"cpu.load",items);
|
|
|
+ result.add(historyResultVo);
|
|
|
+ return ApiResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/last")
|
|
|
+ @ApiOperation("获取单个设备多指标实时数据")
|
|
|
+ public ApiResult<List<MetricItemVo>> last(@RequestBody LastQueryVo lastQueryVo) {
|
|
|
+ List<MetricItemVo> metricItemVos = new ArrayList<>();
|
|
|
+ return ApiResult.success(metricItemVos);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|