Forráskód Böngészése

添加公司级地貌图场站、项目、风机接口

shilin 2 éve
szülő
commit
197c5f8c21
23 módosított fájl, 1091 hozzáadás és 373 törlés
  1. 10 1
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/FailurestatisticsMain.java
  2. 3 3
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/config/GeneratorCodeConfig.java
  3. 49 8
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/init/CacheContext.java
  4. 42 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/mapper/auto/Shutdownevent2Mapper.java
  5. 16 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/mapper/auto/Warning2Mapper.java
  6. 16 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/mapper/auto/WindturbinePartsMapper.java
  7. 85 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/model/auto/Shutdownevent2.java
  8. 95 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/model/auto/Warning2.java
  9. 47 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/model/auto/WindturbineParts.java
  10. 148 143
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/PartpowerstatticsService.java
  11. 148 137
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/PartstatisticsService.java
  12. 82 79
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/ParttemperatureService.java
  13. 103 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/ShutdowneventService.java
  14. 25 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/IShutdownevent2Service.java
  15. 16 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/IWarning2Service.java
  16. 16 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/IWindturbinePartsService.java
  17. 46 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/impl/Shutdownevent2ServiceImpl.java
  18. 20 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/impl/Warning2ServiceImpl.java
  19. 20 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/impl/WindturbinePartsServiceImpl.java
  20. 22 0
      realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/task/SaticScheduleTask.java
  21. 78 0
      realtime/failurestatistics-server-cph/src/main/resources/application-hf.yml
  22. 1 1
      realtime/failurestatistics-server-cph/src/main/resources/application.yml
  23. 3 1
      realtime/failurestatistics-server-cph/src/main/resources/xxl-job-executor.properties

+ 10 - 1
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/FailurestatisticsMain.java

@@ -1,5 +1,7 @@
 package com.gyee.failurestatistics;
 
+import com.gyee.failurestatistics.service.ShutdowneventService;
+import com.gyee.failurestatistics.util.SpringUtils;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -10,7 +12,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 @SpringBootApplication
 @MapperScan("com.gyee.failurestatistics.mapper")
 public class FailurestatisticsMain {
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         SpringApplication.run(FailurestatisticsMain.class, args);
+
+
+        ShutdowneventService shutdowneventService = SpringUtils.getBean("shutdowneventService");
+
+//        System.out.println("开始");
+//        shutdowneventService.updateShutdownevent();
+//        System.out.println("结束");
     }
 }

+ 3 - 3
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/config/GeneratorCodeConfig.java

@@ -56,9 +56,9 @@ public class GeneratorCodeConfig {
 //        mpg.setDataSource(dsc);
 
         dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
-        dsc.setUsername("gdprod");
-        dsc.setPassword("gd123");
-        dsc.setUrl("jdbc:oracle:thin:@10.0.118.71:1521:gdsj");
+        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");

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

@@ -62,25 +62,66 @@ public class CacheContext implements CommandLineRunner {
     public static List<Line> lines = new ArrayList<>();
 
     public static Map<String, List<Windturbine>> wtsmap = new HashMap<String, List<Windturbine>>(); // 风电场MAP风电机LIST集合
-
+    public static Map<String, Project> pjmap = new HashMap<String, Project>(); // 项目MAP
+    public static Map<String, Line> lnmap = new HashMap<String, Line>(); // 线路MAP
     public static List<Equipmentmodel> mlls = new ArrayList<Equipmentmodel>();// 风电机模型LIST集合
     public static Map<String, Equipmentmodel> mlmap = new HashMap<String, Equipmentmodel>();// 风电机模型
     @Override
     public void run(String... args) throws Exception {
 
         log.info("-------------------------------缓存开始--------------------------------------");
-        hpmap=healthpointsService.findAllMap();
+      //  hpmap=healthpointsService.findAllMap();
         wpls = windpowerstationService.list();
-        wpls.stream().filter(i->i.getId().endsWith("FDC")).forEach(i->{
-            wpmap.put(i.getId(),i);
-        });
 
-        projects = projectService.list();
+//
+//        wpls.stream().filter(i->i.getId().endsWith("FDC")).forEach(i->{
+//            wpmap.put(i.getId(),i);
+//        });
+//
+//        projects = projectService.list();
+//
+//        lines = lineService.list();
+//
+//        wtls = windturbineService.list();
+//
+//        mlls = equipmentmodelService.list();
+//        if (!mlls.isEmpty()) {
+//            for (Equipmentmodel model : mlls) {
+//                mlmap.put(model.getId(), model);
+//            }
+//        }
+
 
-        lines = lineService.list();
+        List<Windpowerstation> wptempls = windpowerstationService.list();
+
+        //和风只部署芳山风电场
+ //       wptempls.stream().filter(i->i.getId().equals("FS_FDC")).forEach(i->{
+        wptempls.stream().forEach(i->{
+            wpls.add(i);
+            wpmap.put(i.getId(),i);
+        });
 
-        wtls = windturbineService.list();
+        List<Project> pjtempls  = projectService.list();
 
+        if (!pjtempls.isEmpty()) {
+            pjtempls.stream().filter(i->wpmap.containsKey(i.getWindpowerstationid())).forEach(i->{
+                projects.add(i);
+                pjmap.put(i.getId(),i);
+            });
+        }
+        List<Line> templines = lineService.list();
+        if (!templines.isEmpty()) {
+            templines.stream().filter(i->pjmap.containsKey(i.getProjectid())).forEach(i->{
+                lines.add(i);
+                lnmap.put(i.getId(),i);
+            });
+        }
+        List<Windturbine> wttempls =windturbineService.list();
+        if (!wttempls.isEmpty()) {
+            wttempls.stream().filter(i->wpmap.containsKey(i.getWindpowerstationid())).forEach(i->{
+                wtls.add(i);
+            });
+        }
         mlls = equipmentmodelService.list();
         if (!mlls.isEmpty()) {
             for (Equipmentmodel model : mlls) {

+ 42 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/mapper/auto/Shutdownevent2Mapper.java

@@ -0,0 +1,42 @@
+package com.gyee.failurestatistics.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.failurestatistics.model.auto.Shutdownevent2;
+import com.gyee.failurestatistics.vo.ShutdowneventVo;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+public interface Shutdownevent2Mapper extends BaseMapper<Shutdownevent2> {
+
+    @Select("select * from shutdownevent t  where  t.stoptime>=#{beginDate}   and  t.stoptime<=#{endDate} and t.statuscode=2  and t.warningid is null and t.stoptime is not null  order by t.windturbineid")
+    public List<Shutdownevent2> queryShutdowneventList(@Param(value = "beginDate") Date beginDate, @Param(value = "endDate")Date endDate);
+
+
+
+    @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' " +
+            " and h.messagetype=1 and s.windturbineid is not null " +
+            " and s.windturbineid=#{windturbineid} " +
+
+            "    and h.alerttime>=#{beginDate} " +
+            "     and h.alerttime<=#{endDate} " +
+            "     order by s.rank desc ")
+    public List<ShutdowneventVo> queryAlerthistoryList(@Param(value = "alerthistory")String alerthistory,@Param(value = "windturbineid")String windturbineid, @Param(value = "beginDate")Date beginDate, @Param(value = "endDate")Date endDate);
+
+
+    @Update("update shutdownevent t  set t.warningid=#{warningid},t.stoptypeid=#{stoptypeid}  where t.id=#{stopid}")
+   public int  updateShutdownevent(@Param(value = "warningid") String warningid, @Param(value = "stoptypeid")String stoptypeid, @Param(value = "stopid")String stopid);
+}

+ 16 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/mapper/auto/Warning2Mapper.java

@@ -0,0 +1,16 @@
+package com.gyee.failurestatistics.mapper.auto;
+
+import com.gyee.failurestatistics.model.auto.Warning2;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+public interface Warning2Mapper extends BaseMapper<Warning2> {
+
+}

+ 16 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/mapper/auto/WindturbinePartsMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.failurestatistics.mapper.auto;
+
+import com.gyee.failurestatistics.model.auto.WindturbineParts;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+public interface WindturbinePartsMapper extends BaseMapper<WindturbineParts> {
+
+}

+ 85 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/model/auto/Shutdownevent2.java

@@ -0,0 +1,85 @@
+package com.gyee.failurestatistics.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("SHUTDOWNEVENT2")
+public class Shutdownevent2 extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("ID")
+    private String id;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("STOPTIME")
+    private Date stoptime;
+
+    @TableField("STARTTIME")
+    private Date starttime;
+
+    @TableField("STOPHOURS")
+    private BigDecimal stophours;
+
+    @TableField("LOSSPOWER")
+    private BigDecimal losspower;
+
+    @TableField("STOPTYPEID")
+    private String stoptypeid;
+
+    @TableField("ISHANDLE")
+    private BigDecimal ishandle;
+
+    @TableField("WARNINGID")
+    private String warningid;
+
+    @TableField("PROJECTID")
+    private String projectid;
+
+    @TableField("HANDLEWAY")
+    private String handleway;
+
+    @TableField("FAULTVIEW")
+    private String faultview;
+
+    @TableField("STATUSCODE")
+    private BigDecimal statuscode;
+
+    @TableField("MAINID")
+    private String mainid;
+
+    @TableField("RESETRATE")
+    private String resetrate;
+
+    @TableField("STATERATE")
+    private String staterate;
+
+    @TableField("FAILRATE")
+    private String failrate;
+
+    @TableField("WARNINGRECORDSID")
+    private BigDecimal warningrecordsid;
+
+
+}

+ 95 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/model/auto/Warning2.java

@@ -0,0 +1,95 @@
+package com.gyee.failurestatistics.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WARNING2")
+public class Warning2 extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("ID")
+    private String id;
+
+    @TableField("LEVELID")
+    private String levelid;
+
+    @TableField("MANUFACTURERCODE")
+    private String manufacturercode;
+
+    @TableField("ENGLISHTEXT")
+    private String englishtext;
+
+    @TableField("CHINESETEXT")
+    private String chinesetext;
+
+    @TableField("PARENTID")
+    private String parentid;
+
+    @TableField("ISLEAF")
+    private BigDecimal isleaf;
+
+    @TableField("SEQUENCENUMBER")
+    private BigDecimal sequencenumber;
+
+    /**
+     * ??????
+     */
+    @TableField("CHARACTERISTIC")
+    private String characteristic;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("CODENAME")
+    private String codename;
+
+    @TableField("EDNAVALUE")
+    private BigDecimal ednavalue;
+
+    @TableField("DISPLAY")
+    private BigDecimal display;
+
+    @TableField("WARNINGCLASSIFYID")
+    private String warningclassifyid;
+
+    /**
+     * ??????
+     */
+    @TableField("STANDARDTIME")
+    private BigDecimal standardtime;
+
+    @TableField("ISRESET")
+    private BigDecimal isreset;
+
+    @TableField("WARNINGTYPEID")
+    private String warningtypeid;
+
+    @TableField("FAULTCODE")
+    private String faultcode;
+
+    @TableField("RELATEDPARTS")
+    private String relatedparts;
+
+    @TableField("CLASSIFICATION")
+    private String classification;
+
+    @TableField("ENABLED")
+    private BigDecimal enabled;
+
+
+}

+ 47 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/model/auto/WindturbineParts.java

@@ -0,0 +1,47 @@
+package com.gyee.failurestatistics.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDTURBINE_PARTS")
+public class WindturbineParts extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("ID")
+    private String id;
+
+    /**
+     * ??
+     */
+    @TableField("NAME")
+    private String name;
+
+    /**
+     * ????
+     */
+    @TableField("PARTCODE")
+    private String partcode;
+
+    /**
+     * ????
+     */
+    @TableField("ENABLED")
+    private BigDecimal enabled;
+
+
+}

+ 148 - 143
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/PartpowerstatticsService.java

@@ -97,178 +97,183 @@ public class PartpowerstatticsService {
                         model = CacheContext.mlmap.get(wt.getModelid());
                     }
 
-                    Map<String, Double> glmap = getPartTargetValue(wt, Constant.TPOINT_WT_FJGL, endDate, beginDate, map);
-                    Map<String, Double> ztmap = getPartTargetValue(wt, Constant.FJZT, endDate, beginDate, map);
-
-                    Map<String, Double> cLXSRZYW1map = getPartTargetValue(wt, CLXSRZYW1, endDate, beginDate, map);
-                    Map<String, Double> cLXSRZYW2map = getPartTargetValue(wt, CLXSRZYW2, endDate, beginDate, map);
-                    Map<String, Double> cLXRKYWmap = getPartTargetValue(wt, CLXRKYW, endDate, beginDate, map);
-                    Map<String, Double> cLXYWmap = getPartTargetValue(wt, CLXYW, endDate, beginDate, map);
-
-                    Map<String, Double> fDJZCWDAmap = getPartTargetValue(wt, FDJZCWDA, endDate, beginDate, map);
-                    Map<String, Double> fDJZCWDBmap = getPartTargetValue(wt, FDJZCWDB, endDate, beginDate, map);
-                    Map<String, Double> fDJUXYZWDmap = getPartTargetValue(wt, FDJUXYZWD, endDate, beginDate, map);
-                    Map<String, Double> fDJVXYZWDmap = getPartTargetValue(wt, FDJVXYZWD, endDate, beginDate, map);
-                    Map<String, Double> fDJWXYZWDmap = getPartTargetValue(wt, FDJWXYZWD, endDate, beginDate, map);
-                    Map<String, Double> fDJLQFWDmap = getPartTargetValue(wt, FDJLQFWD, endDate, beginDate, map);
-
-                    Map<String, Double> bJDRQWDmap = getPartTargetValue(wt, BJDRQWD, endDate, beginDate, map);
-                    Map<String, Double> bJDRDYmap = getPartTargetValue(wt, BJDRDY, endDate, beginDate, map);
-                    Map<String, Double> bJDLQWDmap = getPartTargetValue(wt, BJDLQWD, endDate, beginDate, map);
-                    Map<String, Double> bJDJWDmap = getPartTargetValue(wt, BJDJWD, endDate, beginDate, map);
-                    Map<String, Double> bJKZGWDmap = getPartTargetValue(wt, BJKZGWD, endDate, beginDate, map);
-
-                    Map<String, Double> tDGWDmap = getPartTargetValue(wt, TDGWD, endDate, beginDate, map);
-                    Map<String, Double> tDJGWDmap = getPartTargetValue(wt, TDJGWD, endDate, beginDate, map);
-
-                    // Map<功率,Map<统一编码,List<指标结果集合>>>
-                    Map<String, Map<String, List<Double>>> totalmap = new HashMap<String, Map<String, List<Double>>>();
-
-                    if (!glmap.isEmpty() && null != model) {
-                        int step = 0;
-                        if (model.getPowerproduction() == 1500.0) {
-                            step = 150;
-                        } else if (model.getPowerproduction() == 2000.0) {
-                            step = 200;
-                        }
-                        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();
-                            // System.out.println(entry.getKey() + "--->" +
-                            // entry.getValue());
-
-                            if(ztmap.containsKey(entry.getKey()))
-                            {
-                                double zt=ztmap.get(entry.getKey());
-                                if(zt==1)
+
+                    if(StringUtils.notEmp(map) && !map.isEmpty())
+                    {
+                        Map<String, Double> glmap = getPartTargetValue(wt, Constant.TPOINT_WT_FJGL, endDate, beginDate, map);
+                        Map<String, Double> ztmap = getPartTargetValue(wt, Constant.FJZT, endDate, beginDate, map);
+
+                        Map<String, Double> cLXSRZYW1map = getPartTargetValue(wt, CLXSRZYW1, endDate, beginDate, map);
+                        Map<String, Double> cLXSRZYW2map = getPartTargetValue(wt, CLXSRZYW2, endDate, beginDate, map);
+                        Map<String, Double> cLXRKYWmap = getPartTargetValue(wt, CLXRKYW, endDate, beginDate, map);
+                        Map<String, Double> cLXYWmap = getPartTargetValue(wt, CLXYW, endDate, beginDate, map);
+
+                        Map<String, Double> fDJZCWDAmap = getPartTargetValue(wt, FDJZCWDA, endDate, beginDate, map);
+                        Map<String, Double> fDJZCWDBmap = getPartTargetValue(wt, FDJZCWDB, endDate, beginDate, map);
+                        Map<String, Double> fDJUXYZWDmap = getPartTargetValue(wt, FDJUXYZWD, endDate, beginDate, map);
+                        Map<String, Double> fDJVXYZWDmap = getPartTargetValue(wt, FDJVXYZWD, endDate, beginDate, map);
+                        Map<String, Double> fDJWXYZWDmap = getPartTargetValue(wt, FDJWXYZWD, endDate, beginDate, map);
+                        Map<String, Double> fDJLQFWDmap = getPartTargetValue(wt, FDJLQFWD, endDate, beginDate, map);
+
+                        Map<String, Double> bJDRQWDmap = getPartTargetValue(wt, BJDRQWD, endDate, beginDate, map);
+                        Map<String, Double> bJDRDYmap = getPartTargetValue(wt, BJDRDY, endDate, beginDate, map);
+                        Map<String, Double> bJDLQWDmap = getPartTargetValue(wt, BJDLQWD, endDate, beginDate, map);
+                        Map<String, Double> bJDJWDmap = getPartTargetValue(wt, BJDJWD, endDate, beginDate, map);
+                        Map<String, Double> bJKZGWDmap = getPartTargetValue(wt, BJKZGWD, endDate, beginDate, map);
+
+                        Map<String, Double> tDGWDmap = getPartTargetValue(wt, TDGWD, endDate, beginDate, map);
+                        Map<String, Double> tDJGWDmap = getPartTargetValue(wt, TDJGWD, endDate, beginDate, map);
+
+                        // Map<功率,Map<统一编码,List<指标结果集合>>>
+                        Map<String, Map<String, List<Double>>> totalmap = new HashMap<String, Map<String, List<Double>>>();
+
+                        if (!glmap.isEmpty() && null != model) {
+                            int step = 0;
+                            if (model.getPowerproduction() == 1500.0) {
+                                step = 150;
+                            } else if (model.getPowerproduction() == 2000.0) {
+                                step = 200;
+                            }
+                            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();
+                                // System.out.println(entry.getKey() + "--->" +
+                                // entry.getValue());
+
+                                if(ztmap.containsKey(entry.getKey()))
                                 {
-                                    if (entry.getValue() <= step) {
-                                        setTotalmapValue(step, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
-                                    } else if (entry.getValue() <= step * 2) {
-                                        setTotalmapValue(step * 2, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                    double zt=ztmap.get(entry.getKey());
+                                    if(zt==1)
+                                    {
+                                        if (entry.getValue() <= step) {
+                                            setTotalmapValue(step, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else if (entry.getValue() <= step * 2) {
+                                            setTotalmapValue(step * 2, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
 
-                                    } else if (entry.getValue() <= step * 3) {
-                                        setTotalmapValue(step * 3, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else if (entry.getValue() <= step * 3) {
+                                            setTotalmapValue(step * 3, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
 
-                                    } else if (entry.getValue() <= step * 4) {
-                                        setTotalmapValue(step * 4, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else if (entry.getValue() <= step * 4) {
+                                            setTotalmapValue(step * 4, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
 
-                                    } else if (entry.getValue() <= step * 5) {
-                                        setTotalmapValue(step * 5, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else if (entry.getValue() <= step * 5) {
+                                            setTotalmapValue(step * 5, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
 
-                                    } else if (entry.getValue() <= step * 6) {
-                                        setTotalmapValue(step * 6, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else if (entry.getValue() <= step * 6) {
+                                            setTotalmapValue(step * 6, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
 
-                                    } else if (entry.getValue() <= step * 7) {
-                                        setTotalmapValue(step * 7, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else if (entry.getValue() <= step * 7) {
+                                            setTotalmapValue(step * 7, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
 
-                                    } else if (entry.getValue() <= step * 8) {
-                                        setTotalmapValue(step * 8, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else if (entry.getValue() <= step * 8) {
+                                            setTotalmapValue(step * 8, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
 
-                                    } else if (entry.getValue() <= step * 9) {
-                                        setTotalmapValue(step * 9, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else if (entry.getValue() <= step * 9) {
+                                            setTotalmapValue(step * 9, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
 
-                                    } else {
-                                        setTotalmapValue(step * 10, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        } else {
+                                            setTotalmapValue(step * 10, cLXSRZYW1map, cLXSRZYW2map, cLXRKYWmap, cLXYWmap, fDJZCWDAmap, fDJZCWDBmap, fDJUXYZWDmap, fDJVXYZWDmap, fDJWXYZWDmap, fDJLQFWDmap, bJDRQWDmap, bJDRDYmap, bJDLQWDmap, bJDJWDmap, bJKZGWDmap, tDGWDmap, tDJGWDmap, totalmap, entry);
+                                        }
                                     }
                                 }
                             }
-                        }
 
-                        Partpowerstatticsmain po = new Partpowerstatticsmain();
-                        po.setWpid(wp.getId());
-                        po.setWpname(wp.getName());
-                        po.setWtid(wt.getId());
-                        po.setWtname(wt.getName());
-                        po.setRecodedate(endDate);
-                        po.setModel(wt.getModelid());
-
-                        String tid= com.gyee.failurestatistics.util.StringUtils.getUUID();
-                        po.setId(tid);
-                        insertPartpowerstatticsmain(po);
-
-                        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();
-
-
-
-                            for(String code:codels)
-                            {
-                                Partpowerstatticssub sub = new Partpowerstatticssub();
-                                sub.setId(StringUtils.getUUID());
-                                sub.setTid(tid);
-                                StringBuilder sb=new StringBuilder();
-
-                                if (model.getPowerproduction() == 1500.0) {
-                                    sb.append(Integer.valueOf(entry2.getKey())-150);
-                                    sb.append("kw");
-                                    sb.append("-");
-                                    sb.append(Integer.valueOf(entry2.getKey()));
-                                    sb.append("kw");
-                                    sub.setPower(String.valueOf(sb));
-                                }else if (model.getPowerproduction() == 2000.0) {
-                                    sb.append(Integer.valueOf(entry2.getKey())-200);
-                                    sb.append("kw");
-                                    sb.append("-");
-                                    sb.append(Integer.valueOf(entry2.getKey()));
-                                    sb.append("kw");
-                                    sub.setPower(String.valueOf(sb));
-                                }
+                            Partpowerstatticsmain po = new Partpowerstatticsmain();
+                            po.setWpid(wp.getId());
+                            po.setWpname(wp.getName());
+                            po.setWtid(wt.getId());
+                            po.setWtname(wt.getName());
+                            po.setRecodedate(endDate);
+                            po.setModel(wt.getModelid());
+
+                            String tid= com.gyee.failurestatistics.util.StringUtils.getUUID();
+                            po.setId(tid);
+                            insertPartpowerstatticsmain(po);
+
+                            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();
 
-                                //sub.setPower(Double.valueOf(entry2.getKey()));
-                                sub.setRecodedate(po.getRecodedate());
-                                Map<String, List<Double>> submap=entry2.getValue();
-                                if(codenamemap.containsKey(code))
-                                {
-                                    sub.setName(codenamemap.get(code));
-                                }
 
-                                if(codeParentmap.containsKey(code))
-                                {
-                                    sub.setPartid(codeParentmap.get(code));
-                                }
 
-                                if(submap.containsKey(code))
+                                for(String code:codels)
                                 {
-                                    List<Double> values=submap.get(code);
+                                    Partpowerstatticssub sub = new Partpowerstatticssub();
+                                    sub.setId(StringUtils.getUUID());
+                                    sub.setTid(tid);
+                                    StringBuilder sb=new StringBuilder();
+
+                                    if (model.getPowerproduction() == 1500.0) {
+                                        sb.append(Integer.valueOf(entry2.getKey())-150);
+                                        sb.append("kw");
+                                        sb.append("-");
+                                        sb.append(Integer.valueOf(entry2.getKey()));
+                                        sb.append("kw");
+                                        sub.setPower(String.valueOf(sb));
+                                    }else if (model.getPowerproduction() == 2000.0) {
+                                        sb.append(Integer.valueOf(entry2.getKey())-200);
+                                        sb.append("kw");
+                                        sb.append("-");
+                                        sb.append(Integer.valueOf(entry2.getKey()));
+                                        sb.append("kw");
+                                        sub.setPower(String.valueOf(sb));
+                                    }
 
-                                    if(!values.isEmpty())
+                                    //sub.setPower(Double.valueOf(entry2.getKey()));
+                                    sub.setRecodedate(po.getRecodedate());
+                                    Map<String, List<Double>> submap=entry2.getValue();
+                                    if(codenamemap.containsKey(code))
                                     {
-                                        double sum=0;
-                                        for(Double value:values)
-                                        {
-                                            sum=sum+value;
-                                        }
-                                        sub.setDatavalue(new BigDecimal(sum).divide(new BigDecimal(values.size()), DIGIT, RoundingMode.HALF_EVEN).doubleValue());
-                                        sub.setEarlywarningvalue(StringUtils.round(new BigDecimal(sub.getDatavalue()).multiply(new BigDecimal(EARLYWARNPER)).doubleValue(), DIGIT));
-                                        //sub.setEarlywarningvalue(new BigDecimal(sub.getDatavalue()).multiply(new BigDecimal(EARLYWARNPER)).doubleValue());
-                                        //sub.setCriticalvalue(new BigDecimal(sub.getDatavalue()).multiply(new BigDecimal(CRITICALPER)).doubleValue());
-                                        sub.setCriticalvalue(StringUtils.round(new BigDecimal(sub.getDatavalue()).multiply(new BigDecimal(CRITICALPER)).doubleValue(), DIGIT));
+                                        sub.setName(codenamemap.get(code));
+                                    }
 
-                                    }else
+                                    if(codeParentmap.containsKey(code))
                                     {
-                                        sub.setDatavalue(0.0);
-                                        sub.setEarlywarningvalue(0.0);
-                                        sub.setCriticalvalue(0.0);
+                                        sub.setPartid(codeParentmap.get(code));
                                     }
 
+                                    if(submap.containsKey(code))
+                                    {
+                                        List<Double> values=submap.get(code);
+
+                                        if(!values.isEmpty())
+                                        {
+                                            double sum=0;
+                                            for(Double value:values)
+                                            {
+                                                sum=sum+value;
+                                            }
+                                            sub.setDatavalue(new BigDecimal(sum).divide(new BigDecimal(values.size()), DIGIT, RoundingMode.HALF_EVEN).doubleValue());
+                                            sub.setEarlywarningvalue(StringUtils.round(new BigDecimal(sub.getDatavalue()).multiply(new BigDecimal(EARLYWARNPER)).doubleValue(), DIGIT));
+                                            //sub.setEarlywarningvalue(new BigDecimal(sub.getDatavalue()).multiply(new BigDecimal(EARLYWARNPER)).doubleValue());
+                                            //sub.setCriticalvalue(new BigDecimal(sub.getDatavalue()).multiply(new BigDecimal(CRITICALPER)).doubleValue());
+                                            sub.setCriticalvalue(StringUtils.round(new BigDecimal(sub.getDatavalue()).multiply(new BigDecimal(CRITICALPER)).doubleValue(), DIGIT));
+
+                                        }else
+                                        {
+                                            sub.setDatavalue(0.0);
+                                            sub.setEarlywarningvalue(0.0);
+                                            sub.setCriticalvalue(0.0);
+                                        }
+
+                                    }
+                                    partpowerstatticssubService.insertPartpowerstatticssub(sub);
                                 }
-                                partpowerstatticssubService.insertPartpowerstatticssub(sub);
-                            }
 
 
+                            }
+                        } else {
+                            Windturbinetestingpointnew point = map.get(Constant.TPOINT_WT_FJGL);
+                            StringBuilder sb=new StringBuilder();
+                            sb.append("功率数据取值失败或不存在该风机型号!风机编号是");
+                            sb.append(wt.getId());
+                            sb.append(",功率测点是");
+                            sb.append(point.getId());
+                            System.out.println(sb);
                         }
-                    } else {
-                        Windturbinetestingpointnew point = map.get(Constant.TPOINT_WT_FJGL);
-                        StringBuilder sb=new StringBuilder();
-                        sb.append("功率数据取值失败或不存在该风机型号!风机编号是");
-                        sb.append(wt.getId());
-                        sb.append(",功率测点是");
-                        sb.append(point.getId());
-                        System.out.println(sb);
                     }
 
+
                 }
                 System.out.println("结束统计" + wp.getName() + "功率对应部件指标统计");
             }

+ 148 - 137
realtime/failurestatistics-server-cph/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 = 60*30;
+    private final int DAYSTEP = 1440/30;
 
 //    private final long STEP = 900;
 //    private final int DAYSTEP = 96;
@@ -142,148 +142,159 @@ public class PartstatisticsService {
 
                     Map<String, Windturbinetestingpointnew> map = CacheContext.wtpAimap.get(wt.getId());
 
-                    getPartTargetValue(wt, Constant.CLXJKZT, endDate, beginDate, daynum, map,clxmap);
-                    getPartTargetValue(wt, Constant.FDJJKZT, endDate, beginDate, daynum, map,fdjxmap);
-                    getPartTargetValue(wt, Constant.BJJKZT, endDate, beginDate, daynum, map,bjmap);
-                    getPartTargetValue(wt, Constant.ZKJKZT, endDate, beginDate, daynum, map,zkxmap);
-
-                }
-
-                Map<String, Map<String, Integer>> ordermap = new HashMap<String, Map<String, Integer>>();
 
+                    if(StringUtils.notEmp(map) && !map.isEmpty())
+                    {
+                        getPartTargetValue(wt, Constant.CLXJKZT, endDate, beginDate, daynum, map,clxmap);
+                        getPartTargetValue(wt, Constant.FDJJKZT, endDate, beginDate, daynum, map,fdjxmap);
+                        getPartTargetValue(wt, Constant.BJJKZT, endDate, beginDate, daynum, map,bjmap);
+                        getPartTargetValue(wt, Constant.ZKJKZT, endDate, beginDate, daynum, map,zkxmap);
+                    }
 
-                setPartOrderMap(clxmap,fdjxmap,bjmap,zkxmap, ordermap, wtls);
 
+                }
 
-                cal = Calendar.getInstance();
-                cal.set(Calendar.HOUR_OF_DAY, 0);
-                cal.set(Calendar.MINUTE, 0);
-                cal.set(Calendar.SECOND, 0);
-                for (Windturbine wt : wtls) {
+                Map<String, Map<String, Integer>> ordermap = new HashMap<String, Map<String, Integer>>();
 
-                    Partstatisticsmain po = new Partstatisticsmain();
-
-                    po.setId(StringUtils.getUUID());
-                    po.setWpid(wp.getId());
-                    po.setWpname(wp.getName());
-                    po.setWtid(wt.getId());
-                    po.setWtname(wt.getName());
-                    po.setRecodedate(cal.getTime());
-
-
-                    /*********************************************************************************/
-                    po.setDay1clx(clxmap.get(wt.getId()).get(DAY1NUM));
-                    po.setDay1fdj(fdjxmap.get(wt.getId()).get(DAY1NUM));
-                    po.setDay1bj(bjmap.get(wt.getId()).get(DAY1NUM));
-                    po.setDay1zk(zkxmap.get(wt.getId()).get(DAY1NUM));
-                    po.setDay1bpq(0);
-                    po.setDay1ph(0);
-                    po.setDay1zz(0);
-                    po.setDay1jc(0);
-
-                    po.setDay1clxname("严重");
-                    po.setDay1fdjname("严重");
-                    po.setDay1bjname("严重");
-                    po.setDay1zkname("严重");
-                    po.setDay1bpqname("严重");
-                    po.setDay1phname("严重");
-                    po.setDay1zzname("严重");
-                    po.setDay1jcname("严重");
-
-                    po.setDay1topnum(ordermap.get(wt.getId()).get(DAY1NUM));
-
-                    /*********************************************************************************/
-                    po.setDay3clx(clxmap.get(wt.getId()).get(DAY3NUM));
-                    po.setDay3fdj(fdjxmap.get(wt.getId()).get(DAY3NUM));
-                    po.setDay3bj(bjmap.get(wt.getId()).get(DAY3NUM));
-                    po.setDay3zk(zkxmap.get(wt.getId()).get(DAY3NUM));
-                    po.setDay3bpq(0);
-                    po.setDay3ph(0);
-                    po.setDay3zz(0);
-                    po.setDay3jc(0);
-
-                    po.setDay3clxname("严重");
-                    po.setDay3fdjname("严重");
-                    po.setDay3bjname("严重");
-                    po.setDay3zkname("严重");
-                    po.setDay3bpqname("严重");
-                    po.setDay3phname("严重");
-                    po.setDay3zzname("严重");
-                    po.setDay3jcname("严重");
-
-                    po.setDay3topnum(ordermap.get(wt.getId()).get(DAY3NUM));
-
-                    /*********************************************************************************/
-                    po.setDay7clx(clxmap.get(wt.getId()).get(DAY7NUM));
-                    po.setDay7fdj(fdjxmap.get(wt.getId()).get(DAY7NUM));
-                    po.setDay7bj(bjmap.get(wt.getId()).get(DAY7NUM));
-                    po.setDay7zk(zkxmap.get(wt.getId()).get(DAY7NUM));
-                    po.setDay7bpq(0);
-                    po.setDay7ph(0);
-                    po.setDay7zz(0);
-                    po.setDay7jc(0);
-
-                    po.setDay7clxname("严重");
-                    po.setDay7fdjname("严重");
-                    po.setDay7bjname("严重");
-                    po.setDay7zkname("严重");
-                    po.setDay7bpqname("严重");
-                    po.setDay7phname("严重");
-                    po.setDay7zzname("严重");
-                    po.setDay7jcname("严重");
-
-                    po.setDay7topnum(ordermap.get(wt.getId()).get(DAY7NUM));
-
-                    /*********************************************************************************/
-                    po.setDay15clx(clxmap.get(wt.getId()).get(DAY15NUM));
-                    po.setDay15fdj(fdjxmap.get(wt.getId()).get(DAY15NUM));
-                    po.setDay15bj(bjmap.get(wt.getId()).get(DAY15NUM));
-                    po.setDay15zk(zkxmap.get(wt.getId()).get(DAY15NUM));
-                    po.setDay15bpq(0);
-                    po.setDay15ph(0);
-                    po.setDay15zz(0);
-                    po.setDay15jc(0);
-
-                    po.setDay15clxname("严重");
-                    po.setDay15fdjname("严重");
-                    po.setDay15bjname("严重");
-                    po.setDay15zkname("严重");
-                    po.setDay15bpqname("严重");
-                    po.setDay15phname("严重");
-                    po.setDay15zzname("严重");
-                    po.setDay15jcname("严重");
-
-                    po.setDay15topnum(ordermap.get(wt.getId()).get(DAY15NUM));
-
-                    /*********************************************************************************/
-                    po.setMonth1clx(clxmap.get(wt.getId()).get(MONTH1NUM));
-                    po.setMonth1fdj(fdjxmap.get(wt.getId()).get(MONTH1NUM));
-                    po.setMonth1bj(bjmap.get(wt.getId()).get(MONTH1NUM));
-                    po.setMonth1zk(zkxmap.get(wt.getId()).get(MONTH1NUM));
-                    po.setMonth1bpq(0);
-                    po.setMonth1ph(0);
-                    po.setMonth1zz(0);
-                    po.setMonth1jc(0);
-
-                    po.setMonth1clxname("严重");
-                    po.setMonth1fdjname("严重");
-                    po.setMonth1bjname("严重");
-                    po.setMonth1zkname("严重");
-                    po.setMonth1bpqname("严重");
-                    po.setMonth1phname("严重");
-                    po.setMonth1zzname("严重");
-                    po.setMonth1jcname("严重");
-
-                    po.setMonth1topnum(ordermap.get(wt.getId()).get(MONTH1NUM));
-
-                    /*********************************************************************************/
-                    po.setSynthesistopnum(ordermap.get(wt.getId()).get(SYNTHESISNUM));
-
-                    /*********************************************************************************/
-
-                    insertPartstatisticsmain(po);
+                if(StringUtils.notEmp(clxmap) && !clxmap.isEmpty() &&
+                        StringUtils.notEmp(fdjxmap) && !fdjxmap.isEmpty() &&
+                        StringUtils.notEmp(bjmap) && !bjmap.isEmpty() &&
+                        StringUtils.notEmp(zkxmap) && !zkxmap.isEmpty() )
+                {
+                    setPartOrderMap(clxmap,fdjxmap,bjmap,zkxmap, ordermap, wtls);
+
+
+                    cal = Calendar.getInstance();
+                    cal.set(Calendar.HOUR_OF_DAY, 0);
+                    cal.set(Calendar.MINUTE, 0);
+                    cal.set(Calendar.SECOND, 0);
+                    for (Windturbine wt : wtls) {
+
+                        Partstatisticsmain po = new Partstatisticsmain();
+
+                        po.setId(StringUtils.getUUID());
+                        po.setWpid(wp.getId());
+                        po.setWpname(wp.getName());
+                        po.setWtid(wt.getId());
+                        po.setWtname(wt.getName());
+                        po.setRecodedate(cal.getTime());
+
+
+                        /*********************************************************************************/
+                        po.setDay1clx(clxmap.get(wt.getId()).get(DAY1NUM));
+                        po.setDay1fdj(fdjxmap.get(wt.getId()).get(DAY1NUM));
+                        po.setDay1bj(bjmap.get(wt.getId()).get(DAY1NUM));
+                        po.setDay1zk(zkxmap.get(wt.getId()).get(DAY1NUM));
+                        po.setDay1bpq(0);
+                        po.setDay1ph(0);
+                        po.setDay1zz(0);
+                        po.setDay1jc(0);
+
+                        po.setDay1clxname("严重");
+                        po.setDay1fdjname("严重");
+                        po.setDay1bjname("严重");
+                        po.setDay1zkname("严重");
+                        po.setDay1bpqname("严重");
+                        po.setDay1phname("严重");
+                        po.setDay1zzname("严重");
+                        po.setDay1jcname("严重");
+
+                        po.setDay1topnum(ordermap.get(wt.getId()).get(DAY1NUM));
+
+                        /*********************************************************************************/
+                        po.setDay3clx(clxmap.get(wt.getId()).get(DAY3NUM));
+                        po.setDay3fdj(fdjxmap.get(wt.getId()).get(DAY3NUM));
+                        po.setDay3bj(bjmap.get(wt.getId()).get(DAY3NUM));
+                        po.setDay3zk(zkxmap.get(wt.getId()).get(DAY3NUM));
+                        po.setDay3bpq(0);
+                        po.setDay3ph(0);
+                        po.setDay3zz(0);
+                        po.setDay3jc(0);
+
+                        po.setDay3clxname("严重");
+                        po.setDay3fdjname("严重");
+                        po.setDay3bjname("严重");
+                        po.setDay3zkname("严重");
+                        po.setDay3bpqname("严重");
+                        po.setDay3phname("严重");
+                        po.setDay3zzname("严重");
+                        po.setDay3jcname("严重");
+
+                        po.setDay3topnum(ordermap.get(wt.getId()).get(DAY3NUM));
+
+                        /*********************************************************************************/
+                        po.setDay7clx(clxmap.get(wt.getId()).get(DAY7NUM));
+                        po.setDay7fdj(fdjxmap.get(wt.getId()).get(DAY7NUM));
+                        po.setDay7bj(bjmap.get(wt.getId()).get(DAY7NUM));
+                        po.setDay7zk(zkxmap.get(wt.getId()).get(DAY7NUM));
+                        po.setDay7bpq(0);
+                        po.setDay7ph(0);
+                        po.setDay7zz(0);
+                        po.setDay7jc(0);
+
+                        po.setDay7clxname("严重");
+                        po.setDay7fdjname("严重");
+                        po.setDay7bjname("严重");
+                        po.setDay7zkname("严重");
+                        po.setDay7bpqname("严重");
+                        po.setDay7phname("严重");
+                        po.setDay7zzname("严重");
+                        po.setDay7jcname("严重");
+
+                        po.setDay7topnum(ordermap.get(wt.getId()).get(DAY7NUM));
+
+                        /*********************************************************************************/
+                        po.setDay15clx(clxmap.get(wt.getId()).get(DAY15NUM));
+                        po.setDay15fdj(fdjxmap.get(wt.getId()).get(DAY15NUM));
+                        po.setDay15bj(bjmap.get(wt.getId()).get(DAY15NUM));
+                        po.setDay15zk(zkxmap.get(wt.getId()).get(DAY15NUM));
+                        po.setDay15bpq(0);
+                        po.setDay15ph(0);
+                        po.setDay15zz(0);
+                        po.setDay15jc(0);
+
+                        po.setDay15clxname("严重");
+                        po.setDay15fdjname("严重");
+                        po.setDay15bjname("严重");
+                        po.setDay15zkname("严重");
+                        po.setDay15bpqname("严重");
+                        po.setDay15phname("严重");
+                        po.setDay15zzname("严重");
+                        po.setDay15jcname("严重");
+
+                        po.setDay15topnum(ordermap.get(wt.getId()).get(DAY15NUM));
+
+                        /*********************************************************************************/
+                        po.setMonth1clx(clxmap.get(wt.getId()).get(MONTH1NUM));
+                        po.setMonth1fdj(fdjxmap.get(wt.getId()).get(MONTH1NUM));
+                        po.setMonth1bj(bjmap.get(wt.getId()).get(MONTH1NUM));
+                        po.setMonth1zk(zkxmap.get(wt.getId()).get(MONTH1NUM));
+                        po.setMonth1bpq(0);
+                        po.setMonth1ph(0);
+                        po.setMonth1zz(0);
+                        po.setMonth1jc(0);
+
+                        po.setMonth1clxname("严重");
+                        po.setMonth1fdjname("严重");
+                        po.setMonth1bjname("严重");
+                        po.setMonth1zkname("严重");
+                        po.setMonth1bpqname("严重");
+                        po.setMonth1phname("严重");
+                        po.setMonth1zzname("严重");
+                        po.setMonth1jcname("严重");
+
+                        po.setMonth1topnum(ordermap.get(wt.getId()).get(MONTH1NUM));
+
+                        /*********************************************************************************/
+                        po.setSynthesistopnum(ordermap.get(wt.getId()).get(SYNTHESISNUM));
+
+                        /*********************************************************************************/
+
+                        insertPartstatisticsmain(po);
 
+                    }
                 }
+
                 System.out.println("结束统计" + wp.getName() + "部件健康状况和故障数量统计");
 
             }

+ 82 - 79
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/ParttemperatureService.java

@@ -114,107 +114,110 @@ public class ParttemperatureService {
 
             Map<String, Windturbinetestingpointnew> map = CacheContext.wtpAimap.get(wt.getId());
 
-
-            Map<String, Double> wdmap = getWdValue(wt, Constant.TPOINT_WT_JCWD, endDate, beginDate, map);
+            if(StringUtils.notEmp(map) && !map.isEmpty())
+            {
+                Map<String, Double> wdmap = getWdValue(wt, Constant.TPOINT_WT_JCWD, endDate, beginDate, map);
 
 
-            Map<String, Double> cLXSRZYW1map = getPartTargetValue(wt, CLXSRZYW1, endDate, beginDate, map,63,0);
-            Map<String, Double> cLXSRZYW2map = getPartTargetValue(wt, CLXSRZYW2, endDate, beginDate, map,63,0);
-            Map<String, Double> cLXRKYWmap = getPartTargetValue(wt, CLXRKYW, endDate, beginDate, map,63,0);
-            Map<String, Double> cLXYWmap = getPartTargetValue(wt, CLXYW, endDate, beginDate, map,60,0);
+                Map<String, Double> cLXSRZYW1map = getPartTargetValue(wt, CLXSRZYW1, endDate, beginDate, map,63,0);
+                Map<String, Double> cLXSRZYW2map = getPartTargetValue(wt, CLXSRZYW2, endDate, beginDate, map,63,0);
+                Map<String, Double> cLXRKYWmap = getPartTargetValue(wt, CLXRKYW, endDate, beginDate, map,63,0);
+                Map<String, Double> cLXYWmap = getPartTargetValue(wt, CLXYW, endDate, beginDate, map,60,0);
 
-            Map<String, Double> fDJZCWDAmap = getPartTargetValue(wt, FDJZCWDA, endDate, beginDate, map,45,0);
-            Map<String, Double> fDJZCWDBmap = getPartTargetValue(wt, FDJZCWDB, endDate, beginDate, map,45,0);
-            Map<String, Double> fDJUXYZWDmap = getPartTargetValue(wt, FDJUXYZWD, endDate, beginDate, map,110,0);
-            Map<String, Double> fDJVXYZWDmap = getPartTargetValue(wt, FDJVXYZWD, endDate, beginDate, map,110,0);
-            Map<String, Double> fDJWXYZWDmap = getPartTargetValue(wt, FDJWXYZWD, endDate, beginDate, map,110,0);
-            Map<String, Double> fDJLQFWDmap = getPartTargetValue(wt, FDJLQFWD, endDate, beginDate, map,50,0);
+                Map<String, Double> fDJZCWDAmap = getPartTargetValue(wt, FDJZCWDA, endDate, beginDate, map,45,0);
+                Map<String, Double> fDJZCWDBmap = getPartTargetValue(wt, FDJZCWDB, endDate, beginDate, map,45,0);
+                Map<String, Double> fDJUXYZWDmap = getPartTargetValue(wt, FDJUXYZWD, endDate, beginDate, map,110,0);
+                Map<String, Double> fDJVXYZWDmap = getPartTargetValue(wt, FDJVXYZWD, endDate, beginDate, map,110,0);
+                Map<String, Double> fDJWXYZWDmap = getPartTargetValue(wt, FDJWXYZWD, endDate, beginDate, map,110,0);
+                Map<String, Double> fDJLQFWDmap = getPartTargetValue(wt, FDJLQFWD, endDate, beginDate, map,50,0);
 
-            Map<String, Double> bJDRQWDmap = getPartTargetValue(wt, BJDRQWD, endDate, beginDate, map,35,0);
-            Map<String, Double> bJDRDYmap = getPartTargetValue(wt, BJDRDY, endDate, beginDate, map,70,0);
-            Map<String, Double> bJDLQWDmap = getPartTargetValue(wt, BJDLQWD, endDate, beginDate, map,50,0);
-            Map<String, Double> bJDJWDmap = getPartTargetValue(wt, BJDJWD, endDate, beginDate, map,50,0);
-            Map<String, Double> bJKZGWDmap = getPartTargetValue(wt, BJKZGWD, endDate, beginDate, map,45,0);
+                Map<String, Double> bJDRQWDmap = getPartTargetValue(wt, BJDRQWD, endDate, beginDate, map,35,0);
+                Map<String, Double> bJDRDYmap = getPartTargetValue(wt, BJDRDY, endDate, beginDate, map,70,0);
+                Map<String, Double> bJDLQWDmap = getPartTargetValue(wt, BJDLQWD, endDate, beginDate, map,50,0);
+                Map<String, Double> bJDJWDmap = getPartTargetValue(wt, BJDJWD, endDate, beginDate, map,50,0);
+                Map<String, Double> bJKZGWDmap = getPartTargetValue(wt, BJKZGWD, endDate, beginDate, map,45,0);
 
-            Map<String, Double> tDGWDmap = getPartTargetValue(wt, TDGWD, endDate, beginDate, map,35,0);
-            Map<String, Double> tDJGWDmap = getPartTargetValue(wt, TDJGWD, endDate, beginDate, map,35,0);
+                Map<String, Double> tDGWDmap = getPartTargetValue(wt, TDGWD, endDate, beginDate, map,35,0);
+                Map<String, Double> tDJGWDmap = getPartTargetValue(wt, TDJGWD, endDate, beginDate, map,35,0);
 
 
-            Map<String, Map<String, Integer>> pointmap =new HashMap<>();
-            if (!wdmap.isEmpty()  ) {
+                Map<String, Map<String, Integer>> pointmap =new HashMap<>();
+                if (!wdmap.isEmpty()  ) {
 
-                Set<Map.Entry<String, Double>> wdset = wdmap.entrySet();
-                //按照温度区间》测点》统计数量
-                for (Iterator<Map.Entry<String, Double>> wdit = wdset.iterator(); wdit.hasNext();) {
+                    Set<Map.Entry<String, Double>> wdset = wdmap.entrySet();
+                    //按照温度区间》测点》统计数量
+                    for (Iterator<Map.Entry<String, Double>> wdit = wdset.iterator(); wdit.hasNext();) {
 
-                    Map.Entry<String, Double> wdentry = (Map.Entry<String, Double>) wdit.next();
+                        Map.Entry<String, Double> wdentry = (Map.Entry<String, Double>) wdit.next();
 
 
-                    setPointValues(CLXSRZYW1, cLXSRZYW1map, pointmap, wdentry);
-                    setPointValues(CLXSRZYW2, cLXSRZYW2map, pointmap, wdentry);
-                    setPointValues(CLXRKYW, cLXRKYWmap, pointmap, wdentry);
-                    setPointValues(CLXYW, cLXYWmap, pointmap, wdentry);
+                        setPointValues(CLXSRZYW1, cLXSRZYW1map, pointmap, wdentry);
+                        setPointValues(CLXSRZYW2, cLXSRZYW2map, pointmap, wdentry);
+                        setPointValues(CLXRKYW, cLXRKYWmap, pointmap, wdentry);
+                        setPointValues(CLXYW, cLXYWmap, pointmap, wdentry);
 
-                    setPointValues(FDJZCWDA, fDJZCWDAmap, pointmap, wdentry);
-                    setPointValues(FDJZCWDB, fDJZCWDBmap, pointmap, wdentry);
-                    setPointValues(FDJUXYZWD, fDJUXYZWDmap, pointmap, wdentry);
-                    setPointValues(FDJVXYZWD, fDJVXYZWDmap, pointmap, wdentry);
-                    setPointValues(FDJWXYZWD, fDJWXYZWDmap, pointmap, wdentry);
-                    setPointValues(FDJLQFWD, fDJLQFWDmap, pointmap, wdentry);
+                        setPointValues(FDJZCWDA, fDJZCWDAmap, pointmap, wdentry);
+                        setPointValues(FDJZCWDB, fDJZCWDBmap, pointmap, wdentry);
+                        setPointValues(FDJUXYZWD, fDJUXYZWDmap, pointmap, wdentry);
+                        setPointValues(FDJVXYZWD, fDJVXYZWDmap, pointmap, wdentry);
+                        setPointValues(FDJWXYZWD, fDJWXYZWDmap, pointmap, wdentry);
+                        setPointValues(FDJLQFWD, fDJLQFWDmap, pointmap, wdentry);
 
-                    setPointValues(BJDRQWD, bJDRQWDmap, pointmap, wdentry);
-                    setPointValues(BJDRDY, bJDRDYmap, pointmap, wdentry);
-                    setPointValues(BJDLQWD, bJDLQWDmap, pointmap, wdentry);
-                    setPointValues(BJDJWD, bJDJWDmap, pointmap, wdentry);
-                    setPointValues(BJKZGWD, bJKZGWDmap, pointmap, wdentry);
-
-                    setPointValues(TDGWD, tDGWDmap, pointmap, wdentry);
-                    setPointValues(TDJGWD, tDJGWDmap, pointmap, wdentry);
-                }
+                        setPointValues(BJDRQWD, bJDRQWDmap, pointmap, wdentry);
+                        setPointValues(BJDRDY, bJDRDYmap, pointmap, wdentry);
+                        setPointValues(BJDLQWD, bJDLQWDmap, pointmap, wdentry);
+                        setPointValues(BJDJWD, bJDJWDmap, pointmap, wdentry);
+                        setPointValues(BJKZGWD, bJKZGWDmap, pointmap, wdentry);
 
+                        setPointValues(TDGWD, tDGWDmap, pointmap, wdentry);
+                        setPointValues(TDJGWD, tDJGWDmap, pointmap, wdentry);
+                    }
 
-                Set<Map.Entry<String, Map<String, Integer>>> pointset = pointmap.entrySet();
-                //按照温度区间》测点》统计数量
-                for (Iterator<Map.Entry<String, Map<String, Integer>>> pointit = pointset.iterator(); pointit.hasNext();) {
 
-                    Map.Entry<String, Map<String, Integer>> pointentry = (Map.Entry<String, Map<String, Integer>>) pointit.next();
+                    Set<Map.Entry<String, Map<String, Integer>>> pointset = pointmap.entrySet();
+                    //按照温度区间》测点》统计数量
+                    for (Iterator<Map.Entry<String, Map<String, Integer>>> pointit = pointset.iterator(); pointit.hasNext();) {
+
+                        Map.Entry<String, Map<String, Integer>> pointentry = (Map.Entry<String, Map<String, Integer>>) pointit.next();
+
+                        int num=0;
+                        Parttemperaturemain po = new Parttemperaturemain();
+                        po.setId(StringUtils.getUUID());
+                        po.setWpid(wt.getWindpowerstationid());
+                        po.setWtid(wt.getId());
+                        po.setWtname(wt.getName());
+                        po.setRecodedate(cal.getTime());
+                        po.setTrange(pointentry.getKey());
+
+                        Set<Map.Entry<String, Integer>> pset = pointentry.getValue().entrySet();
+                        //测点》统计数量
+                        for (Iterator<Map.Entry<String, Integer>> pit = pset.iterator(); pit.hasNext();) {
+
+                            Map.Entry<String, Integer> pentry = (Map.Entry<String, Integer>) pit.next();
+                            Parttemperaturesub sub = new Parttemperaturesub();
+                            sub.setId(StringUtils.getUUID());
+                            sub.setWpid(wt.getWindpowerstationid());
+                            sub.setWtid(wt.getId());
+                            sub.setWtname(wt.getName());
+                            sub.setRecodedate(cal.getTime());
+                            sub.setTrange(pointentry.getKey());
+                            sub.setPointname(codenamemap.get(pentry.getKey()));
+                            sub.setPartname(codeParentmap.get(pentry.getKey()));
+                            sub.setTsnumber(pentry.getValue());
+                            num=num+pentry.getValue();
+                            parttemperaturesubService.insertParttemperaturesub(sub);
+                        }
 
-                    int num=0;
-                    Parttemperaturemain po = new Parttemperaturemain();
-                    po.setId(StringUtils.getUUID());
-                    po.setWpid(wt.getWindpowerstationid());
-                    po.setWtid(wt.getId());
-                    po.setWtname(wt.getName());
-                    po.setRecodedate(cal.getTime());
-                    po.setTrange(pointentry.getKey());
-
-                    Set<Map.Entry<String, Integer>> pset = pointentry.getValue().entrySet();
-                    //测点》统计数量
-                    for (Iterator<Map.Entry<String, Integer>> pit = pset.iterator(); pit.hasNext();) {
-
-                        Map.Entry<String, Integer> pentry = (Map.Entry<String, Integer>) pit.next();
-                        Parttemperaturesub sub = new Parttemperaturesub();
-                        sub.setId(StringUtils.getUUID());
-                        sub.setWpid(wt.getWindpowerstationid());
-                        sub.setWtid(wt.getId());
-                        sub.setWtname(wt.getName());
-                        sub.setRecodedate(cal.getTime());
-                        sub.setTrange(pointentry.getKey());
-                        sub.setPointname(codenamemap.get(pentry.getKey()));
-                        sub.setPartname(codeParentmap.get(pentry.getKey()));
-                        sub.setTsnumber(pentry.getValue());
-                        num=num+pentry.getValue();
-                        parttemperaturesubService.insertParttemperaturesub(sub);
+                        po.setTsnumber(num);
+                        insertParttemperaturemain(po);
                     }
 
-                    po.setTsnumber(num);
-                    insertParttemperaturemain(po);
-                }
 
 
+                } else {
+                    //System.out.println("初始化当日数据报错!");
+                }
 
-            } else {
-                //System.out.println("初始化当日数据报错!");
             }
 
         }

+ 103 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/ShutdowneventService.java

@@ -0,0 +1,103 @@
+package com.gyee.failurestatistics.service;
+
+import com.gyee.failurestatistics.init.CacheContext;
+import com.gyee.failurestatistics.model.auto.Shutdownevent2;
+import com.gyee.failurestatistics.model.auto.Windpowerstation;
+import com.gyee.failurestatistics.service.auto.IShutdownevent2Service;
+import com.gyee.failurestatistics.util.StringUtils;
+import com.gyee.failurestatistics.vo.ShutdowneventVo;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @ClassName : EarlywarningService
+ * @Description : 报警统计service
+ */
+@Service
+public class ShutdowneventService {
+
+
+    @Resource
+    private IShutdownevent2Service shutdownevent2Service;
+
+    private final String  ALARMHISTORY="ALARMHISTORY";
+
+
+
+
+    public void updateShutdownevent() throws Exception {
+
+        Calendar c = Calendar.getInstance();
+//        c.set(Calendar.YEAR,2021);
+//        c.set(Calendar.MONTH,11);
+//        c.set(Calendar.DAY_OF_MONTH,17);
+
+
+        c.set(Calendar.HOUR_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+
+        Date beginDate=c.getTime();
+        c.add(Calendar.DAY_OF_MONTH,1);
+        Date endDate=c.getTime();
+
+
+        List<Shutdownevent2> sls=shutdownevent2Service.queryShutdowneventList(beginDate, endDate);
+
+        if(!sls.isEmpty())
+        {
+            for(Shutdownevent2 sd:sls)
+            {
+                if(StringUtils.notEmp(sd.getWindturbineid()) && StringUtils.notEmp(sd.getWindpowerstationid())  && CacheContext.wpmap.containsKey(sd.getWindpowerstationid()))
+                {
+                    Windpowerstation wp=CacheContext.wpmap.get(sd.getWindpowerstationid());
+                    String wpname=wp.getId().substring(0,wp.getId().indexOf("_"));
+
+                    StringBuilder alerthistory1=new StringBuilder(ALARMHISTORY).append("_").append(wpname).append("_");
+                    Calendar cal = Calendar.getInstance();
+                    cal.set(Calendar.HOUR_OF_DAY, 0);
+                    cal.set(Calendar.MINUTE, 0);
+                    cal.set(Calendar.SECOND, 0);
+
+//                    cal.set(Calendar.YEAR,2021);
+//                    cal.set(Calendar.MONTH,11);
+//                    cal.set(Calendar.DAY_OF_MONTH,17);
+
+
+                    int year=cal.get(Calendar.YEAR);
+                    int month=cal.get(Calendar.MONTH)+1;
+
+                    alerthistory1.append(year);
+                    if(month<10)
+                    {
+                        alerthistory1.append("0").append(month);
+                    }else
+                    {
+                        alerthistory1.append(month);
+                    }
+
+                    cal.setTime(sd.getStoptime());
+                    Date endTime=cal.getTime();
+                    cal.add(Calendar.MINUTE,-15);
+                    Date beginTime=cal.getTime();
+                    List<ShutdowneventVo> vos= shutdownevent2Service.queryAlerthistoryList(String.valueOf(alerthistory1),sd.getWindturbineid(),beginTime,endTime);
+                    if(!vos.isEmpty())
+                    {
+                        ShutdowneventVo vo=vos.get(0);
+                        if(StringUtils.notEmp(vo.getWarningId()) && StringUtils.notEmp(vo.getStopTypeId()) && StringUtils.notEmp(vo.getId()))
+                        {
+                            shutdownevent2Service.updateShutdownevent(vo.getWarningId(),vo.getStopTypeId(),vo.getId());
+                        }
+                    }
+
+                }
+            }
+        }
+
+
+    }
+}

+ 25 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/IShutdownevent2Service.java

@@ -0,0 +1,25 @@
+package com.gyee.failurestatistics.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.failurestatistics.model.auto.Shutdownevent2;
+import com.gyee.failurestatistics.vo.ShutdowneventVo;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+public interface IShutdownevent2Service extends IService<Shutdownevent2> {
+
+    public List<Shutdownevent2> queryShutdowneventList(Date beginDate, Date endDate);
+
+    public List<ShutdowneventVo> queryAlerthistoryList(String alerthistory,String windturbineid,Date beginDate,Date endDate);
+
+    public int  updateShutdownevent(String warningid, String stoptypeid, String stopid);
+}

+ 16 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/IWarning2Service.java

@@ -0,0 +1,16 @@
+package com.gyee.failurestatistics.service.auto;
+
+import com.gyee.failurestatistics.model.auto.Warning2;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+public interface IWarning2Service extends IService<Warning2> {
+
+}

+ 16 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/IWindturbinePartsService.java

@@ -0,0 +1,16 @@
+package com.gyee.failurestatistics.service.auto;
+
+import com.gyee.failurestatistics.model.auto.WindturbineParts;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+public interface IWindturbinePartsService extends IService<WindturbineParts> {
+
+}

+ 46 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/impl/Shutdownevent2ServiceImpl.java

@@ -0,0 +1,46 @@
+package com.gyee.failurestatistics.service.auto.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.failurestatistics.mapper.auto.Shutdownevent2Mapper;
+import com.gyee.failurestatistics.model.auto.Shutdownevent2;
+import com.gyee.failurestatistics.service.auto.IShutdownevent2Service;
+import com.gyee.failurestatistics.vo.ShutdowneventVo;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+@Service
+public class Shutdownevent2ServiceImpl extends ServiceImpl<Shutdownevent2Mapper, Shutdownevent2> implements IShutdownevent2Service {
+
+
+    @Resource
+    private Shutdownevent2Mapper shutdownevent2Mapper;
+    @Override
+    public List<Shutdownevent2> queryShutdowneventList(Date beginDate, Date endDate) {
+
+        return shutdownevent2Mapper.queryShutdowneventList(beginDate, endDate);
+    }
+
+    @Override
+    public List<ShutdowneventVo> queryAlerthistoryList(String alerthistory,String windturbineid, Date beginDate, Date endDate) {
+
+        return shutdownevent2Mapper.queryAlerthistoryList(alerthistory,windturbineid,beginDate, endDate);
+    }
+
+    @Override
+    public int  updateShutdownevent(String warningid, String stoptypeid, String stopid)
+    {
+
+        return shutdownevent2Mapper.updateShutdownevent(warningid,stoptypeid,stopid);
+    }
+}

+ 20 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/impl/Warning2ServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.failurestatistics.service.auto.impl;
+
+import com.gyee.failurestatistics.model.auto.Warning2;
+import com.gyee.failurestatistics.mapper.auto.Warning2Mapper;
+import com.gyee.failurestatistics.service.auto.IWarning2Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+@Service
+public class Warning2ServiceImpl extends ServiceImpl<Warning2Mapper, Warning2> implements IWarning2Service {
+
+}

+ 20 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/service/auto/impl/WindturbinePartsServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.failurestatistics.service.auto.impl;
+
+import com.gyee.failurestatistics.model.auto.WindturbineParts;
+import com.gyee.failurestatistics.mapper.auto.WindturbinePartsMapper;
+import com.gyee.failurestatistics.service.auto.IWindturbinePartsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-08-30
+ */
+@Service
+public class WindturbinePartsServiceImpl extends ServiceImpl<WindturbinePartsMapper, WindturbineParts> implements IWindturbinePartsService {
+
+}

+ 22 - 0
realtime/failurestatistics-server-cph/src/main/java/com/gyee/failurestatistics/task/SaticScheduleTask.java

@@ -32,8 +32,30 @@ public class SaticScheduleTask {
     private PartstatisticsService partstatisticsService;
     @Resource
     private ParttemperatureService parttemperatureService;
+    @Resource
+    private ShutdowneventService shutdownevent2Service;
+    /**
+     * 故障统计
+     */
+    //@Scheduled(cron = "0 40 0 * * ?")
+    //或直接指定时间间隔,例如:5秒
+    //@Scheduled(fixedRate=5000)
+    @XxlJob("failurestatistics-updateShutdownevent")
+    public void configureTasks0()  {
+
 
+        XxlJobHelper.log("故障报警编号和类型修改调度程序执行开始!........");
 
+        try {
+
+            shutdownevent2Service.updateShutdownevent();
+        } catch (Exception e) {
+
+            e.printStackTrace();
+        }
+
+        XxlJobHelper.log("故障报警编号和类型修改调度任务处理完成!........");
+    }
     //3.添加定时任务
     /**
      * 故障统计

+ 78 - 0
realtime/failurestatistics-server-cph/src/main/resources/application-hf.yml

@@ -0,0 +1,78 @@
+# 项目相关配置
+gyee:
+  #实时数据库Url
+  baseurl: http://10.0.118.73:8011/ts
+  healthurl: http://10.0.118.73:8011/ts
+  #实时数据库选择
+  realtimedataBase: mongodb #数据查询模式 golden、hwy
+  initialcode: INITIAL
+server:
+  port: 8161
+  servlet:
+    context-path: /
+
+management:
+  health:
+    redis:
+      enabled: false
+
+spring:
+  main:
+    allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  autoconfigure:
+    exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driver-class-name: oracle.jdbc.OracleDriver
+    #外网
+    url: jdbc:oracle:thin:@10.0.118.71:1521:gdsj
+    username: gdprod
+    password: gd123
+    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
+    druid:
+      max-active: 20
+      initial-size: 1
+      min-idle: 3
+      max-wait: 60000
+      time-between-eviction-runs-millis: 60000
+      min-evictable-idle-time-millis: 300000
+      test-while-idle: true
+      test-on-borrow: false
+      test-on-return: false
+  servlet:
+    multipart:
+      # 开启 multipart 上传功能
+      enabled: true
+      # 文件写入磁盘的阈值
+      file-size-threshold: 2KB
+      # 最大文件大小
+      max-file-size: 200MB
+      # 最大请求大小
+      max-request-size: 215MB
+
+mybatis-plus:
+  configuration:
+    map-underscore-to-camel-case: true
+    auto-mapping-behavior: full
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  mapper-locations: classpath*:mapper/**/*Mapper.xml
+  global-config:
+    # 逻辑删除配置
+    db-config:
+      id-type: auto
+      # 删除前
+      logic-not-delete-value: 1
+      # 删除后
+      logic-delete-value: 0
+logging:
+  level:
+    root: info
+    com.example: debug
+
+edos:
+  baseURL: http://10.0.118.73:8011/ts

+ 1 - 1
realtime/failurestatistics-server-cph/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: hb
+    active: hf
 #    active: jn

+ 3 - 1
realtime/failurestatistics-server-cph/src/main/resources/xxl-job-executor.properties

@@ -1,5 +1,7 @@
 ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
-xxl.job.admin.addresses=http://192.168.2.198:8175/xxl-job-admin
+#xxl.job.admin.addresses=http://192.168.2.198:8175/xxl-job-admin
+xxl.job.admin.addresses=http://10.0.118.76:8175/xxl-job-admin
+
 
 ### xxl-job, access token
 xxl.job.accessToken=