Browse Source

添加接口

wangchangsheng 3 years ago
parent
commit
0199c9dcee

+ 44 - 0
gyee-sample-impala/src/main/java/com/gyee/sampleimpala/controller/CaseFaultAlgController.java

@@ -1,8 +1,10 @@
 package com.gyee.sampleimpala.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.sampleimpala.common.result.JsonResult;
 import com.gyee.sampleimpala.common.result.ResultCode;
+import com.gyee.sampleimpala.model.kudu.Casefault;
 import com.gyee.sampleimpala.model.kudu.Casefaultalg;
 import com.gyee.sampleimpala.model.kudu.Knowfaultfix;
 import com.gyee.sampleimpala.service.kudu.CasefaultalgService;
@@ -48,4 +50,46 @@ public class CaseFaultAlgController {
 
         return JsonResult.error(ResultCode.ERROR);
     }
+
+
+
+
+    /**
+     * 删除样本案例
+     * @param id
+     * @return
+     */
+    @PostMapping("/faultalg/removealgbyid")
+    @ResponseBody
+    public JSONObject stationRemove(@RequestParam(value = "id", required = true) String id){
+
+        boolean flag = casefaultalgService.removeFaultAlgById(id);
+        if (flag){
+            return JsonResult.success(ResultCode.SUCCESS);
+        }
+
+        return JsonResult.error(ResultCode.ERROR);
+    }
+
+
+    /**
+     * 根据条件查询故障
+     * @param station  场站
+     * @param model    风机型号
+     * @param widget   故障部件
+     * @param st       开始时间
+     * @param et       结束时间
+     * @return
+     */
+    @GetMapping("/faultalg/list")
+    public JSONObject faultAlgList(String station, String[] model, String[] widget,
+                                 String st, String et){
+
+        Page<Casefaultalg> page =new Page(1,10);
+        List<Casefaultalg> list = casefaultalgService.getAll(station, model, widget, st, et);
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+
+
 }

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/sampleimpala/controller/CaseFaultController.java

@@ -31,7 +31,7 @@ public class CaseFaultController {
      * @param et       结束时间
      * @return
      */
-    @GetMapping("/fault/all")
+    @GetMapping("/fault/list")
     public JSONObject stationAll(String station, String[] model, String[] widget,
                                  String st, String et){
         List<Casefault> list = casefaultService.getAll(station, model, widget, st, et);

+ 108 - 0
gyee-sample-impala/src/main/java/com/gyee/sampleimpala/controller/CasePerformanceController.java

@@ -0,0 +1,108 @@
+package com.gyee.sampleimpala.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.sampleimpala.common.result.JsonResult;
+import com.gyee.sampleimpala.common.result.ResultCode;
+import com.gyee.sampleimpala.model.kudu.CasePerformance;
+import com.gyee.sampleimpala.service.GoldenService;
+import com.gyee.sampleimpala.service.kudu.CasePerformanceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 性能样本
+ *
+ * @author w
+ * @since 2021-11-17
+ */
+@CrossOrigin
+@RestController
+@RequestMapping("/case")
+public class CasePerformanceController {
+
+
+    @Autowired
+    private CasePerformanceService casePerformanceService;
+
+    @Autowired
+    private GoldenService goldenService;
+
+    /**
+     * 获取样本数据
+     *
+     * @param station 场站
+     * @param model   风机模型
+     * @param tag     样本类型
+     * @param st      开始时间
+     * @param et      结束时间
+     * @return
+     */
+    @GetMapping("/performance/list")
+    public JSONObject getPerformanceList(String station, String[] model, Integer tag,
+                                         String st, String et) {
+        List<CasePerformance> list = casePerformanceService.getPerformanceList(station, model, tag, st, et);
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+
+    /**
+     * 新增样本
+     *
+     * @param performance 样本对象
+     * @return
+     */
+    @PostMapping("/performance/add")
+    public JSONObject addPerformance(@RequestBody CasePerformance performance) {
+        boolean flag = casePerformanceService.addPerformance(performance);
+
+        if (flag) {
+            return JsonResult.success(ResultCode.SUCCESS);
+        }
+        return JsonResult.error(ResultCode.ERROR);
+    }
+
+
+    /**
+     * 编辑样本
+     *
+     * @param performance 样本对象
+     * @return
+     */
+    @PostMapping("/performance/edit")
+    public JSONObject editPerformance(@RequestBody CasePerformance performance) {
+        boolean flag = casePerformanceService.editPerformance(performance);
+
+        if (flag) {
+            return JsonResult.success(ResultCode.SUCCESS);
+        }
+        return JsonResult.error(ResultCode.ERROR);
+    }
+
+    /**
+     * 删除样本
+     *
+     * @param id 样本id
+     * @return
+     */
+    @PostMapping("/performance/remove")
+    public JSONObject removePerformance(Integer id) {
+        boolean flag = casePerformanceService.removePerformanceById(id);
+        if (flag) {
+            return JsonResult.success(ResultCode.SUCCESS);
+        }
+        return JsonResult.error(ResultCode.ERROR);
+    }
+
+
+
+    public JSONObject  getCurve() {
+
+        return null;
+    }
+
+
+
+}

+ 22 - 14
gyee-sample-impala/src/main/java/com/gyee/sampleimpala/controller/WindturbinePointController.java

@@ -2,6 +2,7 @@ package com.gyee.sampleimpala.controller;
 
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.sampleimpala.common.result.JsonResult;
 import com.gyee.sampleimpala.common.result.ResultCode;
 import com.gyee.sampleimpala.model.custom.TsPointData;
@@ -9,12 +10,10 @@ import com.gyee.sampleimpala.model.kudu.Windturbinepoint;
 import com.gyee.sampleimpala.service.GoldenService;
 import com.gyee.sampleimpala.service.kudu.WindturbinepointService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 故障样本库操作
@@ -34,12 +33,15 @@ public class WindturbinePointController {
     /**
      * 根据风机编号和部件查询关联测点
      *
-     * @param wtId
-     * @param widget
+     * @param wtId 风机编号
+     * @param widget 部件编码
      * @return
      */
-    @GetMapping("/all")
-    public JSONObject pointAll(String wtId, String widget) {
+    @GetMapping("/list")
+    public JSONObject pointAll(
+            @RequestParam(value = "wtId",required = false) String wtId,
+            @RequestParam(value = "widget",required = false) String widget
+    ) {
         List<Windturbinepoint> list = windturbinepointService.getAll(wtId, widget);
         return JsonResult.successData(ResultCode.SUCCESS, list);
     }
@@ -48,16 +50,22 @@ public class WindturbinePointController {
     /**
      * 获取golden原始点数据
      *
-     * @param point    测点
-     * @param startTs
-     * @param endTs
-     * @param interval 等间隔时间  s
+     * @param point []   测点
+     * @param startTs 开始时间(毫秒)
+     * @param endTs 结束时间(毫秒)
+     * @param interval 等间隔时间(秒)
      * @return
      */
     @GetMapping("/item")
-    public JSONObject pointAll(String point, long startTs, long endTs, int interval) {
-        List<TsPointData> list = goldenService.getOriginalData(point, startTs, endTs, interval);
+    public JSONObject pointAll(
+            @RequestParam(value = "point",required = false) String[] point,
+            @RequestParam(value = "startTs",required = false) long startTs,
+            @RequestParam(value = "endTs",required = false) long endTs,
+            @RequestParam(value = "interval",required = false) int interval) {
+        List<Map> list = goldenService.getOriginalData(point, startTs, endTs, interval);
         return JsonResult.successData(ResultCode.SUCCESS, list);
     }
 
+
+
 }