|
@@ -0,0 +1,74 @@
|
|
|
|
+package com.gyee.consumer.controller.datacenter;
|
|
|
|
+
|
|
|
|
+import com.gyee.common.config.R;
|
|
|
|
+import com.gyee.consumer.api.DatacenterApi;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.cloud.openfeign.FeignClient;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @ClassName : DatacenterController
|
|
|
|
+ * @Author : xieshengjie
|
|
|
|
+ * @Date: 2022/2/22 10:45
|
|
|
|
+ * @Description :
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+public class DatacenterController {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private DatacenterApi datacenterApi;
|
|
|
|
+ /**
|
|
|
|
+ * 获取所有表名
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/consumer/dataquery/tables")
|
|
|
|
+ R getTables(){
|
|
|
|
+ return datacenterApi.getTables();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据表名点名查询数据
|
|
|
|
+ * @param tableid
|
|
|
|
+ * @param pointId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/consumer/dataquery//realtimeData")
|
|
|
|
+ R getRealtimedata(@RequestParam(value = "tableid",required = true)String tableid,
|
|
|
|
+ @RequestParam(value = "pointId",required = false)String pointId,
|
|
|
|
+ @RequestParam(value = "pointName",required = false)String pointName,
|
|
|
|
+ @RequestParam(value = "pageNum",required = true)String pageNum,
|
|
|
|
+ @RequestParam(value = "pageSize",required = true)String pageSize){
|
|
|
|
+ return datacenterApi.getRealtimedata(tableid,pointId,pointName,pageNum,pageSize);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据点名查询历史数据
|
|
|
|
+ * @param pointId
|
|
|
|
+ * @param begin
|
|
|
|
+ * @param end
|
|
|
|
+ * @param interval
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/consumer/dataquery//historyData")
|
|
|
|
+ public R gethistoryData(@RequestParam(value = "pointId",required = true)String pointId,
|
|
|
|
+ @RequestParam(value = "begin",required = true)String begin,
|
|
|
|
+ @RequestParam(value = "end",required = true)String end,
|
|
|
|
+ @RequestParam(value = "interval",required = false)String interval,
|
|
|
|
+ @RequestParam(value = "type",required = false)String type){
|
|
|
|
+ return datacenterApi.gethistoryData(pointId,begin,end,interval,type);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/consumer/dataquery//realtimeExport")
|
|
|
|
+ public R realtimeExport(@RequestParam(value = "tableid",required = true)String tableid,
|
|
|
|
+ @RequestParam(value = "pointId",required = false)String pointId,
|
|
|
|
+ @RequestParam(value = "pointName",required = false)String pointName, HttpServletResponse response) throws IOException{
|
|
|
|
+ return datacenterApi.realtimeExport(tableid,pointId,pointName,response);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|