瀏覽代碼

bug修复

hlf 1 月之前
父節點
當前提交
4d86ac2249
共有 54 個文件被更改,包括 2783 次插入81 次删除
  1. 2 1
      data-adapter/src/main/java/com/gyee/dataadapter/cache/MqttCache.java
  2. 58 8
      data-adapter/src/main/java/com/gyee/dataadapter/config/MqttServer.java
  3. 1 0
      data-adapter/src/main/java/com/gyee/dataadapter/config/PushCallback.java
  4. 28 8
      data-adapter/src/main/java/com/gyee/dataadapter/controller/AdapterController.java
  5. 2 0
      data-adapter/src/main/java/com/gyee/dataadapter/dao/IHistoryDao.java
  6. 26 0
      data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/TaosDataService.java
  7. 5 0
      data-adapter/src/main/java/com/gyee/dataadapter/service/IAdapterService.java
  8. 22 3
      data-adapter/src/main/java/com/gyee/dataadapter/service/TsDataService.java
  9. 143 13
      data-adapter/src/main/java/com/gyee/dataadapter/service/impl/AdapterServiceImpl.java
  10. 1 1
      data-adapter/src/main/resources/application.yaml
  11. 二進制
      generationXK-service/log/ota.log.2024-10-15.0.gz
  12. 二進制
      generationXK-service/log/ota.log.2024-10-16.0.gz
  13. 二進制
      generationXK-service/log/ota.log.2024-10-17.0.gz
  14. 20 0
      generationXK-service/src/main/java/com/gyee/generation/controller/ProBaseBackfillController.java
  15. 20 0
      generationXK-service/src/main/java/com/gyee/generation/controller/ProEconEquipmentInfoJsController.java
  16. 20 0
      generationXK-service/src/main/java/com/gyee/generation/controller/StationInfoHourController.java
  17. 16 0
      generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProBaseBackfillMapper.java
  18. 16 0
      generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconEquipmentInfoJsMapper.java
  19. 16 0
      generationXK-service/src/main/java/com/gyee/generation/mapper/auto/StationInfoHourMapper.java
  20. 77 0
      generationXK-service/src/main/java/com/gyee/generation/model/auto/ProBaseBackfill.java
  21. 80 0
      generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconEquipmentInfoJs.java
  22. 65 0
      generationXK-service/src/main/java/com/gyee/generation/model/auto/StationInfoHour.java
  23. 16 0
      generationXK-service/src/main/java/com/gyee/generation/service/auto/IProBaseBackfillService.java
  24. 16 0
      generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconEquipmentInfoJsService.java
  25. 16 0
      generationXK-service/src/main/java/com/gyee/generation/service/auto/IStationInfoHourService.java
  26. 21 0
      generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProBaseBackfillServiceImpl.java
  27. 20 0
      generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconEquipmentInfoJsServiceImpl.java
  28. 20 0
      generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/StationInfoHourServiceImpl.java
  29. 0 4
      runeconomy-xk/pom.xml
  30. 17 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/config/UniformCode.java
  31. 98 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/TemperatureInfoController.java
  32. 35 3
      runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/homepage/EconomyHomePageController.java
  33. 52 1
      runeconomy-xk/src/main/java/com/gyee/runeconomy/init/CacheContext.java
  34. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/auto/TemperatureinfoMapper.java
  35. 15 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ITagValueChanged.java
  36. 51 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/OperateStyle.java
  37. 69 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TagInfo.java
  38. 92 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureComponentInfo.java
  39. 239 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureInfo.java
  40. 99 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureInfoEntity.java
  41. 38 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureItemInfo.java
  42. 23 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureStatus.java
  43. 48 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureTagInfo.java
  44. 539 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/WindturbineInfo.java
  45. 2 2
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProBasicProjectPlan.java
  46. 56 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/Temperatureinfo.java
  47. 4 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/ColumnVo.java
  48. 26 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/PlanDataVo.java
  49. 21 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/PowertrendVo.java
  50. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/ValueVo.java
  51. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ITemperatureinfoService.java
  52. 20 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/TemperatureinfoServiceImpl.java
  53. 355 13
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/homepage/EconomyPointHomePageService.java
  54. 109 24
      runeconomy-xk/src/main/java/com/gyee/runeconomy/util/realtimesource/EdosUtil.java

+ 2 - 1
data-adapter/src/main/java/com/gyee/dataadapter/cache/MqttCache.java

@@ -6,11 +6,12 @@ import org.springframework.stereotype.Component;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 @Component
 public class MqttCache {
     public static Map<String, PointInfo> subData = new HashMap<>();
-    public static Map<String, PointData> subData2 = new HashMap<>();
+    public static Map<String, PointData> subData2 = new ConcurrentHashMap<>();
 
 
 }

+ 58 - 8
data-adapter/src/main/java/com/gyee/dataadapter/config/MqttServer.java

@@ -1,5 +1,6 @@
 package com.gyee.dataadapter.config;
 
+import cn.hutool.core.thread.ThreadUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.eclipse.paho.client.mqttv3.*;
 import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
@@ -60,7 +61,7 @@ public class MqttServer {
     }
 
     public MqttServer() {
-        log.info("9011上线了");
+        log.info("8011上线了");
     }
 
     /**
@@ -104,20 +105,64 @@ public class MqttServer {
                 //如果是订阅者则添加回调类,发布不需要,PushCallback类在后面
                 subsribeClient.setCallback(new PushCallback(MqttServer.this));
             }
-            MqttConnectOptions options = mqttConnect.getOptions();
+        } catch (MqttException e) {
+            log.info(e.getMessage(), e);
+        }
+        MqttConnectOptions options = mqttConnect.getOptions();
+        try {
             //判断拦截状态,这里注意一下,如果没有这个判断,是非常坑的
-            if (!subsribeClient.isConnected()) {
-                subsribeClient.connect(options);
-            } else {//这里的逻辑是如果连接成功就重新连接
+            if (subsribeClient.isConnected()) {
                 subsribeClient.disconnect();
-                subsribeClient.connect(mqttConnect.getOptions(options));
+            } else {//这里的逻辑是如果连接成功就重新连接
+                options = mqttConnect.getOptions(options);
+            }
+            subsribeClient.connect(options);
+            if(!subsribeClient.isConnected()){
+                log.info("重连失败!");
+                subsribeClient = new MqttClient(config.getHost(), config.getClientid(), new MemoryPersistence());// MemoryPersistence设置clientid的保存形式,默认为以内存保存
+                //如果是订阅者则添加回调类,发布不需要,PushCallback类在后面
+                subsribeClient.setCallback(new PushCallback(MqttServer.this));
+                ThreadUtil.sleep(1000);
+                subsribeConnect();
             }
-            log.info("----------Mqtt客户端连接成功");
         } catch (MqttException e) {
             log.info(e.getMessage(), e);
+            log.info("重连失败e!");
+
+            ThreadUtil.sleep(1000);
+            subsribeConnect();
         }
+        log.info("----------Mqtt客户端连接成功");
     }
 
+    public void subsribeConnectCl() {
+        try {
+            //clientId不能和其它的clientId一样,否则会出现频繁断开连接和重连的问题
+            System.out.println("host: " + config.getHost() + "   " + "客户端id: " + config.getClientid());
+            subsribeClient = new MqttClient(config.getHost(), config.getClientid(), new MemoryPersistence());// MemoryPersistence设置clientid的保存形式,默认为以内存保存
+            //如果是订阅者则添加回调类,发布不需要,PushCallback类在后面
+            subsribeClient.setCallback(new PushCallback(MqttServer.this));
+            MqttConnectOptions options = mqttConnect.getOptions();
+            //判断拦截状态,这里注意一下,如果没有这个判断,是非常坑的
+            if (subsribeClient.isConnected()) {
+                subsribeClient.disconnect();
+            } else {//这里的逻辑是如果连接成功就重新连接
+                options = mqttConnect.getOptions(options);
+            }
+            subsribeClient.connect(options);
+            if(!subsribeClient.isConnected()){
+                log.info("重连失败!");
+                ThreadUtil.sleep(1000);
+                subsribeConnect();
+            }
+        } catch (MqttException e) {
+            log.info(e.getMessage(), e);
+            log.info("重连失败e!");
+
+            ThreadUtil.sleep(1000);
+            subsribeConnect();
+        }
+    }
     /**
      * 把组装好的消息发出去
      */
@@ -199,9 +244,14 @@ public class MqttServer {
 
     public void init() throws MqttException {
         //建立连接
-        subsribeConnect();
+        subsribeConnectCl();
+        log.info("连接成功!开始订阅:");
+        log.info(topicStr);
+        log.info(String.valueOf(qos));
+        log.info(String.valueOf(subsribeClient.isConnected()));
         //以某个消息级别订阅某个主题
         subsribeClient.subscribe(topicStr, qos);
+        log.info("订阅成功!");
     }
 
     /**

+ 1 - 0
data-adapter/src/main/java/com/gyee/dataadapter/config/PushCallback.java

@@ -41,6 +41,7 @@ public class PushCallback implements MqttCallback {
                 }
                 // 等待一段时间后再重试
                 log.info(RETRY_INTERVAL_MILLIS + "ms后重连!");
+                log.error(e.getMessage());
                 ThreadUtil.sleep(RETRY_INTERVAL_MILLIS);
             }
         }

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

@@ -38,10 +38,10 @@ public class AdapterController {
         return dataClient.getLatestData(paths);
     }
 
-//    @GetMapping("/latest")
-//    public Map<String, PointData> getLatest(@RequestParam("keys") String keys) {
-//        return tsDataService.getLatest(keys);
-//    }
+    @GetMapping("/latest")
+    public Map<String, PointData> getLatest(@RequestParam("keys") String keys) {
+        return tsDataService.getLatest(keys);
+    }
 
     @PostMapping("/latest")
     public Map<String, PointData> getLatest(@RequestBody List<String> keys) {
@@ -62,17 +62,18 @@ public class AdapterController {
         return tsDataService.getHistorySnap(tagName, startTs, endTs, interval);
     }
 
-    @GetMapping("/history/stat")
-    public List<PointData> getHistoryStat(@RequestParam("tagName") String tagName,
+    @GetMapping("/history/stat3")
+    public List<PointData> getHistoryStat3(@RequestParam("tagName") String tagName,
                                           @RequestParam("startTs") Long startTs, @RequestParam("endTs") Long endTs,
                                           @RequestParam(value = "interval", required = false) Integer interval,
                                           @RequestParam(value = "type", required = false) Integer type) {
         return tsDataService.getHistoryStat(tagName, new Date(startTs), new Date(endTs), interval, type);
     }
 
-    @GetMapping("/history/stat2")
+    @GetMapping("/history/stat")
     public List<DoubleStatData> getHistoryStat2(@RequestParam("tagName") String tagName,
-                                                @RequestParam("startTs") Long startTs, @RequestParam("endTs") Long endTs,
+                                                @RequestParam("startTs") Long startTs,
+                                                @RequestParam("endTs") Long endTs,
                                                 @RequestParam(value = "interval", required = false) Integer interval) {
         List<DoubleStatData> result = new ArrayList<>();
         List<PointData> max = tsDataService.getHistoryStat(tagName, new Date(startTs), new Date(endTs), interval, 2);
@@ -86,6 +87,25 @@ public class AdapterController {
         return result;
     }
 
+
+    @GetMapping("/history/stat2")
+    public List<DoubleStatData> getHistoryStat(@RequestParam("tagName") String tagName,
+                                                @RequestParam("startTs") Long startTs,
+                                                @RequestParam("endTs") Long endTs) {
+        List<DoubleStatData> result = new ArrayList<>();
+        List<PointData> max = tsDataService.getHistoryStat2(tagName, new Date(startTs), new Date(endTs),2);
+        List<PointData> min = tsDataService.getHistoryStat2(tagName, new Date(startTs), new Date(endTs),  3);
+        List<PointData> avg = tsDataService.getHistoryStat2(tagName, new Date(startTs), new Date(endTs),4);
+        if (max.size() == min.size() && min.size() == avg.size()) {
+            for (int i = 0; i < max.size(); i++) {
+                result.add(new DoubleStatData(max.get(i), min.get(i), avg.get(i)));
+            }
+        }
+        return result;
+    }
+
+
+
     @GetMapping("/history/section")
     public Map<String, PointData> getHistorySection(@RequestParam("tagNames") String tagNames, @RequestParam("ts") Long ts) {
         return tsDataService.getHistorySection(ts, tagNames);

+ 2 - 0
data-adapter/src/main/java/com/gyee/dataadapter/dao/IHistoryDao.java

@@ -14,4 +14,6 @@ public interface IHistoryDao {
     List<PointData> getHistoryStat(String tagName, Date startTime, Date endTime, Integer interval, Integer type) throws Exception;
     PointData getHistoryStat0(String tagName, Date startTime, Date endTime, Integer type) throws Exception;
     Map<String, PointData> getHistorySection(Date time, List<String> tagNames) throws Exception;
+    List<PointData> getHistoryStat2(String tagName, Date startTime, Date endTime, Integer type) throws Exception;
+
 }

+ 26 - 0
data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/TaosDataService.java

@@ -99,6 +99,32 @@ public class TaosDataService implements IHistoryDao {
         return result;
     }
 
+
+    @Override
+    public List<PointData> getHistoryStat2(String tagName, Date startTime, Date endTime, Integer type) throws Exception {
+        List<PointData> result = new ArrayList<>();
+        if(StrUtil.isBlank(tagName)) return result;
+        Statement st = config.getInstance().createStatement();
+        StringBuilder sb = new StringBuilder();
+        if (type == 2) {
+            sb.append("select max(val) from ");
+        } else if (type == 3) {
+            sb.append("select min(val) from ");
+        } else {
+            sb.append("select avg(val) from ");
+        }
+        sb.append(config.getDbName()).append(".").append(tagName.toLowerCase())
+                .append(" where ts between ").append(startTime.getTime()).append(" and ").append(endTime.getTime())
+                .append("s)");
+        ResultSet rs = st.executeQuery(sb.toString());
+        while (rs.next()) {
+            result.add(new PointData(endTime, rs.getDouble(1)));
+        }
+        return result;
+    }
+
+
+
     @Override
     public PointData getHistoryStat0(String tagName, Date startTime, Date endTime, Integer type) throws Exception {
         PointData pd = new PointData(endTime, 0);

+ 5 - 0
data-adapter/src/main/java/com/gyee/dataadapter/service/IAdapterService.java

@@ -13,6 +13,9 @@ public interface IAdapterService {
     TotalPointData getTotalData(String start, String end, Integer sampleType, Integer sampleRate, String paths,
                                 String pageIndex, String pageSize, Boolean isDesc);
 
+    TotalPointData getTotalData3(String start, String end, Integer sampleType, String paths,
+                                String pageIndex, String pageSize, Boolean isDesc);
+
     TotalPointData getTotalData(Date start, Date end, Integer sampleType, Integer sampleRate, String paths,
                                 String pageIndex, String pageSize, Boolean isDesc);
 
@@ -21,6 +24,8 @@ public interface IAdapterService {
 
     List<PointData> getPointData(Date start, Date end, Integer sampleType, Integer sampleRate, String paths);
 
+    List<PointData> getPointData2(Date start, Date end, Integer sampleType, String paths);
+
     //Map<String, List<PointData>> getPointData(Date start, Date end, Integer sampleType, Integer sampleRate, String... paths);
 
     //实时数据接口

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

@@ -1,5 +1,6 @@
 package com.gyee.dataadapter.service;
 
+import cn.hutool.core.collection.CollUtil;
 import com.gyee.dataadapter.dao.IHistoryDao;
 import com.gyee.dataadapter.dao.ILatestDao;
 import com.gyee.dataadapter.entity.PointData;
@@ -100,6 +101,22 @@ public class TsDataService {
         }
     }
 
+
+    public List<PointData> getHistoryStat2(String tagName, Date startTime, Date endTime, Integer type) {
+        if (type == null || type < 2 || type > 4) type = 4;
+        try {
+            if (tagName.startsWith("NX_FGS_") || tagName.startsWith("NXFGS_")) {
+                return historyDao.getHistoryStat2(tagName, startTime, endTime, type);
+            } else {
+                return adapterService.getPointData2(startTime, endTime, type, tagName);
+            }
+        } catch (Exception e) {
+            log.error("异常点:" + tagName);
+            log.error(e.getMessage());
+            return new ArrayList<>();
+        }
+    }
+
     public PointData getHistoryStat0(String tagName, Date startTime, Date endTime, Integer type) {
         if (tagName.startsWith("NX_FGS_")) {
             try {
@@ -134,13 +151,15 @@ public class TsDataService {
         try {
             Map<String, PointData> latest = historyDao.getHistorySection(time, nxFgs.get(true));
             result.putAll(latest);
-            if (nxFgs.get(false) == null) return result;
-            for (String tagName : nxFgs.get(false)) {
+            List<String> strings = nxFgs.get(false);
+            if (CollUtil.isEmpty(strings)) return result;
+            for (String tagName : strings) {
                 List<PointData> pdsMap = adapterService.getPointData(time, time, 1, null, tagName);
-                result.put(tagName, pdsMap.get(0));
+                if (CollUtil.isNotEmpty(pdsMap)) result.put(tagName, pdsMap.get(0));
             }
             return result;
         } catch (Exception e) {
+            log.error("Section");
             log.error(e.getMessage());
             return new HashMap<>();
         }

文件差異過大導致無法顯示
+ 143 - 13
data-adapter/src/main/java/com/gyee/dataadapter/service/impl/AdapterServiceImpl.java


+ 1 - 1
data-adapter/src/main/resources/application.yaml

@@ -7,7 +7,7 @@ publish:
     host: tcp://10.220.1.5:2883
     username: admin@scada.com
     password: Scada135}+?
-    cleansession: false
+    cleansession: true
     clientid: HUIANTOGUANGYAO
     keepalive: 10
     connectionTimeout: 3000

二進制
generationXK-service/log/ota.log.2024-10-15.0.gz


二進制
generationXK-service/log/ota.log.2024-10-16.0.gz


二進制
generationXK-service/log/ota.log.2024-10-17.0.gz


+ 20 - 0
generationXK-service/src/main/java/com/gyee/generation/controller/ProBaseBackfillController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+@RestController
+@RequestMapping("/pro-base-backfill")
+public class ProBaseBackfillController {
+
+}

+ 20 - 0
generationXK-service/src/main/java/com/gyee/generation/controller/ProEconEquipmentInfoJsController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+@RestController
+@RequestMapping("/pro-econ-equipment-info-js")
+public class ProEconEquipmentInfoJsController {
+
+}

+ 20 - 0
generationXK-service/src/main/java/com/gyee/generation/controller/StationInfoHourController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-10
+ */
+@RestController
+@RequestMapping("/station-info-hour")
+public class StationInfoHourController {
+
+}

+ 16 - 0
generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProBaseBackfillMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.generation.model.auto.ProBaseBackfill;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+public interface ProBaseBackfillMapper extends BaseMapper<ProBaseBackfill> {
+
+}

+ 16 - 0
generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconEquipmentInfoJsMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.ProEconEquipmentInfoJs;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+public interface ProEconEquipmentInfoJsMapper extends BaseMapper<ProEconEquipmentInfoJs> {
+
+}

+ 16 - 0
generationXK-service/src/main/java/com/gyee/generation/mapper/auto/StationInfoHourMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.StationInfoHour;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-10
+ */
+public interface StationInfoHourMapper extends BaseMapper<StationInfoHour> {
+
+}

+ 77 - 0
generationXK-service/src/main/java/com/gyee/generation/model/auto/ProBaseBackfill.java

@@ -0,0 +1,77 @@
+package com.gyee.generation.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("pro_base_backfill")
+public class ProBaseBackfill implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private String id;
+
+    /**
+     * 测点
+     */
+    @TableField("code")
+    private String code;
+
+    /**
+     * 场站
+     */
+    @TableField("station")
+    private String station;
+
+    /**
+     * 推送/自建
+     */
+    @TableField("type")
+    private String type;
+
+    /**
+     * 定时推送
+     */
+    @TableField("scheduled_push")
+    private Boolean scheduledPush;
+
+    /**
+     * 推送时间
+     */
+    @TableField("push_time")
+    private String pushTime;
+
+    /**
+     * 任务描述
+     */
+    @TableField("task_description")
+    private String taskDescription;
+
+    /**
+     * 运行模式
+     */
+    @TableField("operating_mode")
+    private String operatingMode;
+
+
+}

+ 80 - 0
generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconEquipmentInfoJs.java

@@ -0,0 +1,80 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.time.LocalDate;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("pro_econ_equipment_info_js")
+public class ProEconEquipmentInfoJs implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "id", type = IdType.ASSIGN_UUID)
+    private String id;
+
+    /**
+     * 日期
+     */
+    @TableField("record_date")
+    private LocalDate recordDate;
+
+    /**
+     * 风场编号
+     */
+    @TableField("wpid")
+    private String wpid;
+
+    /**
+     * 测点
+     */
+    @TableField("meter_id")
+    private String meterId;
+
+    /**
+     * 测点描述
+     */
+    @TableField("meter_name")
+    private String meterName;
+
+    /**
+     * 测点数值
+     */
+    @TableField("stop_code")
+    private BigDecimal stopCode;
+
+    /**
+     * 参考值
+     */
+    @TableField("stop_code_modify")
+    private BigDecimal stopCodeModify;
+
+    /**
+     * 回填测点
+     */
+    @TableField("back_code")
+    private String backCode;
+
+
+}

+ 65 - 0
generationXK-service/src/main/java/com/gyee/generation/model/auto/StationInfoHour.java

@@ -0,0 +1,65 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-10
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("station_info_hour")
+public class StationInfoHour implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 序号
+     */
+    @TableId(value = "id", type = IdType.ASSIGN_UUID)
+    private String id;
+
+    /**
+     * 时间
+     */
+    private LocalDateTime recordDate;
+
+    /**
+     * 场站名称
+     */
+    private String wpid;
+
+    /**
+     * 测点
+     */
+    private String meterId;
+
+    /**
+     * 测点描述
+     */
+    private String meterName;
+
+    /**
+     * 数值
+     */
+    private BigDecimal code;
+
+    /**
+     * 测点参考值
+     */
+    private BigDecimal codeModify;
+
+}

+ 16 - 0
generationXK-service/src/main/java/com/gyee/generation/service/auto/IProBaseBackfillService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.generation.model.auto.ProBaseBackfill;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+public interface IProBaseBackfillService extends IService<ProBaseBackfill> {
+
+}

+ 16 - 0
generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconEquipmentInfoJsService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.ProEconEquipmentInfoJs;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+public interface IProEconEquipmentInfoJsService extends IService<ProEconEquipmentInfoJs> {
+
+}

+ 16 - 0
generationXK-service/src/main/java/com/gyee/generation/service/auto/IStationInfoHourService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.StationInfoHour;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-10
+ */
+public interface IStationInfoHourService extends IService<StationInfoHour> {
+
+}

+ 21 - 0
generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProBaseBackfillServiceImpl.java

@@ -0,0 +1,21 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.mapper.auto.ProBaseBackfillMapper;
+import com.gyee.generation.model.auto.ProBaseBackfill;
+import com.gyee.generation.service.auto.IProBaseBackfillService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+
+@Service
+public class ProBaseBackfillServiceImpl extends ServiceImpl<ProBaseBackfillMapper, ProBaseBackfill> implements IProBaseBackfillService {
+
+}

+ 20 - 0
generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconEquipmentInfoJsServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.ProEconEquipmentInfoJs;
+import com.gyee.generation.mapper.auto.ProEconEquipmentInfoJsMapper;
+import com.gyee.generation.service.auto.IProEconEquipmentInfoJsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-25
+ */
+@Service
+public class ProEconEquipmentInfoJsServiceImpl extends ServiceImpl<ProEconEquipmentInfoJsMapper, ProEconEquipmentInfoJs> implements IProEconEquipmentInfoJsService {
+
+}

+ 20 - 0
generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/StationInfoHourServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.StationInfoHour;
+import com.gyee.generation.mapper.auto.StationInfoHourMapper;
+import com.gyee.generation.service.auto.IStationInfoHourService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-10-10
+ */
+@Service
+public class StationInfoHourServiceImpl extends ServiceImpl<StationInfoHourMapper, StationInfoHour> implements IStationInfoHourService {
+
+}

+ 0 - 4
runeconomy-xk/pom.xml

@@ -38,10 +38,6 @@
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
             <version>2.3.7.RELEASE</version>

+ 17 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/config/UniformCode.java

@@ -0,0 +1,17 @@
+package com.gyee.runeconomy.config;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * UniformCode注解
+ *
+ * @author xysn
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface UniformCode {
+    String value() default "";
+}

+ 98 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/TemperatureInfoController.java

@@ -0,0 +1,98 @@
+package com.gyee.runeconomy.controller;
+
+import com.gyee.common.model.PointData;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.TagInfo;
+import com.gyee.runeconomy.model.TemperatureInfo;
+import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+@RestController
+@RequestMapping("/api")
+public class TemperatureInfoController {
+
+    @Resource
+    private IEdosUtil edosUtil;
+
+    /**
+     * 温度矩阵信息
+     */
+//    private List<TemperatureInfo> temperatureInfos =new ArrayList<>();
+
+
+    private Collection<TemperatureInfo> getPage(List<TemperatureInfo> ls, Integer pageNum, Integer pageSize) {
+        if (pageNum == null || pageSize == null) {
+            return ls;
+        }
+        int pagenum = pageNum < 1 ? 1 : pageNum;
+        return ls.stream().skip((long) (pagenum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
+    }
+
+
+
+    /**
+     * 获取温度信息
+     *
+     * @param id 场站ID
+     */
+    @GetMapping("/windturbine/temperature-info")
+    public Collection<TemperatureInfo> getStationTemperatureInfo(@RequestParam(value = "id", required = false) String id,
+                                                                 @RequestParam(value = "status", required = false) String ts,
+                                                                 @RequestParam(value = "projects", required = false) String projects,
+                                                                 @RequestParam(value = "pagenum", required = false) Integer pageNum,
+                                                                 @RequestParam(value = "pagesize", required = false) Integer pageSize) throws Exception {
+        List<TemperatureInfo> ls = null;
+        if (id == null || "".equals(id)) {
+            ls = CacheContext.temperatureInfos;
+        } else {
+            ls = CacheContext.temperatureInfos.stream().filter(t -> t.getStationId().equals(id)).collect(Collectors.toList());
+        }
+        if (ts != null && !"".equals(ts)) {
+            String[] tts = ts.split(",");
+            ls = ls.stream().filter(wt -> wt.isHadByStatus(tts)).collect(Collectors.toList());
+        }
+        addTemperatureInfo(ls);
+        if (projects == null || "".equals(projects)) {
+            return getPage(ls, pageNum, pageSize);
+        }
+        String[] ps = projects.split(",");
+        Set<String> psset = Arrays.stream(ps).collect(Collectors.toSet());
+
+        ls = ls.stream().filter(w -> psset.contains(w.getProjectId())).collect(Collectors.toList());
+
+        addTemperatureInfo(ls);
+        return getPage(ls, pageNum, pageSize);
+    }
+
+
+    private void addTemperatureInfo(List<TemperatureInfo> ls) throws Exception {
+        List<String> tag = new ArrayList<>();
+        List<TagInfo> tagInfos = new ArrayList<>();
+        for (TemperatureInfo tem : ls) {
+            tagInfos.addAll(tem.getTemperatureInfos());
+        }
+        for (TagInfo tagInfo : tagInfos) {
+            tag.add(tagInfo.getTag());
+        }
+        List<PointData> realData = edosUtil.getRealData(tag);
+        for (TagInfo tagInfo : tagInfos) {
+            for (PointData real : realData) {
+                if (real.getPointName().equals(tagInfo.getTag())) {
+                    tagInfo.setValue(real.getPointValueInDouble());
+                    tagInfo.setTimestamp(real.getPointTime());
+                }
+            }
+        }
+
+    }
+
+
+}

+ 35 - 3
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/homepage/EconomyHomePageController.java

@@ -122,13 +122,45 @@ public class EconomyHomePageController {
      */
     @GetMapping(value = "/generating-capacity")
     @ApiOperation(value = "首页-发电量", notes = "首页-发电量")
-    public R getHomeGeneratingCapacity(@RequestParam(value = "companyId", required = false) String companyId) throws Exception {
+    public ResultMsg getHomeGeneratingCapacity(@RequestParam(value = "companyId", required = false) String companyId) throws Exception {
 
         Map<String, Object> map = economyPointHomePageService.getGeneratingCapacity(companyId);
         if (null != map) {
-            return R.data(ResultMsg.ok(map));
+            return ResultMsg.ok(map);
         } else {
-            return R.error(ResultMsg.error());
+            return ResultMsg.error();
+        }
+    }
+
+
+    /**
+     * 首页 右侧模块
+     */
+    @GetMapping(value = "/home-right")
+    @ApiOperation(value = "首页-右侧模块", notes = "首页-右侧模块")
+    public ResultMsg getHomeRight(@RequestParam(value = "companyId", required = false) String companyId) throws Exception {
+
+        Map<String, Object> map = economyPointHomePageService.getHomeRight(companyId);
+        if (null != map) {
+            return ResultMsg.ok(map);
+        } else {
+            return ResultMsg.error();
+        }
+    }
+
+
+    /**
+     * 首页 右侧模块
+     */
+    @GetMapping(value = "/home-middle")
+    @ApiOperation(value = "首页-中间模块", notes = "首页-中间模块")
+    public ResultMsg getHomeMiddle(@RequestParam(value = "companyId", required = false) String companyId) throws Exception {
+
+        Map<String, Object> map = economyPointHomePageService.getHomeMiddle(companyId);
+        if (null != map) {
+            return ResultMsg.ok(map);
+        } else {
+            return ResultMsg.error();
         }
     }
 

+ 52 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/init/CacheContext.java

@@ -1,10 +1,10 @@
 package com.gyee.runeconomy.init;
 
-
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.model.StringUtils;
+import com.gyee.runeconomy.model.TemperatureInfo;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.*;
 import com.gyee.runeconomy.service.realtimelibrary.TheoreticalPowerService;
@@ -81,6 +81,16 @@ public class CacheContext implements CommandLineRunner {
     @Resource
     private IProBasicPowerstationService windpowerstationService;
 
+    @Resource
+    private ITemperatureinfoService iTemperatureinfoService;
+
+
+    /**
+     * 温度矩阵信息
+     */
+    public static List<TemperatureInfo> temperatureInfos;
+
+
     //    public static List<ProBasicBranch> bnls = new ArrayList<>();
     public static List<ProBasicEquipment> wtls = new ArrayList<>();
     public static List<ProBasicProject> pjls = new ArrayList<>();
@@ -165,6 +175,7 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String, ProBasicPowerstation> wpmaps = new HashMap<>();
     public static Map<String, String> wppmap = new HashMap<>();
 
+
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
@@ -655,7 +666,47 @@ public class CacheContext implements CommandLineRunner {
         statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String, List<ProBasicStatusPoint>>>() {
         });
 
+        initTemperatureInfo();
 
         logger.info("缓存结束------------------------------------------------------------");
     }
+
+    private void initTemperatureInfo() {
+        Map<String, TemperatureInfo> tis = new HashMap<>();
+//        Map<String, StationStatus> ssm = getStationStatusMap();
+
+        try {
+//            List<TemperatureInfoEntity> ls = temperatureinfoRepository.findAll();
+            List<Temperatureinfo> ls = iTemperatureinfoService.list();
+            for (Temperatureinfo ti : ls) {
+                if (ti == null || ti.getWindturbineid() == null || "".equals(ti.getWindturbineid())) {
+                    continue;
+                }
+                if (!tis.containsKey(ti.getWindturbineid())) {
+                    TemperatureInfo nti = new TemperatureInfo();
+                    if (tis.containsKey(ti.getWindpowerstationid())) {
+                        nti.setStationName(tis.get(ti.getWindpowerstationid()).getStationName());
+                    }
+                    nti.setWindturbineId(ti.getWindturbineid());
+                    nti.setStationId(ti.getWindpowerstationid());
+                    if (wtmap.containsKey(ti.getWindturbineid())) {
+                        nti.setWindturbineInfo(wtmap.get(ti.getWindturbineid()));
+                        nti.setCode(wtmap.get(ti.getWindturbineid()).getNemCode());
+                    }
+                    tis.put(nti.getWindturbineId(), nti);
+                }
+                tis.get(ti.getWindturbineid()).addTemperaturePoint(ti);
+            }
+            temperatureInfos = new ArrayList<>(tis.values());
+            temperatureInfos.sort((x, y) -> {
+                if (x.getStationId().equals(y.getStationId())) {
+                    return x.getWindturbineIndex() - y.getWindturbineIndex();
+                }
+                return x.getStationId().compareTo(y.getStationId());
+            });
+        } catch (Exception e) {
+            System.out.println("温度矩阵数据初始化失败" + e.toString());
+        }
+    }
+
 }

+ 16 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/auto/TemperatureinfoMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.mapper.auto;
+
+import com.gyee.runeconomy.model.auto.Temperatureinfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 各部件温度出力分析表 Mapper 接口
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-11-04
+ */
+public interface TemperatureinfoMapper extends BaseMapper<Temperatureinfo> {
+
+}

+ 15 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ITagValueChanged.java

@@ -0,0 +1,15 @@
+package com.gyee.runeconomy.model;
+
+/**
+ * 标签点数据变化
+ *
+ * @author xysn
+ */
+public interface ITagValueChanged{
+    /**
+     * 数据改变
+     *
+     * @param value
+     */
+    void valueChanged(double value);
+}

+ 51 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/OperateStyle.java

@@ -0,0 +1,51 @@
+package com.gyee.runeconomy.model;
+
+
+/**
+ * 推荐操作
+ */
+public enum OperateStyle {
+    /**
+     * 不推荐
+     */
+    Nothing(0),
+    /**
+     * 推荐启动
+     */
+    Start(1),
+    /**
+     * 停机
+     */
+    Stop(2),
+    LimitSpeed(3),
+    LimitPower(4),
+    Reset(5),
+    /**
+     * 维护
+     */
+    Maintain(6),
+    ResetMax(7),
+    /**
+     * 取消维护
+     */
+    UnMaintain(8),
+    /**
+     * 挂牌
+     */
+    Lock(9),
+    /**
+     * 取消挂牌
+     */
+    UnLock(10),
+    Unknow(11);
+
+    private final int value;
+
+    OperateStyle(int value) {
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+}

+ 69 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TagInfo.java

@@ -0,0 +1,69 @@
+package com.gyee.runeconomy.model;
+
+import java.io.Serializable;
+
+/**
+ * 标签信息
+ *
+ * @author xysn
+ */
+public class TagInfo implements Serializable {
+    /**
+     * 标签点
+     */
+    private String tag;
+    /**
+     * 值
+     */
+    private double value;
+    /**
+     * 时间戳
+     */
+    private long timestamp;
+    /**
+     * 数据改变监听
+     */
+    private ITagValueChanged valueChanged;
+
+    public TagInfo() {
+    }
+
+    public TagInfo(double value) {
+        this.value = value;
+    }
+
+    public TagInfo(String tag) {
+        this.tag = tag;
+    }
+
+    public String getTag() {
+        return tag;
+    }
+
+    public void setTag(String tag) {
+        this.tag = tag;
+    }
+
+    public double getValue() {
+        return value;
+    }
+
+    public void setValue(double value) {
+        this.value = value;
+        if (this.valueChanged != null) {
+            this.valueChanged.valueChanged(value);
+        }
+    }
+
+    public long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public void setValueChanged(ITagValueChanged valueChanged) {
+        this.valueChanged = valueChanged;
+    }
+}

+ 92 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureComponentInfo.java

@@ -0,0 +1,92 @@
+package com.gyee.runeconomy.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gyee.runeconomy.model.auto.Temperatureinfo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 部件信息
+ */
+public class TemperatureComponentInfo implements Serializable {
+    private String name;
+    private List<TemperatureItemInfo> temperatureItemInfos;
+    /**
+     * 是否排序
+     */
+    private boolean isSorted;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void addTemperaturePoint(Temperatureinfo ti) {
+        if (ti.getName() == null || "".equals(ti.getName())) {
+            return;
+        }
+
+        if (temperatureItemInfos == null) {
+            temperatureItemInfos = new ArrayList<>();
+        }
+
+        TemperatureItemInfo ntii = new TemperatureItemInfo();
+        ntii.setName(ti.getName());
+        TemperatureTagInfo tti = new TemperatureTagInfo();
+        tti.setMaxval(ti.getMaxval());
+        tti.setReasonablemaxval(ti.getReasonablemaxval());
+        tti.setTag(ti.getTag());
+        ntii.setTemperatureTagInfo(tti);
+        temperatureItemInfos.add(ntii);
+
+        isSorted = false;
+    }
+
+    public List<TemperatureItemInfo> getTemperatureItemInfos() {
+        if (temperatureItemInfos == null) {
+            temperatureItemInfos = new ArrayList<>();
+        }
+        if (!isSorted) {
+            temperatureItemInfos.sort(Comparator.comparing(TemperatureItemInfo::getName));
+            isSorted = true;
+        }
+        return temperatureItemInfos;
+    }
+
+    @JsonIgnore
+    public List<TemperatureTagInfo> getTemperatureInfos() {
+        List<TemperatureTagInfo> ls = new ArrayList<>();
+        List<TemperatureItemInfo> tiis = getTemperatureItemInfos();
+        for (TemperatureItemInfo tii : tiis) {
+            ls.add(tii.getTemperatureTagInfo());
+        }
+        return ls;
+    }
+
+    /**
+     * 是否含有特定状态的点
+     *
+     * @param ts
+     * @return
+     */
+    public boolean isHadByStatus(Set<TemperatureStatus> ts) {
+        return getTemperatureItemInfos().stream().anyMatch(wt -> ts.contains(wt.getStatus()));
+    }
+
+    /**
+     * 是否含有特定状态的点
+     *
+     * @param ts
+     * @return
+     */
+    public boolean isHadByStatus(TemperatureStatus ts) {
+        return getTemperatureItemInfos().stream().anyMatch(wt -> wt.getStatus() == ts);
+    }
+}

+ 239 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureInfo.java

@@ -0,0 +1,239 @@
+package com.gyee.runeconomy.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gyee.runeconomy.model.auto.ProBasicEquipment;
+import com.gyee.runeconomy.model.auto.Temperatureinfo;
+
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * 温度信息
+ */
+public class TemperatureInfo implements Serializable {
+    /**
+     * 风机信息
+     */
+    private ProBasicEquipment windturbineInfo;
+    private String windturbineId;
+    private String code;
+    private String stationId;
+    private String stationName;
+    private Map<String, TemperatureComponentInfo> temperatureComponentInfoMap;
+    private List<TemperatureComponentInfo> temperatureComponentInfos;
+    private int windturbineIndex;
+
+    /**
+     * 是否排序
+     */
+    private boolean isSorted;
+
+    public void setWindturbineInfo(ProBasicEquipment windturbineInfo) {
+        this.windturbineInfo = windturbineInfo;
+    }
+
+    public String getWindturbineId() {
+        return windturbineId;
+    }
+
+    public void setWindturbineId(String windturbineId) {
+        this.windturbineId = windturbineId;
+    }
+
+    public String getStationId() {
+        return stationId;
+    }
+
+    public void setStationId(String stationId) {
+        this.stationId = stationId;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    /**
+     * 转速
+     */
+//    public double getRollSpeed() {
+//        if (windturbineInfo == null) {
+//            return 0;
+//        }
+//        return windturbineInfo.getRollSpeed();
+//    }
+
+    /**
+     * 功率
+     */
+//    public double getPower() {
+//        if (windturbineInfo == null) {
+//            return 0;
+//        }
+//        return windturbineInfo.getPower();
+//    }
+
+    /**
+     * 风速
+     */
+//    public double getWindSpeed() {
+//        if (windturbineInfo == null) {
+//            return 0;
+//        }
+//        return windturbineInfo.getWindSpeed();
+//    }
+
+    /**
+     * 状态
+     *
+     * @return
+     */
+//    public double getStatus() {
+//        if (windturbineInfo == null) {
+//            return 0;
+//        }
+//        return windturbineInfo.getStatus();
+//    }
+
+    /**
+     * 期次
+     *
+     * @return
+     */
+    public String getProjectId() {
+        if (windturbineInfo == null) {
+            return "";
+        }
+        return windturbineInfo.getProjectId();
+    }
+
+    public String getStationName() {
+        return stationName;
+    }
+
+    public void setStationName(String stationName) {
+        this.stationName = stationName;
+    }
+
+    @JsonIgnore
+    public Map<String, TemperatureComponentInfo> getTemperatureComponentInfoMap() {
+        if (temperatureComponentInfoMap == null) {
+            temperatureComponentInfoMap = new HashMap<>();
+        }
+        return temperatureComponentInfoMap;
+    }
+
+    /**
+     * 添加温度点信息
+     */
+    public void addTemperaturePoint(Temperatureinfo ti) {
+        if (ti.getComponent() == null || "".equals(ti.getComponent())) {
+            return;
+        }
+        Map<String, TemperatureComponentInfo> tcim = getTemperatureComponentInfoMap();
+        if (temperatureComponentInfos == null) {
+            temperatureComponentInfos = new ArrayList<>();
+        }
+        if (!tcim.containsKey(ti.getComponent())) {
+            TemperatureComponentInfo ntci = new TemperatureComponentInfo();
+            ntci.setName(ti.getComponent());
+            tcim.put(ti.getComponent(), ntci);
+            temperatureComponentInfos.add(ntci);
+        }
+        tcim.get(ti.getComponent()).addTemperaturePoint(ti);
+        isSorted = false;
+    }
+
+    public List<TemperatureComponentInfo> getTemperatureComponentInfos() {
+        if (temperatureComponentInfos == null) {
+            temperatureComponentInfos = new ArrayList<>();
+        }
+        if (!isSorted) {
+            temperatureComponentInfos.sort(Comparator.comparing(TemperatureComponentInfo::getName));
+            isSorted = true;
+        }
+        return temperatureComponentInfos;
+    }
+
+    @JsonIgnore
+    public List<TemperatureTagInfo> getTemperatureInfos() {
+        List<TemperatureTagInfo> ls = new ArrayList<>();
+        List<TemperatureComponentInfo> tcis = getTemperatureComponentInfos();
+        for (TemperatureComponentInfo tci : tcis) {
+            List<TemperatureTagInfo> tis = tci.getTemperatureInfos();
+            ls.addAll(tis);
+        }
+        return ls;
+    }
+
+    @JsonIgnore
+    public int getWindturbineIndex() {
+        if (windturbineIndex <= 0) {
+            String[] ss = windturbineId.split("_");
+            if (ss.length == 2) {
+                try {
+                    windturbineIndex = Integer.parseInt(ss[1]);
+                } catch (Exception e) {
+                }
+            }
+        }
+        return windturbineIndex;
+    }
+
+    /**
+     * 是否含有特定状态的点
+     *
+     * @param tts 状态字符串
+     * @return
+     */
+    public boolean isHadByStatus(String[] tts) {
+        final List<TemperatureComponentInfo> tcis = getTemperatureComponentInfos();
+        Set<TemperatureStatus> tss = new HashSet<>();
+        try {
+            for (String s : tts) {
+                if (s == null || "".equals(s)) {
+                    continue;
+                }
+                tss.add(TemperatureStatus.valueOf(s));
+            }
+        } catch (Exception e) {
+        }
+
+        return tcis.stream().anyMatch(tc -> tc.isHadByStatus(tss));
+    }
+
+
+    /**
+     * 是否含有特定状态的点
+     *
+     * @param ts 状态
+     * @return
+     */
+    public boolean isHadByStatus(TemperatureStatus ts) {
+        final List<TemperatureComponentInfo> tcis = getTemperatureComponentInfos();
+        return tcis.stream().anyMatch(tc -> tc.isHadByStatus(ts));
+    }
+
+    /**
+     * 初始化控制信息
+     *
+     * @param controlType 控制类型
+     */
+//    public void initControlInto(OperateStyle controlType) {
+//        if (controlType == OperateStyle.Start) {
+//            final List<TemperatureTagInfo> temperatureInfos = getTemperatureInfos().stream().filter(ti -> ti.getStopMaxValue() != 0).collect(Collectors.toList());
+//            for (TemperatureTagInfo ti : temperatureInfos) {
+//                ti.setStopMaxValue(0);
+//            }
+//        } else if (controlType == OperateStyle.Stop && isHadByStatus(TemperatureStatus.OverLimit)) {
+//            final List<TemperatureTagInfo> temperatureInfos = getTemperatureInfos().stream().filter(ti -> ti.getStatus() == TemperatureStatus.OverLimit).collect(Collectors.toList());
+//            for (TemperatureTagInfo ti : temperatureInfos) {
+//                ti.setStopMaxValue(ti.getValue());
+//            }
+//        }
+//    }
+}
+

+ 99 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureInfoEntity.java

@@ -0,0 +1,99 @@
+package com.gyee.runeconomy.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "TEMPERATUREINFO")
+public class TemperatureInfoEntity {
+    @Id
+    @Column(name = "ID")
+    private Long id;
+
+    @Column(name = "TAG", length = 50)
+    private String tag;
+
+    @Column(name = "WINDPOWERSTATIONID", nullable = false, length = 10)
+    private String windpowerstationid;
+
+    @Column(name = "WINDTURBINEID", nullable = false, length = 10)
+    private String windturbineid;
+
+    @Column(name = "COMPONENT", nullable = false, length = 30)
+    private String component;
+
+    @Column(name = "NAME", nullable = false, length = 50)
+    private String name;
+
+    @Column(name = "REASONABLEMAXVAL", nullable = false)
+    private Double reasonablemaxval;
+
+    @Column(name = "MAXVAL", nullable = false)
+    private Double maxval;
+
+    public Double getMaxval() {
+        return maxval;
+    }
+
+    public void setMaxval(Double maxval) {
+        this.maxval = maxval;
+    }
+
+    public Double getReasonablemaxval() {
+        return reasonablemaxval;
+    }
+
+    public void setReasonablemaxval(Double reasonablemaxval) {
+        this.reasonablemaxval = reasonablemaxval;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getComponent() {
+        return component;
+    }
+
+    public void setComponent(String component) {
+        this.component = component;
+    }
+
+    public String getWindturbineid() {
+        return windturbineid;
+    }
+
+    public void setWindturbineid(String windturbineid) {
+        this.windturbineid = windturbineid;
+    }
+
+    public String getWindpowerstationid() {
+        return windpowerstationid;
+    }
+
+    public void setWindpowerstationid(String windpowerstationid) {
+        this.windpowerstationid = windpowerstationid;
+    }
+
+    public String getTag() {
+        return tag;
+    }
+
+    public void setTag(String tag) {
+        this.tag = tag;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+}

+ 38 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureItemInfo.java

@@ -0,0 +1,38 @@
+package com.gyee.runeconomy.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import java.io.Serializable;
+
+/**
+ * 温度点信息
+ */
+public class TemperatureItemInfo  implements Serializable {
+    private String name;
+    private TemperatureTagInfo temperatureTagInfo;
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    @JsonIgnore
+    public TemperatureTagInfo getTemperatureTagInfo() {
+        return temperatureTagInfo;
+    }
+
+    public void setTemperatureTagInfo(TemperatureTagInfo temperatureTagInfo) {
+        this.temperatureTagInfo = temperatureTagInfo;
+    }
+
+    public TemperatureStatus getStatus() {
+        return this.temperatureTagInfo.getStatus();
+    }
+
+    public double getValue() {
+        return this.temperatureTagInfo.getValue();
+    }
+}

+ 23 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureStatus.java

@@ -0,0 +1,23 @@
+package com.gyee.runeconomy.model;
+
+/**
+ * 温度状态
+ */
+public enum TemperatureStatus {
+    /**
+     * 正常
+     */
+    Normal,
+    /**
+     * 越限
+     */
+    CrossingLimit,
+    /**
+     * 超限
+     */
+    OverLimit,
+    /**
+     * 坏点
+     */
+    BadPoint,
+}

+ 48 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TemperatureTagInfo.java

@@ -0,0 +1,48 @@
+package com.gyee.runeconomy.model;
+
+
+import java.io.Serializable;
+
+public class TemperatureTagInfo extends TagInfo {
+    /**
+     * 最大正常运行值
+     */
+    private double reasonablemaxval;
+    /**
+     * 最大允许值
+     */
+    private double maxval;
+    /**
+     * 停机时最大值
+     */
+    private double stopMaxValue;
+
+    public double getStopMaxValue() {
+        return stopMaxValue;
+    }
+
+    public void setStopMaxValue(double stopMaxValue) {
+        this.stopMaxValue = stopMaxValue;
+    }
+
+    public void setReasonablemaxval(double reasonablemaxval) {
+        this.reasonablemaxval = reasonablemaxval;
+    }
+
+    public void setMaxval(double maxval) {
+        this.maxval = maxval;
+    }
+
+    public TemperatureStatus getStatus() {
+        if (this.getValue() >= 850) {
+            return TemperatureStatus.BadPoint;
+        }
+        if (maxval != -1 && this.getValue() >= maxval) {
+            return TemperatureStatus.OverLimit;
+        }
+        if (reasonablemaxval != -1 && this.getValue() >= reasonablemaxval) {
+            return TemperatureStatus.CrossingLimit;
+        }
+        return TemperatureStatus.Normal;
+    }
+}

+ 539 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/WindturbineInfo.java

@@ -0,0 +1,539 @@
+package com.gyee.runeconomy.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gyee.runeconomy.config.UniformCode;
+
+import java.io.Serializable;
+
+/**
+ * 风机
+ */
+public class WindturbineInfo implements Serializable {
+    /**
+     * ID
+     */
+    private String id;
+    /**
+     * Code
+     */
+    private String code;
+    /**
+     * 型号
+     */
+    private String modelId;
+    /**
+     * 风机期次信息
+     */
+    private String projectId;
+    /**
+     * 场站信息
+     */
+    private String stationId;
+    /**
+     * 场站名称
+     */
+    private String stationName;
+    /**
+     * 线路信息
+     */
+    private String lineId;
+    /**
+     * 最小切入风速
+     */
+    private double minimumWindSpeed = 3.5;
+    /**
+     * 装机容量
+     */
+    private double powerProduction;
+    /**
+     * 编号
+     */
+    private int index;
+    /**
+     * 状态
+     */
+    @UniformCode("${windturbine.status:FJZT8}")
+    private TagInfo status;
+    /**
+     * 转速
+     */
+    @UniformCode("AI128")
+    private TagInfo rollSpeed;
+    /**
+     * 功率
+     */
+    @UniformCode("AI130")
+    private TagInfo power;
+    /**
+     * 风速
+     */
+    @UniformCode("AI022")
+    private TagInfo windSpeed;
+    /**
+     * 挂牌类型
+     */
+    @UniformCode("${windturbine.lock_type:XDSL}")
+    private TagInfo lockType;
+    /**
+     * 理论功率
+     */
+    @UniformCode("LLGL")
+    private TagInfo theoreticalPower;
+    /**
+     * 5分钟平均风速
+     */
+    @UniformCode("YDPJFS5M")
+    private TagInfo averageWindSpeed5;
+    /**
+     * 故障状态
+     */
+    @UniformCode("GZZT")
+    private TagInfo faultStatus;
+    /**
+     * 资源等级
+     */
+    @UniformCode("ZYZS")
+    private TagInfo resourceLevel;
+
+    /**
+     * 是否为紧急报警
+     */
+    private boolean isEmergencyAlarm = false;
+    /**
+     * 风机评分
+     */
+    @UniformCode("JKZS")
+    private TagInfo score;
+    /**
+     * 欠发状态
+     */
+    @UniformCode("${windturbine.undelivered:RSSQFZT}")
+    private TagInfo undeliveredStatus;
+
+    /**
+     * 解缆状态
+     */
+    @UniformCode("${windturbine.unhooking:DI012}")
+    private TagInfo unhooking;
+    /**
+     * 欠发状态
+     */
+    @UniformCode("${windturbine.wind_trends:FSQS}")
+    private TagInfo windTrends;
+
+    /**
+     * 是否状态异常(故障状态为true,但是风速可启动)
+     */
+    private boolean abnormalState;
+
+    /**
+     * 风机控制指令
+     */
+//    private Map<OperateStyle, CmdInfo> cmdInfos;
+
+    public String getId() {
+        return id;
+    }
+
+    public String getWindturbineId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+        if (id == null) {
+            return;
+        }
+        final String[] ss = id.split("_");
+        if (ss.length != 2) {
+            return;
+        }
+        try {
+            index = Integer.valueOf(ss[1]);
+        } catch (Exception e) {
+        }
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public String getModelId() {
+        return modelId;
+    }
+
+    public void setModelId(String modelId) {
+        this.modelId = modelId;
+    }
+
+    public double getStatus() {
+        if (this.status == null) {
+            this.status = new TagInfo();
+        }
+        return status.getValue();
+    }
+
+    public TagInfo getStatusInfo() {
+        if (this.status == null) {
+            this.status = new TagInfo();
+        }
+        return this.status;
+    }
+
+    public void setStatus(double status) {
+        if (this.status == null) {
+            this.status = new TagInfo();
+        }
+        this.status.setValue(status);
+    }
+
+    /**
+     * 状态时间
+     *
+     * @return
+     */
+    public long getTs() {
+
+        if (this.status == null) {
+            this.status = new TagInfo();
+        }
+        return status.getTimestamp();
+    }
+
+    public String getStationId() {
+        return stationId;
+    }
+
+    public void setStationId(String stationId) {
+        this.stationId = stationId;
+    }
+
+    public String getStationName() {
+        return stationName;
+    }
+
+    public void setStationName(String stationName) {
+        this.stationName = stationName;
+    }
+
+    public double getRollSpeed() {
+        if (this.rollSpeed == null) {
+            this.rollSpeed = new TagInfo();
+        }
+        return rollSpeed.getValue();
+    }
+
+    public void setRollSpeed(double rollSpeed) {
+        if (this.rollSpeed == null) {
+            this.rollSpeed = new TagInfo();
+        }
+        this.rollSpeed.setValue(rollSpeed);
+    }
+
+    public double getPower() {
+        if (this.power == null) {
+            this.power = new TagInfo();
+        }
+        return power.getValue();
+    }
+
+    public void setPower(double power) {
+        if (this.power == null) {
+            this.power = new TagInfo();
+        }
+        this.power.setValue(power);
+    }
+
+    public double getWindSpeed() {
+        if (this.windSpeed == null) {
+            this.windSpeed = new TagInfo();
+        }
+        return windSpeed.getValue();
+    }
+
+    public void setWindSpeed(double windSpeed) {
+        if (this.windSpeed == null) {
+            this.windSpeed = new TagInfo();
+        }
+        this.windSpeed.setValue(windSpeed);
+    }
+
+    /**
+     * 获取风速标签
+     */
+    @JsonIgnore
+    public String getWindSpeedTag() {
+        if (this.windSpeed == null) {
+            this.windSpeed = new TagInfo();
+        }
+        return windSpeed.getTag();
+    }
+
+    public void setStatusTag(String tag) {
+        if (status == null) {
+            status = new TagInfo();
+        }
+        this.status.setTag(tag);
+    }
+
+    public void setRollSpeedTag(String tag) {
+        if (rollSpeed == null) {
+            rollSpeed = new TagInfo();
+        }
+        this.rollSpeed.setTag(tag);
+    }
+
+    public void setPowerTag(String tag) {
+        if (power == null) {
+            power = new TagInfo();
+        }
+        this.power.setTag(tag);
+    }
+
+    public void setWindSpeedTag(String tag) {
+        if (windSpeed == null) {
+            windSpeed = new TagInfo();
+        }
+        this.windSpeed.setTag(tag);
+    }
+
+    public double getLockType() {
+        if (this.lockType == null) {
+            this.lockType = new TagInfo();
+        }
+        return lockType.getValue();
+    }
+
+    public double getLockValue() {
+        return getLockType();
+    }
+
+    public void setLockType(double lockType) {
+        if (this.lockType == null) {
+            this.lockType = new TagInfo();
+        }
+        this.lockType.setValue(lockType);
+    }
+
+    public void setLockTypeTag(String tag) {
+        if (lockType == null) {
+            lockType = new TagInfo();
+        }
+        this.lockType.setTag(tag);
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public double getTheoreticalPower() {
+        if (theoreticalPower == null) {
+            theoreticalPower = new TagInfo();
+        }
+        return theoreticalPower.getValue();
+    }
+
+    public void setTheoreticalPower(double theoreticalPower) {
+        if (this.theoreticalPower == null) {
+            this.theoreticalPower = new TagInfo();
+        }
+        this.theoreticalPower.setValue(theoreticalPower);
+    }
+
+    public double getMinimumWindSpeed() {
+        if (minimumWindSpeed < 3) {
+            return 3.5;
+        }
+        return minimumWindSpeed;
+    }
+
+    public void setMinimumWindSpeed(double minimumWindSpeed) {
+        this.minimumWindSpeed = minimumWindSpeed;
+    }
+
+    public double getAverageWindSpeed5() {
+        if (averageWindSpeed5 == null) {
+            averageWindSpeed5 = new TagInfo();
+        }
+        return averageWindSpeed5.getValue();
+    }
+
+    public void setAverageWindSpeed5(double averageWindSpeed5) {
+        if (this.averageWindSpeed5 == null) {
+            this.averageWindSpeed5 = new TagInfo();
+        }
+        this.averageWindSpeed5.setValue(averageWindSpeed5);
+    }
+
+    @JsonIgnore
+    public String getAverageWindSpeed5Tag() {
+        if (averageWindSpeed5 == null) {
+            averageWindSpeed5 = new TagInfo();
+        }
+        return averageWindSpeed5.getTag();
+    }
+
+    public boolean getFaultStatus() {
+        if (faultStatus == null) {
+            faultStatus = new TagInfo(1);
+        }
+        return faultStatus.getValue() == 1;
+    }
+
+    public void setFaultStatus(boolean faultStatus) {
+        if (this.faultStatus == null) {
+            this.faultStatus = new TagInfo();
+        }
+        this.faultStatus.setValue(faultStatus ? 1 : 0);
+    }
+
+    public double getResourceLevel() {
+        if (this.resourceLevel == null) {
+            this.resourceLevel = new TagInfo();
+        }
+        return resourceLevel.getValue();
+    }
+
+    public void setResourceLevel(double resourceLevel) {
+        if (this.resourceLevel == null) {
+            this.resourceLevel = new TagInfo();
+        }
+        this.resourceLevel.setValue(resourceLevel);
+    }
+
+    /**
+     * 获取风机潜力
+     */
+    public double getPotential() {
+        double potential = theoreticalPower.getValue() - power.getValue();
+        potential = potential < 0 ? 0 : potential;
+        return potential;
+    }
+
+    /**
+     * 获取风能利用率
+     *
+     * @return 风能利用率
+     */
+    public double getWindEnergyUtilisation() {
+        return getPower() / getTheoreticalPower();
+    }
+
+    public boolean isEmergencyAlarm() {
+        return isEmergencyAlarm;
+    }
+
+    public void setEmergencyAlarm(boolean emergencyAlarm) {
+        isEmergencyAlarm = emergencyAlarm;
+    }
+
+    public double getScore() {
+        if (this.score == null) {
+            this.score = new TagInfo();
+        }
+        return score.getValue();
+    }
+
+    public void setScore(double score) {
+        if (this.score == null) {
+            this.score = new TagInfo();
+        }
+        this.score.setValue(score);
+    }
+
+    public String getLineId() {
+        return lineId;
+    }
+
+    public void setLineId(String lineId) {
+        this.lineId = lineId;
+    }
+
+    @JsonIgnore
+    public String getLockTypeTag() {
+        if (this.lockType == null) {
+            this.lockType = new TagInfo();
+        }
+        return this.lockType.getTag();
+    }
+
+    @JsonIgnore
+    public String getStatusTag() {
+        if (this.status == null) {
+            this.status = new TagInfo();
+        }
+        return this.status.getTag();
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public double getPowerProduction() {
+        return powerProduction;
+    }
+
+    public void setPowerProduction(double powerProduction) {
+        this.powerProduction = powerProduction;
+    }
+
+    public boolean getAbnormalState() {
+        return abnormalState;
+    }
+
+    public void setAbnormalState(boolean abnormalState) {
+        this.abnormalState = abnormalState;
+    }
+
+    public double getUndeliveredStatus() {
+        if (this.undeliveredStatus == null) {
+            this.undeliveredStatus = new TagInfo();
+        }
+        return undeliveredStatus.getValue();
+    }
+
+    public void setUndeliveredStatus(double undeliveredStatus) {
+        if (this.undeliveredStatus == null) {
+            this.undeliveredStatus = new TagInfo();
+        }
+        this.undeliveredStatus.setValue(undeliveredStatus);
+    }
+
+    public TagInfo getUnhooking() {
+        if (unhooking == null) {
+            unhooking = new TagInfo();
+        }
+        return unhooking;
+    }
+
+    public void setUnhooking(TagInfo unhooking) {
+        this.unhooking = unhooking;
+    }
+
+    public TagInfo getWindTrends() {
+        if (windTrends == null) {
+            windTrends = new TagInfo();
+        }
+        return windTrends;
+    }
+
+    public void setWindTrends(TagInfo windTrends) {
+        this.windTrends = windTrends;
+    }
+
+//    @JsonIgnore
+//    public Map<OperateStyle, CmdInfo> getCmdInfos() {
+//        if (cmdInfos == null) {
+//            cmdInfos = new HashMap<>();
+//        }
+//        return cmdInfos;
+//    }
+}

+ 2 - 2
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProBasicProjectPlan.java

@@ -81,7 +81,7 @@ public class ProBasicProjectPlan extends Model {
      * 创建时间
      */
     @ExcelProperty("创建时间")
-    private LocalDateTime createTime;
+    private String createTime;
 
     /**
      * 修改人
@@ -93,7 +93,7 @@ public class ProBasicProjectPlan extends Model {
      * 修改时间
      */
     @ExcelProperty("修改时间")
-    private LocalDateTime updateTime;
+    private String updateTime;
 
     /**
      * 是否修改

+ 56 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/Temperatureinfo.java

@@ -0,0 +1,56 @@
+package com.gyee.runeconomy.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 各部件温度出力分析表
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-11-04
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("temperatureinfo")
+public class Temperatureinfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private Long id;
+
+    /**
+     * 测点
+     */
+    private String tag;
+
+    /**
+     * 场站id
+     */
+    private String windpowerstationid;
+
+    /**
+     * 风机id
+     */
+    private String windturbineid;
+
+    private String component;
+
+    private String name;
+
+    private Double reasonablemaxval;
+
+    private Double maxval;
+
+
+}

+ 4 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/ColumnVo.java

@@ -1,6 +1,8 @@
 package com.gyee.runeconomy.model.vo;
 
+import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 /**
  * @author hlf
@@ -8,6 +10,8 @@ import lombok.Data;
  * 文件说明:
  */
 @Data
+@AllArgsConstructor
+@NoArgsConstructor
 public class ColumnVo {
 
     private String name;

+ 26 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/PlanDataVo.java

@@ -0,0 +1,26 @@
+package com.gyee.runeconomy.model.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author hlf
+ * @date 2024/10/30 14:16
+ * 文件说明:
+ */
+@Data
+public class PlanDataVo {
+    private Double zfdljh;
+    private Double zfdlsj;
+    private Double zjd;
+    private Double zwcl;
+    private Double yfdljh;
+    private Double yfdlsj;
+    private Double yjd;
+    private Double ywcl;
+    private Double nfdljh;
+    private Double nfdlsj;
+    private Double njd;
+    private Double nwcl;
+}

+ 21 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/PowertrendVo.java

@@ -0,0 +1,21 @@
+package com.gyee.runeconomy.model.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @author hlf
+ * @date 2024/10/31 15:25
+ * 文件说明:
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PowertrendVo {
+    private String title;
+    private int yAxisIndex;
+    private List<ValueVo> value;
+}

+ 16 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/ValueVo.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.model.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author hlf
+ * @date 2024/10/31 15:26
+ * 文件说明:
+ */
+@Data
+public class ValueVo {
+    private String text;
+    private BigDecimal value;
+}

+ 16 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ITemperatureinfoService.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.service.auto;
+
+import com.gyee.runeconomy.model.auto.Temperatureinfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 各部件温度出力分析表 服务类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-11-04
+ */
+public interface ITemperatureinfoService extends IService<Temperatureinfo> {
+
+}

+ 20 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/TemperatureinfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.runeconomy.service.auto.impl;
+
+import com.gyee.runeconomy.model.auto.Temperatureinfo;
+import com.gyee.runeconomy.mapper.auto.TemperatureinfoMapper;
+import com.gyee.runeconomy.service.auto.ITemperatureinfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 各部件温度出力分析表 服务实现类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-11-04
+ */
+@Service
+public class TemperatureinfoServiceImpl extends ServiceImpl<TemperatureinfoMapper, Temperatureinfo> implements ITemperatureinfoService {
+
+}

+ 355 - 13
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/homepage/EconomyPointHomePageService.java

@@ -8,17 +8,22 @@ import com.gyee.runeconomy.dto.response.EconHomePagePointRateDTO;
 import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
-import com.gyee.runeconomy.model.vo.ColumnVo;
-import com.gyee.runeconomy.model.vo.ComparetqVo;
-import com.gyee.runeconomy.model.vo.GeneratingCapacityVo;
+import com.gyee.runeconomy.model.vo.*;
 import com.gyee.runeconomy.service.auto.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.DecimalFormat;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.time.LocalDate;
+import java.time.Month;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -55,6 +60,14 @@ public class EconomyPointHomePageService {
     @Autowired
     private IProEconPointCodeService proEconPointCodeService;
 
+    @Resource
+    private IProEconPowerstationInfoDay2Service iProEconPowerstationInfoDay2Service;
+
+
+    @Resource
+    private IProBasicProjectPlanService iProBasicProjectPlanService;
+
+
     /**
      * 指标率相应类
      */
@@ -159,7 +172,7 @@ public class EconomyPointHomePageService {
         cl2.setName(String.valueOf(LocalDate.now().getYear()));
         cl2.setField("recodedate");
         ColumnVo cl3 = new ColumnVo();
-        cl3.setName(String.valueOf(LocalDate.now().getYear()-1));
+        cl3.setName(String.valueOf(LocalDate.now().getYear() - 1));
         cl3.setField("recodedate2");
         ColumnVo cl4 = new ColumnVo();
         cl4.setName("涨跌%");
@@ -172,7 +185,6 @@ public class EconomyPointHomePageService {
         List<ColumnVo> ls2 = new ArrayList<>();
 
 
-
         zbtqdb.put("column", ls1);
         zbtqdb.put("data", ls2);
         allmap.put("fdl", ls);
@@ -1554,7 +1566,8 @@ public class EconomyPointHomePageService {
             rfdl.setTotal(day1.getRllfdl());
             BigDecimal rbfb = (day1.getRfdl().compareTo(BigDecimal.ZERO) == 0 || day1.getRllfdl().compareTo(BigDecimal.ZERO) == 0)
                     ? BigDecimal.ZERO
-                    : day1.getRllfdl().divide(day1.getRfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));rfdl.setBfb(rbfb);
+                    : day1.getRllfdl().divide(day1.getRfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
+            rfdl.setBfb(rbfb);
             rfdl.setBfb(rbfb);
             ls.add(rfdl);
 
@@ -1564,17 +1577,19 @@ public class EconomyPointHomePageService {
             yfdl.setTotal(day1.getYllfdl());
             BigDecimal ybfb = (day1.getYfdl().compareTo(BigDecimal.ZERO) == 0 || day1.getYllfdl().compareTo(BigDecimal.ZERO) == 0)
                     ? BigDecimal.ZERO
-                    : day1.getYllfdl().divide(day1.getYfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));rfdl.setBfb(rbfb);
+                    : day1.getYllfdl().divide(day1.getYfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
+            rfdl.setBfb(rbfb);
             yfdl.setBfb(ybfb);
             ls.add(yfdl);
 
             GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
             nfdl.setName("年发电量");
-            nfdl.setValue(day1.getNfdl());
-            nfdl.setTotal(day1.getNllfdl());
+            nfdl.setValue(day1.getNfdl().divide(new BigDecimal(1000)));
+            nfdl.setTotal(day1.getNllfdl().divide(new BigDecimal(1000)));
             BigDecimal nbfb = (day1.getNfdl().compareTo(BigDecimal.ZERO) == 0 || day1.getNllfdl().compareTo(BigDecimal.ZERO) == 0)
                     ? BigDecimal.ZERO
-                    : day1.getNllfdl().divide(day1.getNfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));rfdl.setBfb(rbfb);
+                    : day1.getNllfdl().divide(day1.getNfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
+            rfdl.setBfb(rbfb);
             nfdl.setBfb(nbfb);
             ls.add(nfdl);
 
@@ -1587,7 +1602,7 @@ public class EconomyPointHomePageService {
             cl2.setName(String.valueOf(LocalDate.now().getYear()));
             cl2.setField("recodedate");
             ColumnVo cl3 = new ColumnVo();
-            cl3.setName(String.valueOf(LocalDate.now().getYear()-1));
+            cl3.setName(String.valueOf(LocalDate.now().getYear() - 1));
             cl3.setField("recodedate2");
             ColumnVo cl4 = new ColumnVo();
             cl4.setName("涨跌%");
@@ -1599,11 +1614,35 @@ public class EconomyPointHomePageService {
 
             List<ComparetqVo> ls2 = new ArrayList<>();
             ComparetqVo cv = new ComparetqVo();
-            cv.setWtId("风电发电量");
-            cv.setRecodedate(String.valueOf(day1.getNfdl()));
+            cv.setWtId("发电量");
+            cv.setRecodedate(String.valueOf(day1.getNfdl().divide(new BigDecimal(1000))));
             cv.setRecodedate2(String.valueOf(0));
             cv.setOperation("100");
+            ComparetqVo cv1 = new ComparetqVo();
+            cv1.setWtId("上网电量");
+            cv1.setRecodedate(String.valueOf(0.00));
+            cv1.setRecodedate2(String.valueOf(0));
+            cv1.setOperation("0");
+            ComparetqVo cv2 = new ComparetqVo();
+            cv2.setWtId("网购电量");
+            cv2.setRecodedate(String.valueOf(0.00));
+            cv2.setRecodedate2(String.valueOf(0));
+            cv2.setOperation("0");
+            ComparetqVo cv3 = new ComparetqVo();
+            cv3.setWtId("损失电量");
+            cv3.setRecodedate(String.valueOf(0.00));
+            cv3.setRecodedate2(String.valueOf(0));
+            cv3.setOperation("0");
+            ComparetqVo cv4 = new ComparetqVo();
+            cv4.setWtId("场用电量");
+            cv4.setRecodedate(String.valueOf(0.00));
+            cv4.setRecodedate2(String.valueOf(0));
+            cv4.setOperation("0");
             ls2.add(cv);
+            ls2.add(cv1);
+            ls2.add(cv2);
+            ls2.add(cv3);
+            ls2.add(cv4);
 
             zbtqdb.put("column", ls1);
             zbtqdb.put("data", ls2);
@@ -1611,8 +1650,311 @@ public class EconomyPointHomePageService {
             allmap.put("zbtqdb", zbtqdb);
         }
 
+        return allmap;
+    }
+
+
+    public Map<String, Object> getHomeRight(String companyId) {
+        Map<String, Object> allmap = new HashMap<>();
+        LocalDate now = LocalDate.now();
+        Date currentDate = DateUtils.getCurrentDate();
+        Date monthFirst = DateUtils.getMonthFirst(currentDate);
+        double hoursDiff = DateUtils.hoursDiff2(currentDate, monthFirst);
+        QueryWrapper<ProEconPowerstationInfoDay1> qw = new QueryWrapper<>();
+        qw.lambda().eq(ProEconPowerstationInfoDay1::getRecordDate, now)
+                .eq(ProEconPowerstationInfoDay1::getForeignKeyId, companyId);
+        List<ProEconPowerstationInfoDay1> day1s = proEconPowerstationInfoDay1Service.list(qw);
+        Map<String, Object> sbklyl = new HashMap<>();
+        for (ProEconPowerstationInfoDay1 day1 : day1s) {
+            Map<String, Object> zbtqdb = new HashMap<>();
+            String[] title = {"排名", "名称", "风能利用率%", "去年同期%", "涨跌%"};
+            List<ColumnVo> ls1 = getTitle(title);
+            String[] title2 = {"排名", "名称", "设备利用率%", "去年同期%", "涨跌%"};
+            List<ColumnVo> ls3 = getTitle(title2);
+            List<HomeRightVo> ls2 = new ArrayList<>();
+            HomeRightVo hv = new HomeRightVo();
+            hv.setIndex("1");
+            hv.setName("惠安风场");
+            BigDecimal fnlyl = (day1.getNfdl().compareTo(BigDecimal.ZERO) == 0 || day1.getNllfdl().compareTo(BigDecimal.ZERO) == 0)
+                    ? BigDecimal.ZERO
+                    : day1.getNfdl().divide(day1.getNllfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
+            hv.setFnlyl(String.valueOf(fnlyl));
+            hv.setYearTq("0");
+            hv.setOperation(String.valueOf(fnlyl));
+            ls2.add(hv);
+
+            zbtqdb.put("column", ls1);
+            zbtqdb.put("data", ls2);
+            sbklyl.put("column", ls3);
+            allmap.put("fnlyl", zbtqdb);
+
+        }
+
+        QueryWrapper<ProEconPowerstationInfoDay2> qw2 = new QueryWrapper<>();
+        qw2.lambda().eq(ProEconPowerstationInfoDay2::getRecordDate, now)
+                .eq(ProEconPowerstationInfoDay2::getForeignKeyId, companyId);
+        List<ProEconPowerstationInfoDay2> list = iProEconPowerstationInfoDay2Service.list(qw2);
+        for (ProEconPowerstationInfoDay2 day2 : list) {
+            List<HomeRightVo> ls3 = new ArrayList<>();
+            HomeRightVo hv2 = new HomeRightVo();
+            hv2.setIndex("1");
+            hv2.setName("惠安风场");
+            BigDecimal hoursDiffDecimal = BigDecimal.valueOf(hoursDiff);
+            BigDecimal result = hoursDiffDecimal.subtract(day2.getNhjgztjxs()).subtract(day2.getNhjjxtjxs());
+            BigDecimal ysbklyl = result.divide(hoursDiffDecimal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
+            hv2.setFnlyl(String.valueOf(ysbklyl));
+            hv2.setYearTq("0");
+            hv2.setOperation(String.valueOf(ysbklyl));
+            ls3.add(hv2);
+            sbklyl.put("data", ls3);
+            allmap.put("sbklyl", sbklyl);
+        }
+
+        Map<String, Object> lgxzkh = new HashMap<>();
+        String[] title = {"排名", "名称", "考核分数", "去年同期%", "涨跌%"};
+        List<ColumnVo> ls1 = getTitle(title);
+        List<HomeRightVo> ls2 = new ArrayList<>();
+        HomeRightVo hv = new HomeRightVo();
+        hv.setIndex("1");
+        hv.setName("惠安风场");
+        hv.setFnlyl("98");
+        hv.setYearTq("0");
+        hv.setOperation("100");
+        ls2.add(hv);
+
+        lgxzkh.put("column", ls1);
+        lgxzkh.put("data", ls2);
+        allmap.put("lgxzkh", lgxzkh);
+
+        return allmap;
+
+    }
+
+
+    public List<ColumnVo> getTitle(String[] title) {
+        List<ColumnVo> ls1 = new ArrayList<>();
+        ColumnVo cl1 = new ColumnVo(title[0], "index");
+        ColumnVo cl2 = new ColumnVo(title[1], "name");
+        ColumnVo cl3 = new ColumnVo(title[2], "fnlyl");
+        ColumnVo cl4 = new ColumnVo(title[3], "yearTq");
+        ColumnVo cl5 = new ColumnVo(title[4], "operation");
+        ls1.add(cl1);
+        ls1.add(cl2);
+        ls1.add(cl3);
+        ls1.add(cl4);
+        ls1.add(cl5);
+        return ls1;
+    }
+
+
+    public Map<String, Object> getHomeMiddle(String companyId) throws ParseException {
+        LocalDate currentDate = LocalDate.now();
+        Integer month = LocalDate.now().getMonthValue();
+        int year = LocalDate.now().getYear();
+        Map<String, Object> allmap = new HashMap<>();
+        PlanDataVo pd = new PlanDataVo();
+        List<ProBasicProjectPlan> list = iProBasicProjectPlanService.list();
+
+        QueryWrapper<ProEconPowerstationInfoDay1> qw1 = new QueryWrapper<>();
+        qw1.lambda().eq(ProEconPowerstationInfoDay1::getRecordDate, currentDate)
+                .eq(ProEconPowerstationInfoDay1::getForeignKeyId, companyId);
+        List<ProEconPowerstationInfoDay1> days1 = proEconPowerstationInfoDay1Service.list(qw1);
+
+        LocalDate startOfWeek = currentDate.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY));// 本周周一日期
+        LocalDate endOfWeek = currentDate.with(TemporalAdjusters.nextOrSame(java.time.DayOfWeek.SUNDAY));
+        QueryWrapper<ProEconPowerstationInfoDay1> qw = new QueryWrapper<>();
+        qw.lambda().between(ProEconPowerstationInfoDay1::getRecordDate, startOfWeek, endOfWeek)
+                .eq(ProEconPowerstationInfoDay1::getForeignKeyId, companyId);
+        List<ProEconPowerstationInfoDay1> day1s = proEconPowerstationInfoDay1Service.list(qw);
+        if (null == day1s || day1s.isEmpty()) {
+            pd.setZfdlsj(0.00);
+            pd.setYfdlsj(0.00);
+            pd.setNfdlsj(0.00);
+            return allmap;
+        }
+
+        List<ProBasicProjectPlan> pp = list.stream()
+                .filter(ls -> String.valueOf(month).equals(ls.getMonth())
+                        && ls.getYear().equals(String.valueOf(year)) && ls.getProjectId().equals(companyId))
+                .collect(Collectors.toList());
+        if (null == pp || pp.isEmpty()) {
+            return allmap;
+        }
+        pd.setZfdljh(pp.get(0).getGeneratingCapacity() / 4);
+        double sum = day1s.stream().map(ProEconPowerstationInfoDay1::getRfdl).mapToDouble(BigDecimal::doubleValue).sum();
+        pd.setZfdlsj(sum);
+        Double zjd = calDivide(pd.getZfdlsj(), pd.getZfdljh());
+        pd.setZjd(zjd * 100);
+        pd.setZwcl(zjd);
+        pd.setYfdljh(pp.get(0).getGeneratingCapacity());
+        pd.setYfdlsj(days1.get(0).getYfdl().doubleValue());
+        Double yjd = calDivide(pd.getYfdlsj(), pd.getYfdljh());
+        pd.setYjd(yjd * 100);
+        pd.setYwcl(yjd);
+
+        List<ProBasicProjectPlan> pp2 = list.stream()
+                .filter(ls -> ls.getYear().equals(String.valueOf(year)) && ls.getProjectId().equals(companyId) && ls.getMonth() == null)
+                .collect(Collectors.toList());
+        pd.setNfdljh(pp2.get(0).getGeneratingCapacity());
+        pd.setNfdlsj(days1.get(0).getNfdl().doubleValue()/1000);
+        Double njd = calDivide(pd.getNfdlsj()/1000, pd.getNfdljh());
+        pd.setNjd(njd * 100);
+        pd.setNwcl(njd);
+        allmap.put("planData", pd);
+
+        QueryWrapper<ProEconPowerstationInfoDay1> qw2 = new QueryWrapper<>();
+        qw2.lambda().eq(ProEconPowerstationInfoDay1::getForeignKeyId, companyId);
+        List<ProEconPowerstationInfoDay1> days3 = proEconPowerstationInfoDay1Service.list(qw2);
+
+        Map<Date, List<ProEconPowerstationInfoDay1>> date = days3.stream().collect(Collectors.groupingBy(ProEconPowerstationInfoDay1::getRecordDate));
+        Set<Integer> year2 = new TreeSet<>();
+        for (Date date1 : date.keySet()) {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(date1);
+            int year3 = calendar.get(Calendar.YEAR);
+            year2.add(year3);
+        }
+        int yy = year2.iterator().next();
+        String start = yy + "-01-01";
+        String end = yy + "-12-31";
+        String start2 = yy - 1 + "-01-01";
+        String end2 = yy - 1 + "-12-31";
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Date start1 = sdf.parse(start);
+        Date end1 = sdf.parse(end);
+        Date start3 = sdf.parse(start2);
+        Date end3 = sdf.parse(end2);
+        List<ProEconPowerstationInfoDay1> thisYear = days3.stream().filter(rec -> rec.getRecordDate().after(start1) && rec.getRecordDate().before(end1)).collect(Collectors.toList());
+        List<ProEconPowerstationInfoDay1> lastYear = days3.stream().filter(rec -> rec.getRecordDate().after(start3) && rec.getRecordDate().before(end3)).collect(Collectors.toList());
+        Map<Integer, List<ProEconPowerstationInfoDay1>> day1sMap = thisYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
+        List<PowertrendVo> xdl = new ArrayList<>();
+        List<PowertrendVo> ssdl = new ArrayList<>();
+        List<PowertrendVo> fdl = new ArrayList<>();
+        PowertrendVo ptxdl = new PowertrendVo();
+        PowertrendVo ptssdl = new PowertrendVo();
+        PowertrendVo ptfdl = new PowertrendVo();
+        ptxdl.setTitle("限电量");
+        ptssdl.setTitle("损失电量");
+        ptfdl.setTitle("发电量");
+        ptxdl.setYAxisIndex(0);
+        ptssdl.setYAxisIndex(0);
+        ptfdl.setYAxisIndex(0);
+        List<ValueVo> vexdl = value(year, month);
+        List<ValueVo> vessdl = value(year, month);
+        List<ValueVo> vefdl = value(year, month);
+        for (Integer mon : day1sMap.keySet()) {
+            List<ProEconPowerstationInfoDay1> day1s1 = day1sMap.get(mon);
+            List<ProEconPowerstationInfoDay1> day1s2 = day1s1.stream().sorted(Comparator.comparing(ProEconPowerstationInfoDay1::getRecordDate).reversed()).collect(Collectors.toList());
+            LocalDate localDate = day1s2.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
+            int year1 = localDate.getYear();
+            String text = year1 + "-" + mon;
+            for (ValueVo vv : vexdl) {
+                if (vv.getText().equals(text)) {
+                    vv.setValue(day1s2.get(0).getYxdjclssdl().add(day1s2.get(0).getYxdtjssdl()));
+                }
+            }
+            for (ValueVo vv : vessdl) {
+                if (vv.getText().equals(text)) {
+                    vv.setValue(day1s2.get(0).getYgzssdl().add(day1s2.get(0).getYcnslgzssdl().add(day1s2.get(0).getYjxssdl().add(day1s2.get(0).getYcnsljxssdl()
+                            .add(day1s2.get(0).getYdjssdl().add(day1s2.get(0).getYqxjclssdl().add(day1s2.get(0).getYsdtjssdl().add(day1s2.get(0).getYxnssdl()
+                                    .add(day1s2.get(0).getYxdtjssdl().add(day1s2.get(0).getYxdjclssdl().add(day1s2.get(0).getYcwsldwssdl().add(day1s2.get(0).getYcwsltqssdl()))))))))))));
+                }
+            }
+            for (ValueVo vv : vefdl) {
+                if (vv.getText().equals(text)) {
+                    vv.setValue(day1s2.get(0).getYfdl());
+                }
+            }
+
+        }
+        ptxdl.setValue(vexdl);
+        ptssdl.setValue(vessdl);
+        ptfdl.setValue(vefdl);
+        xdl.add(ptxdl);
+        ssdl.add(ptssdl);
+        fdl.add(ptfdl);
+
+        PowertrendVo ptxdl2 = new PowertrendVo();
+        PowertrendVo ptssdl2 = new PowertrendVo();
+        PowertrendVo ptfdl2 = new PowertrendVo();
+        ptxdl2.setTitle("去年同期限电量");
+        ptssdl2.setTitle("去年同期损失电量");
+        ptfdl2.setTitle("去年同期发电量");
+        ptxdl.setYAxisIndex(0);
+        ptssdl.setYAxisIndex(0);
+        ptfdl.setYAxisIndex(0);
+        if (null == lastYear || lastYear.isEmpty()) {
+            List<ValueVo> value = value(year - 1, month);
+            ptxdl2.setValue(value);
+            ptssdl2.setValue(value);
+            ptfdl2.setValue(value);
+        } else {
+            List<ValueVo> vxdl2 = new ArrayList<>();
+            List<ValueVo> vssdl2 = new ArrayList<>();
+            List<ValueVo> vfdl2 = new ArrayList<>();
+            Map<Integer, List<ProEconPowerstationInfoDay1>> day1sMap2 = lastYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
+            for (Integer mon2 : day1sMap2.keySet()) {
+                List<ProEconPowerstationInfoDay1> day1s3 = day1sMap2.get(mon2);
+                List<ProEconPowerstationInfoDay1> day1s4 = day1s3.stream().sorted(Comparator.comparing(ProEconPowerstationInfoDay1::getRecordDate).reversed()).collect(Collectors.toList());
+                LocalDate localDate = day1s3.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
+                int year1 = localDate.getYear();
+                String text = year1 + "-" + mon2;
+                ValueVo vexdl2 = new ValueVo();
+                ValueVo vessdl2 = new ValueVo();
+                ValueVo vefdl2 = new ValueVo();
+                vexdl2.setText(text);
+                vessdl2.setText(text);
+                vefdl2.setText(text);
+                vexdl2.setValue(day1s4.get(0).getYxdjclssdl().add(day1s4.get(0).getYxdtjssdl()));
+                vessdl2.setValue(day1s4.get(0).getYgzssdl().add(day1s4.get(0).getYcnslgzssdl().add(day1s4.get(0).getYjxssdl().add(day1s4.get(0).getYcnsljxssdl()
+                        .add(day1s4.get(0).getYdjssdl().add(day1s4.get(0).getYqxjclssdl().add(day1s4.get(0).getYsdtjssdl().add(day1s4.get(0).getYxnssdl()
+                                .add(day1s4.get(0).getYxdtjssdl().add(day1s4.get(0).getYxdjclssdl().add(day1s4.get(0).getYcwsldwssdl().add(day1s4.get(0).getYcwsltqssdl()))))))))))));
+                vefdl2.setValue(day1s4.get(0).getYfdl());
+                vxdl2.add(vexdl2);
+                vssdl2.add(vessdl2);
+                vfdl2.add(vefdl2);
+            }
+            ptxdl2.setValue(vxdl2);
+            ptssdl2.setValue(vssdl2);
+            ptxdl2.setValue(vfdl2);
+        }
+        xdl.add(ptxdl2);
+        ssdl.add(ptssdl2);
+        fdl.add(ptfdl2);
 
+        allmap.put("Powertrend", xdl);
+        allmap.put("Powerloss", ssdl);
+        allmap.put("Powersend", fdl);
         return allmap;
+    }
+
+
+    /**
+     * 除法
+     */
+    private Double calDivide(Double divide, Double divisor) {
+        if (divide == 0 || divisor == 0) {
+            return 0.0;
+        } else {
+            BigDecimal divide1 = BigDecimal.valueOf(divide);
+            BigDecimal divisor1 = BigDecimal.valueOf(divisor);
+            BigDecimal result = divide1.divide(divisor1, 2, RoundingMode.HALF_UP);
+            DecimalFormat df = new DecimalFormat("#0.00");
+            String formattedResult = df.format(result);
+            return Double.parseDouble(formattedResult);
+        }
+    }
+
+
+    private List<ValueVo> value(int year, int month) {
+        List<ValueVo> lv = new ArrayList<>();
+        for (int i = 1; i < month; i++) {
+            ValueVo vo = new ValueVo();
+            vo.setText(year + "-" + i);
+            vo.setValue(new BigDecimal(0));
+            lv.add(vo);
+        }
+        return lv;
 
     }
 

+ 109 - 24
runeconomy-xk/src/main/java/com/gyee/runeconomy/util/realtimesource/EdosUtil.java

@@ -854,31 +854,25 @@ public class EdosUtil implements IEdosUtil {
     @Override
     public List<PointData> getRealData(List<String> pointids) throws Exception {
 
-
-        String pointIdString = StringUtil.join(pointids.toArray(), ",");
-        Optional<String> keys = Optional.ofNullable(pointIdString);
-        String url = baseURL + "/latest?null=0";
-        if (pointIdString.contains("GF-")) {
-            url = baseURL2 + "/latest?null=0";
-        }
+        String url = baseURL + "/latest";
         try {
-            if (keys.isPresent())
-                url = url + "&keys=" + keys.get();
-            else {
-                String[] arr = new String[pointids.size()];
-                return ErrorRequest.RequestListError(pointids.toArray(arr));
-            }
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_JSON);
 
-            ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
-            JSONObject jsonObject = resp.getBody();
-            if (jsonObject != null) {
+            // 将请求体和头部信息整合到HttpEntity中
+            HttpEntity<List<String>> requestEntity = new HttpEntity<>(pointids,headers);
 
+            // 发起POST请求
+            ResponseEntity<JSONObject> resp = restTemplate.exchange(url,HttpMethod.POST,requestEntity,JSONObject.class);
+            JSONObject jsonObject = resp.getBody();
 
+            if (jsonObject != null&&!jsonObject.isEmpty()) {
                 //对结果进行有序返回
                 int len = pointids.size();
                 List<PointData> result = new ArrayList<>();
                 HashMap<String, PointData> pointDataHashMap = new HashMap<>();
                 for (int i = 0; i < len; i++) {
+
                     if (pointDataHashMap.containsKey(pointids.get(i)) == false) {
                         PointData pd = new PointData();
                         pd.setPointName(pointids.get(i));
@@ -889,6 +883,7 @@ public class EdosUtil implements IEdosUtil {
                     } else {
                         result.add(pointDataHashMap.get(pointids.get(i)));
                     }
+
                 }
                 Iterator<String> sIterator = jsonObject.keySet().iterator();
                 while (sIterator.hasNext()) {
@@ -900,6 +895,7 @@ public class EdosUtil implements IEdosUtil {
                     // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
                     JSONObject jsonData = jsonObject.getJSONObject(key);
                     Long ts = jsonData.getLong("ts");
+                    pointData.setPointTime(ts);
                     String pointValue = null;
                     if (jsonData.containsKey("doubleValue")) {
                         pointValue = jsonData.getString("doubleValue");
@@ -915,31 +911,120 @@ public class EdosUtil implements IEdosUtil {
                     } else if (pointValue.equals("false")) {
                         pointData.setPointValueInDouble(0.0);
                     } else {
-                        pointData.setPointValueInDouble(Double.parseDouble(pointValue));
+                        double value = Double.parseDouble(pointValue);
+                        pointData.setPointValueInDouble(StringUtils.round(value, 4));
                     }
+
                     pointData.setPointValue(pointValue);
-                    pointData.setPointTime(ts);
-                    //  //System.out.println("key= " + key + ", ts = " + ts + ", value = " + pointValue);
                 }
                 return result;
 
             } else {
-                String[] arr = new String[pointids.size()];
-                return ErrorRequest.RequestListError(pointids.toArray(arr));
+                return ErrorRequest.RequestListError(pointids.toString());
             }
 
         } catch (HttpClientErrorException exception) {
             if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                //System.out.println("404请求错误");
-                String[] arr = new String[pointids.size()];
-                return ErrorRequest.RequestListError(pointids.toArray(arr));
+                return ErrorRequest.RequestListError(pointids.toString());
             } else {
                 throw exception;
             }
         }
 
+
     }
 
+
+
+//    @Override
+//    public List<PointData> getRealData(List<String> pointids) throws Exception {
+//
+//
+//        String pointIdString = StringUtil.join(pointids.toArray(), ",");
+//        Optional<String> keys = Optional.ofNullable(pointIdString);
+//        String url = baseURL + "/latest?null=0";
+//        if (pointIdString.contains("GF-")) {
+//            url = baseURL2 + "/latest?null=0";
+//        }
+//        try {
+//            if (keys.isPresent())
+//                url = url + "&keys=" + keys.get();
+//            else {
+//                String[] arr = new String[pointids.size()];
+//                return ErrorRequest.RequestListError(pointids.toArray(arr));
+//            }
+//
+//            ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
+//            JSONObject jsonObject = resp.getBody();
+//            if (jsonObject != null) {
+//
+//
+//                //对结果进行有序返回
+//                int len = pointids.size();
+//                List<PointData> result = new ArrayList<>();
+//                HashMap<String, PointData> pointDataHashMap = new HashMap<>();
+//                for (int i = 0; i < len; i++) {
+//                    if (pointDataHashMap.containsKey(pointids.get(i)) == false) {
+//                        PointData pd = new PointData();
+//                        pd.setPointName(pointids.get(i));
+//                        pd.setEdnaId(pointids.get(i));
+//                        result.add(pd);
+//
+//                        pointDataHashMap.put(pd.getPointName(), pd);
+//                    } else {
+//                        result.add(pointDataHashMap.get(pointids.get(i)));
+//                    }
+//                }
+//                Iterator<String> sIterator = jsonObject.keySet().iterator();
+//                while (sIterator.hasNext()) {
+//                    // 获得key
+//                    String key = sIterator.next();
+//                    PointData pointData = pointDataHashMap.get(key);
+//                    if (pointData == null)
+//                        continue;
+//                    // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
+//                    JSONObject jsonData = jsonObject.getJSONObject(key);
+//                    Long ts = jsonData.getLong("ts");
+//                    String pointValue = null;
+//                    if (jsonData.containsKey("doubleValue")) {
+//                        pointValue = jsonData.getString("doubleValue");
+//                    } else if (jsonData.containsKey("booleanValue")) {
+//                        pointValue = jsonData.getString("booleanValue");
+//                    } else if (jsonData.containsKey("longValue")) {
+//                        pointValue = jsonData.getString("longValue");
+//                    } else if (jsonData.containsKey("stringValue")) {
+//                        pointValue = jsonData.getString("stringValue");
+//                    }
+//                    if (pointValue.equals("true")) {
+//                        pointData.setPointValueInDouble(1.0);
+//                    } else if (pointValue.equals("false")) {
+//                        pointData.setPointValueInDouble(0.0);
+//                    } else {
+//                        pointData.setPointValueInDouble(Double.parseDouble(pointValue));
+//                    }
+//                    pointData.setPointValue(pointValue);
+//                    pointData.setPointTime(ts);
+//                    //  //System.out.println("key= " + key + ", ts = " + ts + ", value = " + pointValue);
+//                }
+//                return result;
+//
+//            } else {
+//                String[] arr = new String[pointids.size()];
+//                return ErrorRequest.RequestListError(pointids.toArray(arr));
+//            }
+//
+//        } catch (HttpClientErrorException exception) {
+//            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+//                //System.out.println("404请求错误");
+//                String[] arr = new String[pointids.size()];
+//                return ErrorRequest.RequestListError(pointids.toArray(arr));
+//            } else {
+//                throw exception;
+//            }
+//        }
+//
+//    }
+
     @Override
     public Map<String, Double> getRealDataMap(String... pointids) throws Exception {