Browse Source

移植新版健康管理后台项目

shilin 1 year ago
parent
commit
a21f3fefe7
31 changed files with 150 additions and 215 deletions
  1. 10 0
      realtime/failurestatistics-server/pom.xml
  2. 11 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/FailurestatisticsMain.java
  3. 35 138
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/config/GeneratorCodeConfig.java
  4. 8 4
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/init/CacheContext.java
  5. 5 5
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconEarlyWarningMainMapper.java
  6. 1 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconEarlyWarningSubMapper.java
  7. 0 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconFailureStatisticMainMapper.java
  8. 0 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconFailureStatisticsSubMapper.java
  9. 0 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartPowerstatticMainMapper.java
  10. 1 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartStatisticsMainMapper.java
  11. 1 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartTemperatureMainMapper.java
  12. 0 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartTemperatureSubMapper.java
  13. 0 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartpowerStatticsSubMapper.java
  14. 2 0
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconShutdownEventMapper.java
  15. 2 2
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/EarlywarningService.java
  16. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/FailurestatisticsService.java
  17. 14 3
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/PartpowerstatticsService.java
  18. 9 4
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/PartstatisticsService.java
  19. 21 4
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/ParttemperatureService.java
  20. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconEarlyWarningMainServiceImpl.java
  21. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconEarlyWarningSubServiceImpl.java
  22. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconFailureStatisticMainServiceImpl.java
  23. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconFailureStatisticsSubServiceImpl.java
  24. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartPowerstatticMainServiceImpl.java
  25. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartStatisticsMainServiceImpl.java
  26. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartTemperatureMainServiceImpl.java
  27. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartTemperatureSubServiceImpl.java
  28. 1 1
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartpowerStatticsSubServiceImpl.java
  29. 2 2
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/task/SaticScheduleTask.java
  30. 16 14
      realtime/failurestatistics-server/src/main/resources/application-jn.yml
  31. 2 2
      realtime/failurestatistics-server/src/main/resources/xxl-job-executor.properties

+ 10 - 0
realtime/failurestatistics-server/pom.xml

@@ -21,6 +21,8 @@
         <pgsql.version>42.2.5</pgsql.version>
         <groovy.version>3.0.8</groovy.version>
         <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
+        <mybatis-plus.boot.starter.version>3.5.3.1</mybatis-plus.boot.starter.version>
+        <mybatis-plus.generator.version>3.5.3.1</mybatis-plus.generator.version>
 
     </properties>
     <dependencies>
@@ -54,13 +56,21 @@
             <artifactId>lombok</artifactId>
             <optional>true</optional>
         </dependency>
+
         <dependency>
             <groupId>com.baomidou</groupId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>${mybatis-plus.boot.starter.version}</version>
         </dependency>
         <dependency>
             <groupId>com.baomidou</groupId>
             <artifactId>mybatis-plus-generator</artifactId>
+            <version>${mybatis-plus.generator.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.5.0</version>
         </dependency>
         <dependency>
             <groupId>org.freemarker</groupId>

+ 11 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/FailurestatisticsMain.java

@@ -1,6 +1,7 @@
 package com.gyee.failurestatistics;
 
 import com.gyee.failurestatistics.service.ShutdowneventService;
+import com.gyee.failurestatistics.task.SaticScheduleTask;
 import com.gyee.failurestatistics.util.SpringUtils;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
@@ -18,8 +19,15 @@ public class FailurestatisticsMain {
 
         ShutdowneventService shutdowneventService = SpringUtils.getBean("shutdowneventService");
 
-//        System.out.println("开始");
-//        shutdowneventService.updateShutdownevent();
-//        System.out.println("结束");
+        System.out.println("开始");
+        SaticScheduleTask saticScheduleTask= SpringUtils.getBean("saticScheduleTask");
+//        saticScheduleTask.configureTasks1();
+//        saticScheduleTask.configureTasks2();
+//        saticScheduleTask.configureTasks3();
+//        saticScheduleTask.configureTasks4();
+//        saticScheduleTask.configureTasks5();
+
+
+        System.out.println("结束");
     }
 }

+ 35 - 138
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/config/GeneratorCodeConfig.java

@@ -1,150 +1,47 @@
 package com.gyee.failurestatistics.config;
 
 
-import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.generator.AutoGenerator;
-import com.baomidou.mybatisplus.generator.config.*;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
 
-import java.util.Scanner;
+import com.baomidou.mybatisplus.generator.FastAutoGenerator;
+import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
+import com.baomidou.mybatisplus.generator.config.querys.PostgreSqlQuery;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
 
-/**
- *@ClassName GeneratorCodeConfig
- *@Description 自动生成mybatisplus的相关代码
- *@Author 谢生杰
- *@Date 2020/9/25 18:26
- *@Version 1.0
- **/
 public class GeneratorCodeConfig {
-    public static String scanner(String tip) {
-        Scanner scanner = new Scanner(System.in);
-        StringBuilder help = new StringBuilder();
-        help.append("请输入" + tip + ":");
-        System.out.println(help.toString());
-        if (scanner.hasNext()) {
-            String ipt = scanner.next();
-            if (StringUtils.isNotEmpty(ipt)) {
-                return ipt;
-            }
-        }
-        throw new MybatisPlusException("请输入正确的" + tip + "!");
-    }
-
-    public static void main(String[] args) {
-        // 代码生成器
-        AutoGenerator mpg = new AutoGenerator();
-
-        // 全局配置
-        GlobalConfig gc = new GlobalConfig();
-        String projectPath = System.getProperty("user.dir");
-        gc.setOutputDir(projectPath + "/src/main/java");
-        gc.setAuthor("石林");
-        gc.setOpen(false);
-        //实体属性 Swagger2 注解
-        gc.setSwagger2(false);
-        mpg.setGlobalConfig(gc);
-
-        // 数据源配置
-        DataSourceConfig dsc = new DataSourceConfig();
-
-//        dsc.setUrl("jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true");
-//        dsc.setDriverName("com.mysql.jdbc.Driver");
-//        dsc.setUsername("root");
-//        dsc.setPassword("root");
-//        mpg.setDataSource(dsc);
-
-        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
-        dsc.setUsername("nxfdprod");
-        dsc.setPassword("gdnxfd123");
-        dsc.setUrl("jdbc:oracle:thin:@123.60.213.70:1521:GDNXFD");
-        mpg.setDataSource(dsc);
-
-//        dsc.setDriverName("com.cloudera.impala.jdbc41.Driver");
-//        dsc.setUrl("jdbc:impala://192.168.1.67:21050/gyee_test");
-//        mpg.setDataSource(dsc);
 
+    /**
+     * 数据源配置
+     */
+    private static final DataSourceConfig.Builder DATA_SOURCE_CONFIG = new DataSourceConfig
+            .Builder("jdbc:postgresql://127.0.0.1:5432/IMS_NEM_JN", "postgres", "gd123")
+            .dbQuery(new PostgreSqlQuery());
 
+    /**
+     * 输出路径
+     */
+    private static final String outputDir = System.getProperty("user.dir")+"\\web\\health\\src\\main\\java";
 
-        // 包配置
-        PackageConfig pc = new PackageConfig();
-//        pc.setModuleName(scanner("模块名"));
-        pc.setParent("com.gyee.failurestatistics");
-        pc.setEntity("model.auto");
-        pc.setMapper("mapper.auto");
-        pc.setService("service.auto");
-        pc.setServiceImpl("service.auto.impl");
-        pc.setController("controller.auto");
-        mpg.setPackageInfo(pc);
-
-        // 自定义配置
-//        InjectionConfig cfg = new InjectionConfig() {
-//            @Override
-//            public void initMap() {
-//                // to do nothing
-//            }
-//        };
-
-        // 如果模板引擎是 freemarker
-//        String templatePath = "/templates/mapper.xml.ftl";
-        // 如果模板引擎是 velocity
-        // String templatePath = "/templates/mapper.xml.vm";
-
-        // 自定义输出配置
-//        List<FileOutConfig> focList = new ArrayList<>();
-        // 自定义配置会被优先输出
-//        focList.add(new FileOutConfig(templatePath) {
-//            @Override
-//            public String outputFile(TableInfo tableInfo) {
-//                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
-//                return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
-//                        + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
-//            }
-//        });
-        /*
-        cfg.setFileCreate(new IFileCreate() {
-            @Override
-            public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
-                // 判断自定义文件夹是否需要创建
-                checkDir("调用默认方法创建的目录");
-                return false;
-            }
-        });
-        */
-//        cfg.setFileOutConfigList(focList);
-//        mpg.setCfg(cfg);
-
-        // 配置模板
-        TemplateConfig templateConfig = new TemplateConfig();
-
-        // 配置自定义输出模板
-        //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
-        // templateConfig.setEntity("templates/entity2.java");
-        // templateConfig.setService();
-        // templateConfig.setController();
-
-        templateConfig.setXml(null);
-        mpg.setTemplate(templateConfig);
-
-        // 策略配置
-        StrategyConfig strategy = new StrategyConfig();
-        strategy.setNaming(NamingStrategy.underline_to_camel);
-        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
-        strategy.setSuperEntityClass("com.baomidou.mybatisplus.extension.activerecord.Model");
-        strategy.setEntityLombokModel(true);
-        strategy.setRestControllerStyle(true);
+    public static void main(String[] args) {
 
-        strategy.setEntityLombokModel(true);
-        // 公共父类
-//        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
-        // 写于父类中的公共字段
-//        strategy.setSuperEntityColumns("id");
-        strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
-        strategy.setControllerMappingHyphenStyle(true);
-        strategy.setTablePrefix(pc.getModuleName() + "_");
-        mpg.setStrategy(strategy);
-        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
-        mpg.execute();
+        FastAutoGenerator.create(DATA_SOURCE_CONFIG)
+                .globalConfig(builder -> {
+                    builder.author("Shi Lin") // 设置作者
+                            .enableSwagger() // 开启 swagger 模式
+                            .fileOverride() // 覆盖已生成文件
+                            .outputDir(outputDir)   // 指定输出目录
+                            .disableOpenDir();   //禁止打开输出目录
+                })
+                .packageConfig(builder -> {
+                    builder.parent("com.gyee.health"); // 设置父包名
+                })
+                .strategyConfig(builder -> {
+                    builder.addInclude("pro_econ_part_warn_count"); // 设置需要生成的表名
+                    builder.addInclude("pro_econ_part_warn_count_sub"); // 设置需要生成的表名
+                    builder.addInclude("pro_econ_part_warn_count"); // 设置需要生成的表名
+                    builder.addInclude("pro_econ_part_warn_count"); // 设置需要生成的表名
+                })
+                .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
+                .execute();
     }
+
 }

+ 8 - 4
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/init/CacheContext.java

@@ -74,10 +74,10 @@ public class CacheContext implements CommandLineRunner {
 
         log.info("-------------------------------缓存开始--------------------------------------");
       //  hpmap=healthpointsService.findAllMap();
-        wpls = proBasicPowerstationService.list();
+//        wpls = proBasicPowerstationService.list();
 
 //
-//        wpls.stream().filter(i->i.getId().endsWith("FDC")).forEach(i->{
+//        wpls.stream().filter(i->i.getId().contains("FDC")).forEach(i->{
 //            wpmap.put(i.getId(),i);
 //        });
 //
@@ -100,8 +100,12 @@ public class CacheContext implements CommandLineRunner {
         //和风只部署芳山风电场
  //       wptempls.stream().filter(i->i.getId().equals("FS_FDC")).forEach(i->{
         wptempls.stream().forEach(i->{
-            wpls.add(i);
-            wpmap.put(i.getId(),i);
+            if(i.getId().contains("FDC"))
+            {
+                wpls.add(i);
+                wpmap.put(i.getId(),i);
+            }
+
         });
 
         List<ProBasicProject> pjtempls  = proBasicProjectService.list();

File diff suppressed because it is too large
+ 5 - 5
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconEarlyWarningMainMapper.java


+ 1 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconEarlyWarningSubMapper.java

@@ -3,7 +3,6 @@ package com.gyee.failurestatistics.mapper.auto;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.failurestatistics.model.auto.ProEconEarlyWarningSub;
 import org.apache.ibatis.annotations.Delete;
-import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -23,6 +22,5 @@ public interface ProEconEarlyWarningSubMapper extends BaseMapper<ProEconEarlyWar
     public int deleteEarlywarningsub(@Param(value = "record_date") Date recorddate);
 
 
-    @Insert("  INSERT INTO pro_econ_early_warning_sub(id,tid,record_date,wp_id,wp_name,wt_id,wt_name,name,event_id) VALUES(#{id,jdbcType=VARCHAR},#{tid,jdbcType=VARCHAR},#{record_date},#{wp_id,jdbcType=VARCHAR},#{wp_name,jdbcType=VARCHAR},#{wt_id,jdbcType=VARCHAR},#{wt_name,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{event_id,jdbcType=VARCHAR})  ")
-    public int insertEarlywarningsub(ProEconEarlyWarningSub earlywarningsub);
+
 }

File diff suppressed because it is too large
+ 0 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconFailureStatisticMainMapper.java


+ 0 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconFailureStatisticsSubMapper.java

@@ -3,7 +3,6 @@ package com.gyee.failurestatistics.mapper.auto;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.failurestatistics.model.auto.ProEconFailureStatisticsSub;
 import org.apache.ibatis.annotations.Delete;
-import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -22,6 +21,4 @@ public interface ProEconFailureStatisticsSubMapper extends BaseMapper<ProEconFai
     public int deleteFailurestatisticssub(@Param(value = "recorddate") Date recorddate);
 
 
-    @Insert(" INSERT INTO pro_econ_failure_statistics_sub(id,tid,record_date,wp_id,wp_name,wt_id,wt_name,name,event_id) VALUES(#{id,jdbcType=VARCHAR},#{tid,jdbcType=VARCHAR},#{record_date},#{wp_id,jdbcType=VARCHAR},#{wp_name,jdbcType=VARCHAR},#{wt_id,jdbcType=VARCHAR},#{wt_name,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{event_id,jdbcType=VARCHAR}) ")
-    public int insertFailurestatisticssub(ProEconFailureStatisticsSub failurestatisticssub);
 }

+ 0 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartPowerstatticMainMapper.java

@@ -3,7 +3,6 @@ package com.gyee.failurestatistics.mapper.auto;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.failurestatistics.model.auto.ProEconPartPowerStatticMain;
 import org.apache.ibatis.annotations.Delete;
-import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -23,6 +22,4 @@ public interface ProEconPartPowerstatticMainMapper extends BaseMapper<ProEconPar
     public int deletePartpowerstatticsmain(@Param(value = "recorddate") Date recorddate);
 
 
-    @Insert("  INSERT INTO pro_econ_part_power_stattic_main(id,record_date,wp_id,wp_name,wt_id,wt_name,model) VALUES(#{id,jdbcType=VARCHAR},#{record_date},#{wp_id,jdbcType=VARCHAR},#{wp_name,jdbcType=VARCHAR},#{wt_id,jdbcType=VARCHAR},#{wt_name,jdbcType=VARCHAR},#{model,jdbcType=VARCHAR}) ")
-    public int insertPartpowerstatticsmain(ProEconPartPowerStatticMain partpowerstatticsmain);
 }

File diff suppressed because it is too large
+ 1 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartStatisticsMainMapper.java


+ 1 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartTemperatureMainMapper.java

@@ -3,7 +3,6 @@ package com.gyee.failurestatistics.mapper.auto;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.failurestatistics.model.auto.ProEconPartTemperatureMain;
 import org.apache.ibatis.annotations.Delete;
-import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -23,6 +22,5 @@ public interface ProEconPartTemperatureMainMapper extends BaseMapper<ProEconPart
     public int deleteParttemperaturemain(@Param(value = "recorddate") Date recorddate);
 
 
-    @Insert(" INSERT INTO pro_econ_part_temperature_main(id,record_date,wp_id,wp_name,wt_id,wt_name,trange,tsnumber) VALUES(#{id,jdbcType=VARCHAR},#{record_date},#{wp_id,jdbcType=VARCHAR},#{wp_name,jdbcType=VARCHAR},#{wt_id,jdbcType=VARCHAR},#{wt_name,jdbcType=VARCHAR},#{trange,jdbcType=VARCHAR},#{tsnumber,jdbcType=INTEGER}) ")
-    public int insertParttemperaturemain(ProEconPartTemperatureMain parttemperaturemain);
+
 }

+ 0 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartTemperatureSubMapper.java

@@ -3,7 +3,6 @@ package com.gyee.failurestatistics.mapper.auto;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.failurestatistics.model.auto.ProEconPartTemperatureSub;
 import org.apache.ibatis.annotations.Delete;
-import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -23,6 +22,4 @@ public interface ProEconPartTemperatureSubMapper extends BaseMapper<ProEconPartT
     public int deleteParttemperaturesub(@Param(value = "recorddate") Date recorddate);
 
 
-    @Insert(" INSERT INTO pro_econ_part_temperature_sub(id,record_date,wp_id,wp_name,wt_id,wt_name,trange,tsnumber,pointname,partname) VALUES(#{id,jdbcType=VARCHAR},#{record_date},#{wp_id,jdbcType=VARCHAR},#{wp_name,jdbcType=VARCHAR},#{wt_id,jdbcType=VARCHAR},#{wt_name,jdbcType=VARCHAR},#{trange,jdbcType=VARCHAR},#{tsnumber,jdbcType=INTEGER},#{pointname,jdbcType=VARCHAR},#{partname,jdbcType=VARCHAR}) ")
-    public int insertParttemperaturesub(ProEconPartTemperatureSub parttemperaturesub);
 }

+ 0 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconPartpowerStatticsSubMapper.java

@@ -3,7 +3,6 @@ package com.gyee.failurestatistics.mapper.auto;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.failurestatistics.model.auto.ProEconPartPowerStatticsSub;
 import org.apache.ibatis.annotations.Delete;
-import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
@@ -22,6 +21,4 @@ public interface ProEconPartpowerStatticsSubMapper extends BaseMapper<ProEconPar
     public int deletePartpowerstatticssub(@Param(value = "recorddate") Date recorddate);
 
 
-    @Insert("  INSERT INTO pro_econ_part_power_stattics_sub(id,tid,record_date,partid,name,datavalue,power,earlywarningvalue,criticalvalue) VALUES(#{id,jdbcType=VARCHAR},#{tid,jdbcType=VARCHAR},#{record_date},#{partid,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{datavalue,jdbcType=DECIMAL},#{power,jdbcType=VARCHAR},#{earlywarningvalue,jdbcType=DECIMAL},#{criticalvalue,jdbcType=DECIMAL})")
-    public int insertPartpowerstatticssub(ProEconPartPowerStatticsSub partpowerstatticssub);
 }

+ 2 - 0
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconShutdownEventMapper.java

@@ -1,5 +1,6 @@
 package com.gyee.failurestatistics.mapper.auto;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.failurestatistics.model.auto.ProEconShutdownEvent;
 import com.gyee.failurestatistics.model.custom.ShutdowneventVo;
@@ -51,6 +52,7 @@ public interface ProEconShutdownEventMapper extends BaseMapper<ProEconShutdownEv
     @Select("select * from pro_econ_shutdown_event t  where  t.stop_time>=#{beginDate}   and  t.stop_time<=#{endDate} and t.stoptype_id<>'wh'  and t.warning_id is null and t.stop_time is not null  order by t.windturbine_id")
     public List<ProEconShutdownEvent> queryShutdowneventList(@Param(value = "beginDate") Date beginDate, @Param(value = "endDate")Date endDate);
 
+    @DS("slave")
     @Select(" select h.id id,s.windturbineid windTurbineId,s.alertvalue warningId,s.alerttext warnDesc,h.alerttime stopTime,s.category2 stopTypeId " +
             "  from ${alerthistory} h,alarmsnap s" +
             "  where to_NUMBER(h.snapid) =to_NUMBER(s.id) and s.category1='windturbine' " +

+ 2 - 2
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/EarlywarningService.java

@@ -36,9 +36,9 @@ public class EarlywarningService {
 
 
         for (ProBasicPowerstation wp : CacheContext.wpls) {
-            if (wp.getId().endsWith("FDC")) {
+            if (wp.getId().contains("FDC")) {
 
-                String wpname=wp.getId().substring(0,wp.getId().indexOf("_"));
+                String wpname=wp.getId().split("_")[2];
                 StringBuilder alerthistory1=new StringBuilder(ALARMHISTORY).append("_").append(wpname).append("_");
                 StringBuilder alerthistory2=new StringBuilder(ALARMHISTORY).append("_").append(wpname).append("_");
 

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/FailurestatisticsService.java

@@ -95,7 +95,7 @@ public class FailurestatisticsService {
         cal.set(Calendar.MINUTE, 0);
         cal.set(Calendar.SECOND, 0);
         for (ProBasicPowerstation wp : CacheContext.wpls) {
-            if (wp.getId().endsWith("FDC")) {
+            if (wp.getId().contains("FDC")) {
 
                 System.out.println("开始统计"+wp.getName()+"故障排名和次数统计");
                 List<ProBasicEquipment> wtls = CacheContext.wtsmap.get(wp.getId());

+ 14 - 3
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/PartpowerstatticsService.java

@@ -70,7 +70,7 @@ public class PartpowerstatticsService {
         initialCodeValue(codels, codeParentmap, codenamemap);
 
         for (ProBasicPowerstation wp : CacheContext.wpls) {
-            if (wp.getId().endsWith("FDC")) {
+            if (wp.getId().contains("FDC")) {
 
                 System.out.println("开始统计" + wp.getName() + "功率对应部件指标统计");
 
@@ -120,6 +120,9 @@ public class PartpowerstatticsService {
                             } else if (model.getPowerProduction() == 2000.0) {
                                 step = 200;
                             }
+
+                            List<ProEconPartPowerStatticMain> vos=new ArrayList<>();
+
                             Set<Map.Entry<String, Double>> set = glmap.entrySet();
                             for (Iterator<Map.Entry<String, Double>> it = set.iterator(); it.hasNext();) {
                                 Map.Entry<String, Double> entry = (Map.Entry<String, Double>) it.next();
@@ -176,6 +179,9 @@ public class PartpowerstatticsService {
                             po.setId(tid);
                             insertPartpowerstatticsmain(po);
 
+                            vos.add(po);
+
+                            List<ProEconPartPowerStatticsSub> subls=new ArrayList<>();
                             Set<Map.Entry<String, Map<String, List<Double>>>> set2 = totalmap.entrySet();
                             for (Iterator<Map.Entry<String, Map<String, List<Double>>>> it = set2.iterator(); it.hasNext();) {
                                 Map.Entry<String, Map<String, List<Double>>> entry2 = (Map.Entry<String, Map<String, List<Double>>>) it.next();
@@ -246,11 +252,14 @@ public class PartpowerstatticsService {
                                         }
 
                                     }
-                                    proEconPartpowerStatticsSubService.insertPartpowerstatticssub(sub);
-                                }
 
+                                    subls.add(sub);
 
+                                }
+
+                                proEconPartpowerStatticsSubService.saveOrUpdateBatch(subls);
                             }
+                            proEconPartPowerstatticMainService.saveOrUpdateBatch(vos);
                         } else {
                             ProBasicEquipmentPoint point = map.get(ContantXk.CJ_SSGL);
                             StringBuilder sb=new StringBuilder();
@@ -260,6 +269,8 @@ public class PartpowerstatticsService {
                             sb.append(point.getId());
                             System.out.println(sb);
                         }
+
+
                     }
 
 

+ 9 - 4
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/PartstatisticsService.java

@@ -38,8 +38,8 @@ public class PartstatisticsService {
     private final String MONTH1NUM ="month1num";
     private final String SYNTHESISNUM ="synthesisnum";
 
-    private final long STEP = 60*30;
-    private final int DAYSTEP = 1440/30;
+    private final long STEP =1800;
+    private final int DAYSTEP = 48;
 
 
 
@@ -59,6 +59,11 @@ public class PartstatisticsService {
 
         Map<String,Integer> resultmap=new HashMap<String,Integer>();
 
+        resultmap.put(DAY1NUM, 0);
+        resultmap.put(DAY3NUM, 0);
+        resultmap.put(DAY7NUM, 0);
+        resultmap.put(DAY15NUM, 0);
+        resultmap.put(MONTH1NUM, 0);
         if(map.containsKey(code))
         {
             ProBasicEquipmentPoint point = map.get(code);
@@ -120,6 +125,7 @@ public class PartstatisticsService {
 
     public void savePartstatisticsmain() throws Exception {
 
+
         Calendar cal = Calendar.getInstance();
         cal.set(Calendar.HOUR_OF_DAY, 0);
         cal.set(Calendar.MINUTE, 0);
@@ -127,10 +133,9 @@ public class PartstatisticsService {
         Date endDate = cal.getTime();
         cal.add(Calendar.MONTH, -1);
         Date beginDate = cal.getTime();
-
         int daynum = DateUtils.daysDiff(beginDate, endDate);
         for (ProBasicPowerstation wp : CacheContext.wpls) {
-            if (wp.getId().endsWith("FDC")) {
+            if (wp.getId().contains("FDC")) {
 
                 System.out.println("开始统计" + wp.getName() + "部件健康状况和故障数量统计");
                 List<ProBasicEquipment> wtls = CacheContext.wtsmap.get(wp.getId());

+ 21 - 4
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/ParttemperatureService.java

@@ -69,7 +69,7 @@ public class ParttemperatureService {
 
         deleteParttemperaturemain(cal.getTime());
         for (ProBasicPowerstation wp : CacheContext.wpls) {
-            if (wp.getId().endsWith("FDC")) {
+            if (wp.getId().contains("FDC")) {
 
                 List<ProBasicEquipment> wtls = CacheContext.wtsmap.get(wp.getId());
 
@@ -155,6 +155,8 @@ public class ParttemperatureService {
 
 
                     Set<Map.Entry<String, Map<String, Integer>>> pointset = pointmap.entrySet();
+
+                    List<ProEconPartTemperatureMain> vos=new ArrayList<>();
                     //按照温度区间》测点》统计数量
                     for (Iterator<Map.Entry<String, Map<String, Integer>>> pointit = pointset.iterator(); pointit.hasNext();) {
 
@@ -164,11 +166,17 @@ public class ParttemperatureService {
                         ProEconPartTemperatureMain po = new ProEconPartTemperatureMain();
                         po.setId(StringUtils.getUUID());
                         po.setWpId(wt.getWindpowerstationId());
+                        if(CacheContext.wpmap.containsKey(wt.getWindpowerstationId()))
+                        {
+                            po.setWpName(CacheContext.wpmap.get(wt.getWindpowerstationId()).getName());
+                        }
+
                         po.setWtId(wt.getId());
                         po.setWtName(wt.getName());
                         po.setRecordDate(cal.getTime());
                         po.setTrange(pointentry.getKey());
 
+                        List<ProEconPartTemperatureSub> subls=new ArrayList<>();
                         Set<Map.Entry<String, Integer>> pset = pointentry.getValue().entrySet();
                         //测点》统计数量
                         for (Iterator<Map.Entry<String, Integer>> pit = pset.iterator(); pit.hasNext();) {
@@ -177,6 +185,11 @@ public class ParttemperatureService {
                             ProEconPartTemperatureSub sub = new ProEconPartTemperatureSub();
                             sub.setId(StringUtils.getUUID());
                             sub.setWpId(wt.getWindpowerstationId());
+                            if(CacheContext.wpmap.containsKey(wt.getWindpowerstationId()))
+                            {
+                                sub.setWpName(CacheContext.wpmap.get(wt.getWindpowerstationId()).getName());
+                            }
+
                             sub.setWtId(wt.getId());
                             sub.setWtName(wt.getName());
                             sub.setRecordDate(cal.getTime());
@@ -185,14 +198,18 @@ public class ParttemperatureService {
                             sub.setPartname(codeParentmap.get(pentry.getKey()));
                             sub.setTsnumber(pentry.getValue());
                             num=num+pentry.getValue();
-                            proEconPartTemperatureSubService.insertParttemperaturesub(sub);
+                        //    proEconPartTemperatureSubService.insertParttemperaturesub(sub);
+                            subls.add(sub);
                         }
 
+                        proEconPartTemperatureSubService.saveOrUpdateBatch(subls);
+
                         po.setTsnumber(num);
-                        insertParttemperaturemain(po);
+                        vos.add(po);
+                      //  insertParttemperaturemain(po);
                     }
 
-
+                    proEconPartTemperatureMainService.saveOrUpdateBatch(vos);
 
                 } else {
                     //System.out.println("初始化当日数据报错!");

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconEarlyWarningMainServiceImpl.java

@@ -57,7 +57,7 @@ public class ProEconEarlyWarningMainServiceImpl extends ServiceImpl<ProEconEarly
 
         @Override
         public int insertEarlywarningmain(ProEconEarlyWarningMain earlywarningmain) {
-            return  proEconEarlyWarningMainMapper.insertEarlywarningmain(earlywarningmain);
+            return  proEconEarlyWarningMainMapper.insert(earlywarningmain);
         }
 
         @Override

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconEarlyWarningSubServiceImpl.java

@@ -30,6 +30,6 @@ public class ProEconEarlyWarningSubServiceImpl extends ServiceImpl<ProEconEarlyW
 
     @Override
     public int insertEarlywarningsub(ProEconEarlyWarningSub earlywarningsub) {
-        return  proEconEarlyWarningSubMapper.insertEarlywarningsub(earlywarningsub);
+        return  proEconEarlyWarningSubMapper.insert(earlywarningsub);
     }
 }

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconFailureStatisticMainServiceImpl.java

@@ -57,7 +57,7 @@ public class ProEconFailureStatisticMainServiceImpl extends ServiceImpl<ProEconF
 
     @Override
     public int insertFailurestatisticsmain(ProEconFailureStatisticMain failurestatisticsmain) {
-        return  proEconFailureStatisticMainMapper.insertFailurestatisticsmain(failurestatisticsmain);
+        return  proEconFailureStatisticMainMapper.insert(failurestatisticsmain);
     }
 
     @Override

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconFailureStatisticsSubServiceImpl.java

@@ -31,6 +31,6 @@ public class ProEconFailureStatisticsSubServiceImpl extends ServiceImpl<ProEconF
 
     @Override
     public int insertFailurestatisticssub(ProEconFailureStatisticsSub failurestatisticssub) {
-        return  ProEconFailureStatisticsSubMapper.insertFailurestatisticssub(failurestatisticssub);
+        return  ProEconFailureStatisticsSubMapper.insert(failurestatisticssub);
     }
 }

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartPowerstatticMainServiceImpl.java

@@ -31,7 +31,7 @@ public class ProEconPartPowerstatticMainServiceImpl extends ServiceImpl<ProEconP
 
     @Override
     public int insertPartpowerstatticsmain(ProEconPartPowerStatticMain partpowerstatticsmain) {
-        return  proEconPartPowerstatticMainMapper.insertPartpowerstatticsmain(partpowerstatticsmain);
+        return  proEconPartPowerstatticMainMapper.insert(partpowerstatticsmain);
     }
 
 }

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartStatisticsMainServiceImpl.java

@@ -55,6 +55,6 @@ public class ProEconPartStatisticsMainServiceImpl extends ServiceImpl<ProEconPar
 
     @Override
     public int insertPartstatisticsmain(ProEconPartStatisticsMain partstatisticsmain) {
-        return  proEconPartStatisticsMainMapper.insertPartstatisticsmain(partstatisticsmain);
+        return  proEconPartStatisticsMainMapper.insert(partstatisticsmain);
     }
 }

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartTemperatureMainServiceImpl.java

@@ -31,6 +31,6 @@ public class ProEconPartTemperatureMainServiceImpl extends ServiceImpl<ProEconPa
 
     @Override
     public int insertParttemperaturemain(ProEconPartTemperatureMain parttemperaturemain) {
-        return  proEconPartTemperatureMainMapper.insertParttemperaturemain(parttemperaturemain);
+        return  proEconPartTemperatureMainMapper.insert(parttemperaturemain);
     }
 }

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartTemperatureSubServiceImpl.java

@@ -157,6 +157,6 @@ public class ProEconPartTemperatureSubServiceImpl extends ServiceImpl<ProEconPar
 
     @Override
     public int insertParttemperaturesub(ProEconPartTemperatureSub parttemperaturesub) {
-        return  proEconPartTemperatureSubMapper.insertParttemperaturesub(parttemperaturesub);
+        return  proEconPartTemperatureSubMapper.insert(parttemperaturesub);
     }
 }

+ 1 - 1
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/auto/impl/ProEconPartpowerStatticsSubServiceImpl.java

@@ -30,6 +30,6 @@ public class ProEconPartpowerStatticsSubServiceImpl extends ServiceImpl<ProEconP
 
     @Override
     public int insertPartpowerstatticssub(ProEconPartPowerStatticsSub partpowerstatticssub) {
-        return  proEconPartpowerStatticsSubMapper.insertPartpowerstatticssub(partpowerstatticssub);
+        return  proEconPartpowerStatticsSubMapper.insert(partpowerstatticssub);
     }
 }

+ 2 - 2
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/task/SaticScheduleTask.java

@@ -35,9 +35,9 @@ public class SaticScheduleTask {
     @Resource
     private ShutdowneventService shutdowneventService;
     /**
-     * 故障统计
+     * 故障统计报警修正
      */
-    //@Scheduled(cron = "0 40 0 * * ?")
+    //@Scheduled(cron = "0 0/5 * * * ?")
     //或直接指定时间间隔,例如:5秒
     //@Scheduled(fixedRate=5000)
     @XxlJob("failurestatistics-updateShutdownevent")

+ 16 - 14
realtime/failurestatistics-server/src/main/resources/application-jn.yml

@@ -1,8 +1,8 @@
 # 项目相关配置
 gyee:
   #实时数据库Url
-  baseurl: http://10.81.3.155:8011/ts
-  healthurl: http://10.81.3.155:8011/ts
+  baseurl: http://10.81.3.160:8011/ts
+  healthurl: http://10.81.3.160:8011/ts
   #实时数据库选择
   realtimedataBase: mongodb #数据查询模式 golden、hwy
   initialcode: INITIAL
@@ -23,18 +23,20 @@ spring:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
-    #外网
-    driver-class-name: org.postgresql.Driver
-    url: jdbc:postgresql://10.81.3.151:5432/IMS_NEM_JN
-    username: postgres
-    password: postgres
-
-    oracle-schema=:
-    #    type: com.alibaba.druid.pool.DruidDataSource
-    #    url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&serverTimezone=UTC
-    #    username: root
-    #    password: root
-    #    driver-class-name: com.mysql.jdbc.Driver
+    dynamic:
+      primary: master #设置默认的数据源或者数据源组,默认值即为master
+      strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
+      datasource:
+        master:
+          url: jdbc:postgresql://10.81.3.151:5432/IMS_NEM_JN
+          username: postgres
+          password: postgres
+          driver-class-name: org.postgresql.Driver
+        slave:
+          url: jdbc:postgresql://10.81.3.151:5432/wisdom
+          username: postgres
+          password: gd123
+          driver-class-name: org.postgresql.Driver
     druid:
       max-active: 20
       initial-size: 1

+ 2 - 2
realtime/failurestatistics-server/src/main/resources/xxl-job-executor.properties

@@ -7,12 +7,12 @@ xxl.job.admin.addresses=http://10.81.3.152:8175/xxl-job-admin
 xxl.job.accessToken=
 
 ### xxl-job executor appname
-xxl.job.executor.appname=failurestatistics-job
+xxl.job.executor.appname=failurestatistics-job-new
 ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
 xxl.job.executor.address=
 ### xxl-job executor server-info
 xxl.job.executor.ip=
-xxl.job.executor.port=9112
+xxl.job.executor.port=9115
 ### xxl-job executor log-path
 xxl.job.executor.logpath=d:\\jobs\\failurestatistics-job
 ### xxl-job executor log-retention-days