Browse Source

功率曲线拟合 project init

chenminghua 2 years ago
parent
commit
bda2d084d2
90 changed files with 3232 additions and 979 deletions
  1. 3 3
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/ThreadPoolConfig.java
  2. 0 53
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Alertrule2Mapper.java
  3. 0 121
      gyee-sample-impala/src/main/java/com/gyee/impala/model/slave/Alertrule2.java
  4. 0 229
      gyee-sample-impala/src/main/java/com/gyee/impala/service/impl/slave/Alertrule2Service.java
  5. 0 278
      gyee-sample-impala/src/main/resources/mapper/slave/Alertrule2Mapper.xml
  6. 1 1
      pom.xml
  7. 0 26
      power-fetting/src/main/java/com/gyee/power/fetting/BootApplication.java
  8. 0 16
      power-fetting/src/main/java/com/gyee/power/fetting/common/config/GyeeConfig.java
  9. 0 152
      power-fetting/src/main/java/com/gyee/power/fetting/common/spring/InitialRunner.java
  10. 2 9
      power-fetting/pom.xml
  11. 3 3
      power-fetting/src/main/java/com/gyee/power/fetting/MapperGenerator.java
  12. 47 0
      power-fitting/src/main/java/com/gyee/power/fitting/PowerBootApplication.java
  13. 250 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerFittingALG.java
  14. 151 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerProcessALG.java
  15. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/base/ExcludeQueryWrapper.java
  16. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/config/CorsConfig.java
  17. 1 8
      power-fetting/src/main/java/com/gyee/power/fetting/common/config/datasource/DataSourceConfig.java
  18. 68 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/config/GyeeConfig.java
  19. 50 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/config/ThreadPoolConfig.java
  20. 20 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/config/WebSocketConfig.java
  21. 39 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/constants/Constants.java
  22. 3 3
      power-fetting/src/main/java/com/gyee/power/fetting/common/exception/AdviceException.java
  23. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/common/exception/CustomException.java
  24. 3 3
      power-fetting/src/main/java/com/gyee/power/fetting/common/feign/IAdapterService.java
  25. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/common/feign/RemoteServiceBuilder.java
  26. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/result/JsonResult.java
  27. 2 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/result/ResultCode.java
  28. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/spring/ExitDisposable.java
  29. 125 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/spring/InitialRunner.java
  30. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/spring/SpringContextUtil.java
  31. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/Base64Util.java
  32. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/CollectUtil.java
  33. 20 2
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/DateUtil.java
  34. 107 10
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/FileUtil.java
  35. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/JudeSystem.java
  36. 20 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/NumberUtil.java
  37. 61 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/util/PowerFittingUtil.java
  38. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/SnowFlakeUtil.java
  39. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/TokenGenerator.java
  40. 85 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/DataFittingController.java
  41. 83 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/DataPrepareController.java
  42. 99 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/DataProcessController.java
  43. 61 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/DateOptionController.java
  44. 36 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/WindInfoController.java
  45. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/EquipmentmodelMapper.java
  46. 21 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/ModelpowerMapper.java
  47. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/ModelpowerdetailsMapper.java
  48. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/PowerfittinganalysisMapper.java
  49. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/mapper/WindpowerstationMapper.java
  50. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/mapper/WindturbineMapper.java
  51. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/Windturbinetestingpointai2Mapper.java
  52. 72 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Equipmentmodel.java
  53. 47 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Modelpower.java
  54. 47 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Modelpowerdetails.java
  55. 64 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Powerfittinganalysis.java
  56. 5 4
      power-fetting/src/main/java/com/gyee/power/fetting/model/Windpowerstation.java
  57. 4 3
      power-fetting/src/main/java/com/gyee/power/fetting/model/Windturbine.java
  58. 86 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Windturbinetestingpointai2.java
  59. 35 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/LineCurveFitting.java
  60. 14 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PointVo.java
  61. 27 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerFittingPoint.java
  62. 61 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerPointData.java
  63. 43 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/TableTitle.java
  64. 2 1
      power-fetting/src/main/java/com/gyee/power/fetting/model/custom/TsDoubleData.java
  65. 26 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/EquipmentmodelService.java
  66. 19 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/ModelpowerService.java
  67. 19 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/ModelpowerdetailsService.java
  68. 33 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/PowerfittinganalysisService.java
  69. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/service/WindpowerstationService.java
  70. 3 3
      power-fetting/src/main/java/com/gyee/power/fetting/service/WindturbineService.java
  71. 19 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/Windturbinetestingpointai2Service.java
  72. 263 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataFittingService.java
  73. 15 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataOptionService.java
  74. 11 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataPointMP.java
  75. 160 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataPrepareService.java
  76. 155 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataProcessService.java
  77. 174 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/WebSocketServer.java
  78. 46 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/impl/EquipmentmodelServiceImpl.java
  79. 34 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/impl/ModelpowerServiceImpl.java
  80. 34 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/impl/ModelpowerdetailsServiceImpl.java
  81. 92 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/impl/PowerfittinganalysisServiceImpl.java
  82. 6 6
      power-fetting/src/main/java/com/gyee/power/fetting/service/impl/WindpowerstationServiceImpl.java
  83. 8 7
      power-fetting/src/main/java/com/gyee/power/fetting/service/impl/WindturbineServiceImpl.java
  84. 40 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/impl/Windturbinetestingpointai2ServiceImpl.java
  85. 26 10
      power-fetting/src/main/resources/application.yaml
  86. 27 0
      power-fitting/src/main/resources/mapper/EquipmentmodelMapper.xml
  87. 24 0
      power-fitting/src/main/resources/mapper/PowerfittinganalysisMapper.xml
  88. 4 4
      power-fetting/src/main/resources/mapper/WindpowerstationMapper.xml
  89. 2 2
      power-fetting/src/main/resources/mapper/WindturbineMapper.xml
  90. 32 0
      power-fitting/src/main/resources/mapper/Windturbinetestingpointai2Mapper.xml

+ 3 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/ThreadPoolConfig.java

@@ -16,13 +16,13 @@ public class ThreadPoolConfig {
      */
 
     /** 核心线程数(默认线程数) */
-    private static final int corePoolSize = 20;
+    private static final int corePoolSize = 10;
     /** 最大线程数 */
-    private static final int maxPoolSize = 40;
+    private static final int maxPoolSize = 20;
     /** 允许线程空闲时间(单位:默认为秒) */
     private static final int keepAliveTime = 60;
     /** 缓冲队列大小 */
-    private static final int queueCapacity = 200;
+    private static final int queueCapacity = 100;
     /** 允许等待最长时间 */
     private static final int awaitTime = 15;
     /** 线程池名前缀 */

+ 0 - 53
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Alertrule2Mapper.java

@@ -1,53 +0,0 @@
-package com.gyee.impala.mapper.slave;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gyee.impala.model.slave.Alertrule2;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
-
-@Mapper
-public interface Alertrule2Mapper extends BaseMapper<Alertrule2> {
-
-    IPage<Alertrule2> pageQueryAll(Page page,
-                                   @Param("name") String name,
-                                   @Param("station") String station,
-                                   @Param("modelId")String modelId,
-                                   @Param("rank")String rank,
-                                   @Param("category")String category,
-                                   @Param("enabled") String enabled,
-                                   @Param("relatedparts")String relatedparts);
-
-    Integer getMaxEdnaValue();
-
-    List<Alertrule2> getAllByStationIdAndModelId(@Param("idString") String idString);
-
-    List<Alertrule2> getAllByStationIdAndModelId2(
-            @Param("station") String station,
-            @Param("modelid") String modelId
-    );
-
-
-    List<Alertrule2> getById(@Param("idString") String idString);
-
-    List<Alertrule2> queryTree();
-
-    List<Map<String, Alertrule2>> quertByrelatedParts(String relatedParts);
-
-    List<Alertrule2> queryMap();
-
-    int updateByAlertrule2Id(Alertrule2 alertrule2);
-
-    Alertrule2 selectByAlertrule2Id(String id);
-
-
-    int insertAlerture2(Alertrule2 alertrule2);
-
-//    List<Alertrule2> selectByExample(Alertrule2Example example);
-
-}
-

+ 0 - 121
gyee-sample-impala/src/main/java/com/gyee/impala/model/slave/Alertrule2.java

@@ -1,121 +0,0 @@
-package com.gyee.impala.model.slave;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.gyee.impala.common.config.GyeeConfig;
-import com.gyee.impala.common.spring.SpringContextUtil;
-import lombok.AccessLevel;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.io.Serializable;
-import java.util.Date;
-
-@Data
-@TableName("ALERTRULE2")
-public class Alertrule2 implements Serializable {
-
-    @TableId("id")
-    private String id;
-   
-    @TableField("Name")
-    private String name;
-    @JSONField(serialize=false,deserialize = false) //不序列化
-    @TableField("description")
-    private String description;
-    @JSONField(serialize=false,deserialize = false)//不序列化
-    //("表达式")
-    @TableField("expression")
-    private String expression;
-    //("标签")
-    @TableField("tag")
-    private String tag;
-    //("报警级别")
-    @TableField("rank")
-    private String rank;
-    //("是否启用")
-    @TableField("enabled")
-    private int enabled;
-    //("风机类型")
-    @TableField("modelId")
-    private String modelId;
-    //("ednavlue")
-    @TableField("ednaValue")
-    private int ednaValue;
-    //("类别")
-    @TableField("category")
-    private String category;
-    //("range范围")
-    @TableField("range")
-    private String range;
-    //("场站")
-    @TableField("station")
-    private String station;
-    //("风机")
-    @TableField("windturbine")
-    private String windturbine;
-    //("线路")
-    @TableField("line")
-    private String line;
-    //("项目")
-    @TableField("project")
-    private String project;
-    //("电气")
-    @TableField("electrical")
-    private String electrical;
-    //("任务开始事件")
-    @TableField("taskstart")
-    private String taskstart;
-    @TableField("relatedParts")
-    //("关联部件")
-    private String relatedParts;//关联部件
-    @TableField(exist = false)
-    private String userName;//操作人
-    //("操作时间")
-    @TableField("createtime")
-    private Date createtime;//操作时间
-    //前端显示字段 防止报警规则泄漏
-    @TableField(exist = false)
-    @Setter(AccessLevel.NONE)
-    @Getter(AccessLevel.NONE)
-    private String descriptionShow;
-    //前端显示字段 防止报警规则泄漏
-    @TableField(exist = false)
-    @Setter(AccessLevel.NONE)
-    @Getter(AccessLevel.NONE)
-    private String expressionShow;
-
-    private WindPowerStation windPowerStation;
-    private Datadictionary datadictionary;
-
-    public  String getDescriptionShow(){
-        GyeeConfig bean = SpringContextUtil.getBean(GyeeConfig.class);
-        boolean ruleEncryption = bean.getRuleEncryption();
-        if(ruleEncryption&&"1".equals(this.range))
-            return "***********";
-        else
-            return this.description;
-
-    }
-    public String getExpressionShow(){
-        GyeeConfig bean = SpringContextUtil.getBean(GyeeConfig.class);
-        boolean ruleEncryption = bean.getRuleEncryption();
-        if(ruleEncryption&&"1".equals(this.range))
-            return "***********";
-        else
-            return this.expression;
-    }
-
-    public void setDescriptionShow(String descriptionShow){
-        this.description=descriptionShow;
-        this.descriptionShow=descriptionShow;
-    }
-
-    public void setExpressionShow(String expression){
-        this.expression=expression;
-        this.expressionShow=expression;
-    }
-}

+ 0 - 229
gyee-sample-impala/src/main/java/com/gyee/impala/service/impl/slave/Alertrule2Service.java

@@ -1,229 +0,0 @@
-package com.gyee.impala.service.impl.slave;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gyee.impala.mapper.slave.Alertrule2Mapper;
-import com.gyee.impala.model.slave.Alertrule2;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-@Service
-@Slf4j
-public class Alertrule2Service extends ServiceImpl<Alertrule2Mapper, Alertrule2> {
-    Logger logger = LogManager.getLogger();
-
-    @Autowired
-    private Alertrule2Mapper alertrule2Mapper;
-
-//    @Autowired
-//    private LogService logService;
-//
-//    @Autowired
-//    private RuleUpdateEventService eventService;
-
-
-
-//    public int saveAndUpdateAlertrule2(Alertrule2 alertrule2,String userName) {
-//
-//        int result = 0;
-//        Alertrule2 oldRule2=null;
-//        if (StringUtils.isBlank(alertrule2.getId())) {
-//            //生成id,生成规则为HD+自增数
-////            String station = StringUtils.substringBefore(alertrule2.getStation(), "_");
-//            Integer maxEdnaValue = alertrule2Mapper.getMaxEdnaValue();
-//            int max = maxEdnaValue + 1;
-//            String first="";
-//            String[] s = alertrule2.getStation().split("_");
-//            if(s.length>1)
-//                first=s[0];
-//            String newId = first+"_"+ max;
-//            //验证生成的id是否已存在
-//            List<Alertrule2> selectList = alertrule2Mapper.getById(newId);
-//            if (selectList.size() > 0) {
-//                return -999;
-//            }
-//
-//            if (maxEdnaValue == 0) {
-//                logger.error("获取最大EdnaValue失败");
-//                return 0;
-//            } else {
-//                Integer nextEdnaValue = maxEdnaValue + 1;
-//                alertrule2.setId(newId);
-//
-//                alertrule2.setEdnaValue(nextEdnaValue);
-//                alertrule2.setCreatetime(DateUtils.getNowDate());
-//                result = alertrule2Mapper.insertAlerture2(alertrule2);
-//                if (result > 0) {
-//                    logService.alertRuleAddLog(alertrule2, alertrule2.getUserName());
-//                }
-//            }
-//
-//        } else {
-//            oldRule2 = alertrule2Mapper.selectByAlertrule2Id(alertrule2.getId());
-//            if (oldRule2 != null) {
-//                result = alertrule2Mapper.updateByAlertrule2Id(alertrule2);
-//                if (result > 0) {
-//                    logService.alertRuleUpdateLog(oldRule2, alertrule2, alertrule2.getUserName());
-//                }
-//            }
-//        }
-//        if(result>0) {
-//            int i = eventService.saveEventAlertRule(alertrule2, oldRule2,userName);
-//        }
-//        return result;
-//    }
-//
-//    public int deleteAlertrule2(Alertrule2 alertrule2) {
-//        return alertrule2Mapper.deleteById(alertrule2.getId());
-//    }
-//
-//    public IPage<Alertrule2> pageQueryAll(Page page, String name, String station, String modelId, String rank, String category, String enabled, String relatedparts) {
-//        return alertrule2Mapper.pageQueryAll(page, name,station,modelId,rank,category,enabled,relatedparts);
-//    }
-//
-//    //根据场站风机型号生成最新自定义报警规则ID
-//    public String createNextId(String station, String model) {
-//        String nextId = "";
-//        String idString = station + model;
-//        //获取同一个风场同一个型号的所有规则列表
-//        List<Alertrule2> lst = alertrule2Mapper.getAllByStationIdAndModelId(idString);
-//
-//        String maxId = Collections.max(lst.stream().map(Alertrule2::getId).collect(Collectors.toList()));
-//
-//        int maxNum = Integer.parseInt(maxId.substring(2, 5));
-//        int incrementId = 0;
-//        incrementId = maxNum + 1;
-//        if (incrementId < 100) {
-//            nextId = "ZX" + "0" + incrementId + station + model;
-//
-//        } else {
-//            nextId = "ZX" + incrementId + station + model;
-//
-//        }
-//
-//        return nextId;
-//    }
-//
-//
-//
-//    public List<Alertrule2> queryTree() {
-//        List<Alertrule2> dsList = alertrule2Mapper.queryTree();
-//        return dsList;
-//    }
-//
-//    //首页风机部件查询
-//    public Map<String,Integer> queryList(String station, String modelId) {
-//        Map<String,Integer> map2 = new HashMap<>();
-//        map2.put("CLX",0);
-//        map2.put("YP",0);
-//        map2.put("YY",0);
-//        map2.put("BJXT",0);
-//        map2.put("PHXT",0);
-//        map2.put("BPXT",0);
-//        map2.put("CFXT",0);
-//        map2.put("ZZ",0);
-//        map2.put("FDJ",0);
-//        map2.put("QT",0);
-//
-//        List<Alertrule2> dslist = alertrule2Mapper.getAllByStationIdAndModelId2(station,modelId);
-//        map2.put("SUM",dslist.size());
-//        for(Alertrule2 ar : dslist) {
-//            int cnt= 0;
-//            switch (ar.getRelatedParts()) {
-//                case "CLX":
-//                    cnt = map2.get("CLX").intValue();
-//                    map2.put("CLX", ++cnt);
-//                    break;
-//                case "YP":
-//                    cnt = map2.get("YP").intValue();
-//                    map2.put("YP", ++cnt);
-//                    break;
-//                case "YY":
-//                    cnt = map2.get("YY").intValue();
-//                    map2.put("YY", ++cnt);
-//                    break;
-//                case "BJXT":
-//                    cnt = map2.get("BJXT").intValue();
-//                    map2.put("BJXT", ++cnt);
-//                    break;
-//                case "PHXT":
-//                    cnt = map2.get("PHXT").intValue();
-//                    map2.put("PHXT", ++cnt);
-//                    break;
-//                case "BPXT":
-//                    cnt = map2.get("BPXT").intValue();
-//                    map2.put("BPXT",++cnt);
-//                    break;
-//                case "CFXT":
-//                    cnt = map2.get("CFXT").intValue();
-//                    map2.put("CFXT", ++cnt);
-//                    break;
-//                case "ZZ":
-//                    cnt = map2.get("ZZ").intValue();
-//                    map2.put("ZZ", ++cnt);
-//                    break;
-//                case "FDJ":
-//                    cnt = map2.get("FDJ").intValue();
-//                    map2.put("FDJ",++cnt);
-//                    break;
-//                default:
-//                    cnt = map2.get("QT").intValue();
-//                    map2.put("QT", ++cnt);
-//                    break;
-//            }
-//        }
-//        return map2;
-//    }
-//
-//
-//    public List<Map<String, Alertrule2>> queryTree2(String relatedParts) {
-//        List<Map<String, Alertrule2>> dsList = alertrule2Mapper.quertByrelatedParts(relatedParts);
-//        return dsList;
-//    }
-//
-//    public List<Map<String, Alertrule2>> queryMap() {
-//        List<Map<String, Alertrule2>> alertrule2Map = new ArrayList<>();
-//        List<Alertrule2> alertrule = alertrule2Mapper.queryMap();
-//        if (alertrule != null && alertrule.size() > 0) {
-//            List<Map<String, Alertrule2>> alertrule2Map2 = new ArrayList<>();
-//            for (Alertrule2 alertrule2 : alertrule) {
-//                alertrule2.getRelatedParts();
-//                alertrule2.getName();
-//                alertrule2Map2 = queryTree2(alertrule2.getRelatedParts());
-//                alertrule2Map.addAll(alertrule2Map2);
-//            }
-//        }
-//        return alertrule2Map;
-//    }
-//
-//    public List<String> getUniformCodeByNameAndStation(String name, String station, String modelid){
-//        Alertrule2Example example = new Alertrule2Example();
-//        example.createCriteria().andNameEqualTo(name)
-//                .andStationEqualTo(station)
-//                .andModelidEqualTo(modelid);
-////               .andWindturbineLike("%" + wtId + "%");
-//
-//        List<Alertrule2> rules = alertrule2Mapper.selectByExample(example);
-//        if (rules == null || rules.size() == 0)
-//            return null;
-//
-//        Alertrule2 rule = rules.get(0);
-//        String expression = "(([A][I])|([D][I]))([0-9]+)";
-//        List<String> list = StringUtil.pattern(rule.getExpression(), expression);
-//
-//        return list;
-//    }
-//
-//    public Alertrule2 selectByAlertrule2Id(String id) {
-//        return alertrule2Mapper.selectByAlertrule2Id(id);
-//    }
-}
-

+ 0 - 278
gyee-sample-impala/src/main/resources/mapper/slave/Alertrule2Mapper.xml

@@ -1,278 +0,0 @@
-<?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.impala.mapper.slave.Alertrule2Mapper">
-    <resultMap id="BaseResultMap" type="com.gyee.impala.model.slave.Alertrule2">
-        <!--
-          WARNING - @mbg.generated
-          This element is automatically generated by MyBatis Generator, do not modify.
-        -->
-        <id column="id" property="id"/>
-        <result column="name" property="name"/>
-        <result column="description" property="description"/>
-        <result column="expression" property="expression"/>
-        <result column="rank" property="rank"/>
-        <result column="rank" property="rank"/>
-        <result column="enabled" property="enabled"/>
-        <result column="modelId" property="modelId"/>
-        <result column="ednaValue" property="ednaValue"/>
-        <result column="category" property="category"/>
-        <result column="range" property="range"/>
-        <result column="station" property="station"/>
-        <result column="windturbine" property="windturbine"/>
-        <result column="line" property="line"/>
-        <result column="project" property="project"/>
-        <result column="electrical" property="electrical"/>
-        <result column="taskstart" property="taskstart"/>
-        <result column="relatedParts" property="relatedParts"/>
-    </resultMap>
-    <resultMap type="Alertrule2" id="Alertrule2Result">
-        <result property="id" column="id"/>
-        <result property="name" column="name"/>
-        <result property="station" column="station"/>
-        <result property="relatedParts" column="relatedParts"/>
-        <association property="windPowerStation" column="station" javaType="WindPowerStation"
-                     select="com.gyee.wisdom.alarm.sharding.mapper.WindPowerStationMapper.selectByid"/>
-        <association property="datadictionary" column="relatedParts" javaType="Datadictionary"
-                     select="com.gyee.wisdom.alarm.sharding.mapper.DatadictionaryMapper.selectBycode"/>
-    </resultMap>
-    <select id="pageQueryAll" parameterType="java.util.Map" resultMap="Alertrule2Result">
-        select a.* from ALERTRULE2 a
-        left join windpowerstation w on w.id = a.station
-        <where>
-            1=1
-
-            <if test="name !=null and name !=''">
-                and a.name like '%${name}%'
-            </if>
-            <if test="station !=null and station !=''">
-                and a.station like '%${station}%'
-            </if>
-            <if test="modelId !=null and modelId !=''">
-                and a.modelid like '%${modelId}%'
-            </if>
-            <if test="rank !=null and rank !=''">
-                and a.rank = #{rank}
-            </if>
-            <if test="category !=null and category !=''">
-                and a.category = #{category}
-            </if>
-            <if test="enabled !=null and enabled !=''">
-                and a.enabled = #{enabled}
-            </if>
-            <if test="relatedparts !=null and relatedparts !=''">
-                and a.relatedparts = #{relatedparts}
-            </if>
-            <!--            and a.range = 0-->
-        </where>
-
-    </select>
-    <select id="getAllByStationIdAndModelId2" parameterType="java.util.Map"
-            resultMap="Alertrule2Result">
-        select * from ALERTRULE2 a
-        <where>
-            1=1
-            <if test="station !=null and station !=''">
-                and a.station = #{station}
-            </if>
-            <if test="modelid !=null and modelid !=''">
-                and a.modelid = #{modelid}
-            </if>
-            and a.enabled = 1
-        </where>
-    </select>
-    <select id="getMaxEdnaValue" parameterType="java.util.Map" resultType="java.lang.Integer">
-        select max(a.ednavalue) from  ALERTRULE2 a
-    </select>
-    <select id="getAllByStationIdAndModelId" parameterType="java.util.Map"
-            resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        select * from ALERTRULE2 a
-        <where>
-            1=1
-            <if test="idString !=null and idString !=''">
-                and a.id like '%${idString}%'
-            </if>
-        </where>
-    </select>
-    <select id="getById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        select * from ALERTRULE2 a
-        <where>
-            1=1
-            <if test="idString !=null and idString !=''">
-                and a.id = #{idString}
-            </if>
-        </where>
-    </select>
-
-    <select id="quertByrelatedParts" resultType="java.util.HashMap">
-        select a.name from  ALERTRULE2 a
-        where a.relatedparts = #{relatedParts}
-        group by a.name
-    </select>
-
-    <select id="queryTree" resultMap="Alertrule2Result">
-        select distinct a.relatedparts,a.name,d.name from alertrule2 a
-        left join DATADICTIONARY d
-        on d.code = a.relatedparts
-        where
-        relatedparts is not null
-    </select>
-
-    <select id="queryMap" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        select t.relatedparts,d.name from
-            (select a.relatedparts from alertrule2 a
-             where relatedparts  is not null
-             group by a.relatedparts) t
-        left join DATADICTIONARY d
-        on d.code = t.relatedparts
-    </select>
-
-    <update id="updateByAlertrule2Id" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        update alertrule2 a
-        <set>
-            <if test="name != null">a.name = #{name},</if>
-            <if test="description != null">a.description = #{description},</if>
-            <if test="expression != null">a.expression = #{expression},</if>
-            <if test="tag != null">a.tag = #{tag},</if>
-            <if test="rank != null">a.rank = #{rank},</if>
-            <if test="enabled != null">a.enabled = #{enabled},</if>
-            <if test="modelId != null">a.modelId = #{modelId},</if>
-            <if test="ednaValue != null and ednaValue!=0">a.ednaValue = #{ednaValue},</if>
-            <if test="category != null">a.category = #{category},</if>
-            <if test="range != null">a.range = #{range},</if>
-            <if test="station != null">a.station = #{station},</if>
-            <if test="windturbine != null">a.windturbine = #{windturbine},</if>
-            <if test="line != null">a.line = #{line},</if>
-            <if test="project != null">a.project = #{project},</if>
-            <if test="electrical != null">a.electrical = #{electrical},</if>
-            <if test="taskstart != null">a.taskstart = #{taskstart},</if>
-            <if test="relatedParts != null">a.relatedParts = #{relatedParts},</if>
-            <if test="createtime != null">a.createtime = #{createtime}</if>
-        </set>
-        where a.id = #{id}
-    </update>
-
-    <insert id="insertAlerture2" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2"
-            useGeneratedKeys="true" keyProperty="id">
-        insert into alertrule2
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">id,</if>
-            <if test="name != null">Name,</if>
-            <if test="description != null">description,</if>
-            <if test="expression != null">expression,</if>
-            <if test="tag != null">tag,</if>
-            <if test="rank != null">rank,</if>
-            <if test="enabled != null">enabled,</if>
-            <if test="modelId != null">modelId,</if>
-            <if test="ednaValue != null">ednaValue,</if>
-            <if test="category != null">category,</if>
-            <if test="range != null">range,</if>
-            <if test="station != null">station,</if>
-            <if test="windturbine != null">windturbine,</if>
-            <if test="line != null">line,</if>
-            <if test="project != null">project,</if>
-            <if test="electrical != null">electrical,</if>
-            <if test="taskstart != null">taskstart,</if>
-            <if test="relatedParts != null">relatedParts,</if>
-            <if test="createtime != null">createtime</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">#{id},</if>
-            <if test="name != null">#{name},</if>
-            <if test="description != null">#{description},</if>
-            <if test="expression != null">#{expression},</if>
-            <if test="tag != null">#{tag},</if>
-            <if test="rank != null">#{rank},</if>
-            <if test="enabled != null">#{enabled},</if>
-            <if test="modelId != null">#{modelId},</if>
-            <if test="ednaValue != null">#{ednaValue},</if>
-            <if test="category != null">#{category},</if>
-            <if test="range != null">#{range},</if>
-            <if test="station != null">#{station},</if>
-            <if test="windturbine != null">#{windturbine},</if>
-            <if test="line != null">#{line},</if>
-            <if test="project != null">#{project},</if>
-            <if test="electrical != null">#{electrical},</if>
-            <if test="taskstart != null">#{taskstart},</if>
-            <if test="relatedParts != null">#{relatedParts},</if>
-            <if test="createtime != null">#{createtime}</if>
-        </trim>
-    </insert>
-
-    <!--    <insert id="insertAlerture2" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">-->
-    <!--        insert into alertrule2 a(a.id, a.Name, a.description, a.expression, a.tag, a.rank,-->
-    <!--                               a.enabled,a.modelId,a.ednaValue,a.category,a.range,a.station,a.windturbine,a.line,a.project,a.electrical,-->
-    <!--                               a.taskstart,a.relatedParts,a.createtime)-->
-    <!--        values (#{id}, #{Name}, #{description},#{expression},-->
-    <!--                #{tag}, #{rank}, #{enabled},#{modelId}, #{ednaValue}, #{category},#{range},#{station}, #{windturbine}, #{line},-->
-    <!--                #{project}, #{electrical}, #{taskstart},#{relatedParts},#{createtime})-->
-    <!--    </insert>-->
-
-    <select id="selectByAlertrule2Id" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
-        select * from  alertrule2 a where a.id=#{id}
-    </select>
-
-    <select id="selectByExample" parameterType="com.gyee.wisdom.alarm.sharding.model.Alertrule2Example"
-            resultMap="BaseResultMap">
-        <!--
-          WARNING - @mbg.generated
-          This element is automatically generated by MyBatis Generator, do not modify.
-        -->
-        select
-        <if test="distinct">
-            distinct
-        </if>
-        *
-        <!--        <include refid="Base_Column_List" />-->
-        from ALERTRULE2
-        <if test="_parameter != null">
-            <include refid="Example_Where_Clause"/>
-        </if>
-        <if test="orderByClause != null">
-            order by ${orderByClause}
-        </if>
-    </select>
-
-    <sql id="Base_Column_List">
-        <!--
-          WARNING - @mbg.generated
-          This element is automatically generated by MyBatis Generator, do not modify.
-        -->
-        id, name, description, expression, tag, rank, enabled, modelid, ednavalue, category,
-        range, station, windturbine, line, project, electrical, taskstart, relatedparts
-    </sql>
-
-    <sql id="Example_Where_Clause">
-        <!--
-          WARNING - @mbg.generated
-          This element is automatically generated by MyBatis Generator, do not modify.
-        -->
-        <where>
-            <foreach collection="oredCriteria" item="criteria" separator="or">
-                <if test="criteria.valid">
-                    <trim prefix="(" prefixOverrides="and" suffix=")">
-                        <foreach collection="criteria.criteria" item="criterion">
-                            <choose>
-                                <when test="criterion.noValue">
-                                    and ${criterion.condition}
-                                </when>
-                                <when test="criterion.singleValue">
-                                    and ${criterion.condition} #{criterion.value}
-                                </when>
-                                <when test="criterion.betweenValue">
-                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                                </when>
-                                <when test="criterion.listValue">
-                                    and ${criterion.condition}
-                                    <foreach close=")" collection="criterion.value" item="listItem" open="("
-                                             separator=",">
-                                        #{listItem}
-                                    </foreach>
-                                </when>
-                            </choose>
-                        </foreach>
-                    </trim>
-                </if>
-            </foreach>
-        </where>
-    </sql>
-</mapper>

+ 1 - 1
pom.xml

@@ -23,7 +23,7 @@
         <module>benchmarking-impala</module>
         <module>consumer</module>
         <module>gyee-sample-impala</module>
-        <module>power-fetting</module>
+        <module>power-fitting</module>
     </modules>
 
 

+ 0 - 26
power-fetting/src/main/java/com/gyee/power/fetting/BootApplication.java

@@ -1,26 +0,0 @@
-package com.gyee.power.fetting;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-
-/**
- * 使用exclude = {DataSourceAutoConfiguration.class}
- * 禁用springboot默认加载的application.properties单数据源配置
- * 关闭springBoot关于mybatisPlus的一些自动注入
- */
-@EnableAsync
-@EnableCaching
-@EnableScheduling
-@SpringBootApplication
-public class BootApplication {
-
-    public static void main(String[] args) {
-        SpringApplication.run(BootApplication.class, args);
-    }
-
-}

+ 0 - 16
power-fetting/src/main/java/com/gyee/power/fetting/common/config/GyeeConfig.java

@@ -1,16 +0,0 @@
-package com.gyee.power.fetting.common.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-@Data
-@Component
-@ConfigurationProperties(prefix = "gyee")
-public class GyeeConfig {
-
-    /**数据适配器网址 **/
-    private String adapterUrl;
-
-
-}

+ 0 - 152
power-fetting/src/main/java/com/gyee/power/fetting/common/spring/InitialRunner.java

@@ -1,152 +0,0 @@
-package com.gyee.power.fetting.common.spring;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.core.annotation.Order;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * 服务启动前执行,进行全局变量初始化
- */
-@Component
-@Order(2)
-public class InitialRunner implements CommandLineRunner {
-
-//    @Resource
-//    private WindturbineService windturbineService;
-//    @Resource
-//    private WindpowerstationService windpowerstationService;
-//    @Autowired
-//    private KnowcategoryService faulttypeService;
-//    @Autowired
-//    private EquipmentmodelService modelService;
-//    @Autowired
-//    private DiagnosepointService diagnosepointService;
-//    @Autowired
-//    private DiagnosetrainhistoryService diagnosetrainhistoryService;
-//
-//    /**场站所有信息**/
-//    public static List<Windpowerstation> wpList = new ArrayList<>();
-//    /**场站的风机**/
-//    public static Map<String, List<Windturbine>> wpMap = new HashMap<>();
-//    /** <MHS_FDC, 麻黄山风电场> **/
-//    public static Map<String, String> stationMap = new HashMap<>();
-//    /** <麻黄山风电场, MHS_FDC> **/
-//    public static Map<String, String> stationenMap = new HashMap<>();
-//    /**所有的风机**/
-//    public static List<Windturbine> wtList = new ArrayList<>();
-//    /** <NG01_01, Windturbine> **/
-//    public static Map<String, Windturbine> wtMap = new HashMap<>();
-//    /**功率曲线预处理数据表格数据 key:time+wtId  value:当前风机的总条数 **/
-//    public static Map<String, Integer> scatterMap = new HashMap<>();
-//    /***故障  <FDJ,发电机故障>  类型*/
-//    public static Map<String, String> faultTypeMap = new HashMap<>();
-//    public static List<Knowcategory> faultTypeList = new ArrayList<>();
-//    /***scada预警  <FDJ,发电机>  类型*/
-//    public static Map<String, String> scadaWarnMap = new HashMap<>();
-//    public static List<Knowcategory> scadaWarnList = new ArrayList<>();
-//    /***自定义预警  <FDJ,发电机>  类型*/
-//    public static Map<String, String> customWarnMap = new HashMap<>();
-//    public static List<Knowcategory> customWarnList = new ArrayList<>();
-//    /** 设备型号配置 <UP82, Equipmentmodel> **/
-//    public static Map<String, Equipmentmodel> modelMap = new HashMap<>();
-//    /** 故障诊断 训练需要的测点 <NSS_FDC, UP82, Diagnosepoint></> **/
-//    public static Map<String, Map<String, List<Diagnosepoint>>> mapPoint = new HashMap<>();
-//
-//    /*** 故障训练历史模型 */
-//    public static Map<String, List<Diagnosetrainhistory>> historyModelMap = new HashMap<>();
-//    public static List<Diagnosetrainhistory> historyList = new ArrayList<>();
-
-
-
-    @Override
-    public void run(String... args){
-        System.out.println(">>>>>>>>>>>>>>>服务启动,正在缓存数据<<<<<<<<<<<<<<");
-
-//        cacheStation();
-//        cacheKnowCategory();
-//        cacheEquipmentModel();
-//        cacheDiagnosePoint();
-//        cacheHistory();
-
-        System.out.println(">>>>>>>>>>>>>>>数据缓存完成<<<<<<<<<<<<<<");
-    }
-
-    /**
-     * 缓存场站数据
-     * 数据新增或删除后需要更新,故每次清空
-     */
-//    public void cacheStation(){
-//        wpList.clear();
-//        wtList.clear();
-//        stationMap.clear();
-//        stationenMap.clear();
-//        wpMap.clear();
-//        wtMap.clear();
-//
-//        List<Windpowerstation> stations = windpowerstationService.getAll();
-//        wpList = stations;
-//        stations.stream().forEach(obj -> {
-//            List<Windturbine> wts = windturbineService.getWindTurbineId(obj.getId());
-//            stationMap.put(obj.getId(), obj.getName());
-//            stationenMap.put(obj.getName(), obj.getId());
-//            wpMap.put(obj.getId(), wts);
-//            wtList.addAll(wts);
-//            wts.stream().forEach(o -> wtMap.put(o.getId(), o));
-//        });
-//    }
-//
-//    /**
-//     * 缓存故障知识数据
-//     */
-//    public void cacheKnowCategory() {
-//        faultTypeList.clear();
-//        scadaWarnList.clear();
-//        customWarnList.clear();
-//        faultTypeMap.clear();
-//        scadaWarnMap.clear();
-//        customWarnMap.clear();
-//
-//        List<Knowcategory> faultType = faulttypeService.getAll();
-//        faultType.stream().forEach(obj -> {
-//            if (obj.getCategory().equals("GZ")) {
-//                faultTypeList.add(obj);
-//                faultTypeMap.put(obj.getCode().toUpperCase(), obj.getName());
-//            }
-//            else if (obj.getCategory().equals("SCADABJ")) {
-//                scadaWarnList.add(obj);
-//                scadaWarnMap.put(obj.getCode().toUpperCase(), obj.getName());
-//            }
-//            else if (obj.getCategory().equals("CUSTOMBJ")) {
-//                customWarnList.add(obj);
-//                customWarnMap.put(obj.getCode().toUpperCase(), obj.getName());
-//            }
-//        });
-//    }
-//
-//    public void cacheEquipmentModel() {
-//        modelMap.clear();
-//        List<Equipmentmodel> models = modelService.getAll();
-//        models.stream().forEach(obj -> modelMap.put(obj.getId(), obj));
-//    }
-//
-//    public void cacheDiagnosePoint(){
-//        mapPoint.clear();
-//        List<Diagnosepoint> points = diagnosepointService.getDiagnosepointList();
-//        mapPoint = points.stream().collect(Collectors.groupingBy(Diagnosepoint::getStationen, Collectors.groupingBy(Diagnosepoint::getModel)));
-//    }
-//
-//    public void cacheHistory(){
-//        historyModelMap.clear();
-//        historyList.clear();
-//        historyList = diagnosetrainhistoryService.getListAll();
-//        historyModelMap = historyList.stream().filter(h -> h.isEnable()).collect(Collectors.groupingBy(Diagnosetrainhistory::getModel));
-//    }
-}

+ 2 - 9
power-fetting/pom.xml

@@ -9,7 +9,7 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>power-fetting</artifactId>
+    <artifactId>power-fitting</artifactId>
 
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
@@ -19,14 +19,7 @@
     <dependencies>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-
-        <!-- 模板引擎 -->
-        <dependency>
-            <groupId>org.apache.velocity</groupId>
-            <artifactId>velocity-engine-core</artifactId>
-            <version>2.0</version>
+            <artifactId>spring-boot-starter-websocket</artifactId>
         </dependency>
 
         <dependency>

+ 3 - 3
power-fetting/src/main/java/com/gyee/power/fetting/MapperGenerator.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting;
+package com.gyee.power.fitting;
 
 import com.baomidou.mybatisplus.annotation.DbType;
 import com.baomidou.mybatisplus.generator.AutoGenerator;
@@ -23,11 +23,11 @@ public class MapperGenerator {
     private static String canonicalPath = "";
 
     //基本包名
-    private static String basePackage = "com.gyee.impala";
+    private static String basePackage = "com.gyee.power.fetting";
     //作者
     private static String authorName = "chenmh";
     //要生成的表名
-    private static String[] tables = {"",};
+    private static String[] tables = {"",""};
     //table前缀
     private static String prefix = "";
 

+ 47 - 0
power-fitting/src/main/java/com/gyee/power/fitting/PowerBootApplication.java

@@ -0,0 +1,47 @@
+package com.gyee.power.fitting;
+
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.spring.SpringContextUtil;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+import java.io.File;
+
+
+/**
+ * 使用exclude = {DataSourceAutoConfiguration.class}
+ * 禁用springboot默认加载的application.properties单数据源配置
+ * 关闭springBoot关于mybatisPlus的一些自动注入
+ */
+@EnableAsync
+@EnableCaching
+@EnableScheduling
+@SpringBootApplication
+public class PowerBootApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(PowerBootApplication.class, args);
+
+        createFile();
+    }
+
+    private static void createFile(){
+        GyeeConfig bean = SpringContextUtil.getBean(GyeeConfig.class);
+        File f1 = new File(bean.getFilePathPrepare());
+        File f2 = new File(bean.getFilePathProcess());
+        File f3 = new File(bean.getFilePathFitting());
+        File f4 = new File(bean.getFilePathDownload());
+        if (!f1.exists())
+            f1.mkdirs();
+        if (!f2.exists())
+            f2.mkdirs();
+        if (!f3.exists())
+            f3.mkdirs();
+        if (!f4.exists())
+            f4.mkdirs();
+    }
+
+}

+ 250 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerFittingALG.java

@@ -0,0 +1,250 @@
+package com.gyee.power.fitting.common.alg;
+
+
+import com.gyee.power.fitting.model.custom.LineCurveFitting;
+import com.gyee.power.fitting.model.custom.PointVo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 功率曲线拟合算法
+ * 最小二乘法
+ */
+public class PowerFittingALG {
+
+    /**
+     *
+     * @param arrX        风速数组
+     * @param arrY        功率数据
+     * @param length      点个数
+     * @param dimension   维度
+     * @param scale       精度  0.1  0.01
+     * @return
+     */
+    public static List<PointVo> BuildLine(double[] arrX, double[] arrY, int length, int dimension, double scale) {
+
+        List<PointVo> points = new ArrayList<>();
+
+        if (arrX.length != arrY.length || arrX.length < 3) {
+            return points;
+        }
+
+        double minValue = arrY[0];
+        double maxValue = arrY[arrY.length - 1];
+
+        double min = 0;
+        double max = 0;
+
+        double[] coefficient = MultiLine(arrX, arrY, length, dimension);
+
+        for (double i = arrX[0]; i <= arrX[arrX.length - 1]; i += scale) {
+            PointVo point = new PointVo();
+            point.setX(i);
+
+
+            for (int j = 0; j < coefficient.length; j++) {
+                if (j == 0) {
+                    point.setY(coefficient[j] * Math.pow(point.getX(), j));
+                } else {
+                    double temp = coefficient[j] * Math.pow(point.getX(), j);
+                    point.setY(point.getY() + temp);
+                }
+
+            }
+            if (point.getY() < minValue) {
+                point.setY(minValue);
+
+            }
+            if (point.getY() > maxValue) {
+                point.setY(maxValue);
+            }
+
+            if (point.getY() < min) {
+                min = point.getY();
+            }
+            if (point.getY() > max) {
+                max = point.getY();
+            }
+
+            points.add(point);
+        }
+        Builder(points, min, max);
+        return points;
+    }
+
+    private static void Builder(List<PointVo> points, double min, double max) {
+        boolean b = false;
+        for (int i = 0; i < points.size(); i++) {
+            if (b) {
+                points.get(i).setY(max);
+            } else {
+                if (max == points.get(i).getY()) {
+                    b = true;
+                }
+            }
+
+        }
+
+        for (int i = points.size() - 1; i > -1; i--) {
+            if (!b) {
+                points.get(i).setY(min);
+            } else {
+                if (min == points.get(i).getY()) {
+                    b = false;
+                }
+            }
+
+        }
+    }
+
+
+    ///<summary>
+    ///用最小二乘法拟合二元多次曲线
+    ///</summary>
+    ///<param name="arrX">已知点的x坐标集合</param>
+    ///<param name="arrY">已知点的y坐标集合</param>
+    ///<param name="length">已知点的个数</param>
+    ///<param name="dimension">方程的最高次数</param>
+    private static double[] MultiLine(double[] arrX, double[] arrY, int length, int dimension)//二元多次线性方程拟合曲线
+    {
+        int n = dimension + 1;                  //dimension次方程需要求 dimension+1个 系数
+        double[][] Guass = new double[n][n + 1];      //高斯矩阵 例如:y=a0+a1*x+a2*x*x
+        for (int i = 0; i < n; i++) {
+            int j;
+            for (j = 0; j < n; j++) {
+                Guass[i][j] = SumArr(arrX, j + i, length);
+            }
+            Guass[i][j] = SumArr(arrX, i, arrY, 1, length);
+        }
+        return ComputGauss(Guass, n);
+    }
+
+    private static double SumArr(double[] arr, int n, int length) //求数组的元素的n次方的和
+    {
+        double s = 0;
+        for (int i = 0; i < length; i++) {
+            if (arr[i] != 0 || n != 0)
+                s = s + Math.pow(arr[i], n);
+            else
+                s = s + 1;
+        }
+        return s;
+    }
+
+    private static double SumArr(double[] arr1, int n1, double[] arr2, int n2, int length) {
+        double s = 0;
+        for (int i = 0; i < length; i++) {
+            if ((arr1[i] != 0 || n1 != 0) && (arr2[i] != 0 || n2 != 0))
+                s = s + Math.pow(arr1[i], n1) * Math.pow(arr2[i], n2);
+            else
+                s = s + 1;
+        }
+        return s;
+
+    }
+
+    private static double[] ComputGauss(double[][] Guass, int n) {
+        int i, j;
+        int k, m;
+        double temp;
+        double max;
+        double s;
+        double[] x = new double[n];
+        for (i = 0; i < n; i++) x[i] = 0.0;//初始化
+
+        for (j = 0; j < n; j++) {
+            max = 0;
+            k = j;
+            for (i = j; i < n; i++) {
+                if (Math.abs(Guass[i][j]) > max) {
+                    max = Guass[i][j];
+                    k = i;
+                }
+            }
+
+
+            if (k != j) {
+                for (m = j; m < n + 1; m++) {
+                    temp = Guass[j][m];
+                    Guass[j][m] = Guass[k][m];
+                    Guass[k][m] = temp;
+                }
+            }
+            if (0 == max) {
+                // "此线性方程为奇异线性方程" 
+                return x;
+            }
+
+            for (i = j + 1; i < n; i++) {
+                s = Guass[i][j];
+                for (m = j; m < n + 1; m++) {
+                    Guass[i][m] = Guass[i][m] - Guass[j][m] * s / (Guass[j][j]);
+                }
+            }
+
+        }//结束for (j=0;j<n;j++)
+
+        for (i = n - 1; i >= 0; i--) {
+            s = 0;
+            for (j = i + 1; j < n; j++) {
+                s = s + Guass[i][j] * x[j];
+            }
+            x[i] = (Guass[i][n] - s) / Guass[i][i];
+        }
+        return x;
+    }//返回值是函数的系数
+
+
+    /**
+     * 推力系数 CP 值
+     * @param sweptarea  扫风面积
+     * @param line
+     * @return
+     */
+    public static LineCurveFitting BuildCp(Double sweptarea, LineCurveFitting line){
+        List<PointVo> cpValue = new ArrayList<>();
+
+        double kqmd = 1.225; //空气密度
+        double max = 0;
+        double cpAvg = 0;
+        double sum1 = 0;
+
+        for (int i = 0; i < line.getYLines().size(); i++)
+        {
+            PointVo point = line.getYLines().get(i);
+            double speed = point.getX();
+            double power = point.getY();
+            double k = 0.5 * kqmd * Math.pow(speed, 3) * sweptarea;
+            double result = 0;
+            if (k != 0)
+                result = power / k * 1000;
+            //s5.Points.AddXY(speed, result);
+            PointVo cppoint = new PointVo();
+            cppoint.setX(speed);
+            cppoint.setY(result);
+            cpValue.add(cppoint);
+
+            if (max < result)
+            {
+                max = result;
+            }
+
+            if (result > 0 && speed >= 3 && speed <= 25)
+            {
+                cpAvg += result;
+                sum1++;
+
+            }
+
+        }
+        if(sum1>0)
+            cpAvg /= sum1;
+
+        line.setCpValue(cpValue);
+        line.setCpAvg(cpAvg);
+
+        return line;
+    }
+}
+

+ 151 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerProcessALG.java

@@ -0,0 +1,151 @@
+package com.gyee.power.fitting.common.alg;
+
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 功率曲线拟合
+ * 数据预处理算法
+ */
+public class PowerProcessALG {
+
+
+    /**
+     * 数据预处理
+     *
+     * @param list   预处理的数据
+     * @param map    风速对应的理论功率
+     * @param maxs   最大风速
+     * @param mins   最小风速
+     * @param maxp   最大功率
+     * @param minp   最小功率
+     * @param isfbw  是否并网
+     * @param isfhl  是否合理值
+     * @param isbw   并网后10分钟
+     * @param istj   停机前10分钟
+     * @param isglpc 功率曲线偏差
+     * @param isqfh  是否欠符合
+     * @param qfhdj  欠符合等级
+     * @return
+     */
+    public static List<PowerPointData> dataProcess(List<PowerPointData> list, Map<Double, Double> map,
+                                                   Double maxs, Double mins, Double maxp, Double minp, Boolean isfbw,
+                                                   Boolean isfhl, Boolean isbw, Boolean istj, Boolean isglpc, Boolean isqfh, Integer qfhdj){
+        String timeBW = DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN);
+        List<PowerPointData> tempei = new ArrayList<>();
+        List<PowerPointData> tempqf = new ArrayList<>();
+
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            int filter = 0;
+            int fjstatus = 0;
+            if (timeBW == DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN)){
+                timeBW = item.getTime();
+            }
+            // 过滤非并网状态下的数据
+//            if (filter == 0 && isfbw && item.getMxzt() != 1) {
+//                filter = 1;
+//                fjstatus = 1;
+//                timeBW = item.getTime();
+//            } else {
+//                filter = 0;
+//                fjstatus = 0;
+//            }
+            if (filter == 0 && isfbw && item.getMxzt() != 2) {
+                filter = 1;
+                fjstatus = 1;
+                timeBW = item.getTime();
+            } else {
+                filter = 0;
+                fjstatus = 0;
+
+            }
+            if (item.getSpeed() < mins || item.getSpeed() > maxs || item.getPower() < minp || item.getPower() > maxp) {
+                filter = 1;
+            }
+            // 过滤非合理值 并网状态下功率小于等于0
+            if (filter == 0 && isfhl && item.getPower() <= 0) {
+                filter = 1;
+            }
+            // 过滤非合理值 并网状态下功率小于等于0
+            if (filter == 0 && isfhl && item.getSpeed() < 3 && item.getPower() != 0) {
+                filter = 1;
+            }
+            // 过滤并网后十分钟
+            if (filter == 0 && isbw) {
+                if (DateUtil.getTime(item.getTime(), timeBW) <= 10)
+                    filter = 1;
+            }
+            // 过滤停机后十分钟
+            if (istj) {
+                if (fjstatus == 0) {
+                    if (tempei.size() > 0) {
+                        if (DateUtil.getTime(tempei.get(0).getTime(), timeBW) >= 10) {
+                            tempei.remove(0);
+                        }
+                    }
+                    tempei.add(item);
+                } else {
+                    for (PowerPointData temp : tempei) {
+                        temp.setFilter(1);
+                    }
+                    tempei.clear();
+                }
+            }
+            //欠发
+            if (filter == 0 && item.getSpeed() >= 6 && item.getSpeed() < 12.5 && isqfh && qfhdj <= item.getQfzt()) {
+                filter = 1;
+                for (PowerPointData temp : tempqf) {
+                    temp.setFilter(1);
+                }
+            } else if (filter == 0 && item.getSpeed() >= 12.5 && isqfh && qfhdj <= 1) {
+                filter = 1;
+                for (PowerPointData temp : tempqf) {
+                    temp.setFilter(1);
+                }
+            }
+            if (tempqf.size() > 0) {
+                if (DateUtil.getTime(tempqf.get(0).getTime(), item.getTime()) >= 5) {
+                    tempqf.remove(0);
+                }
+            }
+            tempqf.add(item);
+            item.setFilter(filter);
+
+            //功率曲线偏差
+            if (isglpc) {
+                if (map.containsKey(item)) {
+                    double power = map.get(item.getSpeed());
+                    double maxPower = map.get(map.size() - 1);
+                    double k = item.getPower() / power;
+                    if (item.getPower() > 0) {
+                        if (k < 0.95 && maxPower <= power) {
+                            item.setFilter(1);
+                        }
+                        if (k < 0.85 && maxPower > power) {
+                            item.setFilter(1);
+                        }
+                        if (k > 3 && item.getSpeed() < 6 && item.getSpeed() > 4) {
+                            item.setFilter(1);
+                        }
+
+                        if (k > 6 && item.getSpeed() <= 4 && item.getSpeed() > 3.5) {
+                            item.setFilter(1);
+                        }
+                        if (k > 12 && item.getSpeed() <= 3.5 && item.getSpeed() > 3) {
+                            item.setFilter(1);
+                        }
+                    }
+                }
+            }
+        }
+
+        return list;
+    }
+
+}

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/base/ExcludeQueryWrapper.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.base;
+package com.gyee.power.fitting.common.base;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/config/CorsConfig.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.config;
+package com.gyee.power.fitting.common.config;
 
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.CorsRegistry;

+ 1 - 8
power-fetting/src/main/java/com/gyee/power/fetting/common/config/datasource/DataSourceConfig.java

@@ -1,16 +1,9 @@
-package com.gyee.power.fetting.common.config.datasource;
+package com.gyee.power.fitting.common.config;
 
 import com.alibaba.druid.pool.DruidDataSource;
-import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionTemplate;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.jdbc.DataSourceBuilder;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
 
 import javax.sql.DataSource;
 

+ 68 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/config/GyeeConfig.java

@@ -0,0 +1,68 @@
+package com.gyee.power.fitting.common.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.system.ApplicationHome;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.util.List;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "gyee")
+public class GyeeConfig {
+
+    public File jarF = null;
+    {
+        ApplicationHome h = new ApplicationHome(getClass());
+        jarF = h.getSource();
+    }
+
+    /** 数据适配器网址 **/
+    private String adapterUrl;
+    /** 数据准备保存路径(原始数据) **/
+    private String filePathPrepare;
+    /** 数据处理保存路径(处理后的数据) **/
+    private String filePathProcess;
+    /** 数据拟合保存路径(拟合后的数据) **/
+    private String filePathFitting;
+    /** 数据压缩下载 **/
+    private String filePathDownload;
+    /** 功率曲线拟合测点 **/
+    private List<String> points;
+    /** 适配器读取数据等间隔时间 **/
+    private Integer interval;
+
+    public String getFilePathPrepare() {
+        return jarF.getParentFile().getAbsolutePath() + "\\" + filePathPrepare;
+    }
+
+    public void setFilePathPrepare(String filePathPrepare) {
+        this.filePathPrepare = filePathPrepare;
+    }
+
+    public String getFilePathProcess() {
+        return jarF.getParentFile().getAbsolutePath() + "\\" + filePathProcess;
+    }
+
+    public void setFilePathProcess(String filePathProcess) {
+        this.filePathProcess = filePathProcess;
+    }
+
+    public String getFilePathFitting() {
+        return jarF.getParentFile().getAbsolutePath() + "\\" + filePathFitting;
+    }
+
+    public void setFilePathFitting(String filePathFitting) {
+        this.filePathFitting = filePathFitting;
+    }
+
+    public String getFilePathDownload() {
+        return jarF.getParentFile().getAbsolutePath() + "\\" + filePathDownload;
+    }
+
+    public void setFilePathDownload(String filePathDownload) {
+        this.filePathDownload = filePathDownload;
+    }
+}

+ 50 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/config/ThreadPoolConfig.java

@@ -0,0 +1,50 @@
+package com.gyee.power.fitting.common.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+
+@Configuration
+public class ThreadPoolConfig {
+    /**
+     *   默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
+     *	当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
+     *  当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
+     */
+
+    /** 核心线程数(默认线程数) */
+    private static final int corePoolSize = 10;
+    /** 最大线程数 */
+    private static final int maxPoolSize = 20;
+    /** 允许线程空闲时间(单位:默认为秒) */
+    private static final int keepAliveTime = 60;
+    /** 缓冲队列大小 */
+    private static final int queueCapacity = 100;
+    /** 允许等待最长时间 */
+    private static final int awaitTime = 15;
+    /** 线程池名前缀 */
+    private static final String threadNamePrefix = "GYEE-Thread-";
+
+
+    @Bean
+    public ThreadPoolTaskExecutor taskExecutor(){
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(corePoolSize);
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setQueueCapacity(queueCapacity);
+        executor.setKeepAliveSeconds(keepAliveTime);
+        executor.setThreadNamePrefix(threadNamePrefix);
+        executor.setAwaitTerminationSeconds(awaitTime);
+
+        // 线程池对拒绝任务的处理策略
+        // CallerRunsPolicy:由调用线程(提交任务的线程)处理该任务
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        // 初始化
+        executor.initialize();
+        return executor;
+    }
+
+}

+ 20 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/config/WebSocketConfig.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.common.config;
+
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+
+/**
+ * 开启 WebSocket 支持
+ **/
+@Configuration
+public class WebSocketConfig {
+
+    @Bean
+    public ServerEndpointExporter serverEndpointExporter() {
+        System.out.println("开启websocket支持。。。。。");
+        return new ServerEndpointExporter();
+    }
+
+}

+ 39 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/constants/Constants.java

@@ -0,0 +1,39 @@
+package com.gyee.power.fitting.common.constants;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Constants {
+
+    // 数据准备  标记
+    public static final String DATA_PREPARE = "prepare";
+
+    // 数据处理完  标记
+    public static final String DATA_PROCESS = "process";
+
+    // 数据处理完  标记
+    public static final String DATA_FITTING = "fitting";
+
+    // 数据表头
+    public static final List<String> TABLE_TITLE = new ArrayList<>();
+
+    // 拟合后的数据表头
+    public static final List<String> FITTING_TITLE = new ArrayList<>();
+
+
+    static {
+        TABLE_TITLE.add("时间");
+        TABLE_TITLE.add("风机功率");
+        TABLE_TITLE.add("风机风速");
+        TABLE_TITLE.add("发电机转速");
+        TABLE_TITLE.add("风机状态");
+        TABLE_TITLE.add("风机电量");
+        TABLE_TITLE.add("欠发状态");
+        TABLE_TITLE.add("风向");
+        TABLE_TITLE.add("对风角度");
+
+        FITTING_TITLE.add("风速");
+        FITTING_TITLE.add("拟合功率");
+        FITTING_TITLE.add("Cp值");
+    }
+}

+ 3 - 3
power-fetting/src/main/java/com/gyee/power/fetting/common/exception/AdviceException.java

@@ -1,8 +1,8 @@
-package com.gyee.power.fetting.common.exception;
+package com.gyee.power.fitting.common.exception;
 
 import com.alibaba.fastjson.JSONObject;
-import com.gyee.power.fetting.common.result.JsonResult;
-import com.gyee.power.fetting.common.result.ResultCode;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/common/exception/CustomException.java

@@ -1,6 +1,6 @@
-package com.gyee.power.fetting.common.exception;
+package com.gyee.power.fitting.common.exception;
 
-import com.gyee.power.fetting.common.result.ResultCode;
+import com.gyee.power.fitting.common.result.ResultCode;
 import lombok.Data;
 
 @Data

+ 3 - 3
power-fetting/src/main/java/com/gyee/power/fetting/common/feign/IAdapterService.java

@@ -1,7 +1,7 @@
-package com.gyee.power.fetting.common.feign;
+package com.gyee.power.fitting.common.feign;
 
 import com.alibaba.fastjson.JSONObject;
-import com.gyee.power.fetting.model.custom.TsDoubleData;
+import com.gyee.power.fitting.model.custom.TsDoubleData;
 import feign.Headers;
 import feign.Param;
 import feign.RequestLine;
@@ -19,6 +19,6 @@ public interface IAdapterService {
 
     @Headers({"Content-Type: application/json", "Accept: application/json"})
     @RequestLine("GET /ts/history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
-    List<TsDoubleData> getHistorySnapAI(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
+    List<TsDoubleData> getHistorySnap(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
                                         @Param(value = "endTs") long endTs, @Param(value = "interval") Integer interval);
 }

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/common/feign/RemoteServiceBuilder.java

@@ -1,6 +1,6 @@
-package com.gyee.power.fetting.common.feign;
+package com.gyee.power.fitting.common.feign;
 
-import com.gyee.power.fetting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.config.GyeeConfig;
 import feign.Feign;
 import feign.Request;
 import feign.Retryer;

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/result/JsonResult.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.result;
+package com.gyee.power.fitting.common.result;
 
 import com.alibaba.fastjson.JSONObject;
 import lombok.Data;

+ 2 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/result/ResultCode.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.result;
+package com.gyee.power.fitting.common.result;
 
 /*
  * #1001~1999 区间表示参数错误
@@ -9,6 +9,7 @@ package com.gyee.power.fetting.common.result;
 public enum ResultCode {
     /* 成功 */
     SUCCESS(200, "成功"),
+    SUCCESS_DATA_PREPARE(200, "数据已提交,稍后查看"),
 
     /* 默认失败 */
     ERROR(4000, "失败"),

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/spring/ExitDisposable.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.spring;
+package com.gyee.power.fitting.common.spring;
 
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.boot.ExitCodeGenerator;

+ 125 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/spring/InitialRunner.java

@@ -0,0 +1,125 @@
+package com.gyee.power.fitting.common.spring;
+
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.model.*;
+import com.gyee.power.fitting.service.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 服务启动前执行,进行全局变量初始化
+ */
+@Slf4j
+@Component
+@Order(1)
+public class InitialRunner implements CommandLineRunner {
+
+    @Autowired
+    GyeeConfig config;
+    @Resource
+    private WindturbineService windturbineService;
+    @Resource
+    private WindpowerstationService windpowerstationService;
+    @Resource
+    private Windturbinetestingpointai2Service pointService;
+    @Resource
+    private EquipmentmodelService equipmentmodelService;
+    @Resource
+    private ModelpowerService modelpowerService;
+    @Resource
+    private ModelpowerdetailsService modelpowerdetailsService;
+
+
+    /**场站所有信息**/
+    public static List<Windpowerstation> wpList = new ArrayList<>();
+    /** <MHS_FDC, 麻黄山风电场> **/
+    public static Map<String, String> stationMap = new HashMap<>();
+
+    /**所有的风机**/
+    public static List<Windturbine> wtList = new ArrayList<>();
+    /** key:wtId NG01_01 **/
+    public static Map<String, Windturbine> wtMap = new HashMap<>();
+    /**场站的风机**/
+    public static Map<String, List<Windturbine>> wpMap = new HashMap<>();
+
+    public static Map<String, List<Windturbinetestingpointai2>> pointMap = new HashMap<>();
+
+    /**所有设备型号**/
+    public static List<Equipmentmodel> equipmentList = new ArrayList<>();
+    public static Map<String, Equipmentmodel> equipmentMap = new HashMap<>();
+
+    /**功率曲线拟合的风速功率点**/
+    /** key: model  UP82 **/
+    public static Map<String, List<Modelpower>> modelPowerMap = new HashMap<>();
+    /** key: model  UP82 **/
+    public static Map<String, List<Modelpowerdetails>> modelPowerDetailMap = new HashMap<>();
+
+
+    @Override
+    public void run(String... args){
+        System.out.println(">>>>>>>>>>>>>>>服务启动,正在缓存数据<<<<<<<<<<<<<<");
+
+        cacheStation();
+        cachePoints();
+        cacheEquipment();
+        cacheModelPower();
+
+        System.out.println(">>>>>>>>>>>>>>>数据缓存完成<<<<<<<<<<<<<<");
+    }
+
+    /**
+     * 缓存场站、风机数据
+     * 数据新增或删除后需要更新,故每次清空
+     */
+    public void cacheStation(){
+        List<Windpowerstation> stations = windpowerstationService.selectList();
+        wpList = stations.stream().filter(f -> f.getId().endsWith("FDC")).collect(Collectors.toList());
+        wpList.stream().forEach(obj -> {
+            List<Windturbine> wts = windturbineService.selectList(obj.getId());
+            stationMap.put(obj.getId(), obj.getName());
+            wpMap.put(obj.getId(), wts);
+            wtList.addAll(wts);
+
+            wts.stream().forEach(u -> wtMap.put(u.getId(), u));
+        });
+    }
+
+    /**
+     * 缓存测点数据
+     */
+    private void cachePoints() {
+        List<Windturbinetestingpointai2> list = new ArrayList<>();
+        wpList.stream().forEach(d -> list.addAll(pointService.selectList(d.getId(), config.getPoints())));
+        pointMap.putAll(list.stream().collect(Collectors.groupingBy(u -> u.getWindturbineid())));
+        System.out.println("cachePoints: " + pointMap.size());
+        if (pointMap.size() == 0)
+            log.error("cachePoints", "测点数据缓存失败");
+    }
+
+    /**
+     * 缓存设备型号
+     */
+    private void cacheEquipment() {
+        equipmentList.addAll(equipmentmodelService.selectList());
+        for (Equipmentmodel eq : equipmentList)
+            equipmentMap.put(eq.getId(), eq);
+    }
+
+    private void cacheModelPower() {
+        List<Modelpower> lsMP = modelpowerService.selectList();
+        List<Modelpowerdetails> lsMPD = modelpowerdetailsService.selectList();
+        modelPowerMap.putAll(lsMP.stream().collect(Collectors.groupingBy(u -> u.getModelid())));
+        modelPowerDetailMap.putAll(lsMPD.stream().collect(Collectors.groupingBy(u -> u.getModelid())));
+    }
+
+}

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/spring/SpringContextUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.spring;
+package com.gyee.power.fitting.common.spring;
 
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.DisposableBean;

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/Base64Util.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 import java.io.UnsupportedEncodingException;
 import java.util.Base64;

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/CollectUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;

+ 20 - 2
power-fetting/src/main/java/com/gyee/power/fetting/common/util/DateUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.time.DateFormatUtils;
@@ -152,6 +152,8 @@ public class DateUtil extends DateUtils {
 
     public static String YYYY_MM = "yyyy-MM";
 
+    public static String YYYY_MM_DD_CHN = "yyyy年MM月dd日";
+
     public static String YYYY_MM_DD = "yyyy-MM-dd";
 
     public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
@@ -488,9 +490,25 @@ public class DateUtil extends DateUtils {
         return utcSDF;
     }
 
+    // 获取两个时间相差分钟数
+    public static int getTime(String oldTime,String newTime) {
+        int diff = 0;
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long NTime = 0;
+        long OTime = 0;
+        try {
+            NTime = df.parse(newTime).getTime();
+            //从对象中拿到时间
+            OTime = df.parse(oldTime).getTime();
+            diff = (int) (Math.abs((NTime-OTime))/1000/60);
+        } catch (ParseException e) {
+        }
+
+        return diff;
+    }
+
 
     public static void main(String[] args) {
-        System.out.println(getCurrentDate());
         System.out.println(getPreviousDate(3 * 360 * 24));
         System.out.println(covertDateTimestamp("2021-12-30 00:00:00"));
     }

+ 107 - 10
power-fetting/src/main/java/com/gyee/power/fetting/common/util/FileUtil.java

@@ -1,13 +1,15 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
-import com.gyee.power.fetting.common.exception.CustomException;
-import com.gyee.power.fetting.common.result.ResultCode;
 import lombok.extern.slf4j.Slf4j;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
 
 @Slf4j
 public class FileUtil {
@@ -18,7 +20,7 @@ public class FileUtil {
      * @param fileName
      * @param content
      */
-    public static void writeFile(String fileName, String content) {
+    public static boolean writeFile(String fileName, String content) {
         BufferedWriter bw = null;
 
         try {
@@ -29,15 +31,16 @@ public class FileUtil {
             bw = new BufferedWriter(new FileWriter(file, true));
 
             String[] list = content.split("\n");
-            for(int i = 0; i < list.length; i++){
+            for (int i = 0; i < list.length; i++) {
                 bw.write(list[i]);
                 bw.write("\n");
-                if (i % 500 == 0)
+                if (i % 1000 == 0)
                     bw.flush();
             }
             bw.flush();
         } catch (Exception e) {
-            log.error(e.getMessage());
+            log.error("writePowerData", e);
+            return false;
         } finally {
             try {
                 bw.close();
@@ -45,6 +48,8 @@ public class FileUtil {
                 e.printStackTrace();
             }
         }
+
+        return true;
     }
 
     /**
@@ -97,6 +102,45 @@ public class FileUtil {
 
     }
 
+    /**
+     * 读取文件
+     *
+     * @param fileName
+     * @param isAll    是否读取全部数据
+     * @return
+     */
+    public static List<String> readFile(String fileName, boolean isAll) {
+        List<String> list = new ArrayList<>();
+
+        File file = new File(fileName);
+        BufferedReader reader = null;
+        try {
+            reader = new BufferedReader(new FileReader(file));
+            String content = null;
+            int line = 0;
+            // 一次读入一行,直到读入null为文件结束
+            while ((content = reader.readLine()) != null) {
+                // 显示行号
+                list.add(content);
+                line++;
+                if (!isAll && line == 300)
+                    break;
+            }
+            reader.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e1) {
+                }
+            }
+        }
+
+        return list;
+    }
+
 
     /**
      * 加载文件
@@ -128,10 +172,8 @@ public class FileUtil {
                 os.write(buffer, 0, i);
                 i = bis.read(buffer);
             }
-        } catch (FileNotFoundException e) {
-            throw new CustomException(ResultCode.ERROR_FILE_NO);
         } catch (Exception e) {
-            throw new CustomException(ResultCode.ERROR);
+            log.error("FileUtil--download", e);
         } finally {
             if (bis != null) {
                 try {
@@ -149,4 +191,59 @@ public class FileUtil {
             }
         }
     }
+
+
+    /**
+     * @describe 压缩多个文件
+     * @author zfc
+     */
+    public static String zipFiles(List<File> srcFiles, File zipFile) {
+        // 判断压缩后的文件存在不,不存在则创建
+        if (!zipFile.exists()) {
+            try {
+                zipFile.createNewFile();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        // 创建 FileOutputStream 对象
+        FileOutputStream fileOutputStream = null;
+        // 创建 ZipOutputStream
+        ZipOutputStream zipOutputStream = null;
+        // 创建 FileInputStream 对象
+        FileInputStream fileInputStream = null;
+
+        try {
+            // 实例化 FileOutputStream 对象
+            fileOutputStream = new FileOutputStream(zipFile);
+            // 实例化 ZipOutputStream 对象
+            zipOutputStream = new ZipOutputStream(fileOutputStream);
+            // 创建 ZipEntry 对象
+            ZipEntry zipEntry = null;
+            // 遍历源文件数组
+            for (int i = 0; i < srcFiles.size(); i++) {
+                // 将源文件数组中的当前文件读入 FileInputStream 流中
+                fileInputStream = new FileInputStream(srcFiles.get(i));
+                // 实例化 ZipEntry 对象,源文件数组中的当前文件
+                zipEntry = new ZipEntry(srcFiles.get(i).getName());
+                zipOutputStream.putNextEntry(zipEntry);
+                // 该变量记录每次真正读的字节个数
+                int len;
+                // 定义每次读取的字节数组
+                byte[] buffer = new byte[1024];
+                while ((len = fileInputStream.read(buffer)) > 0) {
+                    zipOutputStream.write(buffer, 0, len);
+                }
+            }
+            zipOutputStream.closeEntry();
+            zipOutputStream.close();
+            fileInputStream.close();
+            fileOutputStream.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        return zipFile.getAbsolutePath();
+    }
+
 }

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/JudeSystem.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 
 /**

+ 20 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/NumberUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 
 import java.math.BigDecimal;
@@ -87,4 +87,23 @@ public class NumberUtil {
         return sb.toString();
     }
 
+    public static String toNum(int num){
+        String interval = "";
+        switch(num){
+            case 1:
+                interval = "一秒";
+                break;
+            case 60:
+                interval = "一分钟";
+                break;
+            case 600:
+                interval = "十分钟";
+                break;
+            default:
+                interval = "一分钟";
+        }
+
+        return interval;
+    }
+
 }

+ 61 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/util/PowerFittingUtil.java

@@ -0,0 +1,61 @@
+package com.gyee.power.fitting.common.util;
+
+import com.gyee.power.fitting.common.constants.Constants;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class PowerFittingUtil {
+
+    /**
+     * 功率曲线拟合数据  tree
+     * @return
+     */
+    public static List<Object> powerDataTree(List<Powerfittinganalysis> list, String type){
+        /**多层分组**/
+        Map<String, Map<String, Map<String, List<Powerfittinganalysis>>>> map = list.stream().
+                collect(Collectors.groupingBy(Powerfittinganalysis::getInterval, TreeMap::new,
+                        Collectors.groupingBy(Powerfittinganalysis::getTime,
+                                Collectors.groupingBy(Powerfittinganalysis::getStationcn))));
+
+        List<Object> result = new ArrayList<>();
+        map.forEach((k, v) -> {
+            List<Object> l1 = new ArrayList<>();
+            Map<String, Object> map1 = new TreeMap<>();
+
+            map.get(k).forEach((k1, v1) -> {
+                List<Object> l2 = new ArrayList<>();
+                Map<String, Object> map2 = new HashMap<>();
+                map.get(k).get(k1).forEach((k2, v2) -> {
+                    Map<String, Object> map3 = new HashMap<>();
+                    map3.put("id", SnowFlakeUtil.generateId());
+                    map3.put("label", k2);
+                    map3.put("children", v2.stream().sorted(Comparator.comparing(Powerfittinganalysis::getWindturbine)));
+                    l2.add(map3);
+                });
+
+                map2.put("id", SnowFlakeUtil.generateId());
+                map2.put("label", k1);
+                map2.put("children", l2);
+                l1.add(map2);
+            });
+
+            map1.put("id", SnowFlakeUtil.generateId());
+            map1.put("label", k);
+            map1.put("children", l1);
+            result.add(map1);
+        });
+
+        Map<String, Object> mp = new HashMap<>();
+        mp.put("id", SnowFlakeUtil.generateId());
+        mp.put("label", type.equals(Constants.DATA_PREPARE) ? "数据准备" :
+                type.equals(Constants.DATA_PROCESS) ? "数据预处理" : type.equals(Constants.DATA_FITTING) ? "功率曲线拟合" : "数据");
+        mp.put("children", result);
+
+        List<Object> ls = new ArrayList<>();
+        ls.add(mp);
+
+        return ls;
+    }
+}

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/SnowFlakeUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 
 /**

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/TokenGenerator.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 import java.security.MessageDigest;
 import java.util.UUID;

+ 85 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/DataFittingController.java

@@ -0,0 +1,85 @@
+package com.gyee.power.fitting.controller;
+
+
+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.DataFittingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 功率曲线拟合
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/power/fitting")
+public class DataFittingController {
+
+    @Autowired
+    private DataFittingService fittingService;
+
+
+    /**
+     * 数据拟合
+     * @param ids    数据预处理id
+     * @param maxs
+     * @param mins
+     * @param maxp
+     * @param minp
+     * @param dimension 多项式
+     * @param mode  拟合方式  0:单台拟合  1:合并拟合
+     * @return
+     */
+    @GetMapping("/data")
+    public JSONObject dataFitting(@RequestParam(value = "ids",  required = false) String ids,
+                                  @RequestParam(value = "maxs",  required = false) Double maxs,
+                                  @RequestParam(value = "mins",  required = false) Double mins,
+                                  @RequestParam(value = "maxp",  required = false) Double maxp,
+                                  @RequestParam(value = "minp",  required = false) Double minp,
+                                  @RequestParam(value = "dimension",  required = false) Integer dimension,
+                                  @RequestParam(value = "mode",  required = false) Integer mode){
+        String[] id = ids.split(",");
+        fittingService.dataFitting(Arrays.asList(id), maxs, mins, maxp, minp, dimension, mode);
+        return JsonResult.success(ResultCode.SUCCESS);
+    }
+
+
+    /** 文件 tree
+     * @return
+     */
+    @GetMapping("tree")
+    public JSONObject dataFIttingTree(){
+        List<Object> result = fittingService.dataFittingTree();
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * file 文件数据展示
+     * @param id
+     * @return
+     */
+    @GetMapping("show")
+    public JSONObject dataFittingShow(String id){
+        Map<String, Object> result = fittingService.dataFittingShow(id);
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * 读取曲线,散点等数据
+     * @param id  拟合好的数据ID
+     * @return
+     */
+    @GetMapping("curve")
+    public JSONObject dataFittingCurve(String id){
+        Map<String, Object> result = fittingService.dataFittingCurve(id);
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+}

+ 83 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/DataPrepareController.java

@@ -0,0 +1,83 @@
+package com.gyee.power.fitting.controller;
+
+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.common.util.FileUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import com.gyee.power.fitting.service.custom.DataPrepareService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.*;
+
+
+/**
+ * 功率曲线拟合  数据准备
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/power/prepare")
+public class DataPrepareController {
+
+    @Autowired
+    private DataPrepareService prepareService;
+    @Autowired
+    private PowerfittinganalysisService powerService;
+
+
+    /**
+     * 数据准备  golden-file
+     * @param station
+     * @param wtIds
+     * @param st
+     * @param et
+     * @param interval
+     * @return
+     */
+    @GetMapping("data")
+    public JSONObject dataPrepare(String station, String wtIds, Long st,
+                                  Long et, Integer interval){
+        if (station.isEmpty() || wtIds.isEmpty())
+            return JsonResult.error(ResultCode.PARAM_NOT_COMPLETE);
+
+        String[] points = wtIds.split(",");
+        prepareService.dataPrepare(station, Arrays.asList(points), st, et, interval);
+
+        return JsonResult.error(ResultCode.SUCCESS_DATA_PREPARE);
+    }
+
+    /** 文件 tree
+     * @return
+     */
+    @GetMapping("tree")
+    public JSONObject dataPrepareTree(){
+        List<Object> result = prepareService.dataPrepareTree();
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * file 文件数据展示前500行
+     * @param id
+     * @return
+     */
+    @GetMapping("show")
+    public JSONObject dataPrepareShow(String id){
+        Map<String, Object> result = prepareService.dataPrepareShow(id);
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * file 下载
+     * @return
+     */
+    @GetMapping("download")
+    public void dataPrepareDownload(HttpServletResponse response, @RequestParam(value = "id", required = false) String id){
+        Powerfittinganalysis obj = powerService.selectItemById(id);
+        FileUtil.download(obj.getPath(), response);
+    }
+}

+ 99 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/DataProcessController.java

@@ -0,0 +1,99 @@
+package com.gyee.power.fitting.controller;
+
+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.common.util.FileUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import com.gyee.power.fitting.service.custom.DataProcessService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 功率曲线拟合  数据预处理
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/power/process")
+public class DataProcessController {
+
+    @Autowired
+    private PowerfittinganalysisService powerService;
+    @Autowired
+    private DataProcessService processService;
+
+
+    /**
+     * 数据预处理
+     * @param ids       预处理数据的ID  自定义
+     * @param maxs     最大风速
+     * @param mins     最小风速
+     * @param maxp     最大功率
+     * @param minp     最小功率
+     * @param isfbw    非并网
+     * @param isfhl    非合理值
+     * @param isbw     并网后10分钟
+     * @param istj     停机前10分钟
+     * @param isglpc   功率曲线偏差
+     * @param isqfh    是否欠符合
+     * @param qfhdj    欠符合等级
+     * @return
+     */
+    @GetMapping("data")
+    public JSONObject dataProcess(@RequestParam(value = "ids",  required = false) String ids,
+                                  @RequestParam(value = "maxs",  required = false) Double maxs,
+                                  @RequestParam(value = "mins",  required = false) Double mins,
+                                  @RequestParam(value = "maxp",  required = false) Double maxp,
+                                  @RequestParam(value = "minp",  required = false) Double minp,
+                                  @RequestParam(value = "isfbw",  required = false) Boolean isfbw,
+                                  @RequestParam(value = "isfhl",  required = false) Boolean isfhl,
+                                  @RequestParam(value = "isbw",  required = false) Boolean isbw,
+                                  @RequestParam(value = "istj",  required = false) Boolean istj,
+                                  @RequestParam(value = "isglpc",  required = false) Boolean isglpc,
+                                  @RequestParam(value = "isqfh",  required = false) Boolean isqfh,
+                                  @RequestParam(value = "qfhdj",  required = false) Integer qfhdj){
+
+        String[] id = ids.split(",");
+        processService.dataProcess(Arrays.asList(id), maxs, mins, maxp, minp, isfbw, isfhl, isbw, istj, isglpc, isqfh, qfhdj);
+
+        return JsonResult.error(ResultCode.SUCCESS);
+    }
+
+    /** 文件 tree
+     * @return
+     */
+    @GetMapping("tree")
+    public JSONObject dataProcessTree(){
+        List<Object> result = processService.dataProcessTree();
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * file 文件数据展示前500行
+     * @param id
+     * @return
+     */
+    @GetMapping("show")
+    public JSONObject dataProcessShow(String id){
+        Map<String, Object> result = processService.dataProcessShow(id);
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+    /**
+     * file 下载
+     * @return
+     */
+    @GetMapping("download")
+    public void dataProcessDownload(HttpServletResponse response, @RequestParam(value = "id", required = false) String id){
+        Powerfittinganalysis obj = powerService.selectItemById(id);
+        FileUtil.download(obj.getPath(), response);
+    }
+
+}

+ 61 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/DateOptionController.java

@@ -0,0 +1,61 @@
+package com.gyee.power.fitting.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.common.util.FileUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 数据删除、下载...
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/data/option")
+public class DateOptionController {
+
+    @Autowired
+    private GyeeConfig gyeeConfig;
+    @Autowired
+    private PowerfittinganalysisService powerfittinganalysisService;
+
+
+    /** 删除
+     * @return
+     */
+    @GetMapping("delete")
+    public JSONObject dataDelete(String ids){
+        powerfittinganalysisService.deleteList(ids);
+        return JsonResult.success(ResultCode.SUCCESS);
+    }
+
+
+    /**
+     * 文件压缩下载
+     * @return
+     */
+    @GetMapping("download")
+    public void dataProcessDownload(HttpServletResponse response, @RequestParam(value = "ids", required = false) String ids){
+        if (ids.isEmpty())
+            return;
+
+        List<Powerfittinganalysis> objs = powerfittinganalysisService.selectListByIds(ids);
+        List<String> list = objs.stream().map(p -> p.getPath()).collect(Collectors.toList());
+        List<File> files = list.stream().map(File::new).collect(Collectors.toList());
+
+        File zipFile = new File(gyeeConfig.getFilePathDownload()  + "\\" + objs.get(0).getStation() + "_" + System.currentTimeMillis() + ".zip");
+        // 调用压缩方法
+        String ps = FileUtil.zipFiles(files, zipFile);
+        FileUtil.download(ps, response);
+    }
+
+}

+ 36 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/WindInfoController.java

@@ -0,0 +1,36 @@
+package com.gyee.power.fitting.controller;
+
+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.common.spring.InitialRunner;
+import com.gyee.power.fitting.model.Windpowerstation;
+import com.gyee.power.fitting.model.Windturbine;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 场站风机等基础数据
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/base")
+public class WindInfoController {
+
+    @GetMapping("station")
+    public JSONObject getStation(){
+        List<Windpowerstation> list = InitialRunner.wpList;
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+    @GetMapping("windturbine")
+    public JSONObject getWindTurbine(String stationId){
+        List<Windturbine> list = InitialRunner.wpMap.get(stationId);
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+}

+ 18 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/EquipmentmodelMapper.java

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Equipmentmodel;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Mapper
+public interface EquipmentmodelMapper extends BaseMapper<Equipmentmodel> {
+
+}

+ 21 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/ModelpowerMapper.java

@@ -0,0 +1,21 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Modelpower;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Mapper
+public interface ModelpowerMapper extends BaseMapper<Modelpower> {
+
+    List<Modelpower> selectList();
+}

+ 18 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/ModelpowerdetailsMapper.java

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Modelpowerdetails;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Mapper
+public interface ModelpowerdetailsMapper extends BaseMapper<Modelpowerdetails> {
+
+}

+ 18 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/PowerfittinganalysisMapper.java

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-03
+ */
+@Mapper
+public interface PowerfittinganalysisMapper extends BaseMapper<Powerfittinganalysis> {
+
+}

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/mapper/WindpowerstationMapper.java

@@ -1,8 +1,8 @@
-package com.gyee.power.fetting.mapper;
+package com.gyee.power.fitting.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gyee.power.fetting.model.Windpowerstation;
+import com.gyee.power.fitting.model.Windpowerstation;
 import org.apache.ibatis.annotations.Mapper;
 
 /**

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/mapper/WindturbineMapper.java

@@ -1,8 +1,8 @@
-package com.gyee.power.fetting.mapper;
+package com.gyee.power.fitting.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gyee.power.fetting.model.Windturbine;
+import com.gyee.power.fitting.model.Windturbine;
 import org.apache.ibatis.annotations.Mapper;
 
 /**

+ 18 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/Windturbinetestingpointai2Mapper.java

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Windturbinetestingpointai2;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-01
+ */
+@Mapper
+public interface Windturbinetestingpointai2Mapper extends BaseMapper<Windturbinetestingpointai2> {
+
+}

+ 72 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Equipmentmodel.java

@@ -0,0 +1,72 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("EQUIPMENTMODEL")
+public class Equipmentmodel extends Model<Equipmentmodel> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("DESCRIPTION")
+    private String description;
+
+    @TableField("POWERPRODUCTION")
+    private String powerproduction;
+
+    @TableField("CUTINWINDSPEED")
+    private String cutinwindspeed;
+
+    @TableField("RATEDWINDSPEED")
+    private String ratedwindspeed;
+
+    @TableField("CUTOUTWINDSPEED")
+    private String cutoutwindspeed;
+
+    @TableField("WINDTURBINEMANUFACTURERID")
+    private String windturbinemanufacturerid;
+
+    @TableField("PHOTO")
+    private String photo;
+
+    @TableField("UNIT")
+    private String unit;
+
+    //扫风面积
+    @TableField("SWEPTAREA")
+    private Double sweptarea;
+
+    @TableField("EQUIPMENTCATEGORY")
+    private String equipmentcategory;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 47 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Modelpower.java

@@ -0,0 +1,47 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("MODELPOWER")
+public class Modelpower extends Model<Modelpower> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private String id;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("SPEED")
+    private String speed;
+
+    @TableField("THEORYPOWER")
+    private String theorypower;
+
+    @TableField("ENSUREPOWER")
+    private String ensurepower;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 47 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Modelpowerdetails.java

@@ -0,0 +1,47 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("MODELPOWERDETAILS")
+public class Modelpowerdetails extends Model<Modelpowerdetails> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private String id;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("SPEED")
+    private Double speed;
+
+    @TableField("THEORYPOWER")
+    private Double theorypower;
+
+    @TableField("ENSUREPOWER")
+    private Double ensurepower;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 64 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Powerfittinganalysis.java

@@ -0,0 +1,64 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("POWERFITTINGANALYSIS")
+public class Powerfittinganalysis extends Model<Powerfittinganalysis> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableField("ID")
+    private String id;
+
+    @TableField("STATION")
+    private String station;
+
+    @TableField("STATIONCN")
+    private String stationcn;
+
+    @TableField("WINDTURBINE")
+    private String windturbine;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("INTERVAL")
+    private String interval;
+
+    @TableField("TIME")
+    private String time;
+
+    @TableField("PATH")
+    private String path;
+
+    @TableField("TYPE")
+    private String type;
+
+    @TableField("PREPAREID")
+    private String prepareid;
+
+
+
+
+
+    @Override
+    protected Serializable pkVal() {
+        return null;
+    }
+
+}

+ 5 - 4
power-fetting/src/main/java/com/gyee/power/fetting/model/Windpowerstation.java

@@ -1,11 +1,12 @@
-package com.gyee.power.fetting.model;
+package com.gyee.power.fitting.model;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -84,8 +85,8 @@ public class Windpowerstation extends Model<Windpowerstation> {
     @TableField("HEIGHT")
     private String height;
 
-    @TableField("AQTS")
-    private LocalDate aqts;
+//    @TableField("AQTS")
+//    private Date aqts;
 
 
     @Override

+ 4 - 3
power-fetting/src/main/java/com/gyee/power/fetting/model/Windturbine.java

@@ -1,11 +1,12 @@
-package com.gyee.power.fetting.model;
+package com.gyee.power.fitting.model;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -52,7 +53,7 @@ public class Windturbine extends Model<Windturbine> {
     private String lineid;
 
     @TableField("FIRSTINTEGRATEDTIME")
-    private LocalDate firstintegratedtime;
+    private Date firstintegratedtime;
 
     @TableField("PHOTO")
     private String photo;

+ 86 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Windturbinetestingpointai2.java

@@ -0,0 +1,86 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("WINDTURBINETESTINGPOINTAI2")
+public class Windturbinetestingpointai2 extends Model<Windturbinetestingpointai2> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("VALUEUNIT")
+    private String valueunit;
+
+    @TableField("ENGLISHNAME")
+    private String englishname;
+
+    @TableField("TYPEID")
+    private String typeid;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("MAXVAL")
+    private String maxval;
+
+    @TableField("MINVAL")
+    private String minval;
+
+    @TableField("REASONABLEMAXVAL")
+    private String reasonablemaxval;
+
+    @TableField("REASONABLEMINVAL")
+    private String reasonableminval;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("UNIFORMCODE")
+    private String uniformcode;
+
+    @TableField("SHORTID")
+    private String shortid;
+
+    @TableField("LONGID")
+    private String longid;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("REALTIMEID")
+    private String realtimeid;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 35 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/LineCurveFitting.java

@@ -0,0 +1,35 @@
+package com.gyee.power.fitting.model.custom;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class LineCurveFitting {
+
+    public String name;
+    public List<PointVo> lines;
+    public List<PointVo> YLines;
+
+    public List<PointVo> point;
+    public List<PointVo> YPoint;
+
+    /// <summary>
+    /// 推力系数
+    /// </summary>
+    public List<PointVo> CpValue;
+    /// <summary>
+    /// 推力系数平均值
+    /// </summary>
+    public double CpAvg;
+    /// <summary>
+    /// 平均风速
+    /// </summary>
+    public double speed;
+
+    /// <summary>
+    /// 静风频率
+    /// </summary>
+    public double frequency;
+
+}

+ 14 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PointVo.java

@@ -0,0 +1,14 @@
+package com.gyee.power.fitting.model.custom;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PointVo {
+
+    private Double x;
+    private Double y;
+}

+ 27 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerFittingPoint.java

@@ -0,0 +1,27 @@
+package com.gyee.power.fitting.model.custom;
+
+import lombok.Data;
+
+/**
+ * 拟合后对应的曲线 model
+ */
+@Data
+public class PowerFittingPoint {
+
+    //风速
+    private Double speed;
+    //拟合数据
+    private Double nhdata;
+    //修正数据
+    private Double xzdata;
+    //cp值
+    private Double cpdata;
+
+    public PowerFittingPoint(String[] str) {
+        if (str.length >= 2){
+            this.speed = Double.valueOf(str[0]);
+            this.nhdata = Double.valueOf(str[1]);
+            this.cpdata = ((double)((int)(Double.valueOf(str[2])*1000)))/1000;
+        }
+    }
+}

+ 61 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerPointData.java

@@ -0,0 +1,61 @@
+package com.gyee.power.fitting.model.custom;
+
+import lombok.Data;
+
+import java.text.DecimalFormat;
+
+/**
+ * 数据准备的测点
+ */
+@Data
+public class PowerPointData {
+
+    public PowerPointData(){}
+
+    public PowerPointData(String[] str){
+        DecimalFormat df = new DecimalFormat("0.00");
+        if (str.length >= 9){
+            this.time = str[0];
+            this.power = Double.valueOf(df.format(Double.valueOf(str[1])));
+            this.speed = Double.valueOf(df.format(Double.valueOf(str[2])));
+            this.RR = Double.valueOf(df.format(Double.valueOf(str[3])));
+            this.mxzt = Double.valueOf(df.format(Double.valueOf(str[4]))).intValue();
+            this.DL = Double.valueOf(df.format(Double.valueOf(str[5])));
+            this.qfzt = Double.valueOf(df.format(Double.valueOf(str[6]))).intValue();
+            this.FX = Double.valueOf(df.format(Double.valueOf(str[7])));
+            this.angle = Double.valueOf(df.format(Double.valueOf(str[8])));
+        }
+    }
+
+    //时间
+    private String time;
+
+    //功率
+    private Double power;
+
+    //风速
+    private Double speed;
+
+    //转速
+    private Double RR;
+
+    //明细状态
+    private Integer mxzt;
+
+    //电量
+    private Double DL;
+
+    //欠发状态
+    private Integer qfzt;
+
+    //风向
+    private Double FX;
+
+    //对风角度
+    private Double angle;
+
+    //是否过滤  0:不过滤 1:过滤
+    private Integer filter;
+
+    private String wtId;
+}

+ 43 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/TableTitle.java

@@ -0,0 +1,43 @@
+package com.gyee.power.fitting.model.custom;
+
+import lombok.Data;
+
+/**
+ * 和 PowerPointData / PowerFittingPoint 对应
+ * 主要给前端表格提供对应标题
+ */
+@Data
+public class TableTitle {
+
+    private String key;
+    private String des;
+
+    public TableTitle(String des){
+        this.des = des;
+        if (des.contains("时间")){
+            this.key = "time";
+        } else if (des.contains("风机功率")){
+            this.key = "power";
+        } else if (des.contains("风速")){
+            this.key = "speed";
+        } else if (des.contains("转速")){
+            this.key = "rr";
+        } else if (des.contains("风机状态")){
+            this.key = "mxzt";
+        } else if (des.contains("电量")){
+            this.key = "dl";
+        } else if (des.contains("欠发")){
+            this.key = "qfzt";
+        } else if (des.contains("风向")){
+            this.key = "fx";
+        } else if (des.contains("角度")){
+            this.key = "angle";
+        } else if (des.contains("筛选")){
+            this.key = "filter";
+        } else if (des.contains("拟合功率")){
+            this.key = "nhdata";
+        } else if (des.contains("Cp值")){
+            this.key = "cpdata";
+        }
+    }
+}

+ 2 - 1
power-fetting/src/main/java/com/gyee/power/fetting/model/custom/TsDoubleData.java

@@ -1,5 +1,6 @@
-package com.gyee.power.fetting.model.custom;
+package com.gyee.power.fitting.model.custom;
 
+// 数据适配器取数对应的类
 public class TsDoubleData {
 
     private long ts;

+ 26 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/EquipmentmodelService.java

@@ -0,0 +1,26 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.Equipmentmodel;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+public interface EquipmentmodelService extends IService<Equipmentmodel> {
+
+    List<Equipmentmodel> selectList();
+
+    /**
+     * 通过幸好查询
+     * @param id
+     * @return
+     */
+    Equipmentmodel selectItemByModel(String id);
+}

+ 19 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/ModelpowerService.java

@@ -0,0 +1,19 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.Modelpower;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+public interface ModelpowerService extends IService<Modelpower> {
+
+    List<Modelpower> selectList();
+}

+ 19 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/ModelpowerdetailsService.java

@@ -0,0 +1,19 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.Modelpowerdetails;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+public interface ModelpowerdetailsService extends IService<Modelpowerdetails> {
+
+    List<Modelpowerdetails> selectList();
+}

+ 33 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/PowerfittinganalysisService.java

@@ -0,0 +1,33 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-03
+ */
+public interface PowerfittinganalysisService extends IService<Powerfittinganalysis> {
+
+
+    Powerfittinganalysis selectItemById(String id);
+
+    /**
+     * 根据类型查询
+     * @param type   prepare
+     * @return
+     */
+    List<Powerfittinganalysis> selectList(String type);
+
+    void insertItem(Powerfittinganalysis obj);
+
+    List<Powerfittinganalysis> selectListByIds(String ids);
+
+    void deleteList(String ids);
+}

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/service/WindpowerstationService.java

@@ -1,7 +1,7 @@
-package com.gyee.power.fetting.service;
+package com.gyee.power.fitting.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gyee.power.fetting.model.Windpowerstation;
+import com.gyee.power.fitting.model.Windpowerstation;
 
 import java.util.List;
 

+ 3 - 3
power-fetting/src/main/java/com/gyee/power/fetting/service/WindturbineService.java

@@ -1,7 +1,7 @@
-package com.gyee.power.fetting.service;
+package com.gyee.power.fitting.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gyee.power.fetting.model.Windturbine;
+import com.gyee.power.fitting.model.Windturbine;
 
 import java.util.List;
 
@@ -19,6 +19,6 @@ public interface WindturbineService extends IService<Windturbine> {
      * 查询所有的风机ID
      * @return
      */
-    List<Windturbine> selectList();
+    List<Windturbine> selectList(String station);
 
 }

+ 19 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/Windturbinetestingpointai2Service.java

@@ -0,0 +1,19 @@
+package com.gyee.power.fitting.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.power.fitting.model.Windturbinetestingpointai2;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-01
+ */
+public interface Windturbinetestingpointai2Service extends IService<Windturbinetestingpointai2> {
+
+    List<Windturbinetestingpointai2> selectList(String station, List<String> points);
+}

+ 263 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataFittingService.java

@@ -0,0 +1,263 @@
+package com.gyee.power.fitting.service.custom;
+
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.constants.Constants;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.FileUtil;
+import com.gyee.power.fitting.common.alg.PowerFittingALG;
+import com.gyee.power.fitting.common.util.PowerFittingUtil;
+import com.gyee.power.fitting.model.Modelpowerdetails;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.model.custom.*;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+
+@Service
+public class DataFittingService {
+
+    @Resource
+    private GyeeConfig config;
+    @Resource
+    private PowerfittinganalysisService powerService;
+
+
+    /**
+     * 曲线拟合
+     * @param ids
+     * @param maxs
+     * @param mins
+     * @param maxp
+     * @param minp
+     * @param dimension
+     * @param mode   拟合方式  0:单台拟合  1:合并拟合
+     */
+    public void dataFitting(List<String> ids, Double maxs, Double mins, Double maxp, Double minp, Integer dimension, Integer mode){
+        if (mode == 0){  //单台拟合
+            List<Powerfittinganalysis> listObj = new ArrayList<>();
+            ids.forEach(id -> {
+                Powerfittinganalysis obj = powerService.selectItemById(id);
+                listObj.add(obj);
+                List<Double> arraySpeed = new ArrayList<>();
+                List<Double> arrayPower = new ArrayList<>();
+                /** 读取csv数据 转换成对象数组 **/
+                List<String> line = FileUtil.readFile(obj.getPath(), true);
+                for (int i = 1; i < line.size(); i++) {
+                    String[] split = line.get(i).split(",");
+                    int filter = Integer.valueOf(split[9]); //是否过滤
+                    double x = Double.valueOf(split[2]);    //风速
+                    double y = Double.valueOf(split[1]);    //功率
+                    if (filter == 0 && (x >= mins && x <= maxs && y >= minp && y <= maxp)){
+                        arraySpeed.add(x);
+                        arrayPower.add(y);
+                    }
+                }
+                List<Modelpowerdetails> mp = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
+                Optional<Double> maxP = mp.stream().map(Modelpowerdetails::getEnsurepower).max(Comparator.comparing(Double::doubleValue));
+                fittingMode(listObj, maxP.get(), arraySpeed, arrayPower, dimension, mode);
+            });
+        }
+        if (mode == 1){  //合并拟合
+            AtomicReference<Double> maxP = new AtomicReference<>(0.0);
+            List<Double> arraySpeed = new ArrayList<>();
+            List<Double> arrayPower = new ArrayList<>();
+            List<Powerfittinganalysis> listObj = new ArrayList<>();
+            for (String id : ids){
+                Powerfittinganalysis obj = powerService.selectItemById(id);
+                listObj.add(obj);
+                /** 读取csv数据 转换成对象数组 **/
+                List<String> line = FileUtil.readFile(obj.getPath(), true);
+                for (int i = 1; i < line.size(); i++) {
+                    String[] split = line.get(i).split(",");
+                    int filter = Integer.valueOf(split[9]); //是否过滤
+                    double x = Double.valueOf(split[2]);    //风速
+                    double y = Double.valueOf(split[1]);    //功率
+                    if (filter == 0 && (x >= mins && x <= maxs && y >= minp && y <= maxp)){
+                        arraySpeed.add(x);
+                        arrayPower.add(y);
+                    }
+                }
+                List<Modelpowerdetails> mp = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
+                Double maxPower = mp.stream().map(Modelpowerdetails::getEnsurepower).max(Comparator.comparing(Double::doubleValue)).get();
+                if (maxPower > maxP.get()) maxP.set(maxPower);
+            }
+
+            fittingMode(listObj, maxP.get(), arraySpeed, arrayPower, dimension, mode);
+        }
+    }
+
+
+    /**
+     * 拟合模块展示  tree
+     * @return
+     */
+    public List<Object> dataFittingTree(){
+        List<Powerfittinganalysis> list = powerService.selectList(Constants.DATA_FITTING);
+        List<Object> ls = PowerFittingUtil.powerDataTree(list, Constants.DATA_FITTING);
+        return ls;
+    }
+
+    /**
+     * 组装表格数据
+     * @param id
+     * @return
+     */
+    public Map<String, Object> dataFittingShow(String id){
+        Map<String, Object> map = new HashMap<>();
+
+        /** 添加标题 **/
+        List<TableTitle> lt = new ArrayList<>();
+        StringBuilder sb = setTitle();
+        String[] str = sb.toString().split(",");
+        for (String s : str){
+            lt.add(new TableTitle(s));
+        }
+
+        /** 添加内容 **/
+        List<PowerFittingPoint> list = new ArrayList<>();
+        Powerfittinganalysis obj = powerService.selectItemById(id);
+        List<String> ls = FileUtil.readFile(obj.getPath(), false);
+        for (int i = 1; i < ls.size(); i++){
+            PowerFittingPoint data = new PowerFittingPoint(ls.get(i).split(","));
+            list.add(data);
+        }
+
+        map.put("title", lt);
+        map.put("data", list);
+
+        return map;
+    }
+
+
+    /**
+     * 曲线,散点等数据
+     * 风速 eg:[1,2,3,4。。。。]
+     * 曲线 eg:[1,2,3,4。。。。]
+     * 散点 eg:[[1,2],[3,2],[3,5]。。。。。]
+     * @param id
+     * @return
+     */
+    public Map<String, Object> dataFittingCurve(String id){
+        Map<String, Object> map = new HashMap<>();
+        Powerfittinganalysis obj = powerService.selectItemById(id);
+
+        //实际功率、风速、Cp值
+        List<Object> sjglList = new ArrayList<>();
+        List<Object> cpzList = new ArrayList<>();
+        List<String> ls = FileUtil.readFile(obj.getPath(), true);
+        for (int i = 1; i < ls.size(); i++){
+            String[] split = ls.get(i).split(",");
+            sjglList.add(new String[]{split[0], split[1]});
+            cpzList.add(new String[]{split[0], split[2]});
+        }
+
+        //理论功率
+        List<Modelpowerdetails> modelPower = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
+        List<Object> llglList = modelPower.stream().sorted(Comparator.comparing(Modelpowerdetails::getSpeed)).map(m -> new double[]{m.getSpeed(), m.getEnsurepower()}).collect(Collectors.toList());
+
+        //散点
+        String[] ids = obj.getPrepareid().split(",");
+        List<Object> scatterls = new ArrayList<>(); //蓝色散点 筛选掉的
+        List<Object> scatterhs = new ArrayList<>(); //黄色散点 没筛选的
+        for (String pid : ids){
+            Powerfittinganalysis pf = powerService.selectItemById(pid);
+            List<String> lp = FileUtil.readFile(pf.getPath(), true);
+            for (int i = 1; i < lp.size(); i++){
+                String[] split = lp.get(i).split(",");
+                PowerPointData pd = new PowerPointData(split);
+                pd.setWtId(pf.getWindturbine());
+                pd.setFilter(Integer.parseInt(split[9]));
+
+                DataPointMP pm = new DataPointMP();
+                pm.setS(pd.getSpeed());
+                pm.setP(pd.getPower());
+                pm.setW(pf.getWindturbine());
+                if (0 == pd.getFilter())
+                    scatterls.add(pm);   //没有过滤
+                if (1 == pd.getFilter())
+                    scatterhs.add(pm);   //已过滤
+            }
+        }
+
+        map.put("sjgl", sjglList);    //实际功率
+        map.put("llgl", llglList);    //理论功率
+        map.put("cpz", cpzList);      //Cp值
+        map.put("scatterhs", scatterhs);  //黄色散点
+        map.put("scatterls", scatterls);  //蓝色散点
+
+        return map;
+    }
+
+
+    private String assemble(LineCurveFitting lf){
+        StringBuilder sb = setTitle();
+        for (int i = 0; i < lf.getYLines().size(); i++){
+            PointVo cp = lf.getCpValue().get(i);
+            PointVo gl = lf.getYLines().get(i);
+
+            String stx = String.format("%.2f", gl.getX());
+            double x = Double.parseDouble(stx);
+            String sty = String.format("%.2f", gl.getY());
+            double y = Double.parseDouble(sty);
+            String stcp = String.format("%.4f", cp.getY());
+            double z = Double.parseDouble(stcp);
+            sb.append(x).append(",").append(y).append(",").append(z).append("\n");
+        }
+
+        return sb.toString();
+    }
+
+
+    private StringBuilder setTitle(){
+        StringBuilder sb = new StringBuilder();
+        String columnName = String.join(",", Constants.FITTING_TITLE);
+        sb.append(columnName).append("\n");
+        return sb;
+    }
+
+
+    private void fittingMode(List<Powerfittinganalysis> listObj, Double powerMax, List<Double> arraySpeed, List<Double> arrayPower, Integer dimension, int mode){
+        Powerfittinganalysis obj = listObj.get(0);
+        //风速0-25,数据不全拟合的则不全,需要补一下
+        arraySpeed.add(0.0);
+        arraySpeed.add(25.01);
+        arrayPower.add(0.0);
+        arrayPower.add(powerMax);
+        double[] arrX = arraySpeed.stream().sorted().mapToDouble(i->i).toArray();
+        double[] arrY = arrayPower.stream().sorted().mapToDouble(i->i).toArray();
+
+        // 功率曲线拟合
+        List<PointVo> temp = PowerFittingALG.BuildLine(arrX, arrY, arraySpeed.size(), dimension, 0.01);
+
+        // 推力系数 CP值
+        LineCurveFitting lf = new LineCurveFitting();
+        lf.setYLines(temp);
+        lf = PowerFittingALG.BuildCp(InitialRunner.equipmentMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid()).getSweptarea(), lf);
+
+        String content = assemble(lf);
+        String prepareId = "";
+        String fileName = null;
+        if (mode == 0){
+            prepareId = obj.getId();
+            fileName = config.getFilePathFitting() + obj.getStation() + "_" + obj.getCode() + "_" + System.currentTimeMillis() / 1000 + ".csv";
+        }
+        if (mode == 1){
+            prepareId = listObj.stream().map(d -> d.getId()).collect(Collectors.joining(","));
+            fileName = config.getFilePathFitting() + obj.getStation() + "_merge" + "_" + System.currentTimeMillis() / 1000 + ".csv";
+        }
+        boolean flag = FileUtil.writeFile(fileName, content);
+        if (flag) {  // TODO  保存数据库
+            obj.setPath(fileName);
+            obj.setPrepareid(prepareId);
+            obj.setType(Constants.DATA_FITTING);
+            powerService.insertItem(obj);
+        }
+        System.out.println("功率曲线拟合完成:" + obj.getWindturbine());
+    }
+
+}

+ 15 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataOptionService.java

@@ -0,0 +1,15 @@
+package com.gyee.power.fitting.service.custom;
+
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * 数据删除、下载...
+ */
+@Service
+public class DataOptionService {
+
+
+}

+ 11 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataPointMP.java

@@ -0,0 +1,11 @@
+package com.gyee.power.fitting.service.custom;
+
+import lombok.Data;
+
+@Data
+public class DataPointMP {
+
+    private Double s;
+    private Double p;
+    private String w;
+}

+ 160 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataPrepareService.java

@@ -0,0 +1,160 @@
+package com.gyee.power.fitting.service.custom;
+
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.constants.Constants;
+import com.gyee.power.fitting.common.feign.RemoteServiceBuilder;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.*;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.model.Windturbinetestingpointai2;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+import com.gyee.power.fitting.model.custom.TableTitle;
+import com.gyee.power.fitting.model.custom.TsDoubleData;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.text.DecimalFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+public class DataPrepareService {
+
+    @Autowired
+    private GyeeConfig config;
+    @Autowired
+    WebSocketServer socketServer;
+    @Autowired
+    private PowerfittinganalysisService powerService;
+    @Autowired
+    private RemoteServiceBuilder remoteService;
+
+    /**
+     * 数据准备
+     * @param station 场站
+     * @param wtId  风机ID eg:<NG01_01,NG01_02>
+     * @param st 开始时间  毫秒
+     * @param et 结束时间
+     */
+    @Async
+    public void dataPrepare(String station, List<String> wtId, long st, long et, int interval){
+        for (int k = 0; k < wtId.size(); k++){
+            String wt = wtId.get(k);
+            List<List<TsDoubleData>> result = new ArrayList<>();
+            try{
+                List<String> points = config.getPoints();
+                Map<String, List<Windturbinetestingpointai2>> collect = InitialRunner.pointMap.get(wt).stream().collect(Collectors.groupingBy(w -> w.getUniformcode()));
+                if (collect.size() < 8)
+                    continue;
+
+                for (int i = 0; i < points.size(); i++){
+                    Windturbinetestingpointai2 point = collect.get(points.get(i)).get(0);
+                    List<TsDoubleData> data = remoteService.adapter().getHistorySnap(point.getId(), st, et, interval);
+                    if (data == null || data.size() < 0)
+                        break;
+                    result.add(data);
+                    Thread.sleep(200);
+                }
+                if (result.size() != points.size())
+                    continue;
+
+                String content = assemble(result);
+                // 处理的数据保存在本地
+                String wtCode = InitialRunner.wtMap.get(wt).getCode();
+                String fileName = config.getFilePathPrepare() + station + "_" + wtCode + "_" + System.currentTimeMillis() / 1000 + ".csv";
+                boolean flag = FileUtil.writeFile(fileName, content);
+                if (flag){  // TODO  保存数据库
+                    Powerfittinganalysis obj = new Powerfittinganalysis();
+                    obj.setStation(station);
+                    obj.setStationcn(InitialRunner.stationMap.get(station));
+                    obj.setWindturbine(wt);
+                    obj.setCode(wtCode);
+                    obj.setTime(DateUtil.format(st, DateUtil.YYYY_MM_DD_CHN) + "-" + DateUtil.format(et, DateUtil.YYYY_MM_DD_CHN));
+                    obj.setInterval(NumberUtil.toNum(interval));
+                    obj.setPath(fileName);
+                    obj.setType(Constants.DATA_PREPARE);
+                    powerService.insertItem(obj);
+                }
+                socketServer.sendInfo(JsonResult.successData(ResultCode.SUCCESS, new DecimalFormat("0.00").format((double)(k + 1)/wtId.size())), null);
+                System.out.println("数据准备完成:" + wt);
+            } catch (Exception e) {
+                socketServer.sendInfo(JsonResult.error(), null);
+            } finally {}
+        }
+    }
+
+
+    /**
+     * 数据准备模块展示  tree
+     * @return
+     */
+    public List<Object> dataPrepareTree(){
+        List<Powerfittinganalysis> list = powerService.selectList(Constants.DATA_PREPARE);
+        List<Object> ls = PowerFittingUtil.powerDataTree(list, Constants.DATA_PREPARE);
+        return ls;
+    }
+
+
+    /**
+     * 组装表格数据
+     * @param id
+     * @return
+     */
+    public Map<String, Object> dataPrepareShow(String id){
+        Map<String, Object> map = new HashMap<>();
+
+        /** 添加标题 **/
+        List<TableTitle> lt = new ArrayList<>();
+        StringBuilder sb = setTitle();
+        String[] str = sb.toString().split(",");
+        for (String s : str){
+            lt.add(new TableTitle(s));
+        }
+
+        /** 添加内容  读取前500行 **/
+        List<PowerPointData> list = new ArrayList<>();
+        Powerfittinganalysis obj = powerService.selectItemById(id);
+        List<String> ls = FileUtil.readFile(obj.getPath(), false);
+        for (int i = 1; i < ls.size(); i++){
+            PowerPointData data = new PowerPointData(ls.get(i).split(","));
+            list.add(data);
+        }
+
+        map.put("title", lt);
+        map.put("data", list);
+
+        return map;
+    }
+
+    private String assemble(List<List<TsDoubleData>> list){
+        if (list.size() == 0)
+            return null;
+
+        StringBuilder sb = setTitle();
+        List<TsDoubleData> data = list.get(0);
+        for (int i = 0; i < data.size(); i++){
+            sb.append(DateUtil.format(data.get(i).getTs(), DateUtil.DATE_TIME_PATTERN)).append(",");
+            sb.append(data.get(i).getDoubleValue()).append(",");
+            for (int j = 1; j < list.size(); j++){
+                sb.append(list.get(j).get(i).getDoubleValue()).append(",");
+            }
+            sb.append("\n");
+        }
+
+        return sb.toString();
+    }
+
+    private StringBuilder setTitle(){
+        StringBuilder sb = new StringBuilder();
+        String columnName = String.join(",", Constants.TABLE_TITLE);
+        sb.append(columnName).append("\n");
+        return sb;
+    }
+
+}

+ 155 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/DataProcessService.java

@@ -0,0 +1,155 @@
+package com.gyee.power.fitting.service.custom;
+
+import com.gyee.power.fitting.common.alg.PowerProcessALG;
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.constants.Constants;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.*;
+import com.gyee.power.fitting.model.Modelpowerdetails;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+import com.gyee.power.fitting.model.custom.TableTitle;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class DataProcessService {
+
+    @Autowired
+    private GyeeConfig config;
+    @Autowired
+    private PowerfittinganalysisService powerService;
+
+    /**
+     * 数据预处理
+     *
+     * @param ids     预处理数据的ID
+     * @param maxs   最大风速
+     * @param mins   最小风速
+     * @param maxp   最大功率
+     * @param minp   最小功率
+     * @param isfbw  是否并网
+     * @param isfhl  是否合理值
+     * @param isbw   并网后10分钟
+     * @param istj   停机前10分钟
+     * @param isglpc 功率曲线偏差
+     * @param isqfh  是否欠符合
+     * @param qfhdj  欠符合等级
+     * @return
+     */
+    public void dataProcess(List<String> ids, Double maxs, Double mins, Double maxp, Double minp, Boolean isfbw,
+                            Boolean isfhl, Boolean isbw, Boolean istj, Boolean isglpc, Boolean isqfh, Integer qfhdj) {
+        ids.forEach(id -> {
+            Powerfittinganalysis obj = powerService.selectItemById(id);
+            if (obj == null)
+                return;
+
+            /** 读取csv数据  转换成对象数组 **/
+            List<PowerPointData> eis = new ArrayList<>();
+            List<String> list = FileUtil.readFile(obj.getPath(), true);
+            for (int i = 1; i < list.size(); i++) {
+                eis.add(new PowerPointData(list.get(i).split(",")));
+            }
+
+            /** 风速  ->  保证功率  来自数据库 **/
+            List<Modelpowerdetails> modelPowerList = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
+            Map<Double, Double> modelPowerMap = modelPowerList.stream().collect(Collectors.toMap(Modelpowerdetails::getSpeed, Modelpowerdetails::getEnsurepower));
+
+            /** 数据预处理 **/
+            List<PowerPointData> data = PowerProcessALG.dataProcess(eis, modelPowerMap, maxs, mins, maxp, minp, isfbw, isfhl, isbw, istj, isglpc, isqfh, qfhdj);
+
+            String content = assemble(data);
+            String fileName = config.getFilePathProcess() + obj.getStation() + "_" + obj.getCode() + "_" + System.currentTimeMillis() / 1000 + ".csv";
+            boolean flag = FileUtil.writeFile(fileName, content);
+            if (flag) {  // TODO  保存数据库
+                obj.setPath(fileName);
+                obj.setType(Constants.DATA_PROCESS);
+                powerService.insertItem(obj);
+            }
+            System.out.println("功率曲线拟合数据预处理完成:" + obj.getWindturbine());
+        });
+    }
+
+    /**
+     * 数据预处理模块展示  tree
+     *
+     * @return
+     */
+    public List<Object> dataProcessTree() {
+        List<Powerfittinganalysis> list = powerService.selectList(Constants.DATA_PROCESS);
+        List<Object> ls = PowerFittingUtil.powerDataTree(list, Constants.DATA_PROCESS);
+        return ls;
+    }
+
+
+    /**
+     * 组装表格数据
+     * @param id
+     * @return
+     */
+    public Map<String, Object> dataProcessShow(String id){
+        Map<String, Object> map = new HashMap<>();
+
+        /** 添加标题 **/
+        List<TableTitle> lt = new ArrayList<>();
+        StringBuilder sb = setTitle();
+        String[] str = sb.toString().split(",");
+        for (String s : str){
+            lt.add(new TableTitle(s));
+        }
+
+        /** 添加内容  读取前500行 **/
+        List<PowerPointData> list = new ArrayList<>();
+        Powerfittinganalysis obj = powerService.selectItemById(id);
+        List<String> ls = FileUtil.readFile(obj.getPath(), false);
+        for (int i = 1; i < ls.size(); i++){
+            String[] split = ls.get(i).split(",");
+            PowerPointData data = new PowerPointData(split);
+            data.setFilter(Integer.valueOf(split[9]));
+            list.add(data);
+        }
+
+        map.put("title", lt);
+        map.put("data", list);
+
+        return map;
+    }
+
+
+    private String assemble(List<PowerPointData> list) {
+        if (list.size() == 0)
+            return null;
+
+        StringBuilder sb = setTitle();
+        for (int i = 0; i < list.size(); i++) {
+            sb.append(list.get(i).getTime()).append(",");
+            sb.append(list.get(i).getPower()).append(",");
+            sb.append(list.get(i).getSpeed()).append(",");
+            sb.append(list.get(i).getRR()).append(",");
+            sb.append(list.get(i).getMxzt()).append(",");
+            sb.append(list.get(i).getDL()).append(",");
+            sb.append(list.get(i).getQfzt()).append(",");
+            sb.append(list.get(i).getFX()).append(",");
+            sb.append(list.get(i).getAngle()).append(",");
+            sb.append(list.get(i).getFilter()).append(",");
+            sb.append("\n");
+        }
+
+        return sb.toString();
+    }
+
+    private StringBuilder setTitle() {
+        StringBuilder sb = new StringBuilder();
+        List<String> tableTitle = new ArrayList<>();
+        tableTitle.addAll(Constants.TABLE_TITLE);
+        tableTitle.add("筛选");
+        String columnName = String.join(",", tableTitle);
+        sb.append(columnName).append("\n");
+        return sb;
+    }
+}

+ 174 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/WebSocketServer.java

@@ -0,0 +1,174 @@
+package com.gyee.power.fitting.service.custom;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.exceptions.ApiException;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.websocket.*;
+import javax.websocket.server.PathParam;
+import javax.websocket.server.ServerEndpoint;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ **/
+@Slf4j
+@ServerEndpoint("/ws/powerfitting/{userId}")
+@Component
+public class WebSocketServer {
+
+    /**
+     * 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的
+     */
+    private static int onlineCount = 0;
+
+    /**
+     * concurrent 包的线程安全Set,用来存放每个客户端对应的 myWebSocket对象
+     * 根据userId来获取对应的 WebSocket
+     */
+    private static ConcurrentHashMap<String, WebSocketServer> webSocketMap = new ConcurrentHashMap<>();
+
+    /**
+     * 与某个客户端的连接会话,需要通过它来给客户端发送数据
+     */
+    private Session session;
+
+    /**
+     * 接收 sid
+     */
+    private String userId = "";
+
+
+    /**
+     * 连接建立成功调用的方法
+     *
+     * @param session
+     * @param userId
+     */
+    @OnOpen
+    public void onOpen(Session session, @PathParam("userId") String userId) {
+        this.session = session;
+        this.userId = userId;
+
+        webSocketMap.put(userId, this);
+        log.info("webSocketMap -> " + JSON.toJSONString(webSocketMap));
+
+        addOnlineCount(); // 在线数 +1
+        log.info("有新窗口开始监听:" + userId + ",当前在线人数为" + getOnlineCount());
+
+        try {
+            sendMessage("连接成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new ApiException("websocket IO异常!!!!");
+        }
+
+    }
+
+    /**
+     * 关闭连接
+     */
+
+    @OnClose
+    public void onClose() {
+        if (webSocketMap.get(this.userId) != null) {
+            webSocketMap.remove(this.userId);
+            subOnlineCount(); // 人数 -1
+            log.info("有一连接关闭,当前在线人数为:" + getOnlineCount());
+        }
+    }
+
+    /**
+     * 收到客户端消息后调用的方法
+     *
+     * @param message 客户端发送过来的消息
+     * @param session
+     */
+    @OnMessage
+    public void onMessage(String message, Session session) {
+        log.info("收到来自窗口" + userId + "的信息:" + message);
+
+        if (StringUtils.isNotBlank(message)) {
+            try {
+                // 解析发送的报文
+                JSONObject jsonObject = JSON.parseObject(message);
+                // 追加发送人(防窜改)
+                jsonObject.put("fromUserId", this.userId);
+                String toUserId = jsonObject.getString("toUserId");
+                // 传送给对应 toUserId 用户的 WebSocket
+                if (StringUtils.isNotBlank(toUserId) && webSocketMap.containsKey(toUserId)) {
+                    webSocketMap.get(toUserId).sendMessage(jsonObject.toJSONString());
+                } else {
+                    log.info("请求的userId:" + toUserId + "不在该服务器上"); // 否则不在这个服务器上,发送到 MySQL 或者 Redis
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+    }
+
+    /**
+     * @param session
+     * @param error
+     */
+    @OnError
+    public void onError(Session session, Throwable error) {
+        log.error("用户错误:" + this.userId + ",原因:" + error.getMessage());
+        error.printStackTrace();
+    }
+
+    /**
+     * 实现服务器主动推送
+     *
+     * @param message
+     * @throws IOException
+     */
+    @SneakyThrows
+    public void sendMessage(Object message) {
+        this.session.getBasicRemote().sendText(JSONObject.toJSONString(message));
+    }
+
+    /**
+     * 群发自定义消息
+     *
+     * @param message
+     * @param userId
+     * @throws IOException
+     */
+    public void sendInfo(Object message, @PathParam("userId") String userId) {
+
+        // 遍历集合,可设置为推送给指定sid,为 null 时发送给所有人
+        Iterator entrys = webSocketMap.entrySet().iterator();
+        while (entrys.hasNext()) {
+            Map.Entry entry = (Map.Entry) entrys.next();
+
+            if (userId == null) {
+                webSocketMap.get(entry.getKey()).sendMessage(message);
+                log.info("发送消息到:" + entry.getKey() + ",消息:" + message);
+            } else if (entry.getKey().equals(userId)) {
+                webSocketMap.get(entry.getKey()).sendMessage(message);
+                log.info("发送消息到:" + entry.getKey() + ",消息:" + message);
+            }
+
+        }
+    }
+
+    private static synchronized int getOnlineCount() {
+        return onlineCount;
+    }
+
+    private static synchronized void addOnlineCount() {
+        WebSocketServer.onlineCount++;
+    }
+
+    private static synchronized void subOnlineCount() {
+        WebSocketServer.onlineCount--;
+    }
+}

+ 46 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/impl/EquipmentmodelServiceImpl.java

@@ -0,0 +1,46 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.model.Equipmentmodel;
+import com.gyee.power.fitting.mapper.EquipmentmodelMapper;
+import com.gyee.power.fitting.service.EquipmentmodelService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Service
+public class EquipmentmodelServiceImpl extends ServiceImpl<EquipmentmodelMapper, Equipmentmodel> implements EquipmentmodelService {
+
+    @Override
+    public List<Equipmentmodel> selectList() {
+        List<Equipmentmodel> list = new ArrayList<>();
+        try{
+            list = baseMapper.selectList(null);
+        }catch (Exception e){
+            log.error("EquipmentmodelServiceImpl--selectList", e);
+        }
+
+        return list;
+    }
+
+    @Override
+    public Equipmentmodel selectItemByModel(String id) {
+        Equipmentmodel obj = new Equipmentmodel();
+        try{
+            obj = baseMapper.selectById(id);
+        }catch (Exception e){
+            log.error("EquipmentmodelServiceImpl--selectItemByModel", e);
+        }
+
+        return obj;
+    }
+}

+ 34 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/impl/ModelpowerServiceImpl.java

@@ -0,0 +1,34 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.model.Modelpower;
+import com.gyee.power.fitting.mapper.ModelpowerMapper;
+import com.gyee.power.fitting.service.ModelpowerService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Service
+public class ModelpowerServiceImpl extends ServiceImpl<ModelpowerMapper, Modelpower> implements ModelpowerService {
+
+    @Override
+    public List<Modelpower> selectList() {
+        List<Modelpower> list = new ArrayList<>();
+        try{
+            list = baseMapper.selectList(null);
+        }catch (Exception e){
+            log.error("ModelpowerServiceImpl--selectList", e);
+        }
+
+        return list;
+    }
+}

+ 34 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/impl/ModelpowerdetailsServiceImpl.java

@@ -0,0 +1,34 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.model.Modelpowerdetails;
+import com.gyee.power.fitting.mapper.ModelpowerdetailsMapper;
+import com.gyee.power.fitting.service.ModelpowerdetailsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Service
+public class ModelpowerdetailsServiceImpl extends ServiceImpl<ModelpowerdetailsMapper, Modelpowerdetails> implements ModelpowerdetailsService {
+
+    @Override
+    public List<Modelpowerdetails> selectList() {
+        List<Modelpowerdetails> list = new ArrayList<>();
+        try{
+            list = baseMapper.selectList(null);
+        }catch (Exception e){
+            log.error("ModelpowerdetailsServiceImpl--selectList", e);
+        }
+
+        return list;
+    }
+}

+ 92 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/impl/PowerfittinganalysisServiceImpl.java

@@ -0,0 +1,92 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.common.base.ExcludeQueryWrapper;
+import com.gyee.power.fitting.common.util.SnowFlakeUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.mapper.PowerfittinganalysisMapper;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+0 .00.000* </p>
+ *
+ * @author chenmh
+ * @since 2022-11-03
+ */
+@Service
+public class PowerfittinganalysisServiceImpl extends ServiceImpl<PowerfittinganalysisMapper, Powerfittinganalysis> implements PowerfittinganalysisService {
+
+    @Override
+    public Powerfittinganalysis selectItemById(String id) {
+        Powerfittinganalysis obj = new Powerfittinganalysis();
+
+        ExcludeQueryWrapper wrapper = new ExcludeQueryWrapper();
+        wrapper.eq("ID", id);
+        try{
+            obj = baseMapper.selectOne(wrapper);
+        }catch (Exception e){
+            log.error("PowerfittinganalysisServiceImpl--selectItemById", e);
+        }
+
+        return obj;
+    }
+
+    @Override
+    public List<Powerfittinganalysis> selectList(String type) {
+        List<Powerfittinganalysis> list = new ArrayList();
+
+        ExcludeQueryWrapper wrapper = new ExcludeQueryWrapper();
+        wrapper.eq("type", type);
+
+        try{
+            list = baseMapper.selectList(wrapper);
+        }catch (Exception e){
+            log.error("PowerfittinganalysisServiceImpl--selectList", e);
+        }
+
+        return list;
+    }
+
+
+    @Override
+    public void insertItem(Powerfittinganalysis obj) {
+        if (obj == null)
+            return;
+
+        obj.setId(SnowFlakeUtil.generateId());
+        try{
+            baseMapper.insert(obj);
+        }catch (Exception e){
+            log.error("PowerfittinganalysisServiceImpl--insertItem", e);
+        }
+    }
+
+    @Override
+    public List<Powerfittinganalysis> selectListByIds(String ids) {
+        List<Powerfittinganalysis> list = new ArrayList();
+
+        try{
+            list = baseMapper.selectBatchIds(Arrays.asList(ids.split(",")));
+        }catch (Exception e){
+            log.error("PowerfittinganalysisServiceImpl--selectListByIds", e);
+        }
+
+        return list;
+    }
+
+    @Override
+    public void deleteList(String ids) {
+        try{
+            baseMapper.deleteBatchIds(Arrays.asList(ids.split(",")));
+        }catch (Exception e){
+            log.error("PowerfittinganalysisServiceImpl--deleteList", e);
+        }
+    }
+}

+ 6 - 6
power-fetting/src/main/java/com/gyee/power/fetting/service/impl/WindpowerstationServiceImpl.java

@@ -1,10 +1,10 @@
-package com.gyee.power.fetting.service.impl;
+package com.gyee.power.fitting.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gyee.power.fetting.common.base.ExcludeQueryWrapper;
-import com.gyee.power.fetting.mapper.WindpowerstationMapper;
-import com.gyee.power.fetting.model.Windpowerstation;
-import com.gyee.power.fetting.service.WindpowerstationService;
+import com.gyee.power.fitting.common.base.ExcludeQueryWrapper;
+import com.gyee.power.fitting.mapper.WindpowerstationMapper;
+import com.gyee.power.fitting.model.Windpowerstation;
+import com.gyee.power.fitting.service.WindpowerstationService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
@@ -32,7 +32,7 @@ public class WindpowerstationServiceImpl extends ServiceImpl<WindpowerstationMap
         try{
             list = baseMapper.selectList(wrapper);
         }catch (Exception e){
-            log.error("WindpowerstationServiceImpl", e.getMessage());
+            log.error("WindpowerstationServiceImpl--selectList", e);
         }
 
         return list;

+ 8 - 7
power-fetting/src/main/java/com/gyee/power/fetting/service/impl/WindturbineServiceImpl.java

@@ -1,10 +1,10 @@
-package com.gyee.power.fetting.service.impl;
+package com.gyee.power.fitting.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gyee.power.fetting.common.base.ExcludeQueryWrapper;
-import com.gyee.power.fetting.mapper.WindturbineMapper;
-import com.gyee.power.fetting.model.Windturbine;
-import com.gyee.power.fetting.service.WindturbineService;
+import com.gyee.power.fitting.common.base.ExcludeQueryWrapper;
+import com.gyee.power.fitting.mapper.WindturbineMapper;
+import com.gyee.power.fitting.model.Windturbine;
+import com.gyee.power.fitting.service.WindturbineService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
@@ -24,15 +24,16 @@ import java.util.List;
 public class WindturbineServiceImpl extends ServiceImpl<WindturbineMapper, Windturbine> implements WindturbineService {
 
     @Override
-    public List<Windturbine> selectList() {
+    public List<Windturbine> selectList(String station) {
         List<Windturbine> list = new ArrayList();
 
         ExcludeQueryWrapper wrapper = new ExcludeQueryWrapper();
+        wrapper.eq("WINDPOWERSTATIONID", station);
 
         try{
             list = baseMapper.selectList(wrapper);
         }catch (Exception e){
-            log.error("WindturbineServiceImpl", e.getMessage());
+            log.error("WindturbineServiceImpl--selectList", e);
         }
 
         return list;

+ 40 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/impl/Windturbinetestingpointai2ServiceImpl.java

@@ -0,0 +1,40 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.power.fitting.common.base.ExcludeQueryWrapper;
+import com.gyee.power.fitting.mapper.Windturbinetestingpointai2Mapper;
+import com.gyee.power.fitting.model.Windturbinetestingpointai2;
+import com.gyee.power.fitting.service.Windturbinetestingpointai2Service;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-01
+ */
+@Service
+public class Windturbinetestingpointai2ServiceImpl extends ServiceImpl<Windturbinetestingpointai2Mapper, Windturbinetestingpointai2> implements Windturbinetestingpointai2Service {
+
+    @Override
+    public List<Windturbinetestingpointai2> selectList(String station, List<String> points) {
+        List<Windturbinetestingpointai2> list = new ArrayList();
+
+        ExcludeQueryWrapper wrapper = new ExcludeQueryWrapper();
+        wrapper.eq("windpowerstationid", station);
+        wrapper.in("UNIFORMCODE", points);
+
+        try{
+            list = baseMapper.selectList(wrapper);
+        }catch (Exception e){
+            log.error("WindturbineServiceImpl--selectList", e);
+        }
+
+        return list;
+    }
+}

+ 26 - 10
power-fetting/src/main/resources/application.yaml

@@ -1,10 +1,26 @@
 gyee:
   # 实时适配器的url
   adapter-url: http://10.155.32.4:8011
-  # 数据准备路径(原始数据)
-  file-path-prepare: /home/gyee/data/prepare
-  # 数据处理路径(处理完的数据)
-  file-path-process: /home/gyee/data/precess
+  # 数据准备保存路径(原始数据)
+  file-path-prepare: data\prepare\
+  # 数据处理保存路径(处理后的数据)
+  file-path-process: data\precess\
+  # 数据拟合保存路径(拟合后的数据)
+  file-path-fitting: data\fitting\
+  # 数据压缩下载
+  file-path-download: data\zip\
+  # 风机实发功率\风机风速\发电机转速\明细状态\风机日发电量\实时欠发状态\风向\对风角度(对风误差)  顺序不能乱
+  points:
+    - AI130
+    - AI022
+    - AI128
+    - ZTMX
+    - RFDL
+    - RSSQFZT
+    - AI008
+    - AI036
+  # 数据准备时由于数据量太大,初始一个默认间隔,用于适配器取数
+  interval: 20
 
 server:
   port: 9002
@@ -24,12 +40,12 @@ spring:
     allow-bean-definition-overriding: false #当遇到同样名字的时候,是否允许覆盖注册
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      #kudu数据库
-      master:
-        driver-class-name: com.cloudera.impala.jdbc41.Driver
-        jdbc-url: jdbc:impala://192.168.1.62:21050/gyee_sample_kudu
+    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
+    driver-class-name: oracle.jdbc.OracleDriver
 
+    druid:
       # 初始化大小,最小,最大
       initial-size: 1
       min-idle: 1
@@ -58,7 +74,7 @@ mybatis-plus:
 
 logging:
   level:
-    root: info
+    root: error
     com.example: debug
   file:
     path: ./logs

+ 27 - 0
power-fitting/src/main/resources/mapper/EquipmentmodelMapper.xml

@@ -0,0 +1,27 @@
+<?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.EquipmentmodelMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.Equipmentmodel">
+        <id column="ID" property="id" />
+        <result column="CODE" property="code" />
+        <result column="NAME" property="name" />
+        <result column="DESCRIPTION" property="description" />
+        <result column="POWERPRODUCTION" property="powerproduction" />
+        <result column="CUTINWINDSPEED" property="cutinwindspeed" />
+        <result column="RATEDWINDSPEED" property="ratedwindspeed" />
+        <result column="CUTOUTWINDSPEED" property="cutoutwindspeed" />
+        <result column="WINDTURBINEMANUFACTURERID" property="windturbinemanufacturerid" />
+        <result column="PHOTO" property="photo" />
+        <result column="UNIT" property="unit" />
+        <result column="SWEPTAREA" property="sweptarea" />
+        <result column="EQUIPMENTCATEGORY" property="equipmentcategory" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        ID, CODE, NAME, DESCRIPTION, POWERPRODUCTION, CUTINWINDSPEED, RATEDWINDSPEED, CUTOUTWINDSPEED, WINDTURBINEMANUFACTURERID, PHOTO, UNIT, SWEPTAREA, EQUIPMENTCATEGORY
+    </sql>
+
+</mapper>

+ 24 - 0
power-fitting/src/main/resources/mapper/PowerfittinganalysisMapper.xml

@@ -0,0 +1,24 @@
+<?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.PowerfittinganalysisMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.Powerfittinganalysis">
+        <result column="ID" property="id" />
+        <result column="STATION" property="station" />
+        <result column="STATIONCN" property="stationcn" />
+        <result column="WINDTURBINE" property="windturbine" />
+        <result column="CODE" property="code" />
+        <result column="INTERVAL" property="interval" />
+        <result column="TIME" property="time" />
+        <result column="PATH" property="path" />
+        <result column="TYPE" property="type" />
+        <result column="PREPAREID" property="prepareid" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        ID, STATION, STATIONCN, WINDTURBINE, code, interval, TIME, PATH, TYPE, PREPAREID
+    </sql>
+
+</mapper>

+ 4 - 4
power-fetting/src/main/resources/mapper/WindpowerstationMapper.xml

@@ -1,9 +1,9 @@
 <?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.fetting.mapper.WindpowerstationMapper">
+<mapper namespace="com.gyee.power.fitting.mapper.WindpowerstationMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.gyee.power.fetting.model.Windpowerstation">
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.Windpowerstation">
         <id column="ID" property="id" />
         <result column="CODE" property="code" />
         <result column="NAME" property="name" />
@@ -24,12 +24,12 @@
         <result column="ORDERNUM" property="ordernum" />
         <result column="ALTITUDE" property="altitude" />
         <result column="HEIGHT" property="height" />
-        <result column="AQTS" property="aqts" />
+<!--        <result column="AQTS" property="aqts" />-->
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        ID, CODE, NAME, ADDRESS, TELEPHONE, CAPACITY, CAPACITYUNIT, QUANTITY, ANAME, LONGITUDE, LATITUDE, PHOTO, COMPANYID, SYSTEMMANUFACT, HEADFARM, HEADFARMPHONE, MODEL, ORDERNUM, ALTITUDE, HEIGHT, AQTS
+        ID, CODE, NAME, ADDRESS, TELEPHONE, CAPACITY, CAPACITYUNIT, QUANTITY, ANAME, LONGITUDE, LATITUDE, PHOTO, COMPANYID, SYSTEMMANUFACT, HEADFARM, HEADFARMPHONE, MODEL, ORDERNUM, ALTITUDE, HEIGHT
     </sql>
 
 </mapper>

+ 2 - 2
power-fetting/src/main/resources/mapper/WindturbineMapper.xml

@@ -1,9 +1,9 @@
 <?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.fetting.mapper.WindturbineMapper">
+<mapper namespace="com.gyee.power.fitting.mapper.WindturbineMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.gyee.power.fetting.model.Windturbine">
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.Windturbine">
         <id column="ID" property="id" />
         <result column="CODE" property="code" />
         <result column="WINDPOWERSTATIONID" property="windpowerstationid" />

+ 32 - 0
power-fitting/src/main/resources/mapper/Windturbinetestingpointai2Mapper.xml

@@ -0,0 +1,32 @@
+<?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.Windturbinetestingpointai2Mapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.Windturbinetestingpointai2">
+        <id column="ID" property="id" />
+        <result column="CODE" property="code" />
+        <result column="NAME" property="name" />
+        <result column="MODEL" property="model" />
+        <result column="VALUEUNIT" property="valueunit" />
+        <result column="ENGLISHNAME" property="englishname" />
+        <result column="TYPEID" property="typeid" />
+        <result column="MODELID" property="modelid" />
+        <result column="MAXVAL" property="maxval" />
+        <result column="MINVAL" property="minval" />
+        <result column="REASONABLEMAXVAL" property="reasonablemaxval" />
+        <result column="REASONABLEMINVAL" property="reasonableminval" />
+        <result column="WINDTURBINEID" property="windturbineid" />
+        <result column="UNIFORMCODE" property="uniformcode" />
+        <result column="SHORTID" property="shortid" />
+        <result column="LONGID" property="longid" />
+        <result column="WINDPOWERSTATIONID" property="windpowerstationid" />
+        <result column="REALTIMEID" property="realtimeid" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        ID, CODE, NAME, MODEL, VALUEUNIT, ENGLISHNAME, TYPEID, MODELID, MAXVAL, MINVAL, REASONABLEMAXVAL, REASONABLEMINVAL, WINDTURBINEID, UNIFORMCODE, SHORTID, LONGID, WINDPOWERSTATIONID, REALTIMEID
+    </sql>
+
+</mapper>