wangb 2 週間 前
コミット
33a1c1a678
17 ファイル変更2829 行追加383 行削除
  1. 2 3
      data-adapter/src/main/java/com/gyee/dataadapter/service/impl/AdapterServiceImpl.java
  2. 1 1
      generationXK-service/src/main/resources/application-nxf.yml
  3. 25 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/Electricity/ElectricityController.java
  4. 78 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/NewDataFittingController.java
  5. 161 2
      runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/specific/SpecificController.java
  6. 2 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/FiveLoss/AnnotationTool.java
  7. 0 22
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/FiveLoss/Desc.java
  8. 14 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/init/CacheContext.java
  9. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/auto/StationInfoDayMapper.java
  10. 43 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TsDoubleData.java
  11. 71 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProEconPowerFittingAnalySis.java
  12. 75 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/StationInfoDay.java
  13. 111 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/NewDataFittingVo.java
  14. 273 1
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Comprehensive/ComprehensiveelectricityService.java
  15. 21 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IStationInfoDayService.java
  16. 79 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/StationInfoDayServiceImpl.java
  17. 1857 354
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

+ 2 - 3
data-adapter/src/main/java/com/gyee/dataadapter/service/impl/AdapterServiceImpl.java

@@ -5,7 +5,6 @@ import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson2.JSON;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.gyee.dataadapter.cache.MqttCache;
 import com.gyee.dataadapter.dao.MyWebClient;
 import com.gyee.dataadapter.entity.*;
@@ -87,7 +86,7 @@ public class AdapterServiceImpl implements IAdapterService {
         if (StrUtil.isNotBlank(pageSize)){
             sb.append(pageSize);
         }else {
-            sb.append(100);
+            sb.append(100000);
         }
         sb.append("&isDesc=");
         if (isDesc == null) isDesc = false;
@@ -137,7 +136,7 @@ public class AdapterServiceImpl implements IAdapterService {
         StringBuilder sb = new StringBuilder();
         sb.append("/scadarest/api/SA/HistoryQuerySdb?start=").append(uStart).append("&end=").append(uEnd)
                 .append("&sampleType=").append(sampleType).append("&paths=").append(paths);
-        sb.append("&sampleRate=0");
+        sb.append("&sampleRate=60");
         sb.append("&pageIndex=1");
         sb.append("&pageSize=100");
         sb.append("&isDesc=false");

+ 1 - 1
generationXK-service/src/main/resources/application-nxf.yml

@@ -36,7 +36,7 @@ spring:
           password: smart123!@#
         slave:
           driver-class-name: com.taosdata.jdbc.TSDBDriver
-          url: jdbc:TAOS://10.220.1.5:6041/nxxny?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
+          url: jdbc:TAOS://10.220.1.8:6041/nxxny?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
           username: root
           password: taosdata
         #配置初始化连接数大小

+ 25 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/Electricity/ElectricityController.java

@@ -109,6 +109,31 @@ public class ElectricityController {
 
     }
 
+    @GetMapping("/Comprehensive2")
+    @ResponseBody
+    @ApiOperation(value = "综合厂用电量", notes = "综合厂用电量")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "场站编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "year", value = "场站编号", required = true, dataType = "string", paramType = "query")
+    })
+
+    public AjaxResult cydlfx2(String wpId, String year) throws Exception {
+
+
+        Map<String, Object> resultList = new LinkedHashMap<>();
+        if (StringUtils.notEmp(wpId)) {
+            resultList = comprehensiveelectricityService.Comprehensive2(wpId, year);
+        }
+
+        if (null != resultList) {
+            return AjaxResult.successData(200, resultList);
+        } else {
+            return AjaxResult.error(500, "操作失败");
+        }
+
+    }
+
+
     @GetMapping("/Comprehensive")
     @ResponseBody
     @ApiOperation(value = "综合厂用电量", notes = "综合厂用电量")

+ 78 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/NewDataFittingController.java

@@ -0,0 +1,78 @@
+package com.gyee.runeconomy.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.runeconomy.dto.result.JsonResult;
+import com.gyee.runeconomy.dto.result.PowerPointData;
+import com.gyee.runeconomy.dto.result.ResultCode;
+import com.gyee.runeconomy.model.auto.ProEconPowerFittingAnalySis;
+import com.gyee.runeconomy.model.vo.NewDataFittingVo;
+import com.gyee.runeconomy.service.auto.impl.NewDataFittingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@CrossOrigin
+@RequestMapping("/new/power/fitting")
+public class NewDataFittingController {
+
+
+
+    @Autowired
+    private NewDataFittingService newDataFittingService;
+
+    /**
+     * 功率曲线拟合
+     * @param newDataFittingVo
+     * @return
+     */
+    @PostMapping("/data")
+    public JSONObject dataFitting(@RequestBody NewDataFittingVo newDataFittingVo ) {
+
+        ProEconPowerFittingAnalySis obj = newDataFittingService.newDataFitting(newDataFittingVo);
+        return JsonResult.successData(ResultCode.SUCCESS, obj);
+
+    }
+
+    /**
+     * 读取曲线,散点等数据
+     * @param id  拟合好的数据ID
+     * @return
+     */
+//    @GetMapping("curve")
+//    public JSONObject dataFittingCurve(String id){
+//        Map<String, Object> result = newDataFittingService.dataFittingCurve(id);
+//        return JsonResult.successData(ResultCode.SUCCESS, result);
+//    }
+
+
+
+    /**
+     * 通过key获取原始数据
+     * 对应前端的圈选功能
+     * @param yk  有用点的key
+     * @param wk  无用点的key
+     * @return
+     */
+//    @GetMapping("filter")
+//    public JSONObject dataFittingFilter(String yk, String wk){
+//        List<PowerPointData> list = newDataFittingService.dataOrigin(yk, wk);
+//        return JsonResult.successData(ResultCode.SUCCESS, list);
+//    }
+
+
+    /**
+     * file 文件数据展示
+     * @param id
+     * @return
+     */
+//    @GetMapping("show")
+//    public JSONObject dataFittingShow(String id){
+//        Map<String, Object> result = newDataFittingService.dataFittingShow(id);
+//        return JsonResult.successData(ResultCode.SUCCESS, result);
+//    }
+
+}

+ 161 - 2
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/specific/SpecificController.java

@@ -130,6 +130,21 @@ public class SpecificController {
      *
      * @return
      */
+    @GetMapping("/fdlList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-发电量", notes = "专题分析-发电量")
+    public R fdlList2(@RequestParam(value = "companys") String companys,
+                     @RequestParam(value = "type") String type,
+                     @RequestParam(value = "year") String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.fdlList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
     @GetMapping("/fdlList")
     @ResponseBody
     @ApiOperation(value = "专题分析-发电量", notes = "专题分析-发电量")
@@ -145,11 +160,27 @@ public class SpecificController {
         }
     }
 
+
     /**
      * 查询综合厂用电量
      *
      * @return
      */
+    @GetMapping("/zhcydlList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-综合厂用电量", notes = "专题分析-综合厂用电量")
+    public R zhcydlList2(@RequestParam(value = "companys") String companys,
+                        @RequestParam(value = "type") String type,
+                        @RequestParam(value = "year") String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.zhcydlList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
     @GetMapping("/zhcydlList")
     @ResponseBody
     @ApiOperation(value = "专题分析-综合厂用电量", notes = "专题分析-综合厂用电量")
@@ -170,6 +201,21 @@ public class SpecificController {
      *
      * @return
      */
+    @GetMapping("/gwdlList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-购网电量", notes = "专题分析-购网电量")
+    public R gwdldlList2(@RequestParam(value = "companys") String companys,
+                        @RequestParam(value = "type") String type,
+                        @RequestParam(value = "year") String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.gwdlList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
     @GetMapping("/gwdlList")
     @ResponseBody
     @ApiOperation(value = "专题分析-购网电量", notes = "专题分析-购网电量")
@@ -191,6 +237,21 @@ public class SpecificController {
      *
      * @return
      */
+    @GetMapping("/swdlList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-购网电量", notes = "专题分析-购网电量")
+    public R swdldlList2(@RequestParam(value = "companys") String companys,
+                        @RequestParam(value = "type") String type,
+                        @RequestParam(value = "year") String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.swdlList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
     @GetMapping("/swdlList")
     @ResponseBody
     @ApiOperation(value = "专题分析-购网电量", notes = "专题分析-购网电量")
@@ -212,6 +273,22 @@ public class SpecificController {
      *
      * @return
      */
+    @GetMapping("/lyxsList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-利用小时", notes = "专题分析-利用小时")
+    public R lyxsList2(@RequestParam(value = "companys") String companys,
+                      @RequestParam(value = "type") String type,
+                      @RequestParam(value = "year") String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.lyxsList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
     @GetMapping("/lyxsList")
     @ResponseBody
     @ApiOperation(value = "专题分析-利用小时", notes = "专题分析-利用小时")
@@ -232,6 +309,22 @@ public class SpecificController {
      *
      * @return
      */
+    @GetMapping("/gzsslList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-故障损失率", notes = "专题分析-故障损失率")
+    public R gzsslList2(@RequestParam(value = "companys") String companys,
+                       @RequestParam(value = "type") String type,
+                       @RequestParam(value = "year") String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.gzsslList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
     @GetMapping("/gzsslList")
     @ResponseBody
     @ApiOperation(value = "专题分析-故障损失率", notes = "专题分析-故障损失率")
@@ -247,11 +340,28 @@ public class SpecificController {
         }
     }
 
+
     /**
      * 查询维护损失率
      *
      * @return
      */
+    @GetMapping("/whsslList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-维护损失率", notes = "专题分析-维护损失率")
+    public R whsslList2(@RequestParam(value = "companys") String companys,
+                       @RequestParam(value = "type") String type,
+                       @RequestParam(value = "year") String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.whsslList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
     @GetMapping("/whsslList")
     @ResponseBody
     @ApiOperation(value = "专题分析-维护损失率", notes = "专题分析-维护损失率")
@@ -267,11 +377,28 @@ public class SpecificController {
         }
     }
 
+
     /**
      * 查询限电损失率
      *
      * @return
      */
+    @GetMapping("/xdsslList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-限电损失率", notes = "专题分析-限电损失率")
+    public R xdsslList2(@RequestParam(value = "companys", required = true) String companys,
+                       @RequestParam(value = "type", required = true) String type,
+                       @RequestParam(value = "year", required = true) String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.xdsslList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
     @GetMapping("/xdsslList")
     @ResponseBody
     @ApiOperation(value = "专题分析-限电损失率", notes = "专题分析-限电损失率")
@@ -287,11 +414,27 @@ public class SpecificController {
         }
     }
 
+
     /**
      * 查询性能损失率
      *
      * @return
      */
+    @GetMapping("/xnsslList2")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-性能损失率", notes = "专题分析-性能损失率")
+    public R xnsslList2(@RequestParam(value = "companys", required = true) String companys,
+                       @RequestParam(value = "type", required = true) String type,
+                       @RequestParam(value = "year", required = true) String year) throws ParseException {
+
+        List<SpecificTarget> resultList = specificService.xnsslList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
     @GetMapping("/xnsslList")
     @ResponseBody
     @ApiOperation(value = "专题分析-性能损失率", notes = "专题分析-性能损失率")
@@ -312,13 +455,28 @@ public class SpecificController {
      *
      * @return
      */
-    @GetMapping("/slsslList")
+    @GetMapping("/slsslList2")
     @ResponseBody
     @ApiOperation(value = "专题分析-受累损失率", notes = "专题分析-受累损失率")
-    public R slsslList(@RequestParam(value = "companys", required = true) String companys,
+    public R slsslList2(@RequestParam(value = "companys", required = true) String companys,
                        @RequestParam(value = "type", required = true) String type,
                        @RequestParam(value = "year", required = true) String year) throws ParseException {
 
+        List<SpecificTarget> resultList = specificService.slsslList2(companys, type, year);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+    @GetMapping("/slsslList")
+    @ResponseBody
+    @ApiOperation(value = "专题分析-受累损失率", notes = "专题分析-受累损失率")
+    public R slsslList(@RequestParam(value = "companys") String companys,
+                       @RequestParam(value = "type") String type,
+                       @RequestParam(value = "year") String year) throws ParseException {
+
         List<SpecificTarget> resultList = specificService.slsslList(companys, type, year);
         if (StringUtils.isNotNull(resultList)) {
             return R.data(ResultMsg.ok(resultList));
@@ -327,6 +485,7 @@ public class SpecificController {
         }
     }
 
+
     /**
      * 查询复位及时率
      *

+ 2 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/FiveLoss/AnnotationTool.java

@@ -1,5 +1,7 @@
 package com.gyee.runeconomy.dto.FiveLoss;
 
+import com.gyee.runeconomy.dto.speed.Desc;
+
 import java.lang.reflect.Field;
 import java.util.Collections;
 import java.util.LinkedList;

+ 0 - 22
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/FiveLoss/Desc.java

@@ -1,22 +0,0 @@
-package com.gyee.runeconomy.dto.FiveLoss;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-
-/**
- * 配置通过注解
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Desc {
-
-    String des();
-
-    String uniformCode() default "";
-
-    String remark() default "";
-
-}

+ 14 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/init/CacheContext.java

@@ -4,6 +4,7 @@ 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.config.GyeeConfig;
 import com.gyee.runeconomy.model.TemperatureInfo;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.*;
@@ -84,6 +85,9 @@ public class CacheContext implements CommandLineRunner {
     @Resource
     private ITemperatureinfoService iTemperatureinfoService;
 
+    @Resource
+    GyeeConfig config;
+
 
     /**
      * 温度矩阵信息
@@ -175,6 +179,8 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String, ProBasicPowerstation> wpmaps = new HashMap<>();
     public static Map<String, String> wppmap = new HashMap<>();
 
+    public static Map<String, List<ProBasicEquipmentPoint>> pointNewMap = new HashMap<>();
+
 
     @Override
     public void run(String... args) throws Exception {
@@ -666,11 +672,19 @@ public class CacheContext implements CommandLineRunner {
         statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String, List<ProBasicStatusPoint>>>() {
         });
 
+        cacheNewPoints();
         initTemperatureInfo();
 
         logger.info("缓存结束------------------------------------------------------------");
     }
 
+
+    private void cacheNewPoints() {
+        List<ProBasicEquipmentPoint> list = new ArrayList<>();
+        wpls.stream().forEach(d -> list.addAll(proBasicEquipmentPointService.selectList(d.getId(), config.getPoints())));
+        pointNewMap.putAll(list.stream().collect(Collectors.groupingBy(u -> u.getWindturbineId())));
+    }
+
     private void initTemperatureInfo() {
         Map<String, TemperatureInfo> tis = new HashMap<>();
 //        Map<String, StationStatus> ssm = getStationStatusMap();

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

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

+ 43 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/TsDoubleData.java

@@ -0,0 +1,43 @@
+package com.gyee.runeconomy.model;
+
+// 数据适配器取数对应的类
+public class TsDoubleData {
+
+    private long ts;
+    private int status;
+    private double doubleValue;
+
+    public TsDoubleData(long ts, double doubleValue) {
+        this.ts = ts;
+        this.doubleValue = doubleValue;
+    }
+
+    public TsDoubleData() {
+    }
+
+    public long getTs() {
+        return ts;
+    }
+
+    public void setTs(long ts) {
+        this.ts = ts;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public double getDoubleValue() {
+//        BigDecimal bg = new BigDecimal(doubleValue);
+//        double v = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+        return doubleValue;
+    }
+
+    public void setDoubleValue(double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+}

+ 71 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProEconPowerFittingAnalySis.java

@@ -0,0 +1,71 @@
+package com.gyee.runeconomy.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_econ_power_fitting_analy_sis")
+public class ProEconPowerFittingAnalySis extends Model<ProEconPowerFittingAnalySis> {
+
+    private static final long serialVersionUID=1L;
+
+    private String id;
+
+    private String station;
+
+    private String windturbineId;
+
+    private String time;
+
+    private String path;
+
+    private String type;
+
+    private String interval;
+
+    private String processid;
+
+    private String stationcn;
+
+    private String code;
+
+    private double cpavg;
+
+    private double speedavg;
+
+    private double frequency;
+
+    private double pcratio;
+
+    private double pc5ratio;
+
+    private double pc10ratio;
+
+    private double pc12ratio;
+
+    private double pc25ratio;
+
+    private Integer interp;
+
+    private Integer iscal;
+
+
+//    @Override
+//    protected Serializable pkVal() {
+//        return this.id;
+//    }
+
+}

+ 75 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/StationInfoDay.java

@@ -0,0 +1,75 @@
+package com.gyee.runeconomy.model.auto;
+
+import java.math.BigDecimal;
+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-11-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("station_info_day")
+public class StationInfoDay implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场站
+     */
+    private String stationId;
+
+    /**
+     * 时间
+     */
+    private LocalDate recordDate;
+
+    /**
+     * 安全天数
+     */
+    private Integer aqts;
+
+    private Integer swdl;
+
+    private Integer gwdl;
+
+    private Integer cydl;
+
+    private Integer rfdl;
+
+    private Integer zhcydl;
+
+    private BigDecimal hjwd;
+
+    private BigDecimal rfdlFj;
+
+    /**
+     * 站用变
+     */
+    private Integer zyb;
+
+    /**
+     * 计划发电量
+     */
+    private BigDecimal jhfdl;
+
+
+}

+ 111 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/NewDataFittingVo.java

@@ -0,0 +1,111 @@
+package com.gyee.runeconomy.model.vo;
+
+import lombok.Data;
+
+@Data
+public class NewDataFittingVo {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 场站
+     */
+    private String station;
+    /**
+     * 风机
+     */
+    private String wtIds;
+    /**
+     * 开始时间
+     */
+    private Long st;
+    /**
+     * 结束时间
+     */
+    private Long et;
+    /**
+     * 时间间隔
+     */
+    private Integer interval;
+    /**
+     * 最大风速
+     */
+    private Double maxs;
+    /**
+     * 最小风速
+     */
+    private Double mins;
+    /**
+     * 最大功率
+     */
+    private Double maxp;
+    /**
+     * 最小功率
+     */
+    private Double minp;
+    /**
+     * 非并网
+     */
+    private Boolean isfbw;
+    /**
+     * 非合理值
+     */
+    private Boolean isfhl;
+    /**
+     * 并网后10分钟
+     */
+    private Boolean isbw;
+    /**
+     * 停机前10分钟
+     */
+    private Boolean istj;
+    /**
+     * 功率曲线偏差
+     */
+    private Boolean isglpc;
+    /**
+     * 是否欠符合
+     */
+    private Boolean isqfh;
+    /**
+     * 欠符合等级
+     */
+    private Integer qfhdj;
+    /**
+     * 多项式
+     */
+    private Integer dimension;
+    /**
+     *  拟合方式  0:单台拟合  1:合并拟合  2:同名拟合
+     */
+    private Integer mode;
+
+    public Boolean getIsfbw() {
+        isfbw = isfbw == null ? false : isfbw;
+        return isfbw;
+    }
+
+    public Boolean getIsfhl() {
+        isfhl = isfhl == null ? false : isfhl;
+        return isfhl;
+    }
+
+    public Boolean getIsbw() {
+        isbw = isbw == null ? false : isbw;
+        return isbw;
+    }
+
+    public Boolean getIstj() {
+        istj = istj == null ? false : istj;
+        return istj;
+    }
+
+    public Boolean getIsglpc() {
+        isglpc = isglpc == null ? false : isglpc;
+        return isglpc;
+    }
+
+    public Boolean getIsqfh() {
+        isqfh = isqfh == null ? false : isqfh;
+        return isqfh;
+    }
+
+}

+ 273 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Comprehensive/ComprehensiveelectricityService.java

@@ -10,8 +10,10 @@ import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
 import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
 import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay5;
+import com.gyee.runeconomy.model.auto.StationInfoDay;
 import com.gyee.runeconomy.service.auto.IProBasicPowerstationPointService;
 import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay5Service;
+import com.gyee.runeconomy.service.auto.IStationInfoDayService;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
 import org.springframework.stereotype.Service;
 
@@ -30,7 +32,10 @@ public class ComprehensiveelectricityService {
     @Resource
     private IEdosUtil edosUtil;
 
-    public Map<String, Object> Comprehensive(String wpId, String year) throws Exception {
+    @Resource
+    private IStationInfoDayService iStationInfoDayService;
+
+    public Map<String, Object> Comprehensive2(String wpId, String year) throws Exception {
 
         List<ProBasicPowerstation> wpls = CacheContext.wpls.stream().filter(g -> wpId.equals(g.getId())).collect(Collectors.toList());
         List<ComprehensiveVo> vos = new ArrayList<ComprehensiveVo>();
@@ -295,4 +300,271 @@ public class ComprehensiveelectricityService {
 
         return map;
     }
+
+
+    public Map<String, Object> Comprehensive(String wpId, String year) throws Exception {
+
+        List<ProBasicPowerstation> wpls = CacheContext.wpls.stream().filter(g -> wpId.equals(g.getId())).collect(Collectors.toList());
+        List<ComprehensiveVo> vos = new ArrayList<ComprehensiveVo>();
+        Map<String, Object> map = new LinkedHashMap<>();
+
+        //当前年份
+        Calendar cal = Calendar.getInstance();
+        int dqnf = cal.get(Calendar.YEAR);//本年
+
+        //参数所传年份
+        int currentyear = Integer.parseInt(year);
+
+
+        // 设置为本年一月一号0点
+        Calendar calendar1 = Calendar.getInstance();
+        calendar1.setTime(new Date());
+        calendar1.set(Calendar.YEAR, currentyear); // 根据当前年份变化
+        calendar1.set(Calendar.MONTH, Calendar.JANUARY); // 0表示一月
+        calendar1.set(Calendar.DAY_OF_MONTH, 1);
+        calendar1.set(Calendar.HOUR_OF_DAY, 0);
+        calendar1.set(Calendar.MINUTE, 0);
+        calendar1.set(Calendar.SECOND, 0);
+        calendar1.set(Calendar.MILLISECOND, 0);
+        Date firstDayZeroHour = calendar1.getTime();
+
+        // 获取firstDayZeroHour的月份
+        Calendar calFirstDayZeroHour = Calendar.getInstance();
+        calFirstDayZeroHour.setTime(firstDayZeroHour);
+        int calFirstMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
+        //当前时间月份
+        Calendar calendar = Calendar.getInstance();
+        int currentMonth = calendar.get(Calendar.MONTH);
+        currentMonth = currentMonth + 1;
+
+
+        // 设置为年初一月一号0点,同比计算取值时间(减去一年,比今年计算少一年)
+        Calendar calendar3 = Calendar.getInstance();
+        calendar3.setTime(new Date());
+        calendar3.set(Calendar.YEAR, currentyear - 1); // 根据当前年份变化
+        calendar3.set(Calendar.MONTH, Calendar.JANUARY); // 0表示一月
+        calendar3.set(Calendar.DAY_OF_MONTH, 1);
+        calendar3.set(Calendar.HOUR_OF_DAY, 0);
+        calendar3.set(Calendar.MINUTE, 0);
+        calendar3.set(Calendar.SECOND, 0);
+        calendar3.set(Calendar.MILLISECOND, 0);
+        Date tbjssj = calendar3.getTime();
+
+
+        // 去年十二月一号0点值,环比计算取值时间(初始设置为去年十二月,每循环一次增加一月)
+        Calendar calendar2 = Calendar.getInstance();
+        calendar2.setTime(new Date());
+        // 设置年份为传递的currentyear的前一年
+        calendar2.set(Calendar.YEAR, currentyear - 1);
+        // 设置月份为十二月
+        calendar2.set(Calendar.MONTH, Calendar.DECEMBER); // 11表示十二月
+        // 设置日期为每月的第一天
+        calendar2.set(Calendar.DAY_OF_MONTH, 1);
+        calendar2.set(Calendar.HOUR_OF_DAY, 0);
+        calendar2.set(Calendar.MINUTE, 0);
+        calendar2.set(Calendar.SECOND, 0);
+        calendar2.set(Calendar.MILLISECOND, 0);
+        Date hbjssj = calendar2.getTime();
+
+        double zhcydlsum = 0.0;
+        double sjdlsum = 0.0;
+        double swdlsum = 0.0;
+        double gwdlsum = 0.0;
+        double zhcydllsum = 0.0;
+
+        for (int i = 1; i <= 12; i++) {
+
+            //综合场用电量
+            double zhcydl = 0.0;
+            double zhcydltb = 0.0;
+            double zhcydlhb = 0.0;
+
+            //实际电量
+            double sjdl = 0.0;
+            double sjdltb = 0.0;
+            double sjdlhb = 0.0;
+
+            //上网电量
+            double swdl = 0.0;
+            double swdltb = 0.0;
+            double swdlhb = 0.0;
+
+            //购网电量
+            double gwdl = 0.0;
+            double gwdltb = 0.0;
+            double gwdlhb = 0.0;
+
+            //综合场用电率
+            double zhcydll = 0.0;
+            double zhcydlltb = 0.0;
+            double zhcydllhb = 0.0;
+
+
+            for (ProBasicPowerstation wp : wpls) {
+                //当前场站本年循环所有指标取值集合
+
+                double rfdlsj = 0.0;
+                List<StationInfoDay> zbls = iStationInfoDayService.getmax(wp.getId(), firstDayZeroHour);
+                List<StationInfoDay> tbzbls = iStationInfoDayService.getmax(wp.getId(), tbjssj);
+                List<StationInfoDay> hbzbls = iStationInfoDayService.getmax(wp.getId(), hbjssj);
+
+
+                ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.RFDL);
+                rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
+
+                if (!zbls.isEmpty() && zbls != null) {
+                    //综合场用电量取值
+                    zhcydl = zbls.get(0).getZhcydl().doubleValue();
+                    zhcydlsum += zhcydl;
+                    //发电量取值
+                    if (calFirstMonth == currentMonth && currentyear == dqnf) {
+                        //                        sjdl = (zbls.get(0).getYfdldb().doubleValue() / 10000) + (rfdlsj / 10000);
+                        sjdl = (zbls.get(0).getRfdlFj().doubleValue() );
+                    } else {
+                        sjdl = zbls.get(0).getRfdlFj().doubleValue();
+                    }
+                    sjdlsum += sjdl;
+
+                    //上网电量取值
+                    swdl = zbls.get(0).getSwdl().doubleValue();
+                    swdlsum += swdl;
+                    //购网电量取值
+                    gwdl = zbls.get(0).getGwdl().doubleValue();
+                    gwdlsum += gwdl;
+                    //综合场用电率计算 —— 综合场用电率=(发电量-上网电量+购网电量)/发电量
+                    if (sjdl != 0) {
+                        zhcydll = (sjdl - swdl + gwdl) / sjdl;
+                    } else {
+                        zhcydll = (sjdl - swdl + gwdl) / 1;
+                    }
+                    zhcydllsum += zhcydll;
+                }
+                if (!tbzbls.isEmpty() && tbzbls != null) {
+                    zhcydltb = tbzbls.get(0).getZhcydl().doubleValue();
+                    sjdltb = tbzbls.get(0).getRfdlFj().doubleValue();
+                    swdltb = tbzbls.get(0).getSwdl().doubleValue();
+                    gwdltb = tbzbls.get(0).getGwdl().doubleValue();
+                    if (sjdltb != 0) {
+                        zhcydlltb = (sjdltb - swdltb + gwdltb) / sjdltb;
+                    } else {
+                        zhcydlltb = (sjdltb - swdltb + gwdltb) / 1;
+                    }
+                }
+                if (!hbzbls.isEmpty() && hbzbls != null) {
+                    zhcydlhb = hbzbls.get(0).getZhcydl().doubleValue();
+                    sjdlhb = hbzbls.get(0).getRfdlFj().doubleValue();
+                    swdlhb = hbzbls.get(0).getSwdl().doubleValue();
+                    gwdlhb = hbzbls.get(0).getGwdl().doubleValue();
+                    if (sjdlhb != 0) {
+                        zhcydllhb = (sjdlhb - swdlhb + gwdlhb) / sjdlhb;
+                    } else {
+                        zhcydllhb = (sjdlhb - swdlhb + gwdlhb) / 1;
+                    }
+                }
+
+
+                //添加各指标
+                ComprehensiveVo vo = new ComprehensiveVo();
+
+                //添加综合厂用电量数据
+                vo.setZhcydl(StringUtils.round(zhcydl, 2));
+                if (zhcydltb != 0) {
+                    //                    vo.setZhcydltb(StringUtils.round((zhcydl - zhcydltb) / zhcydltb * 100, 0));
+                    vo.setZhcydltb(StringUtils.round(zhcydltb, 2));
+                } else {
+                    vo.setZhcydltb(0.0);
+                }
+
+                if (zhcydlhb != 0) {
+                    //                    vo.setZhcydlhb(StringUtils.round((zhcydl - zhcydlhb) / zhcydlhb * 100, 0));
+                    vo.setZhcydlhb(StringUtils.round(zhcydlhb, 2));
+                } else {
+                    vo.setZhcydlhb(0.0);
+                }
+
+                //添加时间戳
+                vo.setHours(i);
+
+                //添加实际电量数据
+                vo.setSjdl(StringUtils.round(sjdl, 2));
+
+                if (sjdltb != 0) {
+                    //                    vo.setSjdltb(StringUtils.round((sjdl - sjdltb) / sjdltb * 100, 0));
+                    vo.setSjdltb(StringUtils.round(sjdltb, 2));
+                } else {
+                    vo.setSjdltb(0.0);
+                }
+                if (sjdlhb != 0) {
+                    //                    vo.setSjdlhb(StringUtils.round((sjdl - sjdlhb) / sjdlhb * 100, 0));
+                    vo.setSjdlhb(StringUtils.round(sjdlhb, 2));
+                } else {
+                    vo.setSjdlhb(0.0);
+                }
+
+                //添加上网电量数据
+                vo.setSwdl(StringUtils.round(swdl, 2));
+                if (swdltb != 0) {
+                    //                    vo.setSwdltb(StringUtils.round((swdl - swdltb) / swdltb * 100, 0));
+                    vo.setSwdltb(StringUtils.round(swdltb, 2));
+                } else {
+                    vo.setSwdltb(0.0);
+                }
+                if (swdlhb != 0) {
+                    //                    vo.setSwdlhb(StringUtils.round((swdl - swdlhb) / swdlhb * 100, 0));
+                    vo.setSwdlhb(StringUtils.round(swdlhb, 2));
+                } else {
+                    vo.setSwdlhb(0.0);
+                }
+
+                //添加购网电量数据
+                vo.setGwdl(StringUtils.round(gwdl, 2));
+                if (gwdltb != 0) {
+                    //                    vo.setGwdltb(StringUtils.round((gwdl - gwdltb) / gwdltb * 100, 0));
+                    vo.setGwdltb(StringUtils.round(gwdltb, 2));
+                } else {
+                    vo.setGwdltb(0.0);
+                }
+
+                if (gwdlhb != 0) {
+                    //                    vo.setGwdlhb(StringUtils.round((gwdl - gwdlhb) / gwdlhb * 100, 0));
+                    vo.setGwdlhb(StringUtils.round(gwdlhb, 2));
+                } else {
+                    vo.setGwdlhb(0.0);
+                }
+
+                //添加综合厂用电率数据
+                vo.setZhcydll(StringUtils.round(zhcydll * 100, 0));
+
+                if (zhcydlltb != 0) {
+                    //                    vo.setZhcydlltb(StringUtils.round((zhcydll - zhcydlltb) / zhcydlltb * 100, 0));
+                    vo.setZhcydlltb(StringUtils.round(zhcydlltb, 2));
+                } else {
+                    vo.setZhcydlltb(0.0);
+                }
+
+                if (zhcydllhb != 0) {
+                    //                    vo.setZhcydllhb(StringUtils.round((zhcydll - zhcydllhb) / zhcydllhb * 100, 0));
+                    vo.setZhcydllhb(StringUtils.round(zhcydllhb, 2));
+                } else {
+                    vo.setZhcydllhb(0.0);
+                }
+                vos.add(vo);
+                SortUtils.sort(vos, "hours", SortUtils.ASC);
+                map.put("value", vos);
+
+            }
+            firstDayZeroHour = DateUtils.addMonths(firstDayZeroHour, 1);
+            calFirstDayZeroHour.setTime(firstDayZeroHour);
+            calFirstMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
+            hbjssj = DateUtils.addMonths(hbjssj, 1);
+            tbjssj = DateUtils.addMonths(tbjssj, 1);
+        }
+        map.put("zhcydlsum", StringUtils.round(zhcydlsum, 2));
+        map.put("sjdlsum", StringUtils.round(sjdlsum, 2));
+        map.put("swdlsum", StringUtils.round(swdlsum, 2));
+        map.put("gwdlsum", StringUtils.round(gwdlsum, 2));
+        map.put("zhcydllsum", StringUtils.round(zhcydllsum * 100, 0));
+
+        return map;
+    }
 }

+ 21 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IStationInfoDayService.java

@@ -0,0 +1,21 @@
+package com.gyee.runeconomy.service.auto;
+
+import com.gyee.runeconomy.model.auto.StationInfoDay;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-11-28
+ */
+public interface IStationInfoDayService extends IService<StationInfoDay> {
+
+    List<StationInfoDay> getmax(String foreignKeyId, Date date);
+
+}

+ 79 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/StationInfoDayServiceImpl.java

@@ -0,0 +1,79 @@
+package com.gyee.runeconomy.service.auto.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.model.StringUtils;
+import com.gyee.common.util.DateUtils;
+import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay5;
+import com.gyee.runeconomy.model.auto.StationInfoDay;
+import com.gyee.runeconomy.mapper.auto.StationInfoDayMapper;
+import com.gyee.runeconomy.service.auto.IStationInfoDayService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author xujuanning
+ * @since 2024-11-28
+ */
+@Service
+public class StationInfoDayServiceImpl extends ServiceImpl<StationInfoDayMapper, StationInfoDay> implements IStationInfoDayService {
+
+    @Override
+    public List<StationInfoDay> getmax(String foreignKeyId, Date date) {
+        QueryWrapper<StationInfoDay> qw = null;
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int specifiedYear = calendar.get(Calendar.YEAR);
+        int specifiedMonth = calendar.get(Calendar.MONTH) + 1;
+        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
+        calendar.set(Calendar.HOUR_OF_DAY, 23);
+        calendar.set(Calendar.MINUTE, 59);
+        calendar.set(Calendar.SECOND, 59);
+
+        Date endOfDayOfLastDayOfMonth = calendar.getTime();
+
+        // 获取当前日期的年份和月份
+        int currentYear = Calendar.getInstance().get(Calendar.YEAR);
+        int currentMonth = Calendar.getInstance().get(Calendar.MONTH) + 1;
+
+
+        // 判断指定日期是否是当前月份
+        if (currentYear == specifiedYear && currentMonth == specifiedMonth) {
+            // 如果是当前月份,则将endOfDayOfLastDayOfMonth减去一天
+            Calendar calendar2 = Calendar.getInstance();  // 创建 Calendar 对象,表示当前时间
+            calendar2.add(Calendar.DAY_OF_MONTH, -1);  // 减去一天
+
+            // 设置时、分、秒为最后时刻
+            calendar2.set(Calendar.HOUR_OF_DAY, 23);
+            calendar2.set(Calendar.MINUTE, 59);
+            calendar2.set(Calendar.SECOND, 59);
+
+            endOfDayOfLastDayOfMonth = calendar2.getTime();  // 获取计算后的时间
+        }
+
+        //当前数据
+        List<StationInfoDay> currlist = new ArrayList<>();
+        if (null != date) {
+            qw = new QueryWrapper<>();
+            if (StringUtils.isNotEmpty(foreignKeyId)) {
+                qw.lambda().eq(StationInfoDay::getStationId, foreignKeyId);
+            }
+            qw.lambda().between(StationInfoDay::getRecordDate, DateUtils.getMonthFirst(date), endOfDayOfLastDayOfMonth);
+            qw.lambda().orderByDesc(StationInfoDay::getRecordDate);
+            qw.last("limit 1");
+            currlist = baseMapper.selectList(qw);
+
+        }
+        return currlist;
+    }
+
+}

ファイルの差分が大きいため隠しています
+ 1857 - 354
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java