Explorar o código

调整公司安全天数

xieshengjie hai 1 ano
pai
achega
aa25058a51

+ 14 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/CycleCalculationService.java

@@ -217,7 +217,17 @@ public class CycleCalculationService {
                 List<PointData> ssfsList = edosUtil.getHistStat(ssfsPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 1l, 900l, 2);
                 Optional<PointData> ssfsFirst = ssfsList.stream().findFirst();
                 if (ssfsFirst.isPresent()){
-                    dataMap.put("pjfs",ssfsFirst.get().getPointValueInDouble());
+                    double value = ssfsFirst.get().getPointValueInDouble();
+                    if(wt.getEquipmentCategory().equals("-1")){
+                        if(value>=0 && value<=30){
+                            dataMap.put("pjfs",value);
+                        }else {
+                            dataMap.put("pjfs",0d);
+                        }
+                    }else {
+                        dataMap.put("pjfs",value);
+                    }
+
                 }
                 List<PointData> ssglList = edosUtil.getHistStat(ssglPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 1l, 900l, 2);
                 Optional<PointData> ssglFirst = ssglList.stream().findFirst();
@@ -3997,7 +4007,9 @@ public class CycleCalculationService {
                             double power = powerDatasSnap.get(i).getPointValueInDouble();
 
                             double temp1 = zsgl - power;
-                            zsss+=temp1;
+                            if (temp1>0){
+                                zsss+=temp1;
+                            }
                         }
                     }
                 }

+ 5 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/RealtimeService.java

@@ -95,7 +95,11 @@ public class RealtimeService {
                 ssbf = speed>12?12:speed;
                 ssbfPointDate = PointUtil.createPointData(currentDate, ssbf, ssbfPoint.getNemCode(), ssbfPoint.getName());
             } else {
-                ssbf = speed>12?12:speed;
+                if (wt.getEquipmentCategory().equals("-1")){
+                    ssbf = speed>12?12:speed;
+                }else {
+                    ssbf = speed;
+                }
                 ssbfPointDate = PointUtil.createPointData(currentDate, ssbf, ssbfPoint.getNemCode(), ssbfPoint.getName());
             }
             wtResultList.add(ssbfPointDate);

+ 58 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/RegionCalreService.java

@@ -27,6 +27,59 @@ public class RegionCalreService  {
 
     @Resource
     private IEdosUtil edosUtil;
+
+
+
+
+    public void aqts() throws Exception {
+        Date currentDate = DateUtils.getCurrentDate();
+        List<ProBasicCompany> cpls = CacheContext.cpls;
+        Map<String, Map<String, ProBasicPowerstationPoint>> companypointmap = CacheContext.companypointmap;
+        List<ProBasicEnergyGroup> egls = CacheContext.egls;
+        Map<String, Map<String, ProBasicPowerstationPoint>> grouppointmap = CacheContext.grouppointmap;
+        List<ProBasicRegion> rgls = CacheContext.rgls;
+        Map<String, Map<String, ProBasicPowerstationPoint>> regionpointmap = CacheContext.regionpointmap;
+        List<PointData> resultList = new ArrayList<>();
+        List<ProBasicPowerstationPoint> points = new ArrayList<>();
+        List<String> pointstring = new ArrayList<>();
+        cpls.stream().forEach(company->{
+            ProBasicPowerstationPoint cp0Point = companypointmap.get(company.getId()+"0").get(ContantXk.AQTS);
+            ProBasicPowerstationPoint cp1Point = companypointmap.get(company.getId()+"-1").get(ContantXk.AQTS);
+            ProBasicPowerstationPoint cp2Point = companypointmap.get(company.getId()+"-2").get(ContantXk.AQTS);
+            points.add(cp0Point);
+            points.add(cp1Point);
+            points.add(cp2Point);
+        });
+        rgls.stream().forEach(company->{
+            ProBasicPowerstationPoint rg0Point = companypointmap.get(company.getId()+"0").get(ContantXk.AQTS);
+            ProBasicPowerstationPoint rg1Point = companypointmap.get(company.getId()+"-1").get(ContantXk.AQTS);
+            ProBasicPowerstationPoint rg2Point = companypointmap.get(company.getId()+"-2").get(ContantXk.AQTS);
+            points.add(rg0Point);
+            points.add(rg1Point);
+            points.add(rg2Point);
+        });
+        egls.stream().forEach(company->{
+            ProBasicPowerstationPoint eg0Point = companypointmap.get(company.getId()+"0").get(ContantXk.AQTS);
+            ProBasicPowerstationPoint eg1Point = companypointmap.get(company.getId()+"-1").get(ContantXk.AQTS);
+            ProBasicPowerstationPoint eg2Point = companypointmap.get(company.getId()+"-2").get(ContantXk.AQTS);
+            points.add(eg0Point);
+            points.add(eg1Point);
+            points.add(eg2Point);
+        });
+        points.stream().forEach(i->{
+            pointstring.add(i.getNemCode());
+        });
+
+        List<PointData> realData = edosUtil.getRealData(pointstring);
+        realData.stream().forEach(real->{
+            real.setPointValueInDouble(real.getPointValueInDouble()+1);
+            real.setPointValueInDouble2(real.getPointValueInDouble2()+1);
+            real.setPointValue(real.getPointValueInDouble()+1+"");
+            real.setPointTime(currentDate.getTime());
+        });
+        edosUtil.sendMultiPoint(realData);
+
+    }
     /**
      *
      */
@@ -561,7 +614,9 @@ public class RegionCalreService  {
         }
         Double aqts = Collections.max(aqtsList);
 
-        resultList.add(PointUtil.createPointData(currentDate,aqts,zaqtsPoint.getNemCode(),zaqtsPoint.getName()));
+
+
+//        resultList.add(PointUtil.createPointData(currentDate,aqts,zaqtsPoint.getNemCode(),zaqtsPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,zczzt,zczztPoint.getNemCode(),zczztPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,sszgl.get(),zsszglPoint.getNemCode(),zsszglPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,sszglsyz.get(),zsszglsyzPoint.getNemCode(),zsszglsyzPoint.getName()));
@@ -1019,7 +1074,7 @@ public class RegionCalreService  {
         }
 
         Double aqts = Collections.max(aqtsList);
-        resultList.add(PointUtil.createPointData(currentDate,aqts,zaqtsPoint.getNemCode(),zaqtsPoint.getName()));
+//        resultList.add(PointUtil.createPointData(currentDate,aqts,zaqtsPoint.getNemCode(),zaqtsPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,zczzt,zczztPoint.getNemCode(),zczztPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,sszgl.get(),zsszglPoint.getNemCode(),zsszglPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,sszglsyz.get(),zsszglsyzPoint.getNemCode(),zsszglsyzPoint.getName()));
@@ -1476,7 +1531,7 @@ public class RegionCalreService  {
         }
 
         Double aqts = Collections.max(aqtsList);
-        resultList.add(PointUtil.createPointData(currentDate,aqts,zaqtsPoint.getNemCode(),zaqtsPoint.getName()));
+//        resultList.add(PointUtil.createPointData(currentDate,aqts,zaqtsPoint.getNemCode(),zaqtsPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,zczzt,zczztPoint.getNemCode(),zczztPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,sszgl.get(),zsszglPoint.getNemCode(),zsszglPoint.getName()));
         resultList.add(PointUtil.createPointData(currentDate,sszglsyz.get(),zsszglsyzPoint.getNemCode(),zsszglsyzPoint.getName()));

+ 17 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticScheduleCALTask.java

@@ -1,7 +1,6 @@
 package com.gyee.generation.task;
 
 
-import com.gyee.generation.service.*;
 import com.gyee.generation.service.realtimelibrary.*;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
@@ -10,7 +9,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.Date;
 
 /**
  * @ClassName : SaticScheduleTask
@@ -218,6 +216,23 @@ public class SaticScheduleCALTask {
         XxlJobHelper.log("区域公司历史程序处理完成!........");
     }
 
+    /**
+     * 区域公司安全天数
+     * 每天0点执行
+     * 59 14/15 * * * ?
+     */
+    @XxlJob("regionCal_aqts")
+    public void regionCal_aqts()  {
+
+        XxlJobHelper.log("区域公司安全天数程序执行开始!........");
+        try {
+            regionCalreService.aqts();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("区域公司安全天数程序处理完成!........");
+    }
+