Explorar el Código

预警报告代码提交

王波 hace 3 semanas
padre
commit
3a4f9be5ae
Se han modificado 27 ficheros con 1713 adiciones y 1 borrados
  1. 10 1
      runeconomy-xk/pom.xml
  2. 207 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/config/MapperGenerator.java
  3. 68 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/EarlyWarning/EarlyWarningController.java
  4. 105 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/AlarmDataParser.java
  5. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/ProEconAlarmPlanMapper.java
  6. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/ProEconAlarmRealMapper.java
  7. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/ProEconAlarmRuleMapper.java
  8. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/ReliabilityIssuesMapper.java
  9. 62 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ProEconAlarmPlan.java
  10. 40 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ProEconAlarmReal.java
  11. 116 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ProEconAlarmRule.java
  12. 170 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ReliabilityIssues.java
  13. 77 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/ApiClient.java
  14. 280 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/EarlyWarningReliableService.java
  15. 269 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Weather/WertherForecast.java
  16. 1 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProBasicPowerstationService.java
  17. 5 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ITurbineInfoDayService.java
  18. 18 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ProEconAlarmPlanService.java
  19. 18 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ProEconAlarmRealService.java
  20. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ProEconAlarmRuleService.java
  21. 20 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ReliabilityIssuesService.java
  22. 7 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProBasicPowerstationServiceImpl.java
  23. 30 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconAlarmPlanServiceImpl.java
  24. 30 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconAlarmRealServiceImpl.java
  25. 20 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconAlarmRuleServiceImpl.java
  26. 55 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ReliabilityIssuesServiceImpl.java
  27. 25 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/TurbineInfoDayServiceImpl.java

+ 10 - 1
runeconomy-xk/pom.xml

@@ -178,8 +178,17 @@
             <artifactId>mybatis-plus-extension</artifactId>
             <version>3.5.3.1</version>
         </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.3.2</version>
+        </dependency>
 
-
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.2</version>
+        </dependency>
 
     </dependencies>
     <build>

+ 207 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/config/MapperGenerator.java

@@ -0,0 +1,207 @@
+package com.gyee.runeconomy.config;
+
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.InjectionConfig;
+import com.baomidou.mybatisplus.generator.config.*;
+import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert;
+import com.baomidou.mybatisplus.generator.config.po.TableInfo;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 代码生成器
+ */
+public class MapperGenerator {
+    //项目路径
+    private static String canonicalPath = "";
+
+    //基本包名
+    private static String basePackage = "com.gyee.runeconomy";
+    //作者
+    private static String authorName = "wang";
+    //要生成的表名
+    private static String[] tables = {"pro_econ_alarm_rule"};
+    //table前缀
+    private static String prefix = "";
+
+    //数据库类型
+    private static DbType dbType = DbType.POSTGRE_SQL;
+    //数据库配置四要素
+//    private static String driverName = "com.mysql.cj.jdbc.Driver";
+//    private static String url = "jdbc:mysql://localhost:3306/gyee_sample_kudu?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=UTC";
+//    private static String username = "root";
+//    private static String password = "";
+
+    private static String driverName = "org.postgresql.Driver";
+    private static String url = "jdbc:postgresql://localhost:5432/power_lcm";
+    private static String username = "postgres";
+    private static String password = "gd123";
+
+//    private static String driverName = "oracle.jdbc.driver.OracleDriver";
+//    private static String url = "jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd";
+//    private static String username = "nxfdprod";
+//    private static String password = "gdnxfd123";
+
+
+    public static void main(String[] args) {
+        AutoGenerator gen = new AutoGenerator();
+
+        /**
+         * 获取项目路径
+         */
+        try {
+            canonicalPath = new File("").getCanonicalPath();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        /**
+         * 数据库配置
+         */
+        gen.setDataSource(new DataSourceConfig()
+                .setDbType(dbType)
+                .setDriverName(driverName)
+                .setUrl(url)
+                .setUsername(username)
+                .setPassword(password)
+                .setTypeConvert(new MySqlTypeConvert() {
+                    // 自定义数据库表字段类型转换【可选】
+                    //@Override
+                    //public DbColumnType processTypeConvert(String fieldType) {
+                    //System.out.println("转换类型:" + fieldType);
+                    // if ( fieldType.toLowerCase().contains( "tinyint" ) ) {
+                    //    return DbColumnType.BOOLEAN;
+                    // }
+                    //return super.processTypeConvert(fieldType);
+                    //}
+                }));
+
+        /**
+         * 全局配置
+         */
+        gen.setGlobalConfig(new GlobalConfig()
+                .setOutputDir( canonicalPath + "/runeconomy-xk/src/main/java")//输出目录
+                .setFileOverride(true)// 是否覆盖文件
+                .setActiveRecord(true)// 开启 activeRecord 模式
+                .setEnableCache(false)// XML 二级缓存
+                .setBaseResultMap(true)// XML ResultMap
+                .setBaseColumnList(true)// XML columList
+                .setOpen(false)//生成后打开文件夹
+                .setAuthor(authorName)
+                // 自定义文件命名,注意 %s 会自动填充表实体属性!
+                .setMapperName("%sMapper")
+                .setXmlName("%sMapper")
+                .setServiceName("%sService")
+                .setServiceImplName("%sServiceImpl")
+                .setControllerName("%sController")
+        );
+
+        /**
+         * 策略配置
+         */
+        gen.setStrategy(new StrategyConfig()
+                        // .setCapitalMode(true)// 全局大写命名
+                        //.setDbColumnUnderline(true)//全局下划线命名
+                        .setTablePrefix(new String[]{prefix})// 此处可以修改为您的表前缀
+                        .setNaming(NamingStrategy.underline_to_camel)// 表名生成策略
+                        .setInclude(tables) // 需要生成的表
+                        .setRestControllerStyle(true)
+                        //.setExclude(new String[]{"test"}) // 排除生成的表
+                        // 自定义实体父类
+                        // .setSuperEntityClass("com.baomidou.demo.TestEntity")
+                        // 自定义实体,公共字段
+                        //.setSuperEntityColumns(new String[]{"test_id"})
+                        //.setTableFillList(tableFillList)
+                        // 自定义 mapper 父类 默认BaseMapper
+                        //.setSuperMapperClass("com.baomidou.mybatisplus.mapper.BaseMapper")
+                        // 自定义 service 父类 默认IService
+                        // .setSuperServiceClass("com.baomidou.demo.TestService")
+                        // 自定义 service 实现类父类 默认ServiceImpl
+                        // .setSuperServiceImplClass("com.baomidou.demo.TestServiceImpl")
+                        // 自定义 controller 父类
+                        //.setSuperControllerClass("com.kichun."+packageName+".controller.AbstractController")
+                        // 【实体】是否生成字段常量(默认 false)
+                        // public static final String ID = "test_id";
+                        // .setEntityColumnConstant(true)
+                        // 【实体】是否为构建者模型(默认 false)
+                        // public User setName(String name) {this.name = name; return this;}
+                        // .setEntityBuilderModel(true)
+                        // 【实体】是否为lombok模型(默认 false)<a href="https://projectlombok.org/">document</a>
+                        .setEntityLombokModel(true)
+                // Boolean类型字段是否移除is前缀处理
+                // .setEntityBooleanColumnRemoveIsPrefix(true)
+                // .setRestControllerStyle(true)
+                // .setControllerMappingHyphenStyle(true)
+        );
+
+        /**
+         * 包配置
+         */
+        gen.setPackageInfo(new PackageConfig()
+                //.setModuleName("User")
+                .setParent(basePackage)// 自定义包路径
+                .setController("controller")// 这里是控制器包名,默认 web
+                .setEntity("model") // 设置Entity包名,默认entity
+                .setMapper("mapper") // 设置Mapper包名,默认mapper
+                .setService("service") // 设置Service包名,默认service
+                .setServiceImpl("service.impl") // 设置Service Impl包名,默认service.impl
+                .setXml("mapper") // 设置Mapper XML包名,默认mapper.xml
+        );
+
+        /**
+         * 注入自定义配置
+         */
+        // 注入自定义配置,可以在 VM 中使用 cfg.abc 设置的值
+        InjectionConfig abc = new InjectionConfig() {
+            @Override
+            public void initMap() {
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("abc", this.getConfig().getGlobalConfig().getAuthor() + "-mp");
+                this.setMap(map);
+            }
+        };
+        //自定义文件输出位置(非必须)
+        List<FileOutConfig> fileOutList = new ArrayList<FileOutConfig>();
+        fileOutList.add(new FileOutConfig("/templates/mapper.xml.vm") {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                return canonicalPath + "runeconomy-xk/src/main/resources/mapper/" + tableInfo.getEntityName() + "Mapper.xml";
+            }
+        });
+        abc.setFileOutConfigList(fileOutList);
+        gen.setCfg(abc);
+
+        /**
+         * 指定模板引擎 默认是VelocityTemplateEngine ,需要引入相关引擎依赖
+         */
+        //gen.setTemplateEngine(new FreemarkerTemplateEngine());
+
+        /**
+         * 模板配置
+         */
+        gen.setTemplate(
+                // 关闭默认 xml 生成,调整生成 至 根目录
+                new TemplateConfig().setXml(null)
+                // 自定义模板配置,模板可以参考源码 /mybatis-plus/src/main/resources/template 使用 copy
+                // 至您项目 src/main/resources/template 目录下,模板名称也可自定义如下配置:
+                // .setController("...");
+                // .setEntity("...");
+                // .setMapper("...");
+                // .setXml("...");
+                // .setService("...");
+                // .setServiceImpl("...");
+        );
+
+        // 执行生成
+        gen.execute();
+
+    }
+}

+ 68 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/EarlyWarning/EarlyWarningController.java

@@ -0,0 +1,68 @@
+package com.gyee.runeconomy.controller.EarlyWarning;
+
+import com.alibaba.fastjson.JSONObject;
+
+import com.gyee.runeconomy.dto.result.JsonResult;
+import com.gyee.runeconomy.dto.result.ResultCode;
+import com.gyee.runeconomy.service.EarlyWarning.EarlyWarningReliableService;
+import com.gyee.runeconomy.service.Weather.WertherForecast;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+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.HashMap;
+import java.util.Map;
+
+@RestController
+@CrossOrigin
+@RequestMapping("/WarningReport")
+public class EarlyWarningController {
+
+    @Autowired
+    private EarlyWarningReliableService earlyWarningReliableService;
+
+    @Autowired
+    private WertherForecast wertherForecast;
+
+    @GetMapping(value = "/reporkkxwt")
+    @ApiOperation(value = "预警分析报告-可靠性问题", notes = "预警分析报告—可靠性问题")
+    public JSONObject getinformationkkx() throws Exception {
+
+        earlyWarningReliableService.Electricity();
+
+        return JsonResult.success();
+    }
+
+
+    @GetMapping(value = "/report")
+    @ApiOperation(value = "分析报告", notes = "分析报告")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "time", value = "时间", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "wpid", value = "场站", required = true, dataType = "string", paramType = "query")})
+    public JSONObject getreportinformation(String time, String wpid) throws Exception {
+
+        Map<String, String> map = new HashMap<>();
+        if (!time.isEmpty()) {
+//            map = earlyWarninggetService.Electricity(time, wpid);
+        }
+        if (map.size() > 0) {
+            return JsonResult.successData(ResultCode.SUCCESS, map);
+        } else {
+            return JsonResult.error(500, "该月份没有数据");
+        }
+
+    }
+
+    @GetMapping(value = "/weather")
+    @ApiOperation(value = "天气", notes = "天气")
+    public JSONObject getweather() throws Exception {
+        wertherForecast.doTaskWeatherForecast();
+        return JsonResult.success();
+    }
+
+}

+ 105 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/AlarmDataParser.java

@@ -0,0 +1,105 @@
+package com.gyee.runeconomy.dto;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.util.List;
+import java.util.Map;
+
+public class AlarmDataParser {
+
+    public static class AlarmData {
+        private Long snapId;
+        private String stationId;
+        private String windturbineId;
+        private String alertText;
+        private int count;
+        private String alarmid;
+        private double time;
+        private String relateParts;
+        private String relatePartsText;
+
+        // Getter 和 Setter 方法
+        public Long getSnapId() {
+            return snapId;
+        }
+        public void setSnapId(Long snapId) {
+            this.snapId = snapId;
+        }
+        public String getStationId() {
+            return stationId;
+        }
+        public void setStationId(String stationId) {
+            this.stationId = stationId;
+        }
+        public String getWindturbineId() {
+            return windturbineId;
+        }
+        public void setWindturbineId(String windturbineId) {
+            this.windturbineId = windturbineId;
+        }
+        public String getAlertText() {
+            return alertText;
+        }
+        public void setAlertText(String alertText) {
+            this.alertText = alertText;
+        }
+        public int getCount() {
+            return count;
+        }
+        public void setCount(int count) {
+            this.count = count;
+        }
+        public String getAlarmid() {
+            return alarmid;
+        }
+        public void setAlarmid(String alarmid) {
+            this.alarmid = alarmid;
+        }
+        public double getTime() {
+            return time;
+        }
+        public void setTime(double time) {
+            this.time = time;
+        }
+        public String getRelateParts() {
+            return relateParts;
+        }
+        public void setRelateParts(String relateParts) {
+            this.relateParts = relateParts;
+        }
+        public String getRelatePartsText() {
+            return relatePartsText;
+        }
+        public void setRelatePartsText(String relatePartsText) {
+            this.relatePartsText = relatePartsText;
+        }
+    }
+
+
+    public static List parseResponse(String jsonResponse) {
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // 忽略未知字段
+
+        List<AlarmData> dataList = null;
+        try {
+            List<Map<String, List<AlarmData>>> responseData = objectMapper.readValue(
+                    jsonResponse, new TypeReference<List<Map<String, List<AlarmData>>>>() {
+                    }
+            );
+
+            for (Map<String, List<AlarmData>> map : responseData) {
+                for (Map.Entry<String, List<AlarmData>> entry : map.entrySet()) {
+                    String stationId = entry.getKey();
+                    dataList = entry.getValue();
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dataList;
+    }
+
+}

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

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

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

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

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

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.mapper;
+
+import com.gyee.runeconomy.model.ProEconAlarmRule;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 自定义报警配置 Mapper 接口
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+public interface ProEconAlarmRuleMapper extends BaseMapper<ProEconAlarmRule> {
+
+}

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

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

+ 62 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ProEconAlarmPlan.java

@@ -0,0 +1,62 @@
+package com.gyee.runeconomy.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_econ_alarm_plan")
+public class ProEconAlarmPlan extends Model<ProEconAlarmPlan> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 类型
+     */
+    private String types;
+
+    /**
+     * 排查方法
+     */
+    private String troubleMethod;
+
+    /**
+     * 处理方法
+     */
+    private String processMethod;
+
+    /**
+     * 工器具
+     */
+    private String tools;
+
+    /**
+     * 备件
+     */
+    private String spareParts;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    private String typedetails;
+
+
+}

+ 40 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ProEconAlarmReal.java

@@ -0,0 +1,40 @@
+package com.gyee.runeconomy.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_econ_alarm_real")
+public class ProEconAlarmReal extends Model<ProEconAlarmReal> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 预警编号
+     */
+    private String alarmId;
+
+    /**
+     * 排查方法
+     */
+    private String alarmPlan;
+
+
+}

+ 116 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ProEconAlarmRule.java

@@ -0,0 +1,116 @@
+package com.gyee.runeconomy.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 自定义报警配置
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_econ_alarm_rule")
+public class ProEconAlarmRule extends Model<ProEconAlarmRule> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 自定义报警名称
+     */
+    private String name;
+
+    /**
+     * 报警描述
+     */
+    private String description;
+
+    /**
+     * 公式
+     */
+    private String expression;
+
+    /**
+     * 标签
+     */
+    private String tag;
+
+    /**
+     * 报警级别
+     */
+    private Integer rank;
+
+    /**
+     * 机型
+     */
+    private String modelId;
+
+    /**
+     * 报警类别
+     */
+    private String category;
+
+    /**
+     * 范围
+     */
+    private String range;
+
+    /**
+     * 场站ID
+     */
+    private String stationId;
+
+    /**
+     * 项目ID
+     */
+    private String projectId;
+
+    /**
+     * 线路ID
+     */
+    private String lineId;
+
+    /**
+     * 设备ID
+     */
+    private String deviceId;
+
+    /**
+     * 电气ID
+     */
+    private String electricalId;
+
+    /**
+     * 关联部件
+     */
+    private String relatedParts;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 是否启用
+     */
+    private String enable;
+
+    /**
+     * 统一识别码(如果通过uniformCode配置,则设备类型,场站,机型不能为空)
+     */
+    private String uniformCode;
+
+
+}

+ 170 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/model/ReliabilityIssues.java

@@ -0,0 +1,170 @@
+package com.gyee.runeconomy.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("reliability_issues")
+public class ReliabilityIssues extends Model<ReliabilityIssues> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 风机编号
+     */
+    private String turbineId;
+
+    /**
+     * 场站编号
+     */
+    private String stationId;
+
+    /**
+     * 日期
+     */
+    private String recordDate;
+
+    /**
+     * 故障导致的停机次数
+     */
+    private Integer downtimeCount;
+
+    /**
+     * 主轴相关的故障类型
+     */
+    private String mainShaftType;
+
+    /**
+     * 主轴类故障发生的频率/小时数
+     */
+    private String mainShaftFrequencyHours;
+
+    /**
+     * 发电机相关的故障类型
+     */
+    private String generatorType;
+
+    /**
+     * 发电机类故障发生的频率/小时数
+     */
+    private String generatorFrequencyHours;
+
+    /**
+     * 齿轮箱相关的故障类型
+     */
+    private String gearboxType;
+
+    /**
+     * 齿轮箱类故障发生的频率/小时数
+     */
+    private String gearboxFrequencyHours;
+
+    /**
+     * 变桨系统相关的故障类型
+     */
+    private String pitchSystemType;
+
+    /**
+     * 变桨类故障发生的频率/小时数
+     */
+    private String pitchSystemFrequencyHours;
+
+    /**
+     * 温度类其它类型的故障信息
+     */
+    private String temperatureOtherIssues;
+
+    /**
+     * 温度类其它类故障发生的频率/小时数
+     */
+    private String temperatureOtherFrequencyHours;
+
+    /**
+     * 振动相关的故障类型
+     */
+    private String vibrationType;
+
+    /**
+     * 振动类故障发生的频率/小时数
+     */
+    private String vibrationFrequencyHours;
+
+    /**
+     * 机械系统相关的故障类型
+     */
+    private String mechanicalType;
+
+    /**
+     * 机械类故障发生的频率/小时数
+     */
+    private String mechanicalFrequencyHours;
+
+    /**
+     * 电气系统相关的故障类型
+     */
+    private String electricalType;
+
+    /**
+     * 电气类故障发生的频率/小时数
+     */
+    private String electricalFrequencyHours;
+
+    /**
+     * 液压系统相关的故障类型
+     */
+    private String hydraulicType;
+
+    /**
+     * 液压类故障发生的频率/小时数
+     */
+    private String hydraulicFrequencyHours;
+
+    /**
+     * 测风系统相关的故障类型
+     */
+    private String windMeasurementType;
+
+    /**
+     * 测风类故障发生的频率/小时数
+     */
+    private String windMeasurementFrequencyHours;
+
+    /**
+     * 其它类型的故障信息
+     */
+    private String otherIssues;
+
+    /**
+     * 其它类故障发生的频率/小时数
+     */
+    private String otherFrequencyHours;
+
+    /**
+     * 标记是否存在可靠性问题,"是"或"否"
+     */
+    private String reliabilityIssue;
+
+    /**
+     * 标记可靠性问题,"1"或"2"
+     * 1为温度类,2为状态类,3为两个都有
+     */
+    private Integer reliabilityIs;
+
+}

+ 77 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/ApiClient.java

@@ -0,0 +1,77 @@
+package com.gyee.runeconomy.service.EarlyWarning;
+
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.RestTemplate;
+
+import java.net.URI;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+
+public class ApiClient {
+    private final RestTemplate restTemplate = new RestTemplate();
+
+    public String getDataFromApi(String begin, String end, String deviceId, String modelId, String deviceType, String alarmIds, String timeType) {
+        try {
+            // 构建 URL
+            String baseUrl = "http://10.220.1.11:6015/alarm/history/findCtFeatureStatByWtId";
+            String charset = StandardCharsets.UTF_8.name();  // 获取字符集名称
+            String url = String.format("%s?begin=%s&end=%s&deviceid=%s&modelId=%s&deviceType=%s&alarmIds=%s&timeType=%s",
+                    baseUrl,
+                    URLEncoder.encode(begin, charset),
+                    URLEncoder.encode(end, charset),
+                    URLEncoder.encode(deviceId, charset),
+                    URLEncoder.encode(modelId, charset),
+                    URLEncoder.encode(deviceType, charset),
+                    URLEncoder.encode(alarmIds, charset),
+                    URLEncoder.encode(timeType, charset)
+            );
+
+            // 发送 GET 请求
+            URI uri = new URI(url);
+            ResponseEntity<String> response = restTemplate.getForEntity(uri, String.class);
+
+            // 返回响应内容
+            return response.getBody();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public String getgzFromApi(String begin, String end, String alarmType,String stationid,String deviceid, String description,String modelId,
+                               String deviceType,String components, String alarmId, String isclose, String pageNum,String pageSize) {
+        try {
+            // 构建 URL
+            String baseUrl = "http://172.16.12.101:6015/alarm/history/findAlarmlist";
+            String charset = StandardCharsets.UTF_8.name();  // 获取字符集名称
+            String url = String.format("%s?begin=%s&end=%s&alarmType=%s&stationid=%s&deviceid=%s&description=%s&modelId=%s&deviceType=%s&components=%s&alarmId=%s&isclose=%s&pageNum=%s&pageSize=%s",
+                    baseUrl,
+                    URLEncoder.encode(begin, charset),
+                    URLEncoder.encode(end, charset),
+                    URLEncoder.encode(alarmType, charset),
+                    URLEncoder.encode(stationid, charset),
+                    URLEncoder.encode(deviceid, charset),
+                    URLEncoder.encode(description, charset),
+                    URLEncoder.encode(modelId, charset),
+                    URLEncoder.encode(deviceType, charset),
+                    URLEncoder.encode(components, charset),
+                    URLEncoder.encode(alarmId, charset),
+                    URLEncoder.encode(isclose, charset),
+                    URLEncoder.encode(pageNum, charset),
+                    URLEncoder.encode(pageSize, charset)
+            );
+
+            // 发送 GET 请求
+            URI uri = new URI(url);
+            ResponseEntity<String> response = restTemplate.getForEntity(uri, String.class);
+
+            // 返回响应内容
+            return response.getBody();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 280 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/EarlyWarningReliableService.java

@@ -0,0 +1,280 @@
+package com.gyee.runeconomy.service.EarlyWarning;
+
+
+
+import com.gyee.runeconomy.dto.AlarmDataParser;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.ProEconAlarmPlan;
+import com.gyee.runeconomy.model.ProEconAlarmReal;
+import com.gyee.runeconomy.model.ReliabilityIssues;
+import com.gyee.runeconomy.model.auto.ProBasicEquipment;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
+import com.gyee.runeconomy.model.auto.TurbineInfoDay;
+import com.gyee.runeconomy.service.auto.ProEconAlarmPlanService;
+import com.gyee.runeconomy.service.auto.ProEconAlarmRealService;
+import com.gyee.runeconomy.service.auto.ReliabilityIssuesService;
+import com.gyee.runeconomy.service.auto.ITurbineInfoDayService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+public class EarlyWarningReliableService {
+
+    @Resource
+    private ProEconAlarmRealService proEconAlarmRealService;
+    @Resource
+    private ProEconAlarmPlanService proEconAlarmPlanService;
+    @Resource
+    private ReliabilityIssuesService reliabilityIssuesService;
+    @Resource
+    private ITurbineInfoDayService turbineInfoDayService;
+    public void Electricity() throws Exception {
+        ApiClient client = new ApiClient();
+        /*********************************************时间处理*********************************/
+        // 定义日期格式
+        DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM");
+        DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        // 获取当前日期
+        LocalDate currentDate = LocalDate.now();
+
+        // 减去一个月得到上个月
+        LocalDate previousMonthDate = currentDate.minusMonths(1);
+
+        // 格式化上个月的年月
+        String time = previousMonthDate.format(inputFormatter);
+
+        // 解析上个月的年月
+        YearMonth yearMonth = YearMonth.parse(time, inputFormatter);
+
+        // 获取指定月份的起始和结束日期时间,并转换为字符串
+        String startOfMonth = yearMonth.atDay(1).atTime(0, 0, 0).format(outputFormatter); // 上个月的第一天,精确到 00:00:00
+        String endOfMonth = yearMonth.atEndOfMonth().atTime(23, 59, 59).format(outputFormatter); // 上个月的最后一天,精确到 23:59:59
+//
+//        String startby = "2024-11-01 00:00:00";
+//        String startbyjs = "2024-11-14 10:00:00";
+        /*********************************************时间处理*********************************/
+
+        List<ProBasicPowerstation> powerstationList = CacheContext.wpls;
+        List<ProBasicEquipment> wtlist = CacheContext.wtls;
+
+        for (ProBasicPowerstation p : powerstationList) {
+            List<ProBasicEquipment> equipments = wtlist.stream()
+                    .filter(w -> p.getId().equals(w.getWindpowerstationId()))
+                    .collect(Collectors.toList());
+
+            List<ReliabilityIssues> IssuesList = new ArrayList<>();
+
+            for (ProBasicEquipment equipment : equipments) {
+                // 获取月度风机数据
+                List<TurbineInfoDay> turbineList = turbineInfoDayService.getTurbineList(equipment.getId(), startOfMonth, endOfMonth);
+                int tjcssum = turbineList.stream()
+                        .filter(turbine -> turbine.getTjcs() != null)
+                        .mapToInt(TurbineInfoDay::getTjcs)
+                        .sum();
+
+                // 调用 API 获取预警数据
+                String result = client.getDataFromApi(
+                        startOfMonth,
+                        endOfMonth,
+                        equipment.getId(),
+                        equipment.getModelId(),
+                        "windturbine",
+                        "",
+                        "h"
+                );
+
+                if (result.trim().equals("[]")) {
+                    continue; // 无数据则跳过
+                }
+
+                // 解析预警数据
+                List<AlarmDataParser.AlarmData> response = AlarmDataParser.parseResponse(result);
+                if (response.isEmpty()) {
+                    continue;
+                }
+
+                // 初始化 ReliabilityIssues 对象
+                ReliabilityIssues issue = new ReliabilityIssues();
+                issue.setStationId(p.getId());
+                issue.setTurbineId(equipment.getAname());
+                issue.setRecordDate(time);
+                issue.setDowntimeCount(tjcssum);
+                IssuesList.add(issue);
+
+                // 处理每条预警数据
+                for (AlarmDataParser.AlarmData alarmData : response) {
+                    // 查询 Alarmid 对应信息
+                    String planId = proEconAlarmRealService.getProEconAlarmReal(alarmData.getAlarmid())
+                            .stream()
+                            .findFirst()
+                            .map(ProEconAlarmReal::getAlarmPlan)
+                            .orElse("0");
+
+                    // 查询预警类型和部件类型
+                    ProEconAlarmPlan alarmPlan = proEconAlarmPlanService.selectAlarmPlanByProId(planId)
+                            .stream()
+                            .findFirst()
+                            .orElse(null);
+
+                    String yjType = (alarmPlan != null) ? alarmPlan.getTypedetails() : "0";
+                    String bjType = (alarmPlan != null) ? alarmPlan.getTypes() : "0";
+
+                    // 提取必要字段
+                    String alertText = alarmData.getAlertText();
+                    String frequencyHours = alarmData.getCount() + "/" + alarmData.getTime();
+                    String relateType = alarmData.getRelateParts();
+
+                    // 根据隐患类型分类处理
+                    if ("温度隐患".equals(yjType)) {
+                        processTemperatureIssues(issue, relateType, alertText, frequencyHours);
+                    } else if ("其它隐患".equals(yjType)) {
+                        processOtherIssues(issue, bjType, alertText, frequencyHours);
+                    }
+                }
+            }
+
+            // 计算第一组字段的总频次
+            List<ReliabilityIssues> firstSortedIssues = IssuesList.stream()
+                    .map(iss -> {
+                        double totalFrequency = 0;
+                        // 累加原有字段的频次
+                        totalFrequency += parseFrequency(iss.getMainShaftFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getGeneratorFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getGearboxFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getPitchSystemFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getTemperatureOtherFrequencyHours());
+
+                        // 将计算的总频次存储在临时变量中
+                        iss.setReliabilityIssue(String.valueOf(totalFrequency));  // 临时存储频次总和为字符串
+                        return iss;
+                    })
+                    .sorted((i1, i2) -> Double.compare(parseFrequency(i2.getReliabilityIssue()), parseFrequency(i1.getReliabilityIssue())))  // 按总频次排序
+                    .limit(5)  // 取前五名
+                    .collect(Collectors.toList());
+
+            // 计算第二组字段的总频次
+            List<ReliabilityIssues> secondSortedIssues = IssuesList.stream()
+                    .map(iss -> {
+                        double totalFrequency = 0;
+                        // 累加新增字段的频次
+                        totalFrequency += parseFrequency(iss.getVibrationFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getMechanicalFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getElectricalFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getHydraulicFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getWindMeasurementFrequencyHours());
+                        totalFrequency += parseFrequency(iss.getOtherFrequencyHours());
+
+                        // 将计算的总频次存储在临时变量中
+                        iss.setReliabilityIssue(String.valueOf(totalFrequency));  // 临时存储频次总和为字符串
+                        return iss;
+                    })
+                    .sorted((i1, i2) -> Double.compare(parseFrequency(i2.getReliabilityIssue()), parseFrequency(i1.getReliabilityIssue())))  // 按总频次排序
+                    .limit(5)  // 取前五名
+                    .collect(Collectors.toList());
+
+            // 合并两组数据
+            List<ReliabilityIssues> topTenIssues = new ArrayList<>();
+            firstSortedIssues.forEach(iss -> {
+                iss.setReliabilityIssue("是");
+                iss.setReliabilityIs(1);});
+
+            secondSortedIssues.forEach(isc -> {
+                isc.setReliabilityIssue("是");
+                // 判断 ReliabilityIs 是否为 1
+                if (isc.getReliabilityIs() == 1) {
+                    isc.setReliabilityIs(3);  // 如果是 1,设置为 3
+                } else {
+                    isc.setReliabilityIs(2);  // 否则,设置为 2
+                }
+            });
+
+
+//            topTenIssues.addAll(firstSortedIssues);
+//            topTenIssues.addAll(secondSortedIssues);
+//            // 将 top 10 记录的 reliabilityIssue 设置为 "是"
+//            topTenIssues.forEach(iss -> iss.setReliabilityIssue("是"));
+
+            // 将其它数据的 reliabilityIssue 设置为 "否"
+            IssuesList.stream()
+                    .filter(iss -> !secondSortedIssues.contains(iss) && !firstSortedIssues.contains(iss))  // 排除已经设置为 "是" 的数据
+                    .forEach(iss -> iss.setReliabilityIssue("否"));
+
+            // 调用 saveBatch 保存数据
+            boolean b = reliabilityIssuesService.saveBatch(IssuesList);
+            System.out.println("可靠性问题运行结束");
+        }
+    }
+
+    // 辅助方法:解析频次字符串并计算总和(如果是 "count/time" 格式)
+    private double parseFrequency(String frequency) {
+        if (frequency != null && frequency.contains("/")) {
+            try {
+                String[] parts = frequency.split("/");
+                return Double.parseDouble(parts[0]); // 取前面的频次部分
+            } catch (NumberFormatException e) {
+                return 0;
+            }
+        }
+        return 0;
+    }
+    /**
+     * 处理温度隐患问题
+     */
+    private void processTemperatureIssues(ReliabilityIssues issue, String relateType, String alertText, String frequencyHours) {
+        switch (relateType) {
+            case "ZZ":
+                issue.setMainShaftType(alertText);
+                issue.setMainShaftFrequencyHours(frequencyHours);
+                break;
+            case "FDJ":
+                issue.setGeneratorType(alertText);
+                issue.setGeneratorFrequencyHours(frequencyHours);
+                break;
+            case "CLX":
+                issue.setGearboxType(alertText);
+                issue.setGearboxFrequencyHours(frequencyHours);
+                break;
+            case "BJXT":
+                issue.setPitchSystemType(alertText);
+                issue.setPitchSystemFrequencyHours(frequencyHours);
+                break;
+            default:
+                issue.setTemperatureOtherIssues(alertText);
+                issue.setTemperatureOtherFrequencyHours(frequencyHours);
+                break;
+        }
+    }
+
+    /**
+     * 处理其它隐患问题
+     */
+    private void processOtherIssues(ReliabilityIssues issue, String bjType, String alertText, String frequencyHours) {
+        switch (bjType) {
+            case "ZD":
+                issue.setVibrationType(alertText);
+                issue.setVibrationFrequencyHours(frequencyHours);
+                break;
+            case "JX":
+                issue.setElectricalType(alertText);
+                issue.setElectricalFrequencyHours(frequencyHours);
+                break;
+            case "YYXT":
+                issue.setWindMeasurementType(alertText);
+                issue.setWindMeasurementFrequencyHours(frequencyHours);
+                break;
+            default:
+                issue.setOtherIssues(alertText);
+                issue.setOtherFrequencyHours(frequencyHours);
+                break;
+        }
+    }
+
+}

+ 269 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Weather/WertherForecast.java

@@ -0,0 +1,269 @@
+package com.gyee.runeconomy.service.Weather;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
+import com.gyee.runeconomy.service.auto.IProBasicPowerstationService;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author hlf
+ * @date 2022/9/21 10:52
+ * 文件说明:定时任务工具类
+ */
+
+//@EnableAsync
+
+@Service
+public class WertherForecast {
+
+    private RestTemplate restTemplate = new RestTemplate();
+
+    @Resource
+    private IProBasicPowerstationService powerstationService;
+//
+//    @Resource
+//    private IWeatherDataHourService weatherDataHourService;
+//
+//    @Resource
+//    private IWeatherDataFutureService weatherDataFutureService;
+//
+//    @Resource
+//    private IWeatherDataFutureHistoryService historyService;
+//
+//    @Resource
+//    private IWeather24HourService weather24HourService;
+//
+//    @Resource
+//    private IWeather24HourHistoryService weather24HourHistoryService;
+
+    /**
+     * 天气预报
+     * 一小时执行一次
+     */
+//    @Scheduled(cron = "0 0 */1 * * ?")
+//    @Async
+    public void doTaskWeatherForecast() {
+        System.out.println("开始执行天气预报异步任务,当前线程:" + Thread.currentThread().getName());
+
+        List<ProBasicPowerstation> powerstations = powerstationService.selectList1();
+        if (powerstations.isEmpty()) {
+            return;
+        }
+
+        for (ProBasicPowerstation windplant : powerstations) {
+            String url = "http://weathernew.pae.baidu.com/weathernew/pc?query=" + windplant.getAddress() + "天气&srcid=4982";
+            ResponseEntity<String> entity = restTemplate.getForEntity(url, String.class);
+
+            if (entity.getBody() == null) {
+                continue;
+            }
+
+            try {
+                String jsonString = extractJsonString(entity.getBody());
+                JsonNode root = new ObjectMapper().readTree(jsonString);
+                System.out.println(root.toString());
+//
+//                //未来40天天气-包含当天
+//                JsonNode infoArray = root.path("long_day_forecast").path("info");
+//                //当天紫外线-湿度
+//                JsonNode infoArrayzwx = root.path("feature");
+//                //气压-能见度
+//                JsonNode infoArrayqy = root.path("weather");
+//                //24小时天气
+//                JsonNode infoArray24 = root.path("24_hour_forecast").path("info");
+//
+//                //存储当天天气
+//                List<WeatherDataHour> weatherDataHours = new ArrayList<>();
+//                //存储24小时天气
+//                List<Weather24Hour> weatherDataHours24 = new ArrayList<>();
+//                //存储24小时天气历史
+//                List<Weather24HourHistory> weatherDataHours24history= new ArrayList<>();
+//                //存储未来40天天气
+//                List<WeatherDataFuture> weatherDataFutures = new ArrayList<>();
+//                //存储未来40天天气-历史
+//                List<WeatherDataFutureHistory> futureHistories = new ArrayList<>();
+//
+//                for (JsonNode info : infoArray24) {
+//                    Weather24Hour weather24Hour = parseWeather24Hour(info, windplant);
+//                    weatherDataHours24.add(weather24Hour);
+//                    weather24HourService.remove(windplant.getId());
+//                    weather24HourService.batchAdd(weatherDataHours24);
+//
+//                    Weather24HourHistory weather24HourHistory = parseWeather24HourHistory(info, windplant);
+//                    weatherDataHours24history.add(weather24HourHistory);
+//                    weather24HourHistoryService.batchAdd(weatherDataHours24history);
+//                }
+//
+//
+//                for (JsonNode info : infoArray) {
+//                    WeatherDataHour dataHour = parseWeatherDataHour(info, infoArrayzwx,infoArrayqy, windplant);
+//                    if (dataHour.getRecordDate().equals(LocalDate.now())) {
+//                        weatherDataHours.add(dataHour);
+//                        weatherDataHourService.remove(windplant.getId());
+//                        weatherDataHourService.batchAdd(weatherDataHours);
+//                        weatherDataHours.clear();
+//                    }
+//
+//                    WeatherDataFuture dataFuture = parseWeatherDataFuture(info, windplant);
+//                    weatherDataFutures.add(dataFuture);
+//                    weatherDataFutureService.remove(windplant.getId());
+//                    weatherDataFutureService.batchAdd(weatherDataFutures);
+//                    weatherDataFutures.clear();
+//
+//                    WeatherDataFutureHistory history = parseWeatherDataFutureHistory(info, windplant);
+//                    futureHistories.add(history);
+//                    historyService.batchAdd(futureHistories);
+//                    futureHistories.clear();
+//                }
+
+            } catch (IOException e) {
+                e.printStackTrace();
+        }
+    }
+        System.out.println("天气预报异步任务执行完毕,当前线程:" + Thread.currentThread().getName());
+}
+
+
+
+    private String extractJsonString(String body) {
+        int index = body.indexOf("<!DOC");
+        String a = body.substring(0, index);
+        String b = a.replaceAll("<script>", "");
+        int index1 = b.lastIndexOf(";<");
+        String c = b.substring(0, index1);
+        int index2 = c.indexOf(" {");
+        String d = c.substring(index2);
+        String e = d.substring(1);
+        return e.substring(0, e.indexOf(";</"));
+    }
+//
+//    //当天24小时天气
+//    private Weather24Hour parseWeather24Hour(JsonNode info,ProBasicPowerstation windplant) throws ParseException {
+//        Weather24Hour Hour24 = new Weather24Hour();
+//        Hour24.setStationId(windplant.getId());
+//        Hour24.setStationName(windplant.getAname());
+//        String hour = info.path("hour").asText();
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
+//        Hour24.setRecordDate(sdf.parse(hour));
+//        Hour24.setWeather(info.path("weather").asText());
+//        Hour24.setPrecipitation(info.path("precipitation").asText());
+//        Hour24.setTemperature(info.path("temperature").asText());
+//        Hour24.setWindDirection(info.path("wind_direction").asText());
+//        Hour24.setWindPower(parseWindPower(info.path("wind_power").asText()));
+//        Hour24.setListvalue(info.path("pm25").path("listValue").asText());
+//        Hour24.setListaqival(info.path("pm25").path("listAqiVal").asText());
+//        return Hour24;
+//    }
+//
+//    //当天24小时天气
+//    private Weather24HourHistory parseWeather24HourHistory(JsonNode info, ProBasicPowerstation windplant) throws ParseException {
+//        Weather24HourHistory Hour24History = new Weather24HourHistory();
+//        Hour24History.setStationId(windplant.getId());
+//        Hour24History.setStationName(windplant.getAname());
+//        String hour = info.path("hour").asText();
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
+//        Hour24History.setRecordDate(sdf.parse(hour));
+//        Hour24History.setWeather(info.path("weather").asText());
+//        Hour24History.setTemperature(info.path("temperature").asText());
+//        Hour24History.setPrecipitation(info.path("precipitation").asText());
+//        Hour24History.setWindDirection(info.path("wind_direction").asText());
+//        Hour24History.setWindPower(parseWindPower(info.path("wind_power").asText()));
+//        Hour24History.setListvalue(info.path("pm25").path("listValue").asText());
+//        Hour24History.setListaqival(info.path("pm25").path("listAqiVal").asText());
+//        return Hour24History;
+//    }
+//
+//    //当天天气
+//    private WeatherDataHour parseWeatherDataHour(JsonNode info,JsonNode infoArrayzwx,JsonNode infoArrayqy,ProBasicPowerstation windplant) {
+//        WeatherDataHour data = new WeatherDataHour();
+//        data.setStationId(windplant.getId());
+//        data.setStationName(windplant.getAname());
+//        data.setRecordDate(LocalDate.parse(info.path("date").asText()));
+//        data.setWeather(info.path("weather_day").asText());
+//        data.setHumidity(infoArrayzwx.path("humidity").asText());
+//        data.setUltraviolet(infoArrayzwx.path("ultraviolet").asText());
+//        data.setPressure(infoArrayqy.path("pressure").asText());
+//        data.setVisibility(infoArrayqy.path("visibility").asText());
+//        data.setTemperatureNight(new BigDecimal(info.path("temperature_night").asText()));
+//        data.setTemperatureDay(new BigDecimal(info.path("temperature_day").asText()));
+//        data.setWindDirection(info.path("wind_direction_day").asText());
+//        data.setWindPower(parseWindPower(info.path("wind_power_night").asText()));
+//        data.setSunrisetime(info.path("sunriseTime").asText());
+//        data.setSunsettime(info.path("sunsetTime").asText());
+//        return data;
+//    }
+//
+//    //未来40天天气
+//    private WeatherDataFuture parseWeatherDataFuture(JsonNode info, ProBasicPowerstation windplant) {
+//        WeatherDataFuture data = new WeatherDataFuture();
+//        data.setStationId(windplant.getId());
+//        data.setStationName(windplant.getAname());
+//        data.setRecordDate(LocalDate.parse(info.path("date").asText()));
+//        data.setWeather(info.path("weather_day").asText());
+//        data.setWeatherNight(info.path("weather_night").asText());
+//        data.setTemperatureNight(new BigDecimal(info.path("temperature_night").asText()));
+//        data.setTemperatureDay(new BigDecimal(info.path("temperature_day").asText()));
+//        data.setWindDirection(info.path("wind_direction_day").asText());
+//        data.setWindPower(parseWindPower(info.path("wind_power_night").asText()));
+//        data.setWindPowerDay(parseWindPower(info.path("wind_power_day").asText()));
+//        data.setSunrisetime(info.path("sunriseTime").asText());
+//        data.setSunsettime(info.path("sunsetTime").asText());
+//        data.setListvalue(info.path("pm25").path("listQuality").path("listValue").asText());
+//        return data;
+//    }
+//
+//    //未来40天天气-历史
+//    private WeatherDataFutureHistory parseWeatherDataFutureHistory(JsonNode info, ProBasicPowerstation windplant) {
+//        WeatherDataFutureHistory data = new WeatherDataFutureHistory();
+//        data.setStationId(windplant.getId());
+//        data.setStationName(windplant.getAname());
+//        data.setRecordDate(LocalDate.parse(info.path("date").asText()));
+//        data.setWeather(info.path("weather_day").asText());
+//        data.setWeatherNight(info.path("weather_night").asText());
+//        data.setTemperatureNight(new BigDecimal(info.path("temperature_night").asText()));
+//        data.setTemperatureDay(new BigDecimal(info.path("temperature_day").asText()));
+//        data.setWindDirection(info.path("wind_direction_day").asText());
+//        data.setWindPower(parseWindPower(info.path("wind_power_night").asText()));
+//        data.setWindPowerDay(parseWindPower(info.path("wind_power_day").asText()));
+//        data.setSunrisetime(info.path("sunriseTime").asText());
+//        data.setSunsettime(info.path("sunsetTime").asText());
+//        data.setListvalue(info.path("pm25").path("listQuality").path("listValue").asText());
+//        return data;
+//    }
+
+
+    // 解析风速字符串,例如 "5-6级" 转换为 BigDecimal
+    private static BigDecimal parseWindPower(String windPower) {
+        if (windPower.contains("级")) {
+            String[] parts = windPower.split("级")[0].split("-");
+            if (parts.length == 2) {
+                try {
+                    BigDecimal min = new BigDecimal(parts[0].replace("<", "").trim());
+                    BigDecimal max = new BigDecimal(parts[1].replace("<", "").trim());
+                    return min.add(max).divide(BigDecimal.valueOf(2)); // 取风速的平均值
+                } catch (NumberFormatException e) {
+                    e.printStackTrace();
+                }
+            } else {
+                try {
+                    return new BigDecimal(parts[0].replace("<", "").trim());
+                } catch (NumberFormatException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return BigDecimal.ZERO; // 默认返回 0 风速
+    }
+}

+ 1 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProBasicPowerstationService.java

@@ -24,5 +24,6 @@ public interface IProBasicPowerstationService extends IService<ProBasicPowerstat
      */
     List<ProBasicPowerstation> getProBasicPowerstationlist(String regionId, String companyId, String staType);
 
+    List<ProBasicPowerstation> selectList1();
 
 }

+ 5 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ITurbineInfoDayService.java

@@ -3,6 +3,9 @@ package com.gyee.runeconomy.service.auto;
 import com.gyee.runeconomy.model.auto.TurbineInfoDay;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.text.ParseException;
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -13,4 +16,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ITurbineInfoDayService extends IService<TurbineInfoDay> {
 
+    List<TurbineInfoDay> getTurbineInfoDayList(String wpid, String kssj) throws ParseException;
+    List<TurbineInfoDay> getTurbineList(String wtid,String kssj,String jssj) throws ParseException;
 }

+ 18 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ProEconAlarmPlanService.java

@@ -0,0 +1,18 @@
+package com.gyee.runeconomy.service.auto;
+
+import com.gyee.runeconomy.model.ProEconAlarmPlan;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+public interface ProEconAlarmPlanService extends IService<ProEconAlarmPlan> {
+    List<ProEconAlarmPlan> selectAlarmPlanByProId(String proId);
+}

+ 18 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ProEconAlarmRealService.java

@@ -0,0 +1,18 @@
+package com.gyee.runeconomy.service.auto;
+
+import com.gyee.runeconomy.model.ProEconAlarmReal;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+public interface ProEconAlarmRealService extends IService<ProEconAlarmReal> {
+    List<ProEconAlarmReal> getProEconAlarmReal(String alarmid);
+}

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

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.service.auto;
+
+import com.gyee.runeconomy.model.ProEconAlarmRule;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 自定义报警配置 服务类
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+public interface ProEconAlarmRuleService extends IService<ProEconAlarmRule> {
+
+}

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

@@ -0,0 +1,20 @@
+package com.gyee.runeconomy.service.auto;
+
+import com.gyee.runeconomy.model.ReliabilityIssues;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+public interface ReliabilityIssuesService extends IService<ReliabilityIssues> {
+    boolean saveBatch(List<ReliabilityIssues> list);
+
+    List<ReliabilityIssues> getReliabilityIssues(String wpid,String time);
+}

+ 7 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProBasicPowerstationServiceImpl.java

@@ -47,4 +47,11 @@ public class ProBasicPowerstationServiceImpl extends ServiceImpl<ProBasicPowerst
         }
         return list;
     }
+
+    @Override
+    public List<ProBasicPowerstation> selectList1() {
+        QueryWrapper<ProBasicPowerstation> qw = new QueryWrapper<>();
+        List<ProBasicPowerstation> windplants = baseMapper.selectList(qw);
+        return windplants;
+    }
 }

+ 30 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconAlarmPlanServiceImpl.java

@@ -0,0 +1,30 @@
+package com.gyee.runeconomy.service.auto.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.runeconomy.model.ProEconAlarmPlan;
+import com.gyee.runeconomy.mapper.ProEconAlarmPlanMapper;
+import com.gyee.runeconomy.service.auto.ProEconAlarmPlanService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+@Service
+public class ProEconAlarmPlanServiceImpl extends ServiceImpl<ProEconAlarmPlanMapper, ProEconAlarmPlan> implements ProEconAlarmPlanService {
+
+    @Override
+    public List<ProEconAlarmPlan> selectAlarmPlanByProId(String proId) {
+        QueryWrapper<ProEconAlarmPlan> qw = new QueryWrapper<>();
+        qw.lambda().eq(ProEconAlarmPlan::getId,proId);
+        java.util.List<ProEconAlarmPlan> proEconAlarmPlans = baseMapper.selectList(qw);
+        return proEconAlarmPlans;
+    }
+}

+ 30 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconAlarmRealServiceImpl.java

@@ -0,0 +1,30 @@
+package com.gyee.runeconomy.service.auto.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.runeconomy.model.ProEconAlarmReal;
+import com.gyee.runeconomy.mapper.ProEconAlarmRealMapper;
+import com.gyee.runeconomy.service.auto.ProEconAlarmRealService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+@Service
+public class ProEconAlarmRealServiceImpl extends ServiceImpl<ProEconAlarmRealMapper, ProEconAlarmReal> implements ProEconAlarmRealService {
+
+    @Override
+    public List<ProEconAlarmReal> getProEconAlarmReal(String alarmid) {
+        QueryWrapper<ProEconAlarmReal> qw = new QueryWrapper<>();
+        qw.lambda().eq(ProEconAlarmReal::getAlarmId, alarmid);
+        List<ProEconAlarmReal> list = baseMapper.selectList(qw);
+        return list;
+    }
+}

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

@@ -0,0 +1,20 @@
+package com.gyee.runeconomy.service.auto.impl;
+
+import com.gyee.runeconomy.model.ProEconAlarmRule;
+import com.gyee.runeconomy.mapper.ProEconAlarmRuleMapper;
+import com.gyee.runeconomy.service.auto.ProEconAlarmRuleService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 自定义报警配置 服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+@Service
+public class ProEconAlarmRuleServiceImpl extends ServiceImpl<ProEconAlarmRuleMapper, ProEconAlarmRule> implements ProEconAlarmRuleService {
+
+}

+ 55 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ReliabilityIssuesServiceImpl.java

@@ -0,0 +1,55 @@
+package com.gyee.runeconomy.service.auto.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.runeconomy.model.ReliabilityIssues;
+import com.gyee.runeconomy.mapper.ReliabilityIssuesMapper;
+import com.gyee.runeconomy.service.auto.ReliabilityIssuesService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2024-11-27
+ */
+@Service
+public class ReliabilityIssuesServiceImpl extends ServiceImpl<ReliabilityIssuesMapper, ReliabilityIssues> implements ReliabilityIssuesService {
+
+    @Override
+    public boolean saveBatch(List<ReliabilityIssues> list) {
+        try {
+            list.stream().forEach(i -> {
+                QueryWrapper<ReliabilityIssues> qw = new QueryWrapper<>();
+                qw.lambda().eq(ReliabilityIssues::getTurbineId, i.getTurbineId());
+                qw.lambda().eq(ReliabilityIssues::getRecordDate, i.getRecordDate());
+                qw.lambda().eq(ReliabilityIssues::getStationId, i.getStationId());
+                long count = baseMapper.selectCount(qw);
+                if (count > 0) {
+                    baseMapper.update(i, qw);
+                } else if (count <= 0) {
+                    baseMapper.insert(i);
+                }
+
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public List<ReliabilityIssues> getReliabilityIssues(String wpid, String time) {
+        QueryWrapper<ReliabilityIssues> qw = new QueryWrapper<>();
+        qw.lambda().eq(ReliabilityIssues::getStationId, wpid);
+        qw.lambda().eq(ReliabilityIssues::getRecordDate, time);
+        List<ReliabilityIssues> ReliabilityIssues = baseMapper.selectList(qw);
+        return ReliabilityIssues;
+    }
+}

+ 25 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/TurbineInfoDayServiceImpl.java

@@ -1,11 +1,17 @@
 package com.gyee.runeconomy.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.runeconomy.model.auto.TurbineInfoDay;
 import com.gyee.runeconomy.mapper.auto.TurbineInfoDayMapper;
 import com.gyee.runeconomy.service.auto.ITurbineInfoDayService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  *  服务实现类
@@ -16,5 +22,24 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class TurbineInfoDayServiceImpl extends ServiceImpl<TurbineInfoDayMapper, TurbineInfoDay> implements ITurbineInfoDayService {
+    @Override
+    public List<TurbineInfoDay> getTurbineInfoDayList(String wpid, String kssj) throws ParseException {
+        QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
+        Date kssjDate = new SimpleDateFormat("yyyy-MM-dd").parse(kssj);
+        qw.lambda().eq(TurbineInfoDay::getTurbineId,wpid);
+        qw.lambda().eq(TurbineInfoDay::getRecordDate,kssjDate);
+        List<TurbineInfoDay> list = baseMapper.selectList(qw);
+        return list;
+    }
 
+    @Override
+    public List<TurbineInfoDay> getTurbineList(String wtid, String kssj, String jssj) throws ParseException {
+        QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
+        Date kssjDate = new SimpleDateFormat("yyyy-MM-dd").parse(kssj);
+        Date jssjDate = new SimpleDateFormat("yyyy-MM-dd").parse(jssj);
+        qw.lambda().eq(TurbineInfoDay::getTurbineId,wtid);
+        qw.lambda().between(TurbineInfoDay::getRecordDate,kssjDate,jssjDate);
+        List<TurbineInfoDay> list = baseMapper.selectList(qw);
+        return list;
+    }
 }