瀏覽代碼

预测接口

GYEE 6 月之前
父節點
當前提交
18ce0d5b8c
共有 17 個文件被更改,包括 4744 次插入570 次删除
  1. 3403 570
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/JavaFunctionJobHandler.java
  2. 486 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/PredictController.java
  3. 106 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/GlycSj.java
  4. 9 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/GlycSj2.java
  5. 160 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/HistoryPredict.java
  6. 207 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/ProBasicProjectPlan.java
  7. 149 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/RealtimePredict.java
  8. 2 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoDay.java
  9. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/HistoryPredictMapper.java
  10. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/ProBasicProjectPlanMapper.java
  11. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/RealtimePredictMapper.java
  12. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IHistoryPredictService.java
  13. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IProBasicProjectPlanService.java
  14. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IRealtimePredictService.java
  15. 51 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/HistoryPredictServiceImpl.java
  16. 35 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/ProBasicProjectPlanServiceImpl.java
  17. 40 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/RealtimePredictServiceImpl.java

文件差異過大導致無法顯示
+ 3403 - 570
ruoyi-admin/src/main/java/com/ruoyi/web/controller/JavaFunctionJobHandler.java


+ 486 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/PredictController.java

@@ -0,0 +1,486 @@
+package com.ruoyi.web.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.ruoyi.ucp.entity.*;
+import com.ruoyi.ucp.feign.AdapterApi;
+import com.ruoyi.ucp.service.IHistoryPredictService;
+import com.ruoyi.ucp.service.IPointInfoService;
+import com.ruoyi.ucp.service.IRealtimePredictService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.net.URI;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/predict")
+public class PredictController {
+
+    @Resource
+    private IPointInfoService pointInfoService;
+    @Resource
+    private AdapterApi adapterApi;
+    @Resource
+    private JavaFunctionJobHandler task;
+    @Resource
+    private IRealtimePredictService realtimePredictService;
+    @Resource
+    private IHistoryPredictService historyPredictService;
+
+    private Map<String, PointInfo> tbInfos = new ConcurrentHashMap<>();
+
+    @GetMapping("/stbs")
+    public Map<String, List<Integer>> stbs(){
+        QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
+        wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
+                .in(PointInfo::getUniformCode, "AI114");
+        List<PointInfo> list = pointInfoService.list(wrapper);
+        return list.stream().collect(Collectors.groupingBy(pi -> pi.getStationId().replaceFirst("GJNY_SXGS_", "")
+                .replaceFirst("_FDC_STA", ""), Collectors.mapping(pi -> Integer.parseInt(pi.getTurbineId()
+                .replaceFirst("GJNY_SXGS_.+_F_WT_", "").replaceFirst("_EQ", "")), Collectors.toList())));
+    }
+    @GetMapping("/stb")
+    public Map<String, List<String>> stb(){
+        QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
+        wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
+                .in(PointInfo::getUniformCode, "AI114");
+        List<PointInfo> list = pointInfoService.list(wrapper);
+        return list.stream().collect(Collectors.groupingBy(pi -> pi.getStationId(), Collectors.mapping(pi -> pi.getTurbineId(), Collectors.toList())));
+    }
+    @GetMapping("/snap")
+    public Map<String, Collection<GlycSj>> haha(@RequestParam(value = "stationId",required = false) String stationId,
+                                   @RequestParam(value = "beginTime",required = false) String beginTime,
+                                   @RequestParam(value = "endTime",required = false) String endTime,
+                                   @RequestParam(value = "interval",required = false) Integer interval) {
+        DateTime start = DateUtil.parse(beginTime);
+        DateTime end = DateUtil.parse(endTime);
+        String[] names = {"AI114", "AI066", "AI060", "AI067", "AI082", "AI073", "AI004", "AI047", "AI072", "AI074"};
+        QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
+        wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
+                .eq(PointInfo::getStationId, stationId)
+                .in(PointInfo::getUniformCode, names);
+        List<PointInfo> list = pointInfoService.list(wrapper);
+        Map<String, List<PointInfo>> tbPis = list.stream().collect(Collectors.groupingBy(PointInfo::getTurbineId));
+        Map<String, Collection<GlycSj>> result = new HashMap<>();
+        tbPis.forEach((tbId,pis)->{
+            List<PointData> zt = task.calcTurbineSimpleZt(start, end, interval, tbId);
+            Map<String, GlycSj> map =new TreeMap<>();
+            for (PointInfo info : pis) {
+                try {
+                    List<PointData> s = adapterApi.getHistorySnap(URI.create("http://172.16.12.103:8011/ts"), info.getPointKey(),
+                            start.getTime(), end.getTime(), interval);
+                    long j = start.getTime();
+                    String dt=null;GlycSj glycSj=null;
+                    //AI066	风速,AI060	发电机转速,AI065	风机状态点,AI067	风向,AI082	桨叶1角度,AI073	机舱方向/对风角度
+                    //AI004	U1绕组温度,AI047	电机温度2,AI072	环境温度,AI074	机舱温度
+                    switch (info.getUniformCode()) {
+                        case "AI114":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setGl(s.get(i).getValue());
+
+                                glycSj.setZt(zt.get(i)==null?null:zt.get(i).getValue());
+//                            glycSj.setActualTime(DateUtil.formatDateTime(DateUtil.date(s.get(i).getTs())));
+                                j += interval * 1000;//GJNY_SXGS_LJS_F_WT_
+//                                    glycSj.setTurbineId(info.getTurbineId().replaceFirst("GJNY_SXGS_","").replaceFirst("F_WT_","").replaceFirst("_EQ",""));
+                                glycSj.setTurbineId(info.getTurbineId().replaceFirst("GJNY_SXGS_.+_F_WT_", "").replaceFirst("_EQ", ""));
+                            }
+                            break;
+                        case "AI066":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setFs(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI060":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setFdjzs(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI065":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setZt(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI067":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setFx(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI082":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setJyjd(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI073":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setDfjd(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI004":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setNjwd(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI047":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setDjwd(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI072":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setHjwd(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                        case "AI074":
+                            for (int i = 0; i < s.size(); i++) {
+                                dt = DateUtil.formatDateTime(new Date(j));
+                                glycSj = map.get(dt);
+                                if (glycSj == null) {
+                                    glycSj = new GlycSj();
+                                    map.put(dt, glycSj);
+                                }
+                                glycSj.setJcwd(s.get(i).getValue());
+                                j += interval * 1000;
+                            }
+                            break;
+                    }
+                    map.forEach((k, v) -> {
+                        v.setTime(k);
+                    });
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+            result.put(tbId,map.values());
+        });
+        return result;
+    }
+    @GetMapping("/latest")
+    public Map<String, GlycSj> latest(@RequestParam(value = "stationId",required = false) String stationId) {
+        String[] names = {"AI114", "AI066", "AI060", "AI067", "AI082", "AI073", "AI004", "AI047", "AI072", "AI074"};
+        QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
+        wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
+                .eq(PointInfo::getStationId, stationId)
+                .in(PointInfo::getUniformCode, names);
+        List<PointInfo> list = pointInfoService.list(wrapper);
+        Map<String, List<PointInfo>> tbPis = list.stream().collect(Collectors.groupingBy(PointInfo::getTurbineId));
+        String keys = list.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
+        Map<String, GlycSj> result = new HashMap<>();
+        Map<String, Double> zt = task.calcRealtimeTurbineZt(stationId);
+        Map<String, PointData> latest = adapterApi.getLatest(URI.create("http://172.16.12.103:8011/ts"),keys);
+        tbPis.forEach((tbId,pis)->{
+            GlycSj glycSj = new GlycSj();
+            for (PointInfo info : pis) {
+                double v1 = latest.get(info.getPointKey()).getValue();
+                try {
+                    switch (info.getUniformCode()) {
+                        case "AI114":
+                            glycSj.setGl(v1);
+                            glycSj.setZt(zt.get(tbId));
+                            glycSj.setTurbineId(tbId.replaceFirst("GJNY_SXGS_.+_F_WT_", "").replaceFirst("_EQ", ""));
+                            break;
+                        case "AI066":
+                            glycSj.setFs(v1);
+                            break;
+                        case "AI060":
+                            glycSj.setFdjzs(v1);
+                            break;
+                        case "AI065":
+                            glycSj.setZt(zt.get(tbId));
+                            break;
+                        case "AI067":
+                            glycSj.setFx(v1);
+                            break;
+                        case "AI082":
+                            glycSj.setJyjd(v1);
+                            break;
+                        case "AI073":
+                            glycSj.setDfjd(v1);
+                            break;
+                        case "AI004":
+                            glycSj.setNjwd(v1);
+                            break;
+                        case "AI047":
+                            glycSj.setDjwd(v1);
+                            break;
+                        case "AI072":
+                            glycSj.setHjwd(v1);
+                            break;
+                        case "AI074":
+                            glycSj.setJcwd(v1);
+                            break;
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+            result.put(tbId,glycSj);
+        });
+        return result;
+    }
+    @GetMapping("/haha2")
+    public Map<String, Collection<GlycSj>> haha2(@RequestParam(value = "stationId",required = false) String stationId,
+                                   @RequestParam(value = "beginTime",required = false) String beginTime,
+                                   @RequestParam(value = "endTime",required = false) String endTime,
+                                   @RequestParam(value = "interval",required = false) Integer interval) {
+        String a="[\n" +
+                "  {\n" +
+                "    \"turbineId\": \"0011\",\n" +
+                "    \"time\": \"2024-10-14 22:22:00\",\n" +
+                "    \"gl\": 1744.0,\n" +
+                "    \"fs\": 6.982665061950684,\n" +
+                "    \"fdjzs\": 169.0,\n" +
+                "    \"zt\": 4.0,\n" +
+                "    \"fx\": 0.13901925086975098,\n" +
+                "    \"jyjd\": 0.0,\n" +
+                "    \"dfjd\": 0.1688677817583084,\n" +
+                "    \"njwd\": 61.0,\n" +
+                "    \"djwd\": 32.0,\n" +
+                "    \"hjwd\": 18.921875,\n" +
+                "    \"jcwd\": 29.0\n" +
+                "  },\n" +
+                "  {\n" +
+                "    \"turbineId\": \"0011\",\n" +
+                "    \"time\": \"2024-10-14 22:27:00\",\n" +
+                "    \"gl\": 2144.0,\n" +
+                "    \"fs\": 7.244823455810547,\n" +
+                "    \"fdjzs\": 176.0,\n" +
+                "    \"zt\": 4.0,\n" +
+                "    \"fx\": -0.04913616180419922,\n" +
+                "    \"jyjd\": 0.0,\n" +
+                "    \"dfjd\": -0.04758832976222038,\n" +
+                "    \"njwd\": 63.0,\n" +
+                "    \"djwd\": 32.0,\n" +
+                "    \"hjwd\": 19.046875,\n" +
+                "    \"jcwd\": 29.225000381469727\n" +
+                "  },\n" +
+                "  {\n" +
+                "    \"turbineId\": \"0011\",\n" +
+                "    \"time\": \"2024-10-14 22:32:00\",\n" +
+                "    \"gl\": 1848.0,\n" +
+                "    \"fs\": 7.532032012939453,\n" +
+                "    \"fdjzs\": 171.0,\n" +
+                "    \"zt\": 4.0,\n" +
+                "    \"fx\": 0.024447917938232422,\n" +
+                "    \"jyjd\": 0.0,\n" +
+                "    \"dfjd\": 0.0644155889749527,\n" +
+                "    \"njwd\": 65.0,\n" +
+                "    \"djwd\": 33.0,\n" +
+                "    \"hjwd\": 19.15625,\n" +
+                "    \"jcwd\": 29.225000381469727\n" +
+                "  },\n" +
+                "  {\n" +
+                "    \"turbineId\": \"0011\",\n" +
+                "    \"time\": \"2024-10-14 22:37:00\",\n" +
+                "    \"gl\": 1528.0,\n" +
+                "    \"fs\": 6.8463616371154785,\n" +
+                "    \"fdjzs\": 159.0,\n" +
+                "    \"zt\": 4.0,\n" +
+                "    \"fx\": 0.11313247680664062,\n" +
+                "    \"jyjd\": 0.0,\n" +
+                "    \"dfjd\": 0.11275594681501389,\n" +
+                "    \"njwd\": 64.5,\n" +
+                "    \"djwd\": 33.0,\n" +
+                "    \"hjwd\": 19.125,\n" +
+                "    \"jcwd\": 29.149999618530273\n" +
+                "  },\n" +
+                "  {\n" +
+                "    \"turbineId\": \"0011\",\n" +
+                "    \"time\": \"2024-10-14 22:42:00\",\n" +
+                "    \"gl\": 1280.0,\n" +
+                "    \"fs\": 6.929559230804443,\n" +
+                "    \"fdjzs\": 152.0,\n" +
+                "    \"zt\": 4.0,\n" +
+                "    \"fx\": 0.03271770477294922,\n" +
+                "    \"jyjd\": 0.0,\n" +
+                "    \"dfjd\": 0.031964123249053955,\n" +
+                "    \"njwd\": 63.0,\n" +
+                "    \"djwd\": 33.0,\n" +
+                "    \"hjwd\": 19.078125,\n" +
+                "    \"jcwd\": 29.39999961853027\n" +
+                "  }\n" +
+                "]";
+        QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
+        wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
+                .eq(PointInfo::getStationId, stationId);
+        List<PointInfo> list = pointInfoService.list(wrapper);
+        Map<String, Collection<GlycSj>> result = new HashMap<>();
+        ObjectMapper objectMapper = new ObjectMapper();
+        List<GlycSj> glycSjList = null;
+        try {
+            glycSjList = objectMapper.readValue(a, objectMapper.getTypeFactory().constructCollectionType(List.class, GlycSj.class));
+            // 现在你可以使用glycSjList了
+        } catch (IOException e) {
+            e.printStackTrace();
+            // 处理异常,比如记录日志或抛出运行时异常
+        }
+        result.put(list.get(0).getTurbineId(),glycSjList);
+        return result;
+    }
+    @GetMapping("/haha")
+    public Map<String, GlycSj> haha(@RequestParam(value = "stationId",required = false) String stationId) {
+        String a="  {\n" +
+                "    \"turbineId\": \"0011\",\n" +
+                "    \"time\": \"2024-10-14 22:22:00\",\n" +
+                "    \"gl\": 1744.0,\n" +
+                "    \"fs\": 6.982665061950684,\n" +
+                "    \"fdjzs\": 169.0,\n" +
+                "    \"zt\": 4.0,\n" +
+                "    \"fx\": 0.13901925086975098,\n" +
+                "    \"jyjd\": 0.0,\n" +
+                "    \"dfjd\": 0.1688677817583084,\n" +
+                "    \"njwd\": 61.0,\n" +
+                "    \"djwd\": 32.0,\n" +
+                "    \"hjwd\": 18.921875,\n" +
+                "    \"jcwd\": 29.0\n" +
+                "  }";
+        QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
+        wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
+                .eq(PointInfo::getStationId, stationId);
+        List<PointInfo> list = pointInfoService.list(wrapper);
+        Map<String, GlycSj> result = new HashMap<>();
+        ObjectMapper objectMapper = new ObjectMapper();
+        GlycSj glycSjList = null;
+        try {
+            glycSjList = objectMapper.readValue(a, GlycSj.class);
+            // 现在你可以使用glycSjList了
+        } catch (IOException e) {
+            e.printStackTrace();
+            // 处理异常,比如记录日志或抛出运行时异常
+        }
+        result.put(list.get(0).getTurbineId(),glycSjList);
+        return result;
+    }
+    @PostMapping("/write")
+    public boolean write(@RequestBody Map<String, List<GlycSj2>> data) {
+        try {
+            DateTime date = DateUtil.beginOfMinute(DateUtil.date());
+            int i = Math.floorDiv(date.minute(), 15) * 15;
+            date.setMinutes(i);
+            if (CollUtil.isEmpty(tbInfos)){
+                QueryWrapper<PointInfo> wrapper = new QueryWrapper<>();
+                wrapper.lambda().eq(PointInfo::getInstitutionType, "turbine")
+                        .in(PointInfo::getUniformCode, "AI121");
+                List<PointInfo> list = pointInfoService.list(wrapper);
+                tbInfos = list.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+            }
+            List<RealtimePredict> rpList = new ArrayList<>();
+            List<HistoryPredict> hpList = new ArrayList<>();
+            data.forEach((tbId,glycsjs)->{
+                PointInfo info = tbInfos.get(tbId);
+                for (GlycSj2 glycsj : glycsjs) {
+                    RealtimePredict rp = new RealtimePredict();
+                    rp.setId(tbId+glycsj.getTime());
+                    rp.setModelId("1");
+                    rp.setPredictType("CDQ");
+                    rp.setDeviceType("turbine");
+                    rp.setTime(DateUtil.parseDateTime(glycsj.getTime()));
+                    rp.setSiteId(info.getStationId());
+                    rp.setPeriodId(info.getProjectId());
+                    rp.setLineId(info.getLineId());
+                    rp.setTurbineId(tbId);
+                    rp.setPredictPower(glycsj.getPower());
+                    rp.setPredictEnergy(glycsj.getPower()/4);
+                    rpList.add(rp);
+                    HistoryPredict hp = new HistoryPredict();
+                    hp.setModelId("1");
+                    hp.setPredictType("CDQ");
+                    hp.setDeviceType("turbine");
+                    hp.setDataTime(date);
+                    hp.setPredictTime(DateUtil.parseDateTime(glycsj.getTime()));
+                    hp.setSiteId(info.getStationId());
+                    hp.setPeriodId(info.getProjectId());
+                    hp.setLineId(info.getLineId());
+                    hp.setTurbineId(tbId);
+                    hp.setPredictPower(glycsj.getPower());
+                    hp.setPredictEnergy(glycsj.getPower()/4);
+                    hpList.add(hp);
+                }
+            });
+            realtimePredictService.saveOrUpdateBatch(rpList);
+            historyPredictService.saveBatch(hpList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+        return true;
+    }
+}

+ 106 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/GlycSj.java

@@ -0,0 +1,106 @@
+package com.ruoyi.ucp.entity;
+
+import lombok.Data;
+
+@Data
+public class GlycSj {
+    //gl	fs	fdjzs	zt	fx	jyjd	dfjd	njwd	djwd	hjwd	jcwd
+    //功率	风速	发电机转速	状态点	风向	桨叶1角度	对风角度	U1绕组温度	电机温度2	环境温度	机舱温度
+    //AI114	AI066	AI060	AI065	AI067	AI082	AI073	AI004	AI047	AI072	AI074
+    private String turbineId;
+    private String time;
+    private Double gl;
+    private Double fs;
+    private Double fdjzs;
+    private Double zt;
+    private Double fx;
+    private Double jyjd;
+    private Double dfjd;
+    private Double njwd;
+    private Double djwd;
+    private Double hjwd;
+    private Double jcwd;
+
+    public void setGl(Double gl) {
+        if (gl == null || gl < 0 || gl > 40000) gl = 0.0;
+        this.gl = gl;
+    }
+
+    public void setFs(Double fs) {
+        if (fs == null || fs < 0 || fs > 25) fs = 0.0;
+        this.fs = fs;
+    }
+
+    public void setFdjzs(Double fdjzs) {
+        if (fdjzs == null || fdjzs < 0 || fdjzs > 30000) fdjzs = 0.0;
+        this.fdjzs = fdjzs;
+    }
+
+    public void setZt(Double zt) {
+        this.zt = zt;
+    }
+
+    public void setFx(Double fx) {
+        if (fx == null || fx < -360 || fx > 360) fx = 0.0;
+        this.fx = fx;
+    }
+
+    public void setJyjd(Double jyjd) {
+        if (jyjd == null || jyjd < -1000 || jyjd > 1000) jyjd = 0.0;
+        this.jyjd = jyjd;
+    }
+
+    public void setDfjd(Double dfjd) {
+        if (dfjd == null || dfjd < -1000 || dfjd > 1000) dfjd = 0.0;
+        this.dfjd = dfjd;
+    }
+
+    public void setNjwd(Double njwd) {
+        if (njwd == null || njwd < -10 || njwd > 500) njwd = 0.0;
+        this.njwd = njwd;
+    }
+
+    public void setDjwd(Double djwd) {
+        if (djwd == null || djwd < -10 || djwd > 500) djwd = 0.0;
+        this.djwd = djwd;
+    }
+
+    public void setHjwd(Double hjwd) {
+        if (hjwd == null || hjwd < -100 || hjwd > 100) hjwd = 0.0;
+        this.hjwd = hjwd;
+    }
+
+    public void setJcwd(Double jcwd) {
+        if (jcwd == null || jcwd < -100 || jcwd > 800) jcwd = 0.0;
+        this.jcwd = jcwd;
+    }
+    //    private String actualTime;
+    //AI004	U1绕组温度
+    //AI005	U2绕组温度
+    //AI007	V2绕组温度
+    //AI008	W1绕组温度
+    //AI047	电机温度2
+    //AI048	电机温度3
+    //AI056	电网功率
+    //AI057	电网频率
+    //AI069	功率设定值
+    //AI114	有功功率
+    //AI072	环境温度
+    //AI006	V1绕组温度
+    //AI065	风机状态点
+    //AI066	风速
+    //AI067	风向
+    //AI074	机舱温度
+    //DI025	解缆动作
+    //AI073	机舱方向/对风角度
+    //AI084	桨叶3角度
+    //AI009	W2绕组温度
+    //AI037	齿轮箱侧主轴轴承温度
+    //AI038	齿轮箱入口油温
+    //AI039	齿轮箱入口温度
+    //AI060	发电机转速
+    //DI022	发电机总故障
+    //DI080	总故障
+    //AI083	桨叶2角度
+    //AI082	桨叶1角度
+}

+ 9 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/GlycSj2.java

@@ -0,0 +1,9 @@
+package com.ruoyi.ucp.entity;
+
+import lombok.Data;
+
+@Data
+public class GlycSj2 {
+    private String time;
+    private Double power;
+}

+ 160 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/HistoryPredict.java

@@ -0,0 +1,160 @@
+package com.ruoyi.ucp.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-21
+ */
+@TableName("history_predict")
+public class HistoryPredict implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    private String modelId;
+
+    private String predictType;
+
+    private String deviceType;
+
+    private Date dataTime;
+
+    private Date predictTime;
+
+    private String siteId;
+
+    private String periodId;
+
+    private String lineId;
+
+    private String turbineId;
+
+    private Double predictPower;
+
+    private Double predictEnergy;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getModelId() {
+        return modelId;
+    }
+
+    public void setModelId(String modelId) {
+        this.modelId = modelId;
+    }
+
+    public String getPredictType() {
+        return predictType;
+    }
+
+    public void setPredictType(String predictType) {
+        this.predictType = predictType;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public Date getDataTime() {
+        return dataTime;
+    }
+
+    public void setDataTime(Date dataTime) {
+        this.dataTime = dataTime;
+    }
+
+    public Date getPredictTime() {
+        return predictTime;
+    }
+
+    public void setPredictTime(Date predictTime) {
+        this.predictTime = predictTime;
+    }
+
+    public String getSiteId() {
+        return siteId;
+    }
+
+    public void setSiteId(String siteId) {
+        this.siteId = siteId;
+    }
+
+    public String getPeriodId() {
+        return periodId;
+    }
+
+    public void setPeriodId(String periodId) {
+        this.periodId = periodId;
+    }
+
+    public String getLineId() {
+        return lineId;
+    }
+
+    public void setLineId(String lineId) {
+        this.lineId = lineId;
+    }
+
+    public String getTurbineId() {
+        return turbineId;
+    }
+
+    public void setTurbineId(String turbineId) {
+        this.turbineId = turbineId;
+    }
+
+    public Double getPredictPower() {
+        return predictPower;
+    }
+
+    public void setPredictPower(Double predictPower) {
+        this.predictPower = predictPower;
+    }
+
+    public Double getPredictEnergy() {
+        return predictEnergy;
+    }
+
+    public void setPredictEnergy(Double predictEnergy) {
+        this.predictEnergy = predictEnergy;
+    }
+
+    @Override
+    public String toString() {
+        return "HistoryPredict{" +
+            "id = " + id +
+            ", modelId = " + modelId +
+            ", predictType = " + predictType +
+            ", deviceType = " + deviceType +
+            ", dataTime = " + dataTime +
+            ", predictTime = " + predictTime +
+            ", siteId = " + siteId +
+            ", periodId = " + periodId +
+            ", lineId = " + lineId +
+            ", turbineId = " + turbineId +
+            ", predictPower = " + predictPower +
+            ", predictEnergy = " + predictEnergy +
+        "}";
+    }
+}

+ 207 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/ProBasicProjectPlan.java

@@ -0,0 +1,207 @@
+package com.ruoyi.ucp.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * ���̼ƻ���
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-15
+ */
+@TableName("pro_basic_project_plan")
+public class ProBasicProjectPlan implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ���
+     */
+    private Long id;
+
+    /**
+     * ���̱��
+     */
+    private String projectId;
+
+    /**
+     * �ƻ�������
+     */
+    private Double generatingCapacity;
+
+    /**
+     * �ƻ�ͣ��Сʱ
+     */
+    private Double outageHours;
+
+    /**
+     * ��
+     */
+    private String year;
+
+    /**
+     * ��
+     */
+    private String month;
+
+    /**
+     * ��վ��ţ����ࣩ
+     */
+    private String windpowerstationId;
+
+    /**
+     * ������
+     */
+    private String creator;
+
+    /**
+     * ����ʱ��
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * ������
+     */
+    private String updater;
+
+    /**
+     * ����ʱ��
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * �Ƿ�ɾ��
+     */
+    private Short deleted;
+
+    /**
+     * �⻧���
+     */
+    private Long tenantId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public Double getGeneratingCapacity() {
+        return generatingCapacity;
+    }
+
+    public void setGeneratingCapacity(Double generatingCapacity) {
+        this.generatingCapacity = generatingCapacity;
+    }
+
+    public Double getOutageHours() {
+        return outageHours;
+    }
+
+    public void setOutageHours(Double outageHours) {
+        this.outageHours = outageHours;
+    }
+
+    public String getYear() {
+        return year;
+    }
+
+    public void setYear(String year) {
+        this.year = year;
+    }
+
+    public String getMonth() {
+        return month;
+    }
+
+    public void setMonth(String month) {
+        this.month = month;
+    }
+
+    public String getWindpowerstationId() {
+        return windpowerstationId;
+    }
+
+    public void setWindpowerstationId(String windpowerstationId) {
+        this.windpowerstationId = windpowerstationId;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public LocalDateTime getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(LocalDateTime createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdater() {
+        return updater;
+    }
+
+    public void setUpdater(String updater) {
+        this.updater = updater;
+    }
+
+    public LocalDateTime getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(LocalDateTime updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Short getDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(Short deleted) {
+        this.deleted = deleted;
+    }
+
+    public Long getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(Long tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    @Override
+    public String toString() {
+        return "ProBasicProjectPlan{" +
+            "id = " + id +
+            ", projectId = " + projectId +
+            ", generatingCapacity = " + generatingCapacity +
+            ", outageHours = " + outageHours +
+            ", year = " + year +
+            ", month = " + month +
+            ", windpowerstationId = " + windpowerstationId +
+            ", creator = " + creator +
+            ", createTime = " + createTime +
+            ", updater = " + updater +
+            ", updateTime = " + updateTime +
+            ", deleted = " + deleted +
+            ", tenantId = " + tenantId +
+        "}";
+    }
+}

+ 149 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/RealtimePredict.java

@@ -0,0 +1,149 @@
+package com.ruoyi.ucp.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-21
+ */
+@TableName("realtime_predict")
+public class RealtimePredict implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String modelId;
+
+    private String predictType;
+
+    private String deviceType;
+
+    private Date time;
+
+    private String siteId;
+
+    private String periodId;
+
+    private String lineId;
+
+    private String turbineId;
+
+    private Double predictPower;
+
+    private Double predictEnergy;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getModelId() {
+        return modelId;
+    }
+
+    public void setModelId(String modelId) {
+        this.modelId = modelId;
+    }
+
+    public String getPredictType() {
+        return predictType;
+    }
+
+    public void setPredictType(String predictType) {
+        this.predictType = predictType;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public Date getTime() {
+        return time;
+    }
+
+    public void setTime(Date time) {
+        this.time = time;
+    }
+
+    public String getSiteId() {
+        return siteId;
+    }
+
+    public void setSiteId(String siteId) {
+        this.siteId = siteId;
+    }
+
+    public String getPeriodId() {
+        return periodId;
+    }
+
+    public void setPeriodId(String periodId) {
+        this.periodId = periodId;
+    }
+
+    public String getLineId() {
+        return lineId;
+    }
+
+    public void setLineId(String lineId) {
+        this.lineId = lineId;
+    }
+
+    public String getTurbineId() {
+        return turbineId;
+    }
+
+    public void setTurbineId(String turbineId) {
+        this.turbineId = turbineId;
+    }
+
+    public Double getPredictPower() {
+        return predictPower;
+    }
+
+    public void setPredictPower(Double predictPower) {
+        if (predictPower == null || predictPower < 0) predictPower = 0.0;
+        this.predictPower = predictPower;
+    }
+
+    public Double getPredictEnergy() {
+        return predictEnergy;
+    }
+
+    public void setPredictEnergy(Double predictEnergy) {
+        if (predictEnergy == null || predictEnergy < 0) predictEnergy = 0.0;
+        this.predictEnergy = predictEnergy;
+    }
+
+    @Override
+    public String toString() {
+        return "RealtimePredict{" +
+                "id = " + id +
+                ", modelId = " + modelId +
+                ", predictType = " + predictType +
+                ", deviceType = " + deviceType +
+                ", time = " + time +
+                ", siteId = " + siteId +
+                ", periodId = " + periodId +
+                ", lineId = " + lineId +
+                ", turbineId = " + turbineId +
+                ", predictPower = " + predictPower +
+                ", predictEnergy = " + predictEnergy +
+                "}";
+    }
+}

+ 2 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoDay.java

@@ -46,4 +46,6 @@ public class StationInfoDay implements Serializable {
     private Double rfdlFj;
 
     private Integer zyb;
+
+    private Double jhfdl;
 }

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/HistoryPredictMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.mapper;
+
+import com.ruoyi.ucp.entity.HistoryPredict;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-21
+ */
+public interface HistoryPredictMapper extends BaseMapper<HistoryPredict> {
+
+}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/ProBasicProjectPlanMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.mapper;
+
+import com.ruoyi.ucp.entity.ProBasicProjectPlan;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * ���̼ƻ��� Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-15
+ */
+public interface ProBasicProjectPlanMapper extends BaseMapper<ProBasicProjectPlan> {
+
+}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/RealtimePredictMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.mapper;
+
+import com.ruoyi.ucp.entity.RealtimePredict;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-21
+ */
+public interface RealtimePredictMapper extends BaseMapper<RealtimePredict> {
+
+}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IHistoryPredictService.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.service;
+
+import com.ruoyi.ucp.entity.HistoryPredict;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-21
+ */
+public interface IHistoryPredictService extends IService<HistoryPredict> {
+
+}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IProBasicProjectPlanService.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.service;
+
+import com.ruoyi.ucp.entity.ProBasicProjectPlan;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * ���̼ƻ��� 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-15
+ */
+public interface IProBasicProjectPlanService extends IService<ProBasicProjectPlan> {
+
+}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IRealtimePredictService.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.service;
+
+import com.ruoyi.ucp.entity.RealtimePredict;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-21
+ */
+public interface IRealtimePredictService extends IService<RealtimePredict> {
+
+}

+ 51 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/HistoryPredictServiceImpl.java

@@ -0,0 +1,51 @@
+package com.ruoyi.ucp.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.ucp.entity.HistoryPredict;
+import com.ruoyi.ucp.entity.RealtimePredict;
+import com.ruoyi.ucp.mapper.HistoryPredictMapper;
+import com.ruoyi.ucp.service.IHistoryPredictService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-21
+ */
+@Service
+@DataSource(DataSourceType.GLYC)
+public class HistoryPredictServiceImpl extends ServiceImpl<HistoryPredictMapper, HistoryPredict> implements IHistoryPredictService {
+    @Override
+    public boolean saveOrUpdateBatch(Collection<HistoryPredict> entityList) {
+        return super.saveOrUpdateBatch(entityList);
+    }
+
+    @Override
+    public boolean saveOrUpdateBatch(Collection<HistoryPredict> entityList, int batchSize) {
+        return super.saveOrUpdateBatch(entityList, batchSize);
+    }
+
+    @Override
+    public boolean saveBatch(Collection<HistoryPredict> entityList, int batchSize) {
+        return super.saveBatch(entityList, batchSize);
+    }
+
+    @Override
+    public boolean saveBatch(Collection<HistoryPredict> entityList) {
+        return super.saveBatch(entityList);
+    }
+
+    @Override
+    public List<HistoryPredict> list(Wrapper<HistoryPredict> queryWrapper) {
+        return super.list(queryWrapper);
+    }
+}

+ 35 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/ProBasicProjectPlanServiceImpl.java

@@ -0,0 +1,35 @@
+package com.ruoyi.ucp.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.ucp.entity.ProBasicProjectPlan;
+import com.ruoyi.ucp.mapper.ProBasicProjectPlanMapper;
+import com.ruoyi.ucp.service.IProBasicProjectPlanService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * ���̼ƻ��� 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-15
+ */
+@Service
+@DataSource(DataSourceType.SLAVE)
+public class ProBasicProjectPlanServiceImpl extends ServiceImpl<ProBasicProjectPlanMapper, ProBasicProjectPlan> implements IProBasicProjectPlanService {
+    @Override
+    public List<ProBasicProjectPlan> list(Wrapper<ProBasicProjectPlan> queryWrapper) {
+        return super.list(queryWrapper);
+    }
+
+    @Override
+    public List<ProBasicProjectPlan> list() {
+        return super.list();
+    }
+}

+ 40 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/RealtimePredictServiceImpl.java

@@ -0,0 +1,40 @@
+package com.ruoyi.ucp.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.ucp.entity.RealtimePredict;
+import com.ruoyi.ucp.mapper.RealtimePredictMapper;
+import com.ruoyi.ucp.service.IRealtimePredictService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-10-21
+ */
+@Service
+@DataSource(DataSourceType.GLYC)
+public class RealtimePredictServiceImpl extends ServiceImpl<RealtimePredictMapper, RealtimePredict> implements IRealtimePredictService {
+    @Override
+    public boolean saveOrUpdateBatch(Collection<RealtimePredict> entityList) {
+        return super.saveOrUpdateBatch(entityList);
+    }
+
+    @Override
+    public boolean saveOrUpdateBatch(Collection<RealtimePredict> entityList, int batchSize) {
+        return super.saveOrUpdateBatch(entityList, batchSize);
+    }
+
+    @Override
+    public List<RealtimePredict> list(Wrapper<RealtimePredict> queryWrapper) {
+        return super.list(queryWrapper);
+    }
+}