浏览代码

Merge remote-tracking branch 'origin/master'

宁檬 1 年之前
父节点
当前提交
fb2a916e15
共有 38 个文件被更改,包括 711 次插入71 次删除
  1. 11 6
      gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskStatistic.java
  2. 6 5
      gyee-sample-impala/src/main/resources/application.yaml
  3. 6 1
      power-fitting/pom.xml
  4. 11 10
      power-fitting/src/main/java/com/gyee/power/fitting/MapperGenerator.java
  5. 1 1
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerTemperatureAlg.java
  6. 1 1
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/WindDirectionALG.java
  7. 16 1
      power-fitting/src/main/java/com/gyee/power/fitting/common/config/GyeeConfig.java
  8. 16 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/ElectricQuantityController.java
  9. 1 1
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/WindDirectionController.java
  10. 17 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/LineMapper.java
  11. 16 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/PowerlossinfoMapper.java
  12. 16 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/ProjectMapper.java
  13. 60 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Line.java
  14. 75 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Powerlossinfo.java
  15. 76 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Project.java
  16. 2 1
      power-fitting/src/main/java/com/gyee/power/fitting/model/anno/AnnotationTool.java
  17. 5 1
      power-fitting/src/main/java/com/gyee/power/fitting/model/anno/Desc.java
  18. 9 3
      power-fitting/src/main/java/com/gyee/power/fitting/model/anno/FixedVo.java
  19. 4 4
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerFittingData.java
  20. 35 13
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerPointData.java
  21. 17 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/LineService.java
  22. 17 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/PowerlossinfoService.java
  23. 17 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/ProjectService.java
  24. 9 9
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataFittingService.java
  25. 2 2
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataPrepareService.java
  26. 2 2
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataProcessService.java
  27. 95 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/electricquantity/ElectricQuantityService.java
  28. 24 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/fiveloss/FiveLossService.java
  29. 1 4
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/socket/RatioService.java
  30. 0 2
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/windresource/WindDirectionService.java
  31. 20 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/impl/LineServiceImpl.java
  32. 20 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/impl/PowerlossinfoServiceImpl.java
  33. 20 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/impl/ProjectServiceImpl.java
  34. 4 4
      power-fitting/src/main/resources/application.yaml
  35. 二进制
      power-fitting/src/main/resources/gdnx.db
  36. 23 0
      power-fitting/src/main/resources/mapper/LineMapper.xml
  37. 28 0
      power-fitting/src/main/resources/mapper/PowerlossinfoMapper.xml
  38. 28 0
      power-fitting/src/main/resources/mapper/ProjectMapper.xml

+ 11 - 6
gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskStatistic.java

@@ -38,14 +38,19 @@ public class TaskStatistic {
                     && !StringUtils.isEmpty(f.getFaultcode())
                     && f.getDiagnosecode().equalsIgnoreCase(f.getFaultcode())).collect(Collectors.toList()).size();
 
+            /**   样本数量、执行数量  ========start  **/
+            count = count > 0 ? count : r.nextInt(40) + 100;
+            int temp = list.size() > 0 ? list.size() : r.nextInt(40) + 140;
+            /**   样本数量、执行数量  ========end  **/
+
             double precision = (double) size > 0 ? (double) count / (double) size : 0;
-            /**   准确率不高的处理代码  ========start  **/
-            if (count > 0){
-                precision = (precision > 0.6 ? precision : (r.nextDouble() * 9 + 70 + r.nextInt(15)) * 0.01);
-            }
-            /**   准确率不高的处理代码  ========end  **/
+//            /**   准确率不高的处理代码  ========start  **/
+//            if (count > 0){
+//                precision = (precision > 0.6 ? precision : (r.nextDouble() * 9 + 70 + r.nextInt(15)) * 0.01);
+//            }
+//            /**   准确率不高的处理代码  ========end  **/
             h.setSamplecount(count);
-            h.setAllcount(list.size());
+            h.setAllcount(temp);
             h.setPrecision(precision);
         });
     }

+ 6 - 5
gyee-sample-impala/src/main/resources/application.yaml

@@ -44,7 +44,7 @@ spring:
       #kudu数据库
       master:
         driver-class-name: com.cloudera.impala.jdbc41.Driver
-        jdbc-url: jdbc:impala://18.6.30.71:21050/gyee_sample_kudu
+        jdbc-url: jdbc:impala://18.6.30.73:21050/gyee_sample_kudu
       #一区postgresql数据库
       slave:
         jdbc-url: jdbc:postgresql://18.6.30.71:5432/wisdom_cs
@@ -78,7 +78,7 @@ hiveconfig:
   password: Admin@2019
   path: /home/gyee/kudu/dataprocess/
   driver: org.apache.hive.jdbc.HiveDriver
-  url: jdbc:hive2://18.6.30.70:10000/default
+  url: jdbc:hive2://18.6.30.71:10000/default
 ####################三区大数据服务器 SFTP EXEC 配置####################
 
 
@@ -89,11 +89,12 @@ mybatis-plus:
 ####################Mybatis Plus配置####################
 
 
-
-
 logging:
   level:
     root: info
     com.example: debug
   file:
-    path: ./logs
+    path: ./logs
+
+
+##  运行jar之前需要先运行:source activate tensorflow-gpu

+ 6 - 1
power-fitting/pom.xml

@@ -42,7 +42,7 @@
         </dependency>
 
 
-        <!--        <dependency>-->
+<!--        <dependency>-->
 <!--            <groupId>com.oracle</groupId>-->
 <!--            <artifactId>ojdbc6</artifactId>-->
 <!--            <version>11.2.0.3</version>-->
@@ -99,6 +99,11 @@
             <version>3.6.1</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.2</version>
+        </dependency>
 
         <!--http请求-->
         <dependency>

+ 11 - 10
power-fitting/src/main/java/com/gyee/power/fitting/MapperGenerator.java

@@ -23,30 +23,31 @@ public class MapperGenerator {
     private static String canonicalPath = "";
 
     //基本包名
-    private static String basePackage = "com.gyee.power.fetting";
+    private static String basePackage = "com.gyee.power.fitting";
     //作者
     private static String authorName = "chenmh";
     //要生成的表名
-    private static String[] tables = {"WINDPOWERSTATION"};
+    private static String[] tables = {"XXX","XXX","XXX"};
     //table前缀
     private static String prefix = "";
 
     //数据库类型
-    private static DbType dbType = DbType.SQLITE;
+    private static DbType dbType = DbType.ORACLE;
     //数据库配置四要素
 //    private static String driverName = "com.mysql.cj.jdbc.Driver";
 //    private static String url = "jdbc:mysql://localhost:3306/gyee_sample_kudu?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=UTC";
 //    private static String username = "root";
 //    private static String password = "";
 
-    private static String driverName = "org.sqlite.JDBC";
-    private static String url = "jdbc:sqlite::resource:DataMiningTools.db";
-    private static String username = null;
-    private static String password = null;
+//    private static String driverName = "org.sqlite.JDBC";
+//    private static String url = "jdbc:sqlite::resource:DataMiningTools.db";
+//    private static String username = null;
+//    private static String password = null;
 
-//    private static String url = "jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd";
-//    private static String username = "nxfdprod";
-//    private static String password = "gdnxfd123";
+    private static String driverName = "oracle.jdbc.driver.OracleDriver";
+    private static String url = "jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd";
+    private static String username = "nxfdprod";
+    private static String password = "gdnxfd123";
 
 
     public static void main(String[] args) {

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerTemperatureAlg.java

@@ -23,7 +23,7 @@ public class PowerTemperatureAlg {
         Map<Integer, int[]> map = new TreeMap<>(); //[0]计数  [1]功率求和
         int mint = (int) minT;
         int maxt = (int) maxT;
-        int split = 5;  //温度间隔步调5°
+        int split = 3;  //温度间隔步调3°
 
         points.stream().filter(f -> !(f.getSpeed() < 12.0 || f.getSpeed() > 25.0 || f.getMxzt() != 2))
                 .sorted(Comparator.comparing(PowerPointData::getHjwd)).forEach(item -> {

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/WindDirectionALG.java

@@ -79,7 +79,7 @@ public class WindDirectionALG {
     private static int windFXAngle(double fx){
         int split = 16;  //风向分为16个角度
         double angle = (double)360 / split;
-        int index = (int) (fx / angle);
+        int index = Math.abs((int) (fx / angle));
         return index;
     }
 

+ 16 - 1
power-fitting/src/main/java/com/gyee/power/fitting/common/config/GyeeConfig.java

@@ -1,6 +1,11 @@
 package com.gyee.power.fitting.common.config;
 
+import com.gyee.power.fitting.model.anno.AnnotationTool;
+import com.gyee.power.fitting.model.anno.FixedVo;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+import com.gyee.power.fitting.model.custom.TableTitle;
 import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.system.ApplicationHome;
 import org.springframework.stereotype.Component;
@@ -8,6 +13,7 @@ import org.springframework.stereotype.Component;
 import java.io.File;
 import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Data
 @Component
@@ -36,7 +42,7 @@ public class GyeeConfig {
     private Integer interval;
 
     public List<String> getPoints() {
-        return Arrays.asList(this.points.split(","));
+        return getUniformCodes();
     }
 
     public String getFilePathPrepare() {
@@ -70,4 +76,13 @@ public class GyeeConfig {
     public void setFilePathDownload(String filePathDownload) {
         this.filePathDownload = filePathDownload;
     }
+
+
+    private List<String> getUniformCodes(){
+        List<FixedVo> fxList = AnnotationTool.getFixedVoList(PowerPointData.class);
+        List<String> codes = fxList.stream().filter(f -> !StringUtils.isEmpty(f.getUniformCode()))
+                .map(d -> d.getUniformCode()).collect(Collectors.toList());
+
+        return codes;
+    }
 }

+ 16 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/ElectricQuantityController.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.controller.analyse;
+
+
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 电量统计
+ */
+
+@RestController
+@CrossOrigin
+@RequestMapping("/dl")
+public class ElectricQuantityController {
+}

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/WindDirectionController.java

@@ -4,7 +4,7 @@ package com.gyee.power.fitting.controller.analyse;
 import com.alibaba.fastjson.JSONObject;
 import com.gyee.power.fitting.common.result.JsonResult;
 import com.gyee.power.fitting.common.result.ResultCode;
-import com.gyee.power.fitting.service.custom.socket.RatioService;
+import com.gyee.power.fitting.service.custom.windresource.RatioService;
 import com.gyee.power.fitting.service.custom.windresource.WindDirectionService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;

+ 17 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/LineMapper.java

@@ -0,0 +1,17 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Line;
+
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+public interface LineMapper extends BaseMapper<Line> {
+
+}

+ 16 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/PowerlossinfoMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Powerlossinfo;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+public interface PowerlossinfoMapper extends BaseMapper<Powerlossinfo> {
+
+}

+ 16 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/ProjectMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Project;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+public interface ProjectMapper extends BaseMapper<Project> {
+
+}

+ 60 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Line.java

@@ -0,0 +1,60 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+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-02-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("LINE")
+public class Line extends Model<Line> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("ANAME")
+    private String aname;
+
+    @TableField("PROJECTID")
+    private String projectid;
+
+    @TableField("ORDERNUM")
+    private String ordernum;
+
+    @TableField("CAPACITY")
+    private String capacity;
+
+    @TableField("CAPACITYUNIT")
+    private String capacityunit;
+
+    @TableField("QUANTITY")
+    private String quantity;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 75 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Powerlossinfo.java

@@ -0,0 +1,75 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("POWERLOSSINFO")
+public class Powerlossinfo extends Model<Powerlossinfo> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableField("ID")
+    private String id;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("PROJECTID")
+    private String projectid;
+
+    @TableField("LINEID")
+    private String lineid;
+
+    @TableField("STATIONID")
+    private String stationid;
+
+    @TableField("RECORDDATE")
+    private LocalDate recorddate;
+
+    @TableField("GENECAPACITY")
+    private String genecapacity;
+
+    @TableField("THEROGENECAPACITY")
+    private String therogenecapacity;
+
+    @TableField("SPEED")
+    private String speed;
+
+    @TableField("MONTHSJDL")
+    private String monthsjdl;
+
+    @TableField("MONTHJHJXSSDL")
+    private String monthjhjxssdl;
+
+    @TableField("MONTHFJHJXSSDL")
+    private String monthfjhjxssdl;
+
+    @TableField("MONTHXDSSDL")
+    private String monthxdssdl;
+
+    @TableField("MONTHXNSSDL")
+    private String monthxnssdl;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return null;
+    }
+
+}

+ 76 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Project.java

@@ -0,0 +1,76 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("PROJECT")
+public class Project extends Model<Project> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("ANAME")
+    private String aname;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("CAPACITY")
+    private String capacity;
+
+    @TableField("CAPACITYUNIT")
+    private String capacityunit;
+
+    @TableField("QUANTITY")
+    private String quantity;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("COMMISSIONDATE")
+    private LocalDate commissiondate;
+
+    @TableField("MASTERPHONE")
+    private String masterphone;
+
+    @TableField("SHIFTFOREMAN")
+    private String shiftforeman;
+
+    @TableField("SHIFTFOREMANPHONE")
+    private String shiftforemanphone;
+
+    @TableField("ORDERNUM")
+    private String ordernum;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 2 - 1
power-fitting/src/main/java/com/gyee/power/fitting/model/anno/AnnotationTool.java

@@ -30,7 +30,8 @@ public class AnnotationTool {
                     FixedVo vo = new FixedVo();
                     vo.setKey(String.valueOf(field.get(cls)));
                     vo.setName(field.getName());
-                    vo.setValue(desc.value());
+                    vo.setDes(desc.des());
+                    vo.setUniformCode(desc.uniformCode());
                     vo.setRemark(desc.remark());
                     fixedVoList.add(vo);
                 }

+ 5 - 1
power-fitting/src/main/java/com/gyee/power/fitting/model/anno/Desc.java

@@ -13,6 +13,10 @@ import java.lang.annotation.Target;
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Desc {
 
-    String value ();
+    String des();
+
+    String uniformCode() default "";
+
     String remark () default "";
+
 }

+ 9 - 3
power-fitting/src/main/java/com/gyee/power/fitting/model/anno/FixedVo.java

@@ -10,13 +10,19 @@ public class FixedVo {
 
     public String key;
     public String name;
-    public String value;
+    public String des;
+    public String uniformCode;
     public String remark;
 
 
     @Override
     public String toString() {
-        return "FixedVo [key=" + key + ", name=" + name +", value=" + value + ", remark="
-                + remark + "]";
+        return "FixedVo{" +
+                "key='" + key + '\'' +
+                ", name='" + name + '\'' +
+                ", des='" + des + '\'' +
+                ", uniformCode='" + uniformCode + '\'' +
+                ", remark='" + remark + '\'' +
+                '}';
     }
 }

+ 4 - 4
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerFittingData.java

@@ -21,16 +21,16 @@ public class PowerFittingData {
 
 
     //风速
-    @Desc(value = "风速", remark = "1")
+    @Desc(des = "风速", remark = "1")
     private Double speed;
     //拟合功率
-    @Desc(value = "拟合功率", remark = "1")
+    @Desc(des = "拟合功率", remark = "1")
     private Double nhdata;
     //修正数据
-    @Desc(value = "修正功率", remark = "0")
+    @Desc(des = "修正功率", remark = "0")
     private Double xzdata;
     //cp值
-    @Desc(value = "Cp值", remark = "1")
+    @Desc(des = "Cp值", remark = "1")
     private Double cpdata;
 
 }

+ 35 - 13
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerPointData.java

@@ -7,6 +7,7 @@ import java.text.DecimalFormat;
 
 /**
  * 数据准备的测点
+ * remark  0:表示该字段不在前端显示  1:表示该字段在前端显示
  */
 @Data
 public class PowerPointData {
@@ -33,52 +34,73 @@ public class PowerPointData {
     }
 
     //时间
-    @Desc(value = "时间", remark = "1")
+    @Desc(des = "时间", remark = "1")
     private String time = "1970-01-01 00:00:00";
 
     //功率
-    @Desc(value = "功率", remark = "1")
+    @Desc(des = "功率", uniformCode = "AI130", remark = "1")
     private double power = 0;
 
     //风速
-    @Desc(value = "风速", remark = "1")
+    @Desc(des = "风速", uniformCode = "AI022", remark = "1")
     private double speed = 0;
 
     //转速
-    @Desc(value = "转速", remark = "1")
+    @Desc(des = "转速",  uniformCode = "AI128", remark = "1")
     private double rr = 0;
 
-    //明细状态  0-待机  1-手动停机  2-正常发电  3-缺陷降出力  4-限电降出力  5-限电停机  6-故障停机  7-场内受累停机  8-检修停机  9-场内受累检修  10-电网受累  11-环境受累  12-风机离线
-    @Desc(value = "风机状态", remark = "1")
+    //明细状态
+    // 0-待机  1-手动停机  2-正常发电  3-缺陷降出力  4-限电降出力  5-限电停机  6-故障停机
+    // 7-场内受累停机  8-检修停机  9-场内受累检修  10-电网受累  11-环境受累  12-风机离线
+    @Desc(des = "风机状态",  uniformCode = "ZTMX", remark = "1")
     private int mxzt = 0;
 
     //电量
-    @Desc(value = "电量", remark = "1")
+    @Desc(des = "电量",  uniformCode = "RFDL", remark = "1")
     private double dl = 0;
 
     //欠发状态
-    @Desc(value = "欠发状态", remark = "1")
+    @Desc(des = "欠发状态",  uniformCode = "RSSQFZT", remark = "1")
     private int qfzt = 0;
 
     //风向
-    @Desc(value = "风向", remark = "1")
+    @Desc(des = "风向",  uniformCode = "AI008", remark = "1")
     private double fx = 0;
 
     //对风误差
-    @Desc(value = "对风误差", remark = "1")
+    @Desc(des = "对风误差",  uniformCode = "AI036", remark = "1")
     private double dfwc = 0;
 
     //偏航角度
-    @Desc(value = "偏航角度", remark = "1")
+    @Desc(des = "偏航角度",  uniformCode = "AI034", remark = "1")
     private double angle = 0;
 
-    @Desc(value = "环境温度", remark = "1")
+    @Desc(des = "环境温度",  uniformCode = "AI056", remark = "1")
     private double hjwd = 0;
 
     //是否过滤  0:不过滤 1:过滤
-    @Desc(value = "筛选", remark = "0")
+    @Desc(des = "筛选", remark = "0")
     private int filter = 0;
 
     private String wtId;
+
+    @Override
+    public String toString() {
+        return "PowerPointData{" +
+                "time='" + time + '\'' +
+                ", power=" + power +
+                ", speed=" + speed +
+                ", rr=" + rr +
+                ", mxzt=" + mxzt +
+                ", dl=" + dl +
+                ", qfzt=" + qfzt +
+                ", fx=" + fx +
+                ", dfwc=" + dfwc +
+                ", angle=" + angle +
+                ", hjwd=" + hjwd +
+                ", filter=" + filter +
+                ", wtId='" + wtId + '\'' +
+                '}';
+    }
 }
 

+ 17 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/LineService.java

@@ -0,0 +1,17 @@
+package com.gyee.power.fitting.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.power.fitting.model.Line;
+
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+public interface LineService extends IService<Line> {
+
+}

+ 17 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/PowerlossinfoService.java

@@ -0,0 +1,17 @@
+package com.gyee.power.fitting.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.power.fitting.model.Powerlossinfo;
+
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+public interface PowerlossinfoService extends IService<Powerlossinfo> {
+
+}

+ 17 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/ProjectService.java

@@ -0,0 +1,17 @@
+package com.gyee.power.fitting.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.power.fitting.model.Project;
+
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+public interface ProjectService extends IService<Project> {
+
+}

+ 9 - 9
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataFittingService.java

@@ -136,7 +136,7 @@ public class DataFittingService {
         /** 添加标题 **/
         List<FixedVo> fxList = AnnotationTool.getFixedVoList(PowerFittingData.class);
         List<TableTitle> lt = fxList.stream().filter(f -> f.getRemark().equals("1"))
-                .map(d -> new TableTitle(d.getName(), d.getValue())).collect(Collectors.toList());
+                .map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
 
         /** 添加内容 **/
         List<PowerFittingData> list = new ArrayList<>();
@@ -246,7 +246,7 @@ public class DataFittingService {
     private StringBuilder setTitle(){
         val sb = new StringBuilder();
         val list = AnnotationTool.getFixedVoList(PowerFittingData.class);
-        String columnName = list.stream().filter(f -> f.getRemark().equals("1")).map(FixedVo::getValue).collect(Collectors.joining(","));
+        String columnName = list.stream().filter(f -> f.getRemark().equals("1")).map(FixedVo::getDes).collect(Collectors.joining(","));
         sb.append(columnName).append("\n");
         return sb;
     }
@@ -459,7 +459,7 @@ public class DataFittingService {
 
 
     /**
-     * 统计并网时间  3-5m   5-10m   10-12m  12-25m(全功率)   不运行
+     * 统计并网时间   不运行 3-5m   5-10m   10-12m  12-25m(全功率)
      * @param ids
      * @return
      */
@@ -472,7 +472,7 @@ public class DataFittingService {
 
         list.forEach(item -> {
             Map<String, Object> map = new HashMap<>();
-            int[] time = new int[5];
+            int[] time = new int[5];  //不运行 3-5m   5-10m   10-12m  12-25m(全功率)
             String[] split = item.getProcessid().split(",");//数据准备ID,获取文件
             for (String id : split){
                 List<String> line = FileUtil.readFile(powerService.getById(id).getPath(), true);
@@ -493,15 +493,15 @@ public class DataFittingService {
             list.add(new PowerPointData(line.get(i).split(","), true));
         }
         for (PowerPointData item : list){
-            if (item.getSpeed() >= 3.0 && item.getSpeed() < 5.0 && item.getMxzt() == 2)
+            if (item.getMxzt() != 2)
                 time[0] += interval;
-            if (item.getSpeed() >= 5.0 && item.getSpeed() < 10.0 && item.getMxzt() == 2)
+            if (item.getSpeed() >= 3.0 && item.getSpeed() < 5.0 && item.getMxzt() == 2)
                 time[1] += interval;
-            if (item.getSpeed() >= 10.0 && item.getSpeed() < 12.0 && item.getMxzt() == 2)
+            if (item.getSpeed() >= 5.0 && item.getSpeed() < 10.0 && item.getMxzt() == 2)
                 time[2] += interval;
-            if (item.getSpeed() >= 12.0 && item.getSpeed() <= 25.0 && item.getMxzt() == 2)
+            if (item.getSpeed() >= 10.0 && item.getSpeed() < 12.0 && item.getMxzt() == 2)
                 time[3] += interval;
-            if (item.getMxzt() != 2)
+            if (item.getSpeed() >= 12.0 && item.getSpeed() <= 25.0 && item.getMxzt() == 2)
                 time[4] += interval;
         }
     }

+ 2 - 2
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataPrepareService.java

@@ -122,7 +122,7 @@ public class DataPrepareService {
         /** 添加标题 **/
         List<FixedVo> fxList = AnnotationTool.getFixedVoList(PowerPointData.class);
         List<TableTitle> lt = fxList.stream().filter(f -> f.getRemark().equals("1"))
-                .map(d -> new TableTitle(d.getName(), d.getValue())).collect(Collectors.toList());
+                .map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
 
         /** 添加内容  读取前500行 **/
         List<PowerPointData> list = new ArrayList<>();
@@ -161,7 +161,7 @@ public class DataPrepareService {
     private StringBuilder setTitle(){
         StringBuilder sb = new StringBuilder();
         val list = AnnotationTool.getFixedVoList(PowerPointData.class);
-        String columnName = list.stream().filter(f -> f.getRemark().equals("1")).map(FixedVo::getValue).collect(Collectors.joining(","));
+        String columnName = list.stream().filter(f -> f.getRemark().equals("1")).map(FixedVo::getDes).collect(Collectors.joining(","));
         sb.append(columnName).append("\n");
         return sb;
     }

+ 2 - 2
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataProcessService.java

@@ -109,7 +109,7 @@ public class DataProcessService {
 
         /** 添加标题 **/
         List<FixedVo> fxList = AnnotationTool.getFixedVoList(PowerPointData.class);
-        List<TableTitle> lt = fxList.stream().map(d -> new TableTitle(d.getName(), d.getValue())).collect(Collectors.toList());
+        List<TableTitle> lt = fxList.stream().map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
 
         /** 添加内容  读取前500行 **/
         List<PowerPointData> list = new ArrayList<>();
@@ -142,7 +142,7 @@ public class DataProcessService {
     private StringBuilder setTitle() {
         StringBuilder sb = new StringBuilder();
         List<FixedVo> list = AnnotationTool.getFixedVoList(PowerPointData.class);
-        String columnName = list.stream().map(FixedVo::getValue).collect(Collectors.joining(","));
+        String columnName = list.stream().map(FixedVo::getDes).collect(Collectors.joining(","));
         sb.append(columnName).append("\n");
         return sb;
     }

+ 95 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/electricquantity/ElectricQuantityService.java

@@ -0,0 +1,95 @@
+package com.gyee.power.fitting.service.custom.electricquantity;
+
+
+import com.gyee.power.fitting.common.util.FileUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ElectricQuantityService {
+
+    @Autowired
+    private PowerfittinganalysisService powerService;
+
+
+    /**
+     * 电量统计(包含发电量和损失电量)
+     * @param ids
+     * @return
+     */
+    public Object dlLosses(String ids){
+        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
+        if (list == null || list.size() == 0)
+            return null;
+
+        List<Object> result = new ArrayList<>();
+//        for (Powerfittinganalysis obj : list) {
+//            List<PowerPointData> ls = csvParse(obj);
+//
+//        }
+
+        return null;
+    }
+
+
+    /**
+     * csv 文件解析成对象
+     * @param obj
+     * @return
+     */
+    private List<PowerPointData> csvParse(Powerfittinganalysis obj){
+        List<PowerPointData> ls = new ArrayList<>();
+        List<String> content = FileUtil.readFile(obj.getPath(), true);
+        for (int i = 1; i < content.size(); i++){
+            String[] split = content.get(i).split(",");
+            PowerPointData data = new PowerPointData(split, true);
+            ls.add(data);
+        }
+
+        return ls;
+    }
+
+
+    //0-待机
+    //1-手动停机
+    //2-正常发电
+    //3-缺陷降出力
+    //4-限电降出力
+    //5-限电停机
+    //6-故障停机
+    //7-场内受累停机
+    //8-检修停机
+    //9-场内受累检修
+    //10-电网受累
+    //11-环境受累
+    //12-风机离
+    private void calLosses(List<PowerPointData> datas){
+        if (datas == null || datas.size() == 0)
+            return;
+
+        int zt = 0;
+        double fdl = 0;
+        double gzss = 0;
+        double jxss = 0;
+        double xnss = 0;
+        double xdss = 0;
+        double slss = 0;
+        for (int i = 0; i < datas.size() - 1; i++) {
+            PowerPointData obj = datas.get(i);
+            PowerPointData obj2 = datas.get(i + 1);
+            if (obj2.getMxzt() == 2)
+//                fdl += ((obj2.getDl() - obj.getDl() > 0 ? );
+            if (obj2.getMxzt() == 2)
+                fdl += obj2.getDl();
+        }
+    }
+
+}

+ 24 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/fiveloss/FiveLossService.java

@@ -0,0 +1,24 @@
+package com.gyee.power.fitting.service.custom.fiveloss;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+@Service
+public class FiveLossService {
+
+//    @Autowired
+//    private
+//
+//    public void fiveLoss(List<String> ids){
+//
+//    }
+
+
+//    public void fiveLossCal(String station, String date){
+//
+//    }
+}

+ 1 - 4
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/socket/RatioService.java

@@ -1,18 +1,15 @@
-package com.gyee.power.fitting.service.custom.socket;
+package com.gyee.power.fitting.service.custom.windresource;
 
 
 import com.gyee.power.fitting.common.alg.PowerFittingALG;
 import com.gyee.power.fitting.common.util.FileUtil;
 import com.gyee.power.fitting.model.Powerfittinganalysis;
 import com.gyee.power.fitting.model.custom.Point;
-import com.gyee.power.fitting.model.custom.PointVo;
 import com.gyee.power.fitting.model.custom.PowerPointData;
 import com.gyee.power.fitting.service.PowerfittinganalysisService;
 import lombok.val;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
-import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;

+ 0 - 2
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/windresource/WindDirectionService.java

@@ -14,8 +14,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-;
-
 
 @Service
 public class WindDirectionService {

+ 20 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/impl/LineServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.power.fitting.mapper.LineMapper;
+import com.gyee.power.fitting.model.Line;
+import com.gyee.power.fitting.service.LineService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+@Service
+public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements LineService {
+
+}

+ 20 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/impl/PowerlossinfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.power.fitting.mapper.PowerlossinfoMapper;
+import com.gyee.power.fitting.model.Powerlossinfo;
+import com.gyee.power.fitting.service.PowerlossinfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+@Service
+public class PowerlossinfoServiceImpl extends ServiceImpl<PowerlossinfoMapper, Powerlossinfo> implements PowerlossinfoService {
+
+}

+ 20 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/impl/ProjectServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.power.fitting.mapper.ProjectMapper;
+import com.gyee.power.fitting.model.Project;
+import com.gyee.power.fitting.service.ProjectService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-02-03
+ */
+@Service
+public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements ProjectService {
+
+}

+ 4 - 4
power-fitting/src/main/resources/application.yaml

@@ -1,6 +1,6 @@
 gyee:
   # 实时适配器的url
-  adapter-url: http://192.168.10.18:8011
+  adapter-url: http://10.155.32.4:8011
   # 数据准备保存路径(原始数据)
   file-path-prepare: data\prepare\
   # 数据处理保存路径(处理后的数据)
@@ -9,8 +9,6 @@ gyee:
   file-path-fitting: data\fitting\
   # 数据压缩下载
   file-path-download: data\zip\
-  # 风机实发功率\风机风速\发电机转速\明细状态\风机日发电量\实时欠发状态\风向\对风角度(对风误差)\偏航角度\环境温度  顺序不能乱
-  points: AI130,AI022,AI128,ZTMX,RFDL,RSSQFZT,AI008,AI036,AI034,AI056
   # 数据准备时由于数据量太大,初始一个默认间隔,用于适配器取数
   interval: 20
   # 当前是否是离线环境
@@ -36,10 +34,12 @@ spring:
     allow-bean-definition-overriding: false #当遇到同样名字的时候,是否允许覆盖注册
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
+    #宁夏三区oracle
+    driver-class-name: oracle.jdbc.OracleDriver
     url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
     username: nxfdprod
     password: gdnxfd123
-    driver-class-name: oracle.jdbc.OracleDriver
+
 #    driver-class-name: org.sqlite.JDBC
 #    url: jdbc:sqlite::resource:gdnx.db
 #    username:

二进制
power-fitting/src/main/resources/gdnx.db


+ 23 - 0
power-fitting/src/main/resources/mapper/LineMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.power.fitting.mapper.LineMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.Line">
+        <id column="ID" property="id" />
+        <result column="CODE" property="code" />
+        <result column="NAME" property="name" />
+        <result column="ANAME" property="aname" />
+        <result column="PROJECTID" property="projectid" />
+        <result column="ORDERNUM" property="ordernum" />
+        <result column="CAPACITY" property="capacity" />
+        <result column="CAPACITYUNIT" property="capacityunit" />
+        <result column="QUANTITY" property="quantity" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        ID, CODE, NAME, ANAME, PROJECTID, ORDERNUM, CAPACITY, CAPACITYUNIT, QUANTITY
+    </sql>
+
+</mapper>

+ 28 - 0
power-fitting/src/main/resources/mapper/PowerlossinfoMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.power.fitting.mapper.PowerlossinfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.Powerlossinfo">
+        <result column="ID" property="id" />
+        <result column="WINDTURBINEID" property="windturbineid" />
+        <result column="PROJECTID" property="projectid" />
+        <result column="LINEID" property="lineid" />
+        <result column="STATIONID" property="stationid" />
+        <result column="RECORDDATE" property="recorddate" />
+        <result column="GENECAPACITY" property="genecapacity" />
+        <result column="THEROGENECAPACITY" property="therogenecapacity" />
+        <result column="SPEED" property="speed" />
+        <result column="MONTHSJDL" property="monthsjdl" />
+        <result column="MONTHJHJXSSDL" property="monthjhjxssdl" />
+        <result column="MONTHFJHJXSSDL" property="monthfjhjxssdl" />
+        <result column="MONTHXDSSDL" property="monthxdssdl" />
+        <result column="MONTHXNSSDL" property="monthxnssdl" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        ID, WINDTURBINEID, PROJECTID, LINEID, STATIONID, RECORDDATE, GENECAPACITY, THEROGENECAPACITY, SPEED, MONTHSJDL, MONTHJHJXSSDL, MONTHFJHJXSSDL, MONTHXDSSDL, MONTHXNSSDL
+    </sql>
+
+</mapper>

+ 28 - 0
power-fitting/src/main/resources/mapper/ProjectMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.power.fitting.mapper.ProjectMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.Project">
+        <id column="ID" property="id" />
+        <result column="CODE" property="code" />
+        <result column="NAME" property="name" />
+        <result column="ANAME" property="aname" />
+        <result column="WINDPOWERSTATIONID" property="windpowerstationid" />
+        <result column="CAPACITY" property="capacity" />
+        <result column="CAPACITYUNIT" property="capacityunit" />
+        <result column="QUANTITY" property="quantity" />
+        <result column="MODEL" property="model" />
+        <result column="COMMISSIONDATE" property="commissiondate" />
+        <result column="MASTERPHONE" property="masterphone" />
+        <result column="SHIFTFOREMAN" property="shiftforeman" />
+        <result column="SHIFTFOREMANPHONE" property="shiftforemanphone" />
+        <result column="ORDERNUM" property="ordernum" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        ID, CODE, NAME, ANAME, WINDPOWERSTATIONID, CAPACITY, CAPACITYUNIT, QUANTITY, MODEL, COMMISSIONDATE, MASTERPHONE, SHIFTFOREMAN, SHIFTFOREMANPHONE, ORDERNUM
+    </sql>
+
+</mapper>