Browse Source

信控集控服务错误修改

shilin 2 years ago
parent
commit
28ea6dcdf6
14 changed files with 2247 additions and 2476 deletions
  1. 127 184
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/CoefficientService.java
  2. 12 16
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo15minuteService.java
  3. 86 103
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java
  4. 113 139
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  5. 114 143
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java
  6. 451 469
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  7. 92 112
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java
  8. 202 178
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java
  9. 156 180
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java
  10. 128 168
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java
  11. 129 168
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java
  12. 374 397
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo4Service.java
  13. 88 98
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java
  14. 175 121
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo6Service.java

+ 127 - 184
realtime/generationXK-service/src/main/java/com/gyee/generation/service/CoefficientService.java

@@ -1,20 +1,17 @@
 package com.gyee.generation.service;
 
-import com.gyee.common.contant.Contant;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconActivePowerData;
+import com.gyee.generation.model.auto.ProEconWtPowerCurveFitting;
 import com.gyee.generation.model.vo.StatData;
-import com.gyee.generation.service.auto.IProEconActivePowerDataService;
-import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
-import com.gyee.generation.service.auto.IProEconEquipmentInfoDay2Service;
 import com.gyee.generation.service.auto.IProEconWtPowerCurveFittingService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -24,63 +21,50 @@ import java.util.stream.Collectors;
 @Service
 public class CoefficientService {
 
+    //
+//    private static final Logger logger = LoggerFactory.getLogger(CoefficientService.class);
+    @Resource
+    private IEdosUtil edosUtil;
+    @Resource
+    private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
 
-        private static final Logger logger = LoggerFactory.getLogger(CoefficientService.class);
-        @Resource
-        private IEdosUtil edosUtil;
 
-        @Resource
-        private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
-        private IProEconEquipmentInfoDay2Service proEconEquipmentInfoDay2Service;
-
-        private IProEconActivePowerDataService proEconActivePowerDataService;
-
-
-        private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
-
-
-
-    public  Map<String,Map<String,Double>>  coefficient(Date currentDate) throws Exception {
+    public Map<String, Map<String, Double>> coefficient(Date currentDate) throws Exception {
         //调度时间是第二天,currentDate 是第一天
 
         currentDate = DateUtils.truncDay(currentDate);
 
-        Calendar c= Calendar.getInstance();
+        Calendar c = Calendar.getInstance();
         c.setTime(currentDate);
 
-        c.set(Calendar.DAY_OF_MONTH,1);
+        c.set(Calendar.DAY_OF_MONTH, 1);
         Date monthbeginDate = c.getTime();
-        c.set(Calendar.MONTH,0);
+        c.set(Calendar.MONTH, 0);
         Date yearbeginDate = c.getTime();
 
         c.setTime(currentDate);
         Date beginDate = c.getTime();
-        c.add(Calendar.DAY_OF_MONTH,1);
+        c.add(Calendar.DAY_OF_MONTH, 1);
         Date endDate = c.getTime();
 
-        Map<String,Map<String,Double>> resultmap =new HashMap<>();
-            //查询风机
-            List<ProBasicEquipment> wtls = CacheContext.wtls;
+        Map<String, Map<String, Double>> resultmap = new HashMap<>();
+        //查询风机
+        List<ProBasicEquipment> wtls = CacheContext.wtls;
 
-            //遍历所有风机ID
-            for (ProBasicEquipment wt : wtls)
-            {
+        //遍历所有风机ID
+        for (ProBasicEquipment wt : wtls) {
 
-                Map<String/*风机编号*/, Map<Double/*风速*/, List<Double>/*对应功率集合*/>> map =
-                        new HashMap<String, Map<Double, List<Double>>>();
 
-/**********************************************年功率一致性统计***************************************************************/
+            List<ProEconActivePowerData> yearList;
 
-                List<ProEconActivePowerData> yearList = new ArrayList<ProEconActivePowerData>();
+            List<ProEconActivePowerData> queryYear = new ArrayList<>();
 
-                List<ProEconActivePowerData> queryYear =new ArrayList<>();
+            Map<String, ProBasicEquipmentPoint> wtpointmap = CacheContext.wtpAimap.get(wt.getId());
+            ProBasicEquipmentPoint fspoint = wtpointmap.get(ContantXk.CJ_SSFS);
+            List<PointData> fsls = edosUtil.getHistStat(fspoint.getNemCode(), yearbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
 
-                Map<String, ProBasicEquipmentPoint> wtpointmap= CacheContext.wtpAimap.get(wt.getId());
-                ProBasicEquipmentPoint fspoint=wtpointmap.get(ContantXk.CJ_SSFS);
-                List<PointData>  fsls=edosUtil.getHistStat(fspoint.getNemCode(),yearbeginDate.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
-
-                ProBasicEquipmentPoint glpoint=wtpointmap.get(ContantXk.CJ_SSGL);
-                List<PointData>  glls=edosUtil.getHistStat(glpoint.getNemCode(),yearbeginDate.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
+            ProBasicEquipmentPoint glpoint = wtpointmap.get(ContantXk.CJ_SSGL);
+            List<PointData> glls = edosUtil.getHistStat(glpoint.getNemCode(), yearbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
 
                 if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
                 {
@@ -100,109 +84,100 @@ public class CoefficientService {
                 }
 
 
-                yearList=calCoefficient(queryYear,wt);
+            yearList = calCoefficient(queryYear, wt);
 
-/*****************************************月功率一致性统计********************************************************************/
+//****************************************月功率一致性统计********************************************************************/
 
-                List<ProEconActivePowerData> monthList = new ArrayList<ProEconActivePowerData>();
-                List<ProEconActivePowerData> queryMonth =new ArrayList<>();
+            List<ProEconActivePowerData> monthList;
+            List<ProEconActivePowerData> queryMonth = new ArrayList<>();
 
 
-               fsls=edosUtil.getHistStat(fspoint.getNemCode(),monthbeginDate.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
-               glls=edosUtil.getHistStat(glpoint.getNemCode(),monthbeginDate.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
+            fsls = edosUtil.getHistStat(fspoint.getNemCode(), monthbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
+            glls = edosUtil.getHistStat(glpoint.getNemCode(), monthbeginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
 
-                if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
-                {
-                    for(int i=0;i<fsls.size();i++)
-                    {
-                        PointData fspd=fsls.get(i);
-                        PointData glpd=fsls.get(i);
-                        ProEconActivePowerData po=new ProEconActivePowerData();
-                        po.setWindturbineId(wt.getId());
-                        po.setModelId(wt.getModelId());
-                        po.setWindpowerstationId(wt.getWindpowerstationId());
-                        po.setFrequency(fsls.size());
-                        po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
-                        po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
-                        queryMonth.add(po);
-                    }
+            if (!fsls.isEmpty() && !glls.isEmpty() && fsls.size() == glls.size()) {
+                for (int i = 0; i < fsls.size(); i++) {
+                    PointData fspd = fsls.get(i);
+                    PointData glpd = fsls.get(i);
+                    ProEconActivePowerData po = new ProEconActivePowerData();
+                    po.setWindturbineId(wt.getId());
+                    po.setModelId(wt.getModelId());
+                    po.setWindpowerstationId(wt.getWindpowerstationId());
+                    po.setFrequency(fsls.size());
+                    po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(), 2));
+                    po.setPower(StringUtils.round(glpd.getPointValueInDouble(), 2));
+                    queryMonth.add(po);
                 }
+            }
 
 
-                monthList=calCoefficient(queryMonth,wt);
-
+            monthList = calCoefficient(queryMonth, wt);
 
 
-/*****************************************日功率一致性统计********************************************************************/
+//*****************************************日功率一致性统计********************************************************************/
 
 
-                List<ProEconActivePowerData> dayList = new ArrayList<ProEconActivePowerData>();
+            List<ProEconActivePowerData> dayList;
 
 
-                List<ProEconActivePowerData> queryDay =new ArrayList<>();
+            List<ProEconActivePowerData> queryDay = new ArrayList<>();
 
 
-                fsls=edosUtil.getHistStat(fspoint.getNemCode(),beginDate.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
-                glls=edosUtil.getHistStat(glpoint.getNemCode(),beginDate.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
+            fsls = edosUtil.getHistStat(fspoint.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
+            glls = edosUtil.getHistStat(glpoint.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L, StatData.AVG.getValue());
 
-                if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
-                {
-                    for(int i=0;i<fsls.size();i++)
-                    {
-                        PointData fspd=fsls.get(i);
-                        PointData glpd=fsls.get(i);
-                        ProEconActivePowerData po=new ProEconActivePowerData();
-                        po.setWindturbineId(wt.getId());
-                        po.setModelId(wt.getModelId());
-                        po.setWindpowerstationId(wt.getWindpowerstationId());
-                        po.setFrequency(fsls.size());
-                        po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(),2));
-                        po.setPower(StringUtils.round(glpd.getPointValueInDouble(),2));
-                        queryDay.add(po);
-                    }
+            if (!fsls.isEmpty() && !glls.isEmpty() && fsls.size() == glls.size()) {
+                for (int i = 0; i < fsls.size(); i++) {
+                    PointData fspd = fsls.get(i);
+                    PointData glpd = fsls.get(i);
+                    ProEconActivePowerData po = new ProEconActivePowerData();
+                    po.setWindturbineId(wt.getId());
+                    po.setModelId(wt.getModelId());
+                    po.setWindpowerstationId(wt.getWindpowerstationId());
+                    po.setFrequency(fsls.size());
+                    po.setSpeed(StringUtils.round(fspd.getPointValueInDouble(), 2));
+                    po.setPower(StringUtils.round(glpd.getPointValueInDouble(), 2));
+                    queryDay.add(po);
                 }
-                dayList=calCoefficient(queryDay,wt);
-
-
+            }
+            dayList = calCoefficient(queryDay, wt);
 
-                Double resultYear = coefficient(yearList, currentDate, wt.getId());
-                Double resultMonth = coefficient(monthList, currentDate, wt.getId());
-                Double resultDay = coefficient(dayList, currentDate, wt.getId());
 
-                Map<String,Double> tempmap=new HashMap<>();
-                tempmap.put("year",resultYear);
-                tempmap.put("month",resultMonth);
-                tempmap.put("day",resultDay);
-                resultmap.put(wt.getId(),tempmap);
+            Double resultYear = coefficient(yearList, currentDate, wt.getId());
+            Double resultMonth = coefficient(monthList, currentDate, wt.getId());
+            Double resultDay = coefficient(dayList, currentDate, wt.getId());
 
-            }
+            Map<String, Double> tempmap = new HashMap<>();
+            tempmap.put("year", resultYear);
+            tempmap.put("month", resultMonth);
+            tempmap.put("day", resultDay);
+            resultmap.put(wt.getId(), tempmap);
 
+        }
 
 
-            return resultmap;
+        return resultmap;
     }
 
 
-    private List<ProEconActivePowerData> calCoefficient(List<ProEconActivePowerData> query, ProBasicEquipment wt)
-    {
+    private List<ProEconActivePowerData> calCoefficient(List<ProEconActivePowerData> query, ProBasicEquipment wt) {
 
 
         Map<Double, List<ProEconActivePowerData>> apdataYearMap = query.stream().collect(Collectors.groupingBy(ProEconActivePowerData::getSpeed));
 
 
-        Map<Double, Double> speedAndPowerYearMap=new HashMap<Double, Double>();
-        apdataYearMap.forEach((key,value)->{
-            DoubleSummaryStatistics summaryStatistics=value.stream().mapToDouble(n -> n.getPower()).summaryStatistics();
-            speedAndPowerYearMap.put(key,summaryStatistics.getAverage());
+        Map<Double, Double> speedAndPowerYearMap = new HashMap<>();
+        apdataYearMap.forEach((key, value) -> {
+            DoubleSummaryStatistics summaryStatistics = value.stream().mapToDouble(ProEconActivePowerData::getPower).summaryStatistics();
+            speedAndPowerYearMap.put(key, summaryStatistics.getAverage());
         });
 
-        List<ProEconActivePowerData> yearList = new ArrayList<ProEconActivePowerData>();
+        List<ProEconActivePowerData> yearList = new ArrayList<>();
 
 
+        speedAndPowerYearMap.forEach((key, value) -> {
 
-        speedAndPowerYearMap.forEach((key,value)->{
-
-            ProEconActivePowerData activepowerdata= new ProEconActivePowerData();
+            ProEconActivePowerData activepowerdata = new ProEconActivePowerData();
             activepowerdata.setWindturbineId(wt.getId());
             activepowerdata.setSpeed(key);
             activepowerdata.setPower(value);
@@ -218,117 +193,85 @@ public class CoefficientService {
 
 
     //功率一致性系数
-    private Double coefficient(List<ProEconActivePowerData> dataList, Date currentDate, String windturbineId)
-    {
-        Double result=0.0;
-        Double count =0.0;
+    private Double coefficient(List<ProEconActivePowerData> dataList, Date currentDate, String windturbineId) {
+        double result = 0.0;
+        double count = 0.0;
+
+        if (dataList != null && dataList.size() != 0) {
 
-        if (dataList != null && dataList.size() != 0)
-        {
+            List<ProEconWtPowerCurveFitting> powerList;
 
-            List<ProEconWtPowerCurveFitting> powerList = null;
-  
-                Calendar c=Calendar.getInstance();
-                c.setTime(currentDate);
-                String year =String.valueOf(c.get(Calendar.YEAR));
-                String month = String.valueOf(c.get(Calendar.MONTH)+1);
+            Calendar c = Calendar.getInstance();
+            c.setTime(currentDate);
 
-                powerList = proEconWtPowerCurveFittingService.list().stream()
-                        .filter(i->i.getWindturbineId().equals(windturbineId)).collect(Collectors.toList());
 
-      
+            powerList = proEconWtPowerCurveFittingService.list().stream()
+                    .filter(i -> i.getWindturbineId().equals(windturbineId)).collect(Collectors.toList());
 
 
-            for (ProEconActivePowerData data : dataList)
-            {
+            for (ProEconActivePowerData data : dataList) {
                 Double p1 = data.getPower();
                 Double speed = data.getSpeed();
-                if (speed < 3 || speed > 25)
-                {
+                if (speed < 3 || speed > 25) {
                     continue;
                 }
-                
-                if (CacheContext.wtmap.containsKey(windturbineId))
-                {
-                    ProBasicEquipment wt=CacheContext.wtmap.get(windturbineId);
 
-                    if (wt.getWindpowerstationId().contains("GDC"))
-                    {
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+
+                    if (wt.getWindpowerstationId().contains("GDC")) {
                         speed /= 100;
                         speed = StringUtils.round(speed, 2);
                         speed *= 100;
 
                         speed = StringUtils.round(speed, 2);
-                    }
-                    else
-                    {
+                    } else {
                         speed = StringUtils.round(speed, 2);
                     }
                 }
-      
-
 
 
-                if (CacheContext.modelpowermap.containsKey(data.getModelId()))
-                {
-                    if (CacheContext.modelpowermap.get(data.getModelId()).size() > 0)
-                    {
-                        if (CacheContext.modelpowermap.get(data.getModelId()).containsKey(speed))
-                        {
+                if (CacheContext.modelpowermap.containsKey(data.getModelId())) {
+                    if (CacheContext.modelpowermap.get(data.getModelId()).size() > 0) {
+                        if (CacheContext.modelpowermap.get(data.getModelId()).containsKey(speed)) {
                             Double p = CacheContext.modelpowermap.get(data.getModelId()).get(speed).getEnsurePower();
 
 
-                            if (p != 0)
-                            {
-                                for (int i = 0; i < data.getFrequency(); i++)
-                                {
+                            if (p != 0) {
+                                for (int i = 0; i < data.getFrequency(); i++) {
                                     result += Math.abs((p - p1) / p);
                                     count += 1;
                                 }
                             }
                         }
-                    }
-                    else
-                    {
-                        if (powerList != null && powerList.size() > 0)
-                        {
+                    } else {
+                        if (powerList.size() > 0) {
                             Double finalSpeed = speed;
-                            OptionalDouble opd = powerList.stream().filter(i->i.getSpeed()== finalSpeed).mapToDouble(x->x.getOptimalPower()).findFirst();
-
-
-                            double p=0.0;
-                            if (opd.isPresent())
-                            {
-                                p=opd.getAsDouble();
-                                if (p != 0)
-                                {
-                                    for (int i = 0; i < data.getFrequency(); i++)
-                                    {
-                                        result += Math.abs((p- p1) / p);
+                            OptionalDouble opd = powerList.stream().filter(i -> Objects.equals(i.getSpeed(), finalSpeed)).mapToDouble(ProEconWtPowerCurveFitting::getOptimalPower).findFirst();
+
+
+                            double p;
+                            if (opd.isPresent()) {
+                                p = opd.getAsDouble();
+                                if (p != 0) {
+                                    for (int i = 0; i < data.getFrequency(); i++) {
+                                        result += Math.abs((p - p1) / p);
                                         count += 1;
                                     }
                                 }
-                            }
-                            else
-                            {
+                            } else {
 
-                                DoubleSummaryStatistics summaryStatistics=powerList.stream().mapToDouble(ProEconWtPowerCurveFitting::getSpeed).summaryStatistics();
+                                DoubleSummaryStatistics summaryStatistics = powerList.stream().mapToDouble(ProEconWtPowerCurveFitting::getSpeed).summaryStatistics();
 
-                                Double max = summaryStatistics.getMax();
-                                if (speed > max)
-                                {
-                                    summaryStatistics=powerList.stream().mapToDouble(ProEconWtPowerCurveFitting::getActualPower).summaryStatistics();
+                                double max = summaryStatistics.getMax();
+                                if (speed > max) {
+                                    summaryStatistics = powerList.stream().mapToDouble(ProEconWtPowerCurveFitting::getActualPower).summaryStatistics();
                                     p = summaryStatistics.getMax();
-                                    if (p != 0.0)
-                                    {
-
-                                        if (p != 0)
-                                        {
-                                            for (int i = 0; i < data.getFrequency(); i++)
-                                            {
-                                                result += Math.abs((p - p1) / p);
-                                                count += 1;
-                                            }
+                                    if (p != 0.0) {
+
+                                        for (int i = 0; i < data.getFrequency(); i++) {
+                                            result += Math.abs((p - p1) / p);
+                                            count += 1;
                                         }
                                     }
                                 }

+ 12 - 16
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo15minuteService.java

@@ -4,15 +4,13 @@ import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProEconEquipmentInfo15minute;
 import com.gyee.generation.service.auto.IProEconEquipmentInfo15minuteService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -24,7 +22,7 @@ import java.util.stream.Collectors;
 @Service
 public class EquipmentInfo15minuteService {
 
-    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo15minuteService.class);
+//    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo15minuteService.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -35,8 +33,6 @@ public class EquipmentInfo15minuteService {
 
     /**
      * 计算设备15分钟信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calLineInfoMinute15(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -53,7 +49,7 @@ public class EquipmentInfo15minuteService {
            ).map(ProEconEquipmentInfo15minute::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconEquipmentInfo15minuteService.removeByIds(idls);
 
@@ -81,7 +77,7 @@ public class EquipmentInfo15minuteService {
                     List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
                     if(!pointls.isEmpty())
                     {
-                        DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                        DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                         //15分钟平均风速
                         pewp.setFpjfs(summaryStatistics.getAverage());
                     }
@@ -94,7 +90,7 @@ public class EquipmentInfo15minuteService {
                     List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
                     if(!pointls.isEmpty())
                     {
-                        DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                        DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                         //15分钟平均功率
                         pewp.setFpjgl(summaryStatistics.getAverage());
                     }
@@ -162,9 +158,9 @@ public class EquipmentInfo15minuteService {
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
 
 
-            lastState=-1;//上一分钟状态
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.MXZT));
+        //上一分钟状态
+        Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
+            if(wtpAimap.containsKey(ContantXk.MXZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
@@ -372,7 +368,7 @@ public class EquipmentInfo15minuteService {
 
 
 
-/*******************************************15分钟信息统计*********************************************************/
+//*******************************************15分钟信息统计*********************************************************/
 
 
 
@@ -390,7 +386,7 @@ public class EquipmentInfo15minuteService {
 //        4	限电
 //        5	受累
 //        6	离线
-/*******************************************15分钟信息统计*********************************************************/
+//*******************************************15分钟信息统计*********************************************************/
 
             double lastState = -1;//上一分钟状态
 
@@ -408,7 +404,7 @@ public class EquipmentInfo15minuteService {
 
 
             Map<String, ProBasicEquipmentPoint> aimap = wtpAimap.get(wt.getNemCode());
-            if (wtpAimap.containsKey(ContantXk.SBZT)) ;
+            if (wtpAimap.containsKey(ContantXk.SBZT))
             {
 
                 ProBasicEquipmentPoint point = aimap.get(ContantXk.SBZT);
@@ -510,7 +506,7 @@ public class EquipmentInfo15minuteService {
             pewp.setFslxs(new BigDecimal(slsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
 
 
-            /*******************************************15分钟信息统计*********************************************************/
+            //*******************************************15分钟信息统计*********************************************************/
         }
 
 

+ 86 - 103
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java

@@ -4,14 +4,13 @@ import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
-
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -23,7 +22,7 @@ import java.util.stream.Collectors;
 @Service
 public class EquipmentInfo1Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo1Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo1Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -36,8 +35,6 @@ public class EquipmentInfo1Service {
 
     /**
      * 计算设备日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -53,7 +50,7 @@ public class EquipmentInfo1Service {
                         && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconEquipmentInfoDay1::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconEquipmentInfoDay1Service.removeByIds(idls);
 
@@ -96,14 +93,14 @@ public class EquipmentInfo1Service {
     }
 
     private void extracted(Date recordDate, Date end, Date begin,Map<String, ProBasicEquipmentPoint> pointmap, ProEconEquipmentInfoDay1 pewp,List<ProEconEquipmentInfoDay1> pepid1ls) throws Exception {
-        /*******************************************日信息统计*********************************************************/
+        //*******************************************日信息统计*********************************************************/
         if(pointmap.containsKey(ContantXk.SSPJFS))
         {
             ProBasicEquipmentPoint point= pointmap.get(ContantXk.SSPJFS);
             List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
             if(!pointls.isEmpty())
             {
-                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                 //日最大风速
                 pewp.setRzdfs(summaryStatistics.getMax());
                 //日最小风速
@@ -120,7 +117,7 @@ public class EquipmentInfo1Service {
             List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
             if(!pointls.isEmpty())
             {
-                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                 //日最大功率
                 pewp.setRzdgl(summaryStatistics.getMax());
                 //日最小功率
@@ -344,64 +341,57 @@ public class EquipmentInfo1Service {
             }
         }
 
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
         if(pepid1ls.isEmpty())
         {
-            setPowerandSpeedMonth(end, begin, pointmap, pewp);
+            setPowerandSpeedMonth(pewp);
         }else
         {
 
 
-            if(!pepid1ls.isEmpty())
-            {
-               ProEconEquipmentInfoDay1 pepid=pepid1ls.get(0);
-
-               //如果昨日大于今日最大功率
-                if(pepid.getYzdgl()> pewp.getRzdgl())
-                {
-                    pewp.setYzdgl(pepid.getYzdgl());
-                }else {
-                    pewp.setYzdgl(pewp.getRzdgl());
-                }
-                //如果昨日大于今日最大风速
-                if(pepid.getYzdfs()> pewp.getRzdfs())
-                {
-                    pewp.setYzdfs(pepid.getYzdfs());
-                }else
-                {
-                    pewp.setYzdfs(pewp.getRzdfs());
-                }
-
-                //如果昨日小于今日最小功率
-                if(pepid.getYzxgl()< pewp.getRzxgl())
-                {
-                    pewp.setYzxgl(pepid.getYzxgl());
-                }else
-                {
-                    pewp.setYzxgl(pewp.getRzxgl());
-                }
-                //如果昨日小于今日最小风速
-                if(pepid.getYzxfs()< pewp.getRzxfs())
-                {
-                    pewp.setYzxfs(pepid.getYzxfs());
-                }else
-                {
-                    pewp.setYzxfs(pewp.getRzxfs());
-                }
-                double   pjfs = new BigDecimal(pewp.getYpjfs()+pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            ProEconEquipmentInfoDay1 pepid=pepid1ls.get(0);
 
-                pewp.setYzxfs(pjfs);
-
-                double   pjgl = new BigDecimal(pewp.getYpjgl()+pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-                pewp.setYzxgl(pjgl);
+            //如果昨日大于今日最大功率
+            if(pepid.getYzdgl()> pewp.getRzdgl())
+            {
+                pewp.setYzdgl(pepid.getYzdgl());
+            }else {
+                pewp.setYzdgl(pewp.getRzdgl());
+            }
+            //如果昨日大于今日最大风速
+            if(pepid.getYzdfs()> pewp.getRzdfs())
+            {
+                pewp.setYzdfs(pepid.getYzdfs());
+            }else
+            {
+                pewp.setYzdfs(pewp.getRzdfs());
+            }
 
+            //如果昨日小于今日最小功率
+            if(pepid.getYzxgl()< pewp.getRzxgl())
+            {
+                pewp.setYzxgl(pepid.getYzxgl());
             }else
             {
-                setPowerandSpeedMonth(end, begin, pointmap, pewp);
+                pewp.setYzxgl(pewp.getRzxgl());
             }
+            //如果昨日小于今日最小风速
+            if(pepid.getYzxfs()< pewp.getRzxfs())
+            {
+                pewp.setYzxfs(pepid.getYzxfs());
+            }else
+            {
+                pewp.setYzxfs(pewp.getRzxfs());
+            }
+            double   pjfs = BigDecimal.valueOf(pewp.getYpjfs() + pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+
+            pewp.setYzxfs(pjfs);
+
+            double   pjgl = BigDecimal.valueOf(pewp.getYpjgl() + pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            pewp.setYzxgl(pjgl);
 
         }
 
@@ -621,62 +611,55 @@ public class EquipmentInfo1Service {
         }
 
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
         if(pepid1ls.isEmpty())
         {
-            setPowerandSpeedYear(end, begin, pointmap, pewp);
+            setPowerandSpeedYear(pewp);
         }else
         {
 
-            if(!pepid1ls.isEmpty())
-            {
-                ProEconEquipmentInfoDay1 pepid=pepid1ls.get(0);
-
-                //如果昨日大于今日最大功率
-                if(pepid.getNzdgl()> pewp.getRzdgl())
-                {
-                    pewp.setNzdgl(pepid.getNzdgl());
-                }else {
-                    pewp.setNzdgl(pewp.getRzdgl());
-                }
-                //如果昨日大于今日最大风速
-                if(pepid.getNzdfs()> pewp.getRzdfs())
-                {
-                    pewp.setNzdfs(pepid.getNzdfs());
-                }else
-                {
-                    pewp.setNzdfs(pewp.getRzdfs());
-                }
-
-                //如果昨日小于今日最小功率
-                if(pepid.getNzxgl()< pewp.getRzxgl())
-                {
-                    pewp.setNzxgl(pepid.getNzxgl());
-                }else
-                {
-                    pewp.setNzxgl(pewp.getRzxgl());
-                }
-                //如果昨日小于今日最小风速
-                if(pepid.getNzxfs()< pewp.getRzxfs())
-                {
-                    pewp.setNzxfs(pepid.getNzxfs());
-                }else
-                {
-                    pewp.setNzxfs(pewp.getRzxfs());
-                }
-                double   pjfs = new BigDecimal(pewp.getNpjfs()+pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            ProEconEquipmentInfoDay1 pepid=pepid1ls.get(0);
 
-                pewp.setNzxfs(pjfs);
-
-                double   pjgl = new BigDecimal(pewp.getNpjgl()+pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-                pewp.setNzxgl(pjgl);
+            //如果昨日大于今日最大功率
+            if(pepid.getNzdgl()> pewp.getRzdgl())
+            {
+                pewp.setNzdgl(pepid.getNzdgl());
+            }else {
+                pewp.setNzdgl(pewp.getRzdgl());
+            }
+            //如果昨日大于今日最大风速
+            if(pepid.getNzdfs()> pewp.getRzdfs())
+            {
+                pewp.setNzdfs(pepid.getNzdfs());
+            }else
+            {
+                pewp.setNzdfs(pewp.getRzdfs());
+            }
 
+            //如果昨日小于今日最小功率
+            if(pepid.getNzxgl()< pewp.getRzxgl())
+            {
+                pewp.setNzxgl(pepid.getNzxgl());
             }else
             {
-                setPowerandSpeedYear(end, begin, pointmap, pewp);
+                pewp.setNzxgl(pewp.getRzxgl());
             }
+            //如果昨日小于今日最小风速
+            if(pepid.getNzxfs()< pewp.getRzxfs())
+            {
+                pewp.setNzxfs(pepid.getNzxfs());
+            }else
+            {
+                pewp.setNzxfs(pewp.getRzxfs());
+            }
+            double   pjfs = BigDecimal.valueOf(pewp.getNpjfs() + pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+
+            pewp.setNzxfs(pjfs);
+
+            double   pjgl = BigDecimal.valueOf(pewp.getNpjgl() + pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            pewp.setNzxgl(pjgl);
 
         }
 
@@ -894,7 +877,7 @@ public class EquipmentInfo1Service {
         }
     }
 
-    private void setPowerandSpeedYear(Date end, Date begin, Map<String, ProBasicEquipmentPoint> pointmap, ProEconEquipmentInfoDay1 pewp) throws Exception {
+    private void setPowerandSpeedYear(ProEconEquipmentInfoDay1 pewp) {
         //年最大风速
         pewp.setNzdfs(pewp.getRzdfs());
         //年最小风速
@@ -911,7 +894,7 @@ public class EquipmentInfo1Service {
 
     }
 
-    private void setPowerandSpeedMonth(Date end, Date begin, Map<String, ProBasicEquipmentPoint> pointmap, ProEconEquipmentInfoDay1 pewp) throws Exception {
+    private void setPowerandSpeedMonth(ProEconEquipmentInfoDay1 pewp) {
 
         //月最大风速
         pewp.setYzdfs(pewp.getRzdfs());

+ 113 - 139
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java

@@ -4,13 +4,13 @@ import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay2;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay2Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
 @Service
 public class EquipmentInfo2Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo2Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo2Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -33,8 +33,6 @@ public class EquipmentInfo2Service {
 
     /**
      * 计算设备日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calEquipmentInfoDay2(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -51,7 +49,7 @@ public class EquipmentInfo2Service {
            ).map(ProEconEquipmentInfoDay2::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconEquipmentInfoDay2Service.removeByIds(idls);
 
@@ -110,7 +108,7 @@ public class EquipmentInfo2Service {
 //                12	通讯中断
 //                13	设备离线
 
-        double lastState=-1;//上一分钟状态
+        double lastState;//上一分钟状态
 
         double djsc=0;//待机时长
         double sdtjsc=0;//手动停机时长
@@ -131,8 +129,9 @@ public class EquipmentInfo2Service {
 
 
             lastState=-1;//上一分钟状态
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.MXZT));
+            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+
+            if(aimap.containsKey(ContantXk.MXZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
@@ -340,9 +339,9 @@ public class EquipmentInfo2Service {
 
 
 
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
         if(pepidls.isEmpty())
         {
@@ -352,93 +351,80 @@ public class EquipmentInfo2Service {
         {
 
 
-            if(!pepidls.isEmpty())
-            {
-               ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
-
-                //月合计故障小时(明细)
-                pewp.setYgzxsmx(StringUtils.round(pepid.getYgzxsmx()+pewp.getRgzxsmx(),2));
-                //月合计场内受累故障小时(明细)
-                pewp.setYcnslgzxsmx(StringUtils.round(pepid.getYcnslgzxsmx()+pewp.getRcnslgzxsmx(),2));
-                //月合计检修小时(明细)
-                pewp.setYjxxsmx(StringUtils.round(pepid.getYjxxsmx()+pewp.getRjxxsmx(),2));
-                //月合计场内受累检修小时(明细)
-                pewp.setYcnsljxxsmx(StringUtils.round( pepid.getYcnsljxxsmx()+pewp.getRcnsljxxsmx(),2));
-                //月合计待机小时(明细)
-                pewp.setYdjxsmx(StringUtils.round(pepid.getYdjxsmx()+pewp.getRdjxsmx(),2));
-                //月合计缺陷降出力小时(明细)
-                pewp.setYqxjclxsmx(StringUtils.round(pepid.getYqxjclxsmx()+pewp.getRqxjclxsmx(),2));
-                //月合计手动停机小时(明细)
-                pewp.setYsdtjxsmx(StringUtils.round(pepid.getYsdtjxsmx()+pewp.getRsdtjxsmx(),2));
-                //月合计性能小时(明细)
-                pewp.setYbwxsmx(StringUtils.round(pepid.getYbwxsmx()+pewp.getRbwxsmx(),2));
-                //月合计限电停机小时(明细)
-                pewp.setYxdtjxsmx(StringUtils.round(pepid.getYxdtjxsmx()+pewp.getRxdtjxsmx(),2));
-                //月合计限电降出力小时(明细)
-                pewp.setYxdjclxsmx(StringUtils.round(pepid.getYxdjclxsmx()+pewp.getRxdjclxsmx(),2));
-                //月合计场外受累电网小时(明细)
-                pewp.setYcwsldwxsmx(StringUtils.round(pepid.getYcwsldwxsmx()+pewp.getRcwsldwxsmx(),2));
-                //月合计场外受累电网小时(明细)
-                pewp.setYcwsltqxsmx(StringUtils.round(pepid.getYcwsltqxsmx()+pewp.getRcwsltqxsmx(),2));
-                //月合计通讯中断小时(明细)
-                pewp.setYtxzdxsmx(StringUtils.round(pepid.getYtxzdxsmx()+pewp.getRtxzdxsmx(),2));
-                //月合计离线小时(明细)
-                pewp.setYlxxsmx(StringUtils.round(pepid.getYlxxsmx()+pewp.getRlxxsmx(),2));
-            }else
-            {
-                setLossHoursMonth(pewp);
-            }
+            ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+            //月合计故障小时(明细)
+            pewp.setYgzxsmx(StringUtils.round(pepid.getYgzxsmx()+pewp.getRgzxsmx(),2));
+            //月合计场内受累故障小时(明细)
+            pewp.setYcnslgzxsmx(StringUtils.round(pepid.getYcnslgzxsmx()+pewp.getRcnslgzxsmx(),2));
+            //月合计检修小时(明细)
+            pewp.setYjxxsmx(StringUtils.round(pepid.getYjxxsmx()+pewp.getRjxxsmx(),2));
+            //月合计场内受累检修小时(明细)
+            pewp.setYcnsljxxsmx(StringUtils.round( pepid.getYcnsljxxsmx()+pewp.getRcnsljxxsmx(),2));
+            //月合计待机小时(明细)
+            pewp.setYdjxsmx(StringUtils.round(pepid.getYdjxsmx()+pewp.getRdjxsmx(),2));
+            //月合计缺陷降出力小时(明细)
+            pewp.setYqxjclxsmx(StringUtils.round(pepid.getYqxjclxsmx()+pewp.getRqxjclxsmx(),2));
+            //月合计手动停机小时(明细)
+            pewp.setYsdtjxsmx(StringUtils.round(pepid.getYsdtjxsmx()+pewp.getRsdtjxsmx(),2));
+            //月合计性能小时(明细)
+            pewp.setYbwxsmx(StringUtils.round(pepid.getYbwxsmx()+pewp.getRbwxsmx(),2));
+            //月合计限电停机小时(明细)
+            pewp.setYxdtjxsmx(StringUtils.round(pepid.getYxdtjxsmx()+pewp.getRxdtjxsmx(),2));
+            //月合计限电降出力小时(明细)
+            pewp.setYxdjclxsmx(StringUtils.round(pepid.getYxdjclxsmx()+pewp.getRxdjclxsmx(),2));
+            //月合计场外受累电网小时(明细)
+            pewp.setYcwsldwxsmx(StringUtils.round(pepid.getYcwsldwxsmx()+pewp.getRcwsldwxsmx(),2));
+            //月合计场外受累电网小时(明细)
+            pewp.setYcwsltqxsmx(StringUtils.round(pepid.getYcwsltqxsmx()+pewp.getRcwsltqxsmx(),2));
+            //月合计通讯中断小时(明细)
+            pewp.setYtxzdxsmx(StringUtils.round(pepid.getYtxzdxsmx()+pewp.getRtxzdxsmx(),2));
+            //月合计离线小时(明细)
+            pewp.setYlxxsmx(StringUtils.round(pepid.getYlxxsmx()+pewp.getRlxxsmx(),2));
 
         }
 
 
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
             setLossHoursYear(pewp);
         }else
         {
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
-
-                //年合计故障小时(明细)
-                pewp.setNgzxsmx(StringUtils.round(pepid.getNgzxsmx()+pewp.getRgzxsmx(),2));
-                //年合计场内受累故障小时(明细)
-                pewp.setNcnslgzxsmx(StringUtils.round(pepid.getNcnslgzxsmx()+pewp.getRcnslgzxsmx(),2));
-                //年合计检修小时(明细)
-                pewp.setNjxxsmx(StringUtils.round(pepid.getNjxxsmx()+pewp.getRjxxsmx(),2));
-                //年合计场内受累检修小时(明细)
-                pewp.setNcnsljxxsmx(StringUtils.round( pepid.getNcnsljxxsmx()+pewp.getRcnsljxxsmx(),2));
-                //年合计待机小时(明细)
-                pewp.setNdjxsmx(StringUtils.round(pepid.getNdjxsmx()+pewp.getRdjxsmx(),2));
-                //年合计缺陷降出力小时(明细)
-                pewp.setNqxjclxsmx(StringUtils.round(pepid.getNqxjclxsmx()+pewp.getRqxjclxsmx(),2));
-                //年合计手动停机小时(明细)
-                pewp.setNsdtjxsmx(StringUtils.round(pepid.getNsdtjxsmx()+pewp.getRsdtjxsmx(),2));
-                //年合计性能小时(明细)
-                pewp.setNbwxsmx(StringUtils.round(pepid.getNbwxsmx()+pewp.getRbwxsmx(),2));
-                //年合计限电停机小时(明细)
-                pewp.setNxdtjxsmx(StringUtils.round(pepid.getNxdtjxsmx()+pewp.getRxdtjxsmx(),2));
-                //年合计限电降出力小时(明细)
-                pewp.setNxdjclxsmx(StringUtils.round(pepid.getNxdjclxsmx()+pewp.getRxdjclxsmx(),2));
-                //年合计场外受累电网小时(明细)
-                pewp.setNcwsldwxsmx(StringUtils.round(pepid.getNcwsldwxsmx()+pewp.getRcwsldwxsmx(),2));
-                //年合计场外受累电网小时(明细)
-                pewp.setNcwsltqxsmx(StringUtils.round(pepid.getNcwsltqxsmx()+pewp.getRcwsltqxsmx(),2));
-                //年合计通讯中断小时(明细)
-                pewp.setNtxzdxsmx(StringUtils.round(pepid.getNtxzdxsmx()+pewp.getRtxzdxsmx(),2));
-                //年合计离线小时(明细)
-                pewp.setNlxxsmx(StringUtils.round(pepid.getNlxxsmx()+pewp.getRlxxsmx(),2));
-
-            }else
-            {
-                setLossHoursYear(pewp);
-            }
+            ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+            //年合计故障小时(明细)
+            pewp.setNgzxsmx(StringUtils.round(pepid.getNgzxsmx()+pewp.getRgzxsmx(),2));
+            //年合计场内受累故障小时(明细)
+            pewp.setNcnslgzxsmx(StringUtils.round(pepid.getNcnslgzxsmx()+pewp.getRcnslgzxsmx(),2));
+            //年合计检修小时(明细)
+            pewp.setNjxxsmx(StringUtils.round(pepid.getNjxxsmx()+pewp.getRjxxsmx(),2));
+            //年合计场内受累检修小时(明细)
+            pewp.setNcnsljxxsmx(StringUtils.round( pepid.getNcnsljxxsmx()+pewp.getRcnsljxxsmx(),2));
+            //年合计待机小时(明细)
+            pewp.setNdjxsmx(StringUtils.round(pepid.getNdjxsmx()+pewp.getRdjxsmx(),2));
+            //年合计缺陷降出力小时(明细)
+            pewp.setNqxjclxsmx(StringUtils.round(pepid.getNqxjclxsmx()+pewp.getRqxjclxsmx(),2));
+            //年合计手动停机小时(明细)
+            pewp.setNsdtjxsmx(StringUtils.round(pepid.getNsdtjxsmx()+pewp.getRsdtjxsmx(),2));
+            //年合计性能小时(明细)
+            pewp.setNbwxsmx(StringUtils.round(pepid.getNbwxsmx()+pewp.getRbwxsmx(),2));
+            //年合计限电停机小时(明细)
+            pewp.setNxdtjxsmx(StringUtils.round(pepid.getNxdtjxsmx()+pewp.getRxdtjxsmx(),2));
+            //年合计限电降出力小时(明细)
+            pewp.setNxdjclxsmx(StringUtils.round(pepid.getNxdjclxsmx()+pewp.getRxdjclxsmx(),2));
+            //年合计场外受累电网小时(明细)
+            pewp.setNcwsldwxsmx(StringUtils.round(pepid.getNcwsldwxsmx()+pewp.getRcwsldwxsmx(),2));
+            //年合计场外受累电网小时(明细)
+            pewp.setNcwsltqxsmx(StringUtils.round(pepid.getNcwsltqxsmx()+pewp.getRcwsltqxsmx(),2));
+            //年合计通讯中断小时(明细)
+            pewp.setNtxzdxsmx(StringUtils.round(pepid.getNtxzdxsmx()+pewp.getRtxzdxsmx(),2));
+            //年合计离线小时(明细)
+            pewp.setNlxxsmx(StringUtils.round(pepid.getNlxxsmx()+pewp.getRlxxsmx(),2));
 
         }
 
@@ -550,7 +536,7 @@ public class EquipmentInfo2Service {
 //        4	限电
 //        5	受累
 //        6	离线
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
         double lastState=-1;//上一分钟状态
 
@@ -568,8 +554,8 @@ public class EquipmentInfo2Service {
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
 
 
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.SBZT));
+            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+            if(aimap.containsKey(ContantXk.SBZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.SBZT);
@@ -673,9 +659,9 @@ public class EquipmentInfo2Service {
                     pewp.setRslxs(new BigDecimal(slsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
 
 
-            /*******************************************日信息统计*********************************************************/
+            //*******************************************日信息统计*********************************************************/
 
-            /*******************************************月信息统计*********************************************************/
+            //*******************************************月信息统计*********************************************************/
             if(pepidls.isEmpty())
             {
                 setLossHoursMonthSimple(pewp);
@@ -683,64 +669,52 @@ public class EquipmentInfo2Service {
             }else
             {
 
-                if(!pepidls.isEmpty())
-                {
-                    ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
-
-                    //月合计待机小时
-                    pewp.setYdjxs(StringUtils.round(pepid.getYdjxs()+pewp.getRdjxs(),2));
-                    //月合计维护停机小时
-                    pewp.setYjxtjxs(StringUtils.round(pepid.getYjxtjxs()+pewp.getRjxtjxs(),2));
-                    // 月合计故障小时
-                    pewp.setYgztjxs(StringUtils.round(pepid.getYgztjxs()+pewp.getRgztjxs(),2));
-                    //月合计运行小时
-                    pewp.setYyxxs(StringUtils.round(pepid.getYyxxs()+pewp.getRyxxs(),2));
-                    //月合计限电小时
-                    pewp.setYxdxs(StringUtils.round(pepid.getYxdxs()+pewp.getRxdxs(),2));
-                    //月合计通讯中断小时
-                    pewp.setYtxzdxs(StringUtils.round(pepid.getYtxzdxs()+pewp.getRtxzdxs(),2));
-                    //月合计受累小时
-                    pewp.setYslxs(StringUtils.round(pepid.getYslxs()+pewp.getRslxs(),2));
-                }else
-                {
-                    setLossHoursMonthSimple(pewp);
-                }
+                ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+                //月合计待机小时
+                pewp.setYdjxs(StringUtils.round(pepid.getYdjxs()+pewp.getRdjxs(),2));
+                //月合计维护停机小时
+                pewp.setYjxtjxs(StringUtils.round(pepid.getYjxtjxs()+pewp.getRjxtjxs(),2));
+                // 月合计故障小时
+                pewp.setYgztjxs(StringUtils.round(pepid.getYgztjxs()+pewp.getRgztjxs(),2));
+                //月合计运行小时
+                pewp.setYyxxs(StringUtils.round(pepid.getYyxxs()+pewp.getRyxxs(),2));
+                //月合计限电小时
+                pewp.setYxdxs(StringUtils.round(pepid.getYxdxs()+pewp.getRxdxs(),2));
+                //月合计通讯中断小时
+                pewp.setYtxzdxs(StringUtils.round(pepid.getYtxzdxs()+pewp.getRtxzdxs(),2));
+                //月合计受累小时
+                pewp.setYslxs(StringUtils.round(pepid.getYslxs()+pewp.getRslxs(),2));
 
             }
-            /*******************************************月信息统计*********************************************************/
+            //*******************************************月信息统计*********************************************************/
 
-            /*******************************************年信息统计*********************************************************/
+            //*******************************************年信息统计*********************************************************/
             if(pepidls.isEmpty())
             {
                 setLossHoursYearSimple(pewp);
 
             }else
             {
-                if(!pepidls.isEmpty())
-                {
-                    ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
-
-                    //年合计待机小时
-                    pewp.setNdjxs(StringUtils.round(pepid.getNdjxs()+pewp.getRdjxs(),2));
-                    //年合计维护停机小时
-                    pewp.setNjxtjxs(StringUtils.round(pepid.getNjxtjxs()+pewp.getRjxtjxs(),2));
-                    // 年合计故障小时
-                    pewp.setNgztjxs(StringUtils.round(pepid.getNgztjxs()+pewp.getRgztjxs(),2));
-                    //年合计运行小时
-                    pewp.setNyxxs(StringUtils.round(pepid.getNyxxs()+pewp.getRyxxs(),2));
-                    //年合计限电小时
-                    pewp.setNxdxs(StringUtils.round(pepid.getNxdxs()+pewp.getRxdxs(),2));
-                    //年合计通讯中断小时
-                    pewp.setNtxzdxs(StringUtils.round(pepid.getNtxzdxs()+pewp.getRtxzdxs(),2));
-                    //年合计受累小时
-                    pewp.setNslxs(StringUtils.round(pepid.getNslxs()+pewp.getRslxs(),2));
-                }else
-                {
-                    setLossHoursYearSimple(pewp);
-                }
+                ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+                //年合计待机小时
+                pewp.setNdjxs(StringUtils.round(pepid.getNdjxs()+pewp.getRdjxs(),2));
+                //年合计维护停机小时
+                pewp.setNjxtjxs(StringUtils.round(pepid.getNjxtjxs()+pewp.getRjxtjxs(),2));
+                // 年合计故障小时
+                pewp.setNgztjxs(StringUtils.round(pepid.getNgztjxs()+pewp.getRgztjxs(),2));
+                //年合计运行小时
+                pewp.setNyxxs(StringUtils.round(pepid.getNyxxs()+pewp.getRyxxs(),2));
+                //年合计限电小时
+                pewp.setNxdxs(StringUtils.round(pepid.getNxdxs()+pewp.getRxdxs(),2));
+                //年合计通讯中断小时
+                pewp.setNtxzdxs(StringUtils.round(pepid.getNtxzdxs()+pewp.getRtxzdxs(),2));
+                //年合计受累小时
+                pewp.setNslxs(StringUtils.round(pepid.getNslxs()+pewp.getRslxs(),2));
 
             }
-            /*******************************************年信息统计*********************************************************/
+            //*******************************************年信息统计*********************************************************/
     }
 
 

+ 114 - 143
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java

@@ -4,25 +4,23 @@ import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay3;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay3Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
 public class EquipmentInfo3Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo2Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo2Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -34,8 +32,6 @@ public class EquipmentInfo3Service {
 
     /**
      * 计算设备日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -52,7 +48,7 @@ public class EquipmentInfo3Service {
                          ).map(ProEconEquipmentInfoDay3::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconEquipmentInfoDay3Service.removeByIds(idls);
 
@@ -113,7 +109,7 @@ public class EquipmentInfo3Service {
 //                12	通讯中断
 //                13	设备离线
 
-        double lastState=-1;//上一分钟状态
+        double lastState;//上一分钟状态
 
         double djcs=0;//待机时长
         double sdtjcs=0;//手动停机时长
@@ -135,8 +131,8 @@ public class EquipmentInfo3Service {
 
 
             lastState=-1;//上一分钟状态
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.MXZT));
+            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+            if(aimap.containsKey(ContantXk.MXZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
@@ -342,9 +338,9 @@ public class EquipmentInfo3Service {
         //日合计离线次数(明细)
         pewp.setRlxcsmx(sblxcs);
 
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
         if(pepidls.isEmpty())
         {
@@ -354,93 +350,80 @@ public class EquipmentInfo3Service {
         {
 
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
-
-                //月合计故障次数(明细)
-                pewp.setYgzcsmx(StringUtils.round(pepid.getYgzcsmx()+pewp.getRgzcsmx(),2));
-                //月合计场内受累故障次数(明细)
-                pewp.setYcnslgzcsmx(StringUtils.round(pepid.getYcnslgzcsmx()+pewp.getRcnslgzcsmx(),2));
-                //月合计检修次数(明细)
-                pewp.setYjxcsmx(StringUtils.round(pepid.getYjxcsmx()+pewp.getRjxcsmx(),2));
-                //月合计场内受累检修次数(明细)
-                pewp.setYcnsljxcsmx(StringUtils.round( pepid.getYcnsljxcsmx()+pewp.getRcnsljxcsmx(),2));
-                //月合计待机次数(明细)
-                pewp.setYdjcsmx(StringUtils.round(pepid.getYdjcsmx()+pewp.getRdjcsmx(),2));
-                //月合计缺陷降出力次数(明细)
-                pewp.setYqxjclcsmx(StringUtils.round(pepid.getYqxjclcsmx()+pewp.getRqxjclcsmx(),2));
-                //月合计手动停机次数(明细)
-                pewp.setYsdtjcsmx(StringUtils.round(pepid.getYsdtjcsmx()+pewp.getRsdtjcsmx(),2));
-                //月合计性能次数(明细)
-                pewp.setYbwcsmx(StringUtils.round(pepid.getYbwcsmx()+pewp.getRbwcsmx(),2));
-                //月合计限电停机次数(明细)
-                pewp.setYxdtjcsmx(StringUtils.round(pepid.getYxdtjcsmx()+pewp.getRxdtjcsmx(),2));
-                //月合计限电降出力次数(明细)
-                pewp.setYxdjclcsmx(StringUtils.round(pepid.getYxdjclcsmx()+pewp.getRxdjclcsmx(),2));
-                //月合计场外受累电网次数(明细)
-                pewp.setYcwsldwcsmx(StringUtils.round(pepid.getYcwsldwcsmx()+pewp.getRcwsldwcsmx(),2));
-                //月合计场外受累电网次数(明细)
-                pewp.setYcwsltqcsmx(StringUtils.round(pepid.getYcwsltqcsmx()+pewp.getRcwsltqcsmx(),2));
-                //月合计通讯中断次数(明细)
-                pewp.setYtxzdcsmx(StringUtils.round(pepid.getYtxzdcsmx()+pewp.getRtxzdcsmx(),2));
-                //月合计离线次数(明细)
-                pewp.setYlxcsmx(StringUtils.round(pepid.getYlxcsmx()+pewp.getRlxcsmx(),2));
-            }else
-            {
-                setLossHoursMonth(pewp);
-            }
+            ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+            //月合计故障次数(明细)
+            pewp.setYgzcsmx(StringUtils.round(pepid.getYgzcsmx()+pewp.getRgzcsmx(),2));
+            //月合计场内受累故障次数(明细)
+            pewp.setYcnslgzcsmx(StringUtils.round(pepid.getYcnslgzcsmx()+pewp.getRcnslgzcsmx(),2));
+            //月合计检修次数(明细)
+            pewp.setYjxcsmx(StringUtils.round(pepid.getYjxcsmx()+pewp.getRjxcsmx(),2));
+            //月合计场内受累检修次数(明细)
+            pewp.setYcnsljxcsmx(StringUtils.round( pepid.getYcnsljxcsmx()+pewp.getRcnsljxcsmx(),2));
+            //月合计待机次数(明细)
+            pewp.setYdjcsmx(StringUtils.round(pepid.getYdjcsmx()+pewp.getRdjcsmx(),2));
+            //月合计缺陷降出力次数(明细)
+            pewp.setYqxjclcsmx(StringUtils.round(pepid.getYqxjclcsmx()+pewp.getRqxjclcsmx(),2));
+            //月合计手动停机次数(明细)
+            pewp.setYsdtjcsmx(StringUtils.round(pepid.getYsdtjcsmx()+pewp.getRsdtjcsmx(),2));
+            //月合计性能次数(明细)
+            pewp.setYbwcsmx(StringUtils.round(pepid.getYbwcsmx()+pewp.getRbwcsmx(),2));
+            //月合计限电停机次数(明细)
+            pewp.setYxdtjcsmx(StringUtils.round(pepid.getYxdtjcsmx()+pewp.getRxdtjcsmx(),2));
+            //月合计限电降出力次数(明细)
+            pewp.setYxdjclcsmx(StringUtils.round(pepid.getYxdjclcsmx()+pewp.getRxdjclcsmx(),2));
+            //月合计场外受累电网次数(明细)
+            pewp.setYcwsldwcsmx(StringUtils.round(pepid.getYcwsldwcsmx()+pewp.getRcwsldwcsmx(),2));
+            //月合计场外受累电网次数(明细)
+            pewp.setYcwsltqcsmx(StringUtils.round(pepid.getYcwsltqcsmx()+pewp.getRcwsltqcsmx(),2));
+            //月合计通讯中断次数(明细)
+            pewp.setYtxzdcsmx(StringUtils.round(pepid.getYtxzdcsmx()+pewp.getRtxzdcsmx(),2));
+            //月合计离线次数(明细)
+            pewp.setYlxcsmx(StringUtils.round(pepid.getYlxcsmx()+pewp.getRlxcsmx(),2));
 
         }
 
 
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
             setLossHoursYear(pewp);
         }else
         {
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
-
-                //年合计故障次数(明细)
-                pewp.setNgzcsmx(StringUtils.round(pepid.getNgzcsmx()+pewp.getRgzcsmx(),2));
-                //年合计场内受累故障次数(明细)
-                pewp.setNcnslgzcsmx(StringUtils.round(pepid.getNcnslgzcsmx()+pewp.getRcnslgzcsmx(),2));
-                //年合计检修次数(明细)
-                pewp.setNjxcsmx(StringUtils.round(pepid.getNjxcsmx()+pewp.getRjxcsmx(),2));
-                //年合计场内受累检修次数(明细)
-                pewp.setNcnsljxcsmx(StringUtils.round( pepid.getNcnsljxcsmx()+pewp.getRcnsljxcsmx(),2));
-                //年合计待机次数(明细)
-                pewp.setNdjcsmx(StringUtils.round(pepid.getNdjcsmx()+pewp.getRdjcsmx(),2));
-                //年合计缺陷降出力次数(明细)
-                pewp.setNqxjclcsmx(StringUtils.round(pepid.getNqxjclcsmx()+pewp.getRqxjclcsmx(),2));
-                //年合计手动停机次数(明细)
-                pewp.setNsdtjcsmx(StringUtils.round(pepid.getNsdtjcsmx()+pewp.getRsdtjcsmx(),2));
-                //年合计性能次数(明细)
-                pewp.setNbwcsmx(StringUtils.round(pepid.getNbwcsmx()+pewp.getRbwcsmx(),2));
-                //年合计限电停机次数(明细)
-                pewp.setNxdtjcsmx(StringUtils.round(pepid.getNxdtjcsmx()+pewp.getRxdtjcsmx(),2));
-                //年合计限电降出力次数(明细)
-                pewp.setNxdjclcsmx(StringUtils.round(pepid.getNxdjclcsmx()+pewp.getRxdjclcsmx(),2));
-                //年合计场外受累电网次数(明细)
-                pewp.setNcwsldwcsmx(StringUtils.round(pepid.getNcwsldwcsmx()+pewp.getRcwsldwcsmx(),2));
-                //年合计场外受累电网次数(明细)
-                pewp.setNcwsltqcsmx(StringUtils.round(pepid.getNcwsltqcsmx()+pewp.getRcwsltqcsmx(),2));
-                //年合计通讯中断次数(明细)
-                pewp.setNtxzdcsmx(StringUtils.round(pepid.getNtxzdcsmx()+pewp.getRtxzdcsmx(),2));
-                //年合计离线次数(明细)
-                pewp.setNlxcsmx(StringUtils.round(pepid.getNlxcsmx()+pewp.getRlxcsmx(),2));
-
-            }else
-            {
-                setLossHoursYear(pewp);
-            }
+            ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+            //年合计故障次数(明细)
+            pewp.setNgzcsmx(StringUtils.round(pepid.getNgzcsmx()+pewp.getRgzcsmx(),2));
+            //年合计场内受累故障次数(明细)
+            pewp.setNcnslgzcsmx(StringUtils.round(pepid.getNcnslgzcsmx()+pewp.getRcnslgzcsmx(),2));
+            //年合计检修次数(明细)
+            pewp.setNjxcsmx(StringUtils.round(pepid.getNjxcsmx()+pewp.getRjxcsmx(),2));
+            //年合计场内受累检修次数(明细)
+            pewp.setNcnsljxcsmx(StringUtils.round( pepid.getNcnsljxcsmx()+pewp.getRcnsljxcsmx(),2));
+            //年合计待机次数(明细)
+            pewp.setNdjcsmx(StringUtils.round(pepid.getNdjcsmx()+pewp.getRdjcsmx(),2));
+            //年合计缺陷降出力次数(明细)
+            pewp.setNqxjclcsmx(StringUtils.round(pepid.getNqxjclcsmx()+pewp.getRqxjclcsmx(),2));
+            //年合计手动停机次数(明细)
+            pewp.setNsdtjcsmx(StringUtils.round(pepid.getNsdtjcsmx()+pewp.getRsdtjcsmx(),2));
+            //年合计性能次数(明细)
+            pewp.setNbwcsmx(StringUtils.round(pepid.getNbwcsmx()+pewp.getRbwcsmx(),2));
+            //年合计限电停机次数(明细)
+            pewp.setNxdtjcsmx(StringUtils.round(pepid.getNxdtjcsmx()+pewp.getRxdtjcsmx(),2));
+            //年合计限电降出力次数(明细)
+            pewp.setNxdjclcsmx(StringUtils.round(pepid.getNxdjclcsmx()+pewp.getRxdjclcsmx(),2));
+            //年合计场外受累电网次数(明细)
+            pewp.setNcwsldwcsmx(StringUtils.round(pepid.getNcwsldwcsmx()+pewp.getRcwsldwcsmx(),2));
+            //年合计场外受累电网次数(明细)
+            pewp.setNcwsltqcsmx(StringUtils.round(pepid.getNcwsltqcsmx()+pewp.getRcwsltqcsmx(),2));
+            //年合计通讯中断次数(明细)
+            pewp.setNtxzdcsmx(StringUtils.round(pepid.getNtxzdcsmx()+pewp.getRtxzdcsmx(),2));
+            //年合计离线次数(明细)
+            pewp.setNlxcsmx(StringUtils.round(pepid.getNlxcsmx()+pewp.getRlxcsmx(),2));
 
         }
 
@@ -552,7 +535,7 @@ public class EquipmentInfo3Service {
 //        4	限电
 //        5	受累
 //        6	离线
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
         double lastState=-1;//上一分钟状态
 
@@ -570,8 +553,8 @@ public class EquipmentInfo3Service {
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
 
 
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.SBZT));
+            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+            if(aimap.containsKey(ContantXk.SBZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.SBZT);
@@ -666,9 +649,9 @@ public class EquipmentInfo3Service {
         pewp.setRslcs(slsc);
 
 
-        /*******************************************日信息统计*********************************************************/
+        //*******************************************日信息统计*********************************************************/
 
-        /*******************************************月信息统计*********************************************************/
+        //*******************************************月信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
             setLossHoursMonthSimple(pewp);
@@ -677,34 +660,28 @@ public class EquipmentInfo3Service {
         {
 
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
-
-
-                //月合计待机次数
-                pewp.setYdjcs(StringUtils.round(pepid.getYdjcs()+pewp.getRdjcs(),2));
-                //月合计维护停机次数
-                pewp.setYjxtjcs(StringUtils.round(pepid.getYjxtjcs()+pewp.getRjxtjcs(),2));
-                // 月合计故障次数
-                pewp.setYgztjcs(StringUtils.round(pepid.getYgztjcs()+pewp.getRgztjcs(),2));
-                //月合计运行次数
-                pewp.setYyxcs(StringUtils.round(pepid.getYyxcs()+pewp.getRyxcs(),2));
-                //月合计限电次数
-                pewp.setYxdcs(StringUtils.round(pepid.getYxdcs()+pewp.getRxdcs(),2));
-                //月合计通讯中断次数
-                pewp.setYtxzdcs(StringUtils.round(pepid.getYtxzdcs()+pewp.getRtxzdcs(),2));
-                //月合计受累次数
-                pewp.setYslcs(StringUtils.round(pepid.getYslcs()+pewp.getRslcs(),2));
-            }else
-            {
-                setLossHoursMonthSimple(pewp);
-            }
+            ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+
+            //月合计待机次数
+            pewp.setYdjcs(StringUtils.round(pepid.getYdjcs()+pewp.getRdjcs(),2));
+            //月合计维护停机次数
+            pewp.setYjxtjcs(StringUtils.round(pepid.getYjxtjcs()+pewp.getRjxtjcs(),2));
+            // 月合计故障次数
+            pewp.setYgztjcs(StringUtils.round(pepid.getYgztjcs()+pewp.getRgztjcs(),2));
+            //月合计运行次数
+            pewp.setYyxcs(StringUtils.round(pepid.getYyxcs()+pewp.getRyxcs(),2));
+            //月合计限电次数
+            pewp.setYxdcs(StringUtils.round(pepid.getYxdcs()+pewp.getRxdcs(),2));
+            //月合计通讯中断次数
+            pewp.setYtxzdcs(StringUtils.round(pepid.getYtxzdcs()+pewp.getRtxzdcs(),2));
+            //月合计受累次数
+            pewp.setYslcs(StringUtils.round(pepid.getYslcs()+pewp.getRslcs(),2));
 
         }
-        /*******************************************月信息统计*********************************************************/
+        //*******************************************月信息统计*********************************************************/
 
-        /*******************************************年信息统计*********************************************************/
+        //*******************************************年信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
             setLossHoursYearSimple(pewp);
@@ -713,32 +690,26 @@ public class EquipmentInfo3Service {
         {
 
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
-
-
-                //年合计待机次数
-                pewp.setNdjcs(StringUtils.round(pepid.getNdjcs()+pewp.getRdjcs(),2));
-                //年合计维护停机次数
-                pewp.setNjxtjcs(StringUtils.round(pepid.getNjxtjcs()+pewp.getRjxtjcs(),2));
-                // 年合计故障次数
-                pewp.setNgztjcs(StringUtils.round(pepid.getNgztjcs()+pewp.getRgztjcs(),2));
-                //年合计运行次数
-                pewp.setNyxcs(StringUtils.round(pepid.getNyxcs()+pewp.getRyxcs(),2));
-                //年合计限电次数
-                pewp.setNxdcs(StringUtils.round(pepid.getNxdcs()+pewp.getRxdcs(),2));
-                //年合计通讯中断次数
-                pewp.setNtxzdcs(StringUtils.round(pepid.getNtxzdcs()+pewp.getRtxzdcs(),2));
-                //年合计受累次数
-                pewp.setNslcs(StringUtils.round(pepid.getNslcs()+pewp.getRslcs(),2));
-            }else
-            {
-                setLossHoursYearSimple(pewp);
-            }
+            ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+
+            //年合计待机次数
+            pewp.setNdjcs(StringUtils.round(pepid.getNdjcs()+pewp.getRdjcs(),2));
+            //年合计维护停机次数
+            pewp.setNjxtjcs(StringUtils.round(pepid.getNjxtjcs()+pewp.getRjxtjcs(),2));
+            // 年合计故障次数
+            pewp.setNgztjcs(StringUtils.round(pepid.getNgztjcs()+pewp.getRgztjcs(),2));
+            //年合计运行次数
+            pewp.setNyxcs(StringUtils.round(pepid.getNyxcs()+pewp.getRyxcs(),2));
+            //年合计限电次数
+            pewp.setNxdcs(StringUtils.round(pepid.getNxdcs()+pewp.getRxdcs(),2));
+            //年合计通讯中断次数
+            pewp.setNtxzdcs(StringUtils.round(pepid.getNtxzdcs()+pewp.getRtxzdcs(),2));
+            //年合计受累次数
+            pewp.setNslcs(StringUtils.round(pepid.getNslcs()+pewp.getRslcs(),2));
 
         }
-        /*******************************************年信息统计*********************************************************/
+        //*******************************************年信息统计*********************************************************/
     }
 
 

File diff suppressed because it is too large
+ 451 - 469
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java


+ 92 - 112
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java

@@ -5,14 +5,11 @@ import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
-import com.gyee.generation.model.vo.PointVo;
 import com.gyee.generation.service.auto.*;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -24,7 +21,7 @@ import java.util.stream.Collectors;
 @Service
 public class EquipmentInfo5Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo5Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfo5Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -47,23 +44,21 @@ public class EquipmentInfo5Service {
 
     /**
      * 复位及时率
-     * @param currentDate
      */
     public void resetRate(Date currentDate) {
         //调度时间是第二天,currentDate 是第一天
-        Date beginDate = currentDate;
         Date endDate = DateUtils.addDays(currentDate, 1);
 
 
         List<ProEconShutdownEvent2> shutdownevents = proEconShutdownEvent2Service.list().stream().filter(i ->
                 i.getWinpowerstationId().contains("FDC")
-                        && (i.getStopTime().compareTo(beginDate) == 0 || i.getStopTime().after(beginDate))
+                        && (i.getStopTime().compareTo(currentDate) == 0 || i.getStopTime().after(currentDate))
                         && (i.getStopTime().compareTo(endDate) == 0 || i.getStopTime().before(endDate))
                         && !i.getStopTypeId().equals("wh")
         ).collect(Collectors.toList());
 
 
-        Map<String, ProEconEquipmentInfoDay5> rates = new HashMap<String, ProEconEquipmentInfoDay5>();
+        Map<String, ProEconEquipmentInfoDay5> rates = new HashMap<>();
 
         for (ProBasicEquipment wt : CacheContext.wtls) {
             ProEconEquipmentInfoDay5 rate = new ProEconEquipmentInfoDay5();
@@ -144,7 +139,7 @@ public class EquipmentInfo5Service {
                         && i.getRecordDate().compareTo(currentDate) == 0
                 ).findFirst();
 
-                ProEconEquipmentInfoDay5 dayInfo = new ProEconEquipmentInfoDay5();
+                ProEconEquipmentInfoDay5 dayInfo ;
                 if (dayInfoo.isPresent()) {
 
                     dayInfo = dayInfoo.get();
@@ -189,18 +184,14 @@ public class EquipmentInfo5Service {
      * 状态转换及时率
      */
     Double interval = 0.33; //20分钟
-    Map<Double, Double> stateDescription1 = new HashMap<Double, Double>();
-    Map<Double, Double> stateDescription2 = new HashMap<Double, Double>();
-
+    Map<Double, Double> stateDescription1 = new HashMap<>();
+    Map<Double, Double> stateDescription2 = new HashMap<>();
 
+    Double interval1 = 0.0;
+    Double interval2 = 0.0;
+    Double interval3 = 0.0;
 
     public void stateRate(Date currentDate) throws Exception {
-        Map<Integer, String> statusDescription = new HashMap<Integer, String>();
-        statusDescription.put(0, "待机");
-        statusDescription.put(2, "正常发电");
-        statusDescription.put(4, "故障停机");
-        statusDescription.put(12, "通讯中断");
-        statusDescription.put(6, "检修停机");
 
 
 
@@ -221,9 +212,9 @@ public class EquipmentInfo5Service {
         Date endDate = DateUtils.addDays(currentDate, 1);
 
 
-        Map<String, ProEconEquipmentInfoDay5> rates = new HashMap<String, ProEconEquipmentInfoDay5>();
-        Map<String, List<ProEconStateTranRatesSub>> ratesubs1 = new HashMap<String, List<ProEconStateTranRatesSub>>();
-        Map<String, List<ProEconStateTranRatesSub2>> ratesubs2 = new HashMap<String, List<ProEconStateTranRatesSub2>>();
+        Map<String, ProEconEquipmentInfoDay5> rates = new HashMap<>();
+        Map<String, List<ProEconStateTranRatesSub>> ratesubs1 = new HashMap<>();
+        Map<String, List<ProEconStateTranRatesSub2>> ratesubs2 = new HashMap<>();
 
         for (ProBasicEquipment wt : CacheContext.wtls) {
             ProEconEquipmentInfoDay5 rate = new ProEconEquipmentInfoDay5();
@@ -254,18 +245,13 @@ public class EquipmentInfo5Service {
 
             //List<PointData> powerDataList = getHistoryDatasSnap(powerpointDictionary[id].ID, beginDate, endDate);
 
-            List<ProEconStateTranRatesSub> subs = new ArrayList<ProEconStateTranRatesSub>();
+            List<ProEconStateTranRatesSub> subs = new ArrayList<>();
             ProEconStateTranRatesSub sub = new ProEconStateTranRatesSub();
 
             if (speedDataList != null && statusDataList != null && statusDataList.size() == speedDataList.size()) {
-                DoubleSummaryStatistics summaryStatistics = speedDataList.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
-
-                //最大最小风速
-                double max = summaryStatistics.getMax();
-                double min = summaryStatistics.getMin();
 
 
-                for (Integer i = 0; i < speedDataList.size(); i++) {
+                for (int i = 0; i < speedDataList.size(); i++) {
                     if (speedDataList.get(i).getPointValueInDouble() <= 3.0) {
                         sub = buildStateRate(currentDate, wt.getId(), speedDataList, statusDataList, subs, sub, i, 3.0);
 
@@ -300,21 +286,21 @@ public class EquipmentInfo5Service {
                 //========================================================================================================================================
                 //========================================================================================================================================
 
-                List<ProEconStateTranRatesSub2> subs2 = new ArrayList<ProEconStateTranRatesSub2>();
+                List<ProEconStateTranRatesSub2> subs2 = new ArrayList<>();
                 ProEconStateTranRatesSub2 sub2 = new ProEconStateTranRatesSub2();
 
-                Double interval1 = 0.0;
-                Double interval2 = 0.0;
-                Double interval3 = 0.0;
+
 
                 List<Date> intervaltimebegin = new ArrayList<>();
                 List<Date> intervaltimeend = new ArrayList<>();
 
 
-                Double lastspeed = 0.0;
 
-                for (Integer i = 0; i < subs.size(); i++) {
+                for (int i = 0; i < subs.size(); i++) {
 
+                    interval1 = 0.0;
+                    interval2 = 0.0;
+                    interval3 = 0.0;
 
                     if (sub2.getSpeed() == null) {
                         buildStatetransitionratesSub2(subs, sub2, i);
@@ -323,7 +309,7 @@ public class EquipmentInfo5Service {
                         if (subs.get(i).getDurationHours() > interval)  //当前时间间隔满足条件
                         {
                             /* 加处理代码 */
-                            Double tempspeed = 0.0;
+                            double tempspeed;
                             if (interval1 >= interval2 && interval1 >= interval3) {
                                 tempspeed = 3.0;
                             } else if (interval2 >= interval1 && interval2 >= interval3) {
@@ -332,14 +318,14 @@ public class EquipmentInfo5Service {
                                 tempspeed = 4.0;
                             }
 
-                            if (subs.get(i).getSpeed() == tempspeed) {
+                            if (Objects.equals(subs.get(i).getSpeed(), tempspeed)) {
                                 sub2.setEndTime(subs.get(i).getEndTime());
                                 sub2.setDurationHours(sub2.getDurationHours() + subs.get(i).getDurationHours());
 
                                 /* 加处理代码 */
                             } else {
 
-                                newMethod(subs, sub2, interval1, interval2, interval3, intervaltimebegin, intervaltimeend, lastspeed, i);
+                                setStateTranRatesSub2(sub2, intervaltimebegin, intervaltimeend);
                                 interval1 = 0.0;
                                 interval2 = 0.0;
                                 interval3 = 0.0;
@@ -372,11 +358,11 @@ public class EquipmentInfo5Service {
 
                                 } else {
                                     interval3 = interval3 - subs.get(i).getDurationHours();
-                                    ;
+
                                 }
 
 
-                                newMethod(subs, sub2, interval1, interval2, interval3, intervaltimebegin, intervaltimeend, lastspeed, i);
+                                setStateTranRatesSub2(sub2,  intervaltimebegin, intervaltimeend);
                                 interval1 = 0.0;
                                 interval2 = 0.0;
                                 interval3 = 0.0;
@@ -405,7 +391,7 @@ public class EquipmentInfo5Service {
                         }
                     }
                     //-----------------------------------------------------------------------------------------------------------------
-                    newMethod(subs, interval1, interval2, interval3, i, lastspeed, intervaltimebegin, intervaltimeend);
+                    newMethod(subs,  i,  intervaltimebegin, intervaltimeend);
                     //------------------------------------------------------------------------------------------------------------------
                 }
 
@@ -436,17 +422,17 @@ public class EquipmentInfo5Service {
 //============================================================================================================================================================================
 //============================================================================================================================================================================
 
-                for (Integer i = 0; i < subs2.size(); i++) {
+                for (ProEconStateTranRatesSub2 proEconStateTranRatesSub2 : subs2) {
 
 
-                    if (subs2.get(i).getSpeed() == 3) {
-                        if (subs2.get(i).getDurationHours() > 0.5) {
-                            if (subs2.get(i).getStatusCode() == 0 || subs2.get(i).getStatusCode() == 1) {
+                    if (proEconStateTranRatesSub2.getSpeed() == 3) {
+                        if (proEconStateTranRatesSub2.getDurationHours() > 0.5) {
+                            if (proEconStateTranRatesSub2.getStatusCode() == 0 || proEconStateTranRatesSub2.getStatusCode() == 1) {
                                 //if (subs2.get(i).getStatusCode() == 4 && subs2.get(i).getStatusCode() == 2)
                                 //{
-                                if (subs2.get(i).getStatusHours() < 0.25)//5分钟
+                                if (proEconStateTranRatesSub2.getStatusHours() < 0.25)//5分钟
                                 {
-                                    subs2.get(i).setResetRate(0.25);
+                                    proEconStateTranRatesSub2.setResetRate(0.25);
                                     double temp = rate.getTimerate1();
                                     temp = temp + 1;
                                     rate.setTimerate1(temp);
@@ -463,9 +449,9 @@ public class EquipmentInfo5Service {
                                     temp = temp + 1;
                                     rate.setTimerate4(temp);
 
-                                } else if (subs2.get(i).getStatusHours() < 0.33)//10分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.33)//10分钟
                                 {
-                                    subs2.get(i).setResetRate(0.33);
+                                    proEconStateTranRatesSub2.setResetRate(0.33);
                                     double temp = rate.getTimerate2();
                                     temp = temp + 1;
                                     rate.setTimerate2(temp);
@@ -477,10 +463,10 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate4();
                                     temp = temp + 1;
                                     rate.setTimerate4(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.42)//15分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.42)//15分钟
                                 {
 
-                                    subs2.get(i).setResetRate(0.42);
+                                    proEconStateTranRatesSub2.setResetRate(0.42);
                                     double temp = rate.getTimerate3();
                                     temp = temp + 1;
                                     rate.setTimerate3(temp);
@@ -488,9 +474,9 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate4();
                                     temp = temp + 1;
                                     rate.setTimerate4(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.5)//20分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.5)//20分钟
                                 {
-                                    subs2.get(i).setResetRate(0.5);
+                                    proEconStateTranRatesSub2.setResetRate(0.5);
                                     double temp = rate.getTimerate4();
                                     temp = temp + 1;
                                     rate.setTimerate4(temp);
@@ -504,12 +490,12 @@ public class EquipmentInfo5Service {
                             }
 
 
-                            if (subs2.get(i).getStatusCode() == 4) {
+                            if (proEconStateTranRatesSub2.getStatusCode() == 4) {
 
-                                if (subs2.get(i).getStatusHours() < 0.25)//5分钟
+                                if (proEconStateTranRatesSub2.getStatusHours() < 0.25)//5分钟
                                 {
 
-                                    subs2.get(i).setResetRate(0.25);
+                                    proEconStateTranRatesSub2.setResetRate(0.25);
                                     double temp = rate.getTimerate5();
                                     temp = temp + 1;
                                     rate.setTimerate5(temp);
@@ -525,10 +511,10 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate8();
                                     temp = temp + 1;
                                     rate.setTimerate8(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.33)//10分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.33)//10分钟
                                 {
 
-                                    subs2.get(i).setResetRate(0.33);
+                                    proEconStateTranRatesSub2.setResetRate(0.33);
                                     double temp = rate.getTimerate6();
                                     temp = temp + 1;
                                     rate.setTimerate6(temp);
@@ -540,9 +526,9 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate8();
                                     temp = temp + 1;
                                     rate.setTimerate8(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.42)//15分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.42)//15分钟
                                 {
-                                    subs2.get(i).setResetRate(0.42);
+                                    proEconStateTranRatesSub2.setResetRate(0.42);
                                     double temp = rate.getTimerate7();
                                     temp = temp + 1;
                                     rate.setTimerate7(temp);
@@ -551,9 +537,9 @@ public class EquipmentInfo5Service {
                                     temp = temp + 1;
                                     rate.setTimerate8(temp);
 
-                                } else if (subs2.get(i).getStatusHours() < 0.5)//20分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.5)//20分钟
                                 {
-                                    subs2.get(i).setResetRate(0.5);
+                                    proEconStateTranRatesSub2.setResetRate(0.5);
                                     double temp = rate.getTimerate8();
                                     temp = temp + 1;
                                     rate.setTimerate8(temp);
@@ -568,16 +554,16 @@ public class EquipmentInfo5Service {
 
 
                         }
-                    } else if (subs2.get(i).getSpeed() == 3.5) {
-                        if (subs2.get(i).getDurationHours() > 0.5) {
+                    } else if (proEconStateTranRatesSub2.getSpeed() == 3.5) {
+                        if (proEconStateTranRatesSub2.getDurationHours() > 0.5) {
 
 
-                            if (subs2.get(i).getStatusCode() == 0 || subs2.get(i).getStatusCode() == 1) {
+                            if (proEconStateTranRatesSub2.getStatusCode() == 0 || proEconStateTranRatesSub2.getStatusCode() == 1) {
                                 //if (subs2.get(i).getStatusCode() == 4 && subs2.get(i).getStatusCode() == 2)
                                 //{
-                                if (subs2.get(i).getStatusHours() < 0.25)//5分钟
+                                if (proEconStateTranRatesSub2.getStatusHours() < 0.25)//5分钟
                                 {
-                                    subs2.get(i).setResetRate(0.25);
+                                    proEconStateTranRatesSub2.setResetRate(0.25);
                                     double temp = rate.getTimerate1();
                                     temp = temp + 1;
                                     rate.setTimerate1(temp);
@@ -593,9 +579,9 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate4();
                                     temp = temp + 1;
                                     rate.setTimerate4(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.33)//10分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.33)//10分钟
                                 {
-                                    subs2.get(i).setResetRate(0.3);
+                                    proEconStateTranRatesSub2.setResetRate(0.3);
                                     double temp = rate.getTimerate2();
                                     temp = temp + 1;
                                     rate.setTimerate2(temp);
@@ -607,9 +593,9 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate4();
                                     temp = temp + 1;
                                     rate.setTimerate4(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.42)//15分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.42)//15分钟
                                 {
-                                    subs2.get(i).setResetRate(0.42);
+                                    proEconStateTranRatesSub2.setResetRate(0.42);
                                     double temp = rate.getTimerate3();
                                     temp = temp + 1;
                                     rate.setTimerate3(temp);
@@ -617,9 +603,9 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate4();
                                     temp = temp + 1;
                                     rate.setTimerate4(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.5)//20分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.5)//20分钟
                                 {
-                                    subs2.get(i).setResetRate(0.5);
+                                    proEconStateTranRatesSub2.setResetRate(0.5);
                                     double temp = rate.getTimerate4();
                                     temp = temp + 1;
                                     rate.setTimerate4(temp);
@@ -631,12 +617,12 @@ public class EquipmentInfo5Service {
                                 rate.setTimerate13(temp);
                             }
 
-                            if (subs2.get(i).getStatusCode() == 4) {
+                            if (proEconStateTranRatesSub2.getStatusCode() == 4) {
                                 //if (subs2.get(i).getStatusCode() == 0 || subs2.get(i).getStatusCode() == 1)
                                 //{
-                                if (subs2.get(i).getStatusHours() < 0.25)//5分钟
+                                if (proEconStateTranRatesSub2.getStatusHours() < 0.25)//5分钟
                                 {
-                                    subs2.get(i).setResetRate(0.25);
+                                    proEconStateTranRatesSub2.setResetRate(0.25);
                                     double temp = rate.getTimerate5();
                                     temp = temp + 1;
                                     rate.setTimerate5(temp);
@@ -652,9 +638,9 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate8();
                                     temp = temp + 1;
                                     rate.setTimerate8(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.33)//10分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.33)//10分钟
                                 {
-                                    subs2.get(i).setResetRate(0.33);
+                                    proEconStateTranRatesSub2.setResetRate(0.33);
                                     double temp = rate.getTimerate6();
                                     temp = temp + 1;
                                     rate.setTimerate6(temp);
@@ -666,9 +652,9 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate8();
                                     temp = temp + 1;
                                     rate.setTimerate8(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.42)//15分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.42)//15分钟
                                 {
-                                    subs2.get(i).setResetRate(0.42);
+                                    proEconStateTranRatesSub2.setResetRate(0.42);
                                     double temp = rate.getTimerate7();
                                     temp = temp + 1;
                                     rate.setTimerate7(temp);
@@ -676,9 +662,9 @@ public class EquipmentInfo5Service {
                                     temp = rate.getTimerate8();
                                     temp = temp + 1;
                                     rate.setTimerate8(temp);
-                                } else if (subs2.get(i).getStatusHours() < 0.5)//20分钟
+                                } else if (proEconStateTranRatesSub2.getStatusHours() < 0.5)//20分钟
                                 {
-                                    subs2.get(i).setResetRate(0.5);
+                                    proEconStateTranRatesSub2.setResetRate(0.5);
                                     double temp = rate.getTimerate8();
                                     temp = temp + 1;
                                     rate.setTimerate8(temp);
@@ -690,13 +676,13 @@ public class EquipmentInfo5Service {
                                 rate.setTimerate14(temp);
                             }
                         }
-                    } else if (subs2.get(i).getSpeed() == 4) {
-                        if (subs2.get(i).getDurationHours() > 0.5) {
-                            if (subs2.get(i).getStatusCode() == 0) {
-                                if (subs2.get(i).getStatusCode() == 1) {
-                                    if (subs2.get(i).getStatusHours() < 0.25)//5分钟
+                    } else if (proEconStateTranRatesSub2.getSpeed() == 4) {
+                        if (proEconStateTranRatesSub2.getDurationHours() > 0.5) {
+                            if (proEconStateTranRatesSub2.getStatusCode() == 0) {
+                                if (proEconStateTranRatesSub2.getStatusCode() == 1) {
+                                    if (proEconStateTranRatesSub2.getStatusHours() < 0.25)//5分钟
                                     {
-                                        subs2.get(i).setResetRate(0.25);
+                                        proEconStateTranRatesSub2.setResetRate(0.25);
                                         double temp = rate.getTimerate9();
                                         temp = temp + 1;
                                         rate.setTimerate9(temp);
@@ -712,9 +698,9 @@ public class EquipmentInfo5Service {
                                         temp = rate.getTimerate12();
                                         temp = temp + 1;
                                         rate.setTimerate12(temp);
-                                    } else if (subs2.get(i).getStatusHours() < 0.33)//10分钟
+                                    } else if (proEconStateTranRatesSub2.getStatusHours() < 0.33)//10分钟
                                     {
-                                        subs2.get(i).setResetRate(0.33);
+                                        proEconStateTranRatesSub2.setResetRate(0.33);
                                         double temp = rate.getTimerate10();
                                         temp = temp + 1;
                                         rate.setTimerate10(temp);
@@ -726,9 +712,9 @@ public class EquipmentInfo5Service {
                                         temp = rate.getTimerate12();
                                         temp = temp + 1;
                                         rate.setTimerate12(temp);
-                                    } else if (subs2.get(i).getStatusHours() < 0.42)//15分钟
+                                    } else if (proEconStateTranRatesSub2.getStatusHours() < 0.42)//15分钟
                                     {
-                                        subs2.get(i).setResetRate(0.42);
+                                        proEconStateTranRatesSub2.setResetRate(0.42);
                                         double temp = rate.getTimerate11();
                                         temp = temp + 1;
                                         rate.setTimerate11(temp);
@@ -736,9 +722,9 @@ public class EquipmentInfo5Service {
                                         temp = rate.getTimerate12();
                                         temp = temp + 1;
                                         rate.setTimerate12(temp);
-                                    } else if (subs2.get(i).getStatusHours() < 0.5)//20分钟
+                                    } else if (proEconStateTranRatesSub2.getStatusHours() < 0.5)//20分钟
                                     {
-                                        subs2.get(i).setResetRate(0.5);
+                                        proEconStateTranRatesSub2.setResetRate(0.5);
                                         double temp = rate.getTimerate12();
                                         temp = temp + 1;
                                         rate.setTimerate12(temp);
@@ -787,7 +773,7 @@ public class EquipmentInfo5Service {
                                 && i.getRecordDate().compareTo(currentDate) == 0
                         ).findFirst();
 
-                ProEconEquipmentInfoDay5 dayInfo = new ProEconEquipmentInfoDay5();
+                ProEconEquipmentInfoDay5 dayInfo;
                 if (dayInfoo.isPresent()) {
 
                     dayInfo = dayInfoo.get();
@@ -807,7 +793,7 @@ public class EquipmentInfo5Service {
 
     }
 
-    private static void newMethod(List<ProEconStateTranRatesSub> subs, ProEconStateTranRatesSub2 sub2, Double interval1, Double interval2, Double interval3, List<Date> intervaltimebegin, List<Date> intervaltimeend, Double lastspeed, Integer i) {
+    private  void setStateTranRatesSub2(ProEconStateTranRatesSub2 sub2, List<Date> intervaltimebegin, List<Date> intervaltimeend) {
 
         if (interval1 >= interval2 && interval1 >= interval3) {
 
@@ -860,17 +846,17 @@ public class EquipmentInfo5Service {
         }
     }
 
-    private static void newMethod(List<ProEconStateTranRatesSub> subs, Double interval1, Double interval2, Double interval3, Integer i, Double lastspeed, List<Date> intervaltimebegin, List<Date> intervaltimeend) {
+    private  void newMethod(List<ProEconStateTranRatesSub> subs, Integer i, List<Date> intervaltimebegin, List<Date> intervaltimeend) {
         if (subs.get(i).getSpeed() == 3.0) {
             interval1 += subs.get(i).getDurationHours();
 
-            lastspeed = 3.0;
+
         } else if (subs.get(i).getSpeed() == 3.5) {
             interval2 += subs.get(i).getDurationHours();
-            lastspeed = 3.5;
+
         } else {
             interval3 += subs.get(i).getDurationHours();
-            lastspeed = 4.0;
+
         }
 
 
@@ -948,7 +934,7 @@ public class EquipmentInfo5Service {
         } else {
             if (sub.getEndTime() == null) {
                 //判定是几米风速 3 、 3.5 、 4
-                if (sub.getSpeed() == speed) {
+                if (Objects.equals(sub.getSpeed(), speed)) {
                     //stateDescription.Add(3, 4);
                     //stateDescription.Add(3.5m, 0);
                     //stateDescription.Add(4, 0);
@@ -981,7 +967,7 @@ public class EquipmentInfo5Service {
                     ProEconStateTranRatesSub finalSub = sub;
                     DoubleSummaryStatistics summaryStatistics = speedDataList.stream().filter(x -> new Date(x.getPointTime()).after(finalSub.getStartTime())
                             && new Date(x.getPointTime()).before(finalSub.getEndTime())
-                    ).mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                    ).mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
 
                     //最大最小风速
                     double max = summaryStatistics.getMax();
@@ -1014,21 +1000,15 @@ public class EquipmentInfo5Service {
         sub.setSpeed(speed);
     }
 
-    private double coefficient(List<PointVo> tmpeSpeed, double dbValue) {
-        double result = 0;
-        for (PointVo item : tmpeSpeed) {
-            result += (dbValue - item.getX()) / dbValue;
-        }
-        result = result / tmpeSpeed.size() * 100;
-        return result;
-    }
+
 
     //故障消缺及时率
 
     public void failRate(Date cuttentDate) {
 
-        Map<Date, Map<String, ProEconFaultLiminatedefects>> dtDictionary = new HashMap<Date, Map<String, ProEconFaultLiminatedefects>>();
+        Map<Date, Map<String, ProEconFaultLiminatedefects>> dtDictionary = new HashMap<>();
         Calendar c = Calendar.getInstance();
+        c.setTime(cuttentDate);
         //Date now = Date.Now.Date.AddMonths(-1); //上月
         Date now = DateUtils.truncate(c.getTime()); //本月
 
@@ -1062,7 +1042,7 @@ public class EquipmentInfo5Service {
             if (dtDictionary.containsKey(dt)) {
                 fdDictionary = dtDictionary.get(dt);
             } else {
-                fdDictionary = new HashMap<String, ProEconFaultLiminatedefects>();
+                fdDictionary = new HashMap<>();
                 dtDictionary.put(dt, fdDictionary);
             }
             ProEconFaultLiminatedefects fs;
@@ -1102,7 +1082,7 @@ public class EquipmentInfo5Service {
 
             }
             if (fs.getFaultCount() != 0) {
-                double temp = new BigDecimal(fs.getRightCount()).divide(new BigDecimal(fs.getFaultCount()), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
+                double temp = BigDecimal.valueOf(fs.getRightCount()).divide(BigDecimal.valueOf(fs.getFaultCount()), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
 
                 fs.setRate(temp);
 

+ 202 - 178
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java

@@ -3,9 +3,11 @@ package com.gyee.generation.service;//package com.gyee.generation.service;
 import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
-import com.gyee.generation.service.auto.*;
+import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
+import com.gyee.generation.service.auto.IProEconEquipmentInfoDay2Service;
+import com.gyee.generation.service.auto.IProEconEquipmentInfoDay4Service;
+import com.gyee.generation.service.auto.IProEconEquipmentInfoDayTopService;
 import com.gyee.generation.util.DateUtils;
-import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -20,19 +22,15 @@ import java.util.stream.Collectors;
 public class EquipmentInfoDayTopService {
 
     private static final Logger logger = LoggerFactory.getLogger(EquipmentInfoDayTopService.class);
-    @Resource
-    private IEdosUtil edosUtil;
 
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
     @Resource
     private IProEconEquipmentInfoDay2Service proEconEquipmentInfoDay2Service;
-    @Resource
-    private IProEconEquipmentInfoDay3Service proEconEquipmentInfoDay3Service;
+
     @Resource
     private IProEconEquipmentInfoDay4Service proEconEquipmentInfoDay4Service;
-    @Resource
-    private IProEconEquipmentInfoDay5Service proEconEquipmentInfoDay5Service;
+
     @Resource
     private IProEconEquipmentInfoDayTopService proEconEquipmentInfoDayTopService;
 
@@ -47,213 +45,239 @@ public class EquipmentInfoDayTopService {
                         && CacheContext.wtmap.containsKey(i.getWindturbineId())).map(ProEconEquipmentInfoDayTop::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconEquipmentInfoDayTopService.removeByIds(idls);
         }
         for (ProBasicPowerstation wp : CacheContext.wpls) {
 
             List<ProEconEquipmentInfoDayTop> topls = new ArrayList<>();
+
             for (ProBasicEquipment wt : CacheContext.wpwtmap.get(wp.getId())) {
 
+                ProEconEquipmentInfoDayTop peeidt = getEquipmentInfoDayTop(recordDate, c, wt);
 
-                ProEconEquipmentInfoDayTop peeidt = new ProEconEquipmentInfoDayTop();
-
-                peeidt.setWindpowerstationId(wt.getWindpowerstationId());
-                peeidt.setLineId(wt.getLineId());
-                peeidt.setProjectId(wt.getProjectId());
-                peeidt.setWindturbineId(wt.getId());
-                peeidt.setRecordDate(DateUtils.truncDay(recordDate));
-                peeidt.setYear(DateUtils.getYear(recordDate));
-                peeidt.setMonth(DateUtils.getMonth(recordDate) + 1);
-
-                List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate)) == 0
-                                && i.getWindturbineId().equals(wt.getId())
-                        ).collect(Collectors.toList());
-
-                if (!pepid1ls.isEmpty()) {
-                    ProEconEquipmentInfoDay1 pepid1 = pepid1ls.get(0);
-                    //发电量
-                    peeidt.setDayfdl(pepid1.getRfdl());
-                    peeidt.setMonthfdl(pepid1.getYfdl());
-                    peeidt.setYearfdl(pepid1.getNfdl());
-                    //理论发电量
-                    peeidt.setDayllfdl(pepid1.getRllfdl());
-                    peeidt.setMonthllfdl(pepid1.getYllfdl());
-                    peeidt.setYearllfdl(pepid1.getNllfdl());
-                    //平均风速
-                    peeidt.setDayfs(pepid1.getRpjfs());
-                    peeidt.setMonthfs(pepid1.getYpjfs());
-                    peeidt.setYearfs(pepid1.getNpjfs());
-                    //平均功率
-                    peeidt.setDaygl(pepid1.getRpjgl());
-                    peeidt.setMonthgl(pepid1.getYpjgl());
-                    peeidt.setYeargl(pepid1.getNpjgl());
-                    //故障损失电量
-                    peeidt.setDaygzssdl(pepid1.getRgzssdl());
-                    peeidt.setMonthgzssdl(pepid1.getYgzssdl());
-                    peeidt.setYeargzssdl(pepid1.getNgzssdl());
-                    //限电损失电量
-                    peeidt.setDayxdssdl(pepid1.getRxdtjssdl());
-                    peeidt.setMonthxdssdl(pepid1.getYxdtjssdl());
-                    peeidt.setYearxdssdl(pepid1.getNxdtjssdl());
-                    //维护损失电量
-                    peeidt.setDaywhssdl(pepid1.getRjxssdl());
-                    peeidt.setMonthwhssdl(pepid1.getYjxssdl());
-                    peeidt.setYearwhssdl(pepid1.getNjxssdl());
-                    //性能损失电量
-                    peeidt.setDayxnssdl(pepid1.getRqxjclssdl());
-                    peeidt.setMonthxnssdl(pepid1.getYqxjclssdl());
-                    peeidt.setYearxnssdl(pepid1.getNqxjclssdl());
-                }
+                topls.add(peeidt);
 
+            }
 
-                List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate)) == 0
-                                && i.getWindturbineId().equals(wt.getId())
-                        ).collect(Collectors.toList());
-
-                if (!pepid2ls.isEmpty()) {
-                    ProEconEquipmentInfoDay2 pepid2 = pepid2ls.get(0);
-                    //故障时间
-                    peeidt.setDaygzsj(pepid2.getRgzxsmx());
-                    peeidt.setMonthfdl(pepid2.getYgzxsmx());
-                    peeidt.setYearfdl(pepid2.getNgzxsmx());
-                    //维护时间
-                    peeidt.setDaywhsj(pepid2.getRjxxsmx());
-                    peeidt.setMonthwhsj(pepid2.getYjxxsmx());
-                    peeidt.setYearwhsj(pepid2.getNjxxsmx());
-                    //运行时间
-                    peeidt.setDayyxsj(pepid2.getRyxxs());
-                    peeidt.setMonthyxsj(pepid2.getYyxxs());
-                    peeidt.setYearyxsj(pepid2.getNyxxs());
-                    //停机时间
-                    peeidt.setDaytjsj(pepid2.getRgzxsmx());
-                    peeidt.setMonthtjsj(pepid2.getYgzxsmx());
-                    peeidt.setYeartjsj(pepid2.getNgzxsmx());
-                    //利用小时数
-
-                    double defaultpower = 1500.0;
-                    if (CacheContext.modelMap.containsKey(wt.getModelId())) {
-                        defaultpower = CacheContext.modelMap.get(wt.getModelId()).getPowerProduction();
-                    }
+            // Map<指标, Map<风机编号,ProEconEquipmentInfoDayTop>>
+            Map<String, Map<String, ProEconEquipmentInfoDayTop>> ordermap = new HashMap<>();
 
-                    peeidt.setDaylyxs(BigDecimal.valueOf(peeidt.getDayfdl()).divide(new BigDecimal(defaultpower), 2, RoundingMode.HALF_EVEN).doubleValue());
-                    peeidt.setMonthlyxs(BigDecimal.valueOf(peeidt.getMonthfdl()).divide(new BigDecimal(defaultpower), 2, RoundingMode.HALF_EVEN).doubleValue());
-                    peeidt.setDaylyxs(BigDecimal.valueOf(peeidt.getYearfdl()).divide(new BigDecimal(defaultpower), 2, RoundingMode.HALF_EVEN).doubleValue());
+            List<String> filedls = initialFiled();
+            //遍历循环排序,将序号赋值给rank,再通过风机编号转为,MAP
+            orderObject(topls,ordermap,filedls);
 
 
-                    //设备可利用率
-                    int dayhours = 24;
-                    double temp = StringUtils.round(dayhours - peeidt.getDaygzsj(), 2);
-                    peeidt.setDaysbklyl(temp);
+            for (ProEconEquipmentInfoDayTop top : topls) {
 
-                    Calendar cal = Calendar.getInstance();
-                    cal.setTime(recordDate);
-                    int days = c.get(Calendar.DAY_OF_MONTH);
+                calLevels(top, topls.size(), ordermap, "day");
+                calLevels(top, topls.size(), ordermap, "month");
+                calLevels(top, topls.size(), ordermap, "year");
 
-                    dayhours = 24 * days;
-                    temp = StringUtils.round(dayhours - peeidt.getMonthgzsj(), 2);
-                    peeidt.setMonthsbklyl(temp);
+            }
 
-                    days = c.get(Calendar.DAY_OF_YEAR);
-                    dayhours = 24 * days;
-                    temp = StringUtils.round(dayhours - peeidt.getYeargzsj(), 2);
-                    peeidt.setYearsbklyl(temp);
+            topls=topls.stream()
+                    .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayScore).reversed()).collect(Collectors.toList());
 
+            for (int i=0;i<topls.size();i++) {
+                ProEconEquipmentInfoDayTop top =topls.get(i);
+                top.setDayRank(i+1);
+            }
+            topls=topls.stream()
+                    .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthScore).reversed()).collect(Collectors.toList());
 
-                    //等效可用系数
-                    dayhours = 24;
-                    temp = StringUtils.round(dayhours - peeidt.getDaygzsj() - peeidt.getDaywhsj(), 2);
-                    peeidt.setDaydxkyxs(temp);
+            for (int i=0;i<topls.size();i++) {
+                ProEconEquipmentInfoDayTop top =topls.get(i);
+                top.setMonthRank(i+1);
+            }
+            topls=topls.stream()
+                    .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearScore).reversed()).collect(Collectors.toList());
 
-                    cal = Calendar.getInstance();
-                    cal.setTime(recordDate);
-                    days = c.get(Calendar.DAY_OF_MONTH);
+            for (int i=0;i<topls.size();i++) {
+                ProEconEquipmentInfoDayTop top =topls.get(i);
+                top.setYearRank(i+1);
 
-                    dayhours = 24 * days;
-                    temp = StringUtils.round(dayhours - peeidt.getMonthgzsj() - peeidt.getMonthwhsj(), 2);
-                    peeidt.setMonthdxkyxs(temp);
+                proEconEquipmentInfoDayTopService.save(top);
+            }
 
-                    days = c.get(Calendar.DAY_OF_YEAR);
-                    dayhours = 24 * days;
-                    temp = StringUtils.round(dayhours - peeidt.getYeargzsj() - peeidt.getMonthwhsj(), 2);
-                    peeidt.setYeardxkyxs(temp);
-                }
 
-                List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list().stream()
-                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate)) == 0
-                                && i.getWindturbineId().equals(wt.getId())
-                        ).collect(Collectors.toList());
-
-                if (!pepid4ls.isEmpty()) {
-                    ProEconEquipmentInfoDay4 pepid4 = pepid4ls.get(0);
-                    //拟合优度
-                    peeidt.setDaynhyd(pepid4.getRnhyd());
-                    peeidt.setMonthnhyd(pepid4.getYnhyd());
-                    peeidt.setYearnhyd(pepid4.getNnhyd());
-                    //有效风时数
-                    peeidt.setDayyxfss(pepid4.getRyxfss());
-                    peeidt.setMonthyxfss(pepid4.getYyxfss());
-                    peeidt.setYearyxfss(pepid4.getNyxfss());
-                    //小风切入
-                    peeidt.setDayxfqr(pepid4.getRxfqrfs());
-                    peeidt.setMonthxfqr(pepid4.getYxfqrfs());
-                    peeidt.setYearxfqr(pepid4.getNxfqrfs());
-                    //静风频率
-
-                    int dayhours = 24;
-                    double temp = BigDecimal.valueOf(pepid4.getRjfsc()).divide(new BigDecimal(dayhours), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
-                    peeidt.setDayjfpl(temp);
-
-                    Calendar cal = Calendar.getInstance();
-                    cal.setTime(recordDate);
-                    int days = c.get(Calendar.DAY_OF_MONTH);
-
-                    dayhours = 24 * days;
-                    temp = BigDecimal.valueOf(pepid4.getYjfsc()).divide(new BigDecimal(dayhours), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
-                    peeidt.setMonthjfpl(temp);
-
-                    days = c.get(Calendar.DAY_OF_YEAR);
-                    dayhours = 24 * days;
-                    temp = BigDecimal.valueOf(pepid4.getNjfsc()).divide(new BigDecimal(dayhours), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
-                    peeidt.setYearjfpl(temp);
-
-
-                    //功率一致性系数
-                    peeidt.setDayglyzxxs(pepid4.getRglyzxxs());
-                    peeidt.setMonthglyzxxs(pepid4.getYglyzxxs());
-                    peeidt.setYearglyzxxs(pepid4.getNglyzxxs());
-                }
+        }
 
 
-                topls.add(peeidt);
+    }
+
+    private ProEconEquipmentInfoDayTop getEquipmentInfoDayTop(Date recordDate, Calendar c, ProBasicEquipment wt) {
+        ProEconEquipmentInfoDayTop peeidt = new ProEconEquipmentInfoDayTop();
 
+        peeidt.setWindpowerstationId(wt.getWindpowerstationId());
+        peeidt.setLineId(wt.getLineId());
+        peeidt.setProjectId(wt.getProjectId());
+        peeidt.setWindturbineId(wt.getId());
+        peeidt.setRecordDate(DateUtils.truncDay(recordDate));
+        peeidt.setYear(DateUtils.getYear(recordDate));
+        peeidt.setMonth(DateUtils.getMonth(recordDate) + 1);
+
+        List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list().stream()
+                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate)) == 0
+                        && i.getWindturbineId().equals(wt.getId())
+                ).collect(Collectors.toList());
+
+        if (!pepid1ls.isEmpty()) {
+            ProEconEquipmentInfoDay1 pepid1 = pepid1ls.get(0);
+            //发电量
+            peeidt.setDayfdl(pepid1.getRfdl());
+            peeidt.setMonthfdl(pepid1.getYfdl());
+            peeidt.setYearfdl(pepid1.getNfdl());
+            //理论发电量
+            peeidt.setDayllfdl(pepid1.getRllfdl());
+            peeidt.setMonthllfdl(pepid1.getYllfdl());
+            peeidt.setYearllfdl(pepid1.getNllfdl());
+            //平均风速
+            peeidt.setDayfs(pepid1.getRpjfs());
+            peeidt.setMonthfs(pepid1.getYpjfs());
+            peeidt.setYearfs(pepid1.getNpjfs());
+            //平均功率
+            peeidt.setDaygl(pepid1.getRpjgl());
+            peeidt.setMonthgl(pepid1.getYpjgl());
+            peeidt.setYeargl(pepid1.getNpjgl());
+            //故障损失电量
+            peeidt.setDaygzssdl(pepid1.getRgzssdl());
+            peeidt.setMonthgzssdl(pepid1.getYgzssdl());
+            peeidt.setYeargzssdl(pepid1.getNgzssdl());
+            //限电损失电量
+            peeidt.setDayxdssdl(pepid1.getRxdtjssdl());
+            peeidt.setMonthxdssdl(pepid1.getYxdtjssdl());
+            peeidt.setYearxdssdl(pepid1.getNxdtjssdl());
+            //维护损失电量
+            peeidt.setDaywhssdl(pepid1.getRjxssdl());
+            peeidt.setMonthwhssdl(pepid1.getYjxssdl());
+            peeidt.setYearwhssdl(pepid1.getNjxssdl());
+            //性能损失电量
+            peeidt.setDayxnssdl(pepid1.getRqxjclssdl());
+            peeidt.setMonthxnssdl(pepid1.getYqxjclssdl());
+            peeidt.setYearxnssdl(pepid1.getNqxjclssdl());
+        }
 
+
+        List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list().stream()
+                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate)) == 0
+                        && i.getWindturbineId().equals(wt.getId())
+                ).collect(Collectors.toList());
+
+        if (!pepid2ls.isEmpty()) {
+            ProEconEquipmentInfoDay2 pepid2 = pepid2ls.get(0);
+            //故障时间
+            peeidt.setDaygzsj(pepid2.getRgzxsmx());
+            peeidt.setMonthfdl(pepid2.getYgzxsmx());
+            peeidt.setYearfdl(pepid2.getNgzxsmx());
+            //维护时间
+            peeidt.setDaywhsj(pepid2.getRjxxsmx());
+            peeidt.setMonthwhsj(pepid2.getYjxxsmx());
+            peeidt.setYearwhsj(pepid2.getNjxxsmx());
+            //运行时间
+            peeidt.setDayyxsj(pepid2.getRyxxs());
+            peeidt.setMonthyxsj(pepid2.getYyxxs());
+            peeidt.setYearyxsj(pepid2.getNyxxs());
+            //停机时间
+            peeidt.setDaytjsj(pepid2.getRgzxsmx());
+            peeidt.setMonthtjsj(pepid2.getYgzxsmx());
+            peeidt.setYeartjsj(pepid2.getNgzxsmx());
+            //利用小时数
+
+            double defaultpower = 1500.0;
+            if (CacheContext.modelMap.containsKey(wt.getModelId())) {
+                defaultpower = CacheContext.modelMap.get(wt.getModelId()).getPowerProduction();
             }
 
-            // Map<指标, Map<风机编号,ProEconEquipmentInfoDayTop>>
-            Map<String, Map<String, ProEconEquipmentInfoDayTop>> ordermap = new HashMap<>();
+            peeidt.setDaylyxs(BigDecimal.valueOf(peeidt.getDayfdl()).divide(new BigDecimal(defaultpower), 2, RoundingMode.HALF_EVEN).doubleValue());
+            peeidt.setMonthlyxs(BigDecimal.valueOf(peeidt.getMonthfdl()).divide(new BigDecimal(defaultpower), 2, RoundingMode.HALF_EVEN).doubleValue());
+            peeidt.setDaylyxs(BigDecimal.valueOf(peeidt.getYearfdl()).divide(new BigDecimal(defaultpower), 2, RoundingMode.HALF_EVEN).doubleValue());
 
-            List<String> filedls = initialFiled();
-            //遍历循环排序,将序号赋值给rank,再通过风机编号转为,MAP
-            orderObject(topls,ordermap,filedls);
 
+            //设备可利用率
+            int dayhours = 24;
+            double temp = StringUtils.round(dayhours - peeidt.getDaygzsj(), 2);
+            peeidt.setDaysbklyl(temp);
 
-            for (ProEconEquipmentInfoDayTop top : topls) {
+            Calendar cal = Calendar.getInstance();
+            cal.setTime(recordDate);
+            int days = c.get(Calendar.DAY_OF_MONTH);
 
-                calLevels(top, topls.size(), ordermap, "day");
-                calLevels(top, topls.size(), ordermap, "month");
-                calLevels(top, topls.size(), ordermap, "year");
+            dayhours = 24 * days;
+            temp = StringUtils.round(dayhours - peeidt.getMonthgzsj(), 2);
+            peeidt.setMonthsbklyl(temp);
 
-                proEconEquipmentInfoDayTopService.save(top);
-            }
+            days = c.get(Calendar.DAY_OF_YEAR);
+            dayhours = 24 * days;
+            temp = StringUtils.round(dayhours - peeidt.getYeargzsj(), 2);
+            peeidt.setYearsbklyl(temp);
 
 
-        }
+            //等效可用系数
+            dayhours = 24;
+            temp = StringUtils.round(dayhours - peeidt.getDaygzsj() - peeidt.getDaywhsj(), 2);
+            peeidt.setDaydxkyxs(temp);
+
+            cal = Calendar.getInstance();
+            cal.setTime(recordDate);
+            days = c.get(Calendar.DAY_OF_MONTH);
+
+            dayhours = 24 * days;
+            temp = StringUtils.round(dayhours - peeidt.getMonthgzsj() - peeidt.getMonthwhsj(), 2);
+            peeidt.setMonthdxkyxs(temp);
 
+            days = c.get(Calendar.DAY_OF_YEAR);
+            dayhours = 24 * days;
+            temp = StringUtils.round(dayhours - peeidt.getYeargzsj() - peeidt.getMonthwhsj(), 2);
+            peeidt.setYeardxkyxs(temp);
+        }
 
+        List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list().stream()
+                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate)) == 0
+                        && i.getWindturbineId().equals(wt.getId())
+                ).collect(Collectors.toList());
+
+        if (!pepid4ls.isEmpty()) {
+            ProEconEquipmentInfoDay4 pepid4 = pepid4ls.get(0);
+            //拟合优度
+            peeidt.setDaynhyd(pepid4.getRnhyd());
+            peeidt.setMonthnhyd(pepid4.getYnhyd());
+            peeidt.setYearnhyd(pepid4.getNnhyd());
+            //有效风时数
+            peeidt.setDayyxfss(pepid4.getRyxfss());
+            peeidt.setMonthyxfss(pepid4.getYyxfss());
+            peeidt.setYearyxfss(pepid4.getNyxfss());
+            //小风切入
+            peeidt.setDayxfqr(pepid4.getRxfqrfs());
+            peeidt.setMonthxfqr(pepid4.getYxfqrfs());
+            peeidt.setYearxfqr(pepid4.getNxfqrfs());
+            //静风频率
+
+            int dayhours = 24;
+            double temp = BigDecimal.valueOf(pepid4.getRjfsc()).divide(new BigDecimal(dayhours), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
+            peeidt.setDayjfpl(temp);
+
+            Calendar cal = Calendar.getInstance();
+            cal.setTime(recordDate);
+            int days = c.get(Calendar.DAY_OF_MONTH);
+
+            dayhours = 24 * days;
+            temp = BigDecimal.valueOf(pepid4.getYjfsc()).divide(new BigDecimal(dayhours), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
+            peeidt.setMonthjfpl(temp);
+
+            days = c.get(Calendar.DAY_OF_YEAR);
+            dayhours = 24 * days;
+            temp = BigDecimal.valueOf(pepid4.getNjfsc()).divide(new BigDecimal(dayhours), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
+            peeidt.setYearjfpl(temp);
+
+
+            //功率一致性系数
+            peeidt.setDayglyzxxs(pepid4.getRglyzxxs());
+            peeidt.setMonthglyzxxs(pepid4.getYglyzxxs());
+            peeidt.setYearglyzxxs(pepid4.getNglyzxxs());
+        }
+        return peeidt;
     }
 
 
@@ -267,7 +291,7 @@ public class EquipmentInfoDayTopService {
             List<ProEconEquipmentInfoDayTop> ls = new ArrayList<>();
 
 
-            Map<String, ProEconEquipmentInfoDayTop> map = new HashMap<>();
+            Map<String, ProEconEquipmentInfoDayTop> map;
 
             switch (str) {
                 case "dayfs":

+ 156 - 180
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java

@@ -6,12 +6,10 @@ import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.model.vo.Location;
-import com.gyee.generation.service.auto.*;
+import com.gyee.generation.service.auto.IProEconPowerstationInfoDay1Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -23,7 +21,7 @@ import java.util.stream.Collectors;
 @Service
 public class WindPowerInfo1Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo1Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo1Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -35,8 +33,6 @@ public class WindPowerInfo1Service {
 
     /**
      * 计算区域日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calRegionInfoDay(Date recordDate) throws Exception {
 
@@ -56,9 +52,9 @@ public class WindPowerInfo1Service {
             for(ProEconPowerstationInfoDay1 wpinfo:wpinfodayls)
             {
 
-                if(rgmap.containsKey(wpinfo.getCompanyId()))
+                if(rgmap.containsKey(wpinfo.getRegionId()))
                 {
-                    Map<String, List<ProEconPowerstationInfoDay1>> map=rgmap.get(wpinfo.getCompanyId());
+                    Map<String, List<ProEconPowerstationInfoDay1>> map=rgmap.get(wpinfo.getRegionId());
                     List<ProEconPowerstationInfoDay1> qbls=map.get("qb");
                     List<ProEconPowerstationInfoDay1> gfls=map.get("fd");
                     List<ProEconPowerstationInfoDay1> fdls=map.get("gf");
@@ -88,6 +84,7 @@ public class WindPowerInfo1Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    rgmap.put(wpinfo.getRegionId(),map);
                 }
             }
 
@@ -99,7 +96,7 @@ public class WindPowerInfo1Service {
                             && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay1::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay1Service.removeByIds(idls);
 
@@ -160,17 +157,15 @@ public class WindPowerInfo1Service {
 
 
 
-            };
+            }
         }
 
     }
 
     /**
      * 计算公司日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calCompanyInfoDay(Date recordDate) throws Exception {
+    public void calCompanyInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -219,6 +214,7 @@ public class WindPowerInfo1Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    cpmap.put(wpinfo.getCompanyId(),map);
                 }
             }
 
@@ -229,7 +225,7 @@ public class WindPowerInfo1Service {
                             && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay1::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay1Service.removeByIds(idls);
 
@@ -292,52 +288,52 @@ public class WindPowerInfo1Service {
 
 
 
-            };
+            }
         }
 
     }
 
-    private void calCp(ProEconPowerstationInfoDay1 pewp,List<ProEconPowerstationInfoDay1> ls) throws Exception {
+    private void calCp(ProEconPowerstationInfoDay1 pewp,List<ProEconPowerstationInfoDay1> ls) {
 
         if(!ls.isEmpty())
         {
-//            DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(n -> n.getRzdfs()).summaryStatistics();
+//            DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzdfs).summaryStatistics();
 //            //日最大风速
 //            pewp.setRzdfs(summaryStatistics.getMax());
 //            //日最小风速
-//            summaryStatistics=ls.stream().mapToDouble(n -> n.getRzxfs()).summaryStatistics();
+//            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzxfs).summaryStatistics();
 //            pewp.setRzxfs(summaryStatistics.getMin());
 //            //日平均风速
-//            summaryStatistics=ls.stream().mapToDouble(n -> n.getRpjfs()).summaryStatistics();
+//            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRpjfs).summaryStatistics();
 //            pewp.setRpjfs(summaryStatistics.getAverage());
 //
-//            summaryStatistics=ls.stream().mapToDouble(n -> n.getRzdgl()).summaryStatistics();
+//            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzdgl).summaryStatistics();
 //            //日最大功率
 //            pewp.setRzdgl(summaryStatistics.getMax());
 //            //日最小功率
-//            summaryStatistics=ls.stream().mapToDouble(n -> n.getRzxgl()).summaryStatistics();
+//            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzxgl).summaryStatistics();
 //            pewp.setRzxgl(summaryStatistics.getMin());
 //            //日平均功率
-//            summaryStatistics=ls.stream().mapToDouble(n -> n.getRpjgl()).summaryStatistics();
+//            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRpjgl).summaryStatistics();
 //            pewp.setRpjgl(summaryStatistics.getAverage());
 
 
             //日发电量
-            DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(n -> n.getRfdl()).summaryStatistics();
+            DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRfdl).summaryStatistics();
             pewp.setRfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日可用电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRkydl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRkydl).summaryStatistics();
             pewp.setRkydl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //日理论发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRllfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRllfdl).summaryStatistics();
             pewp.setRllfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //日故障损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRgzssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRgzssdl).summaryStatistics();
             pewp.setRgzssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
@@ -345,76 +341,76 @@ public class WindPowerInfo1Service {
             pewp.setRcnslgzssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日检修损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRjxssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRjxssdl).summaryStatistics();
             pewp.setRjxssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日场内受累检修损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRcnsljxssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRcnsljxssdl).summaryStatistics();
             pewp.setRcnsljxssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //日待机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRdjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRdjssdl).summaryStatistics();
             pewp.setRdjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日缺陷降出力损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRqxjclssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRqxjclssdl).summaryStatistics();
             pewp.setRqxjclssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日手动停机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRsdtjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRsdtjssdl).summaryStatistics();
             pewp.setRsdtjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日性能损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRxnssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRxnssdl).summaryStatistics();
             pewp.setRxnssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日限电停机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRxdtjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRxdtjssdl).summaryStatistics();
             pewp.setRxdtjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日限电降出力损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRxdjclssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRxdjclssdl).summaryStatistics();
             pewp.setRxdjclssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //日场外受累电网损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRcwsldwssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRcwsldwssdl).summaryStatistics();
             pewp.setRcwsldwssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //日场外受累天气损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRcwsltqssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRcwsltqssdl).summaryStatistics();
             pewp.setRcwsltqssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日增发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRzfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzfdl).summaryStatistics();
             pewp.setRzfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日欠发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRqfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRqfdl).summaryStatistics();
             pewp.setRqfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //日自耗电
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getRzhd()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRzhd).summaryStatistics();
             pewp.setRzhd(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月发电量
-             summaryStatistics=ls.stream().mapToDouble(n -> n.getYfdl()).summaryStatistics();
+             summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYfdl).summaryStatistics();
             pewp.setYfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月可用电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYkydl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYkydl).summaryStatistics();
             pewp.setYkydl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //月理论发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYllfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYllfdl).summaryStatistics();
             pewp.setYllfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //月故障损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYgzssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYgzssdl).summaryStatistics();
             pewp.setYgzssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
@@ -422,76 +418,76 @@ public class WindPowerInfo1Service {
             pewp.setYcnslgzssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月检修损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYjxssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYjxssdl).summaryStatistics();
             pewp.setYjxssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月场内受累检修损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYcnsljxssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYcnsljxssdl).summaryStatistics();
             pewp.setYcnsljxssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //月待机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYdjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYdjssdl).summaryStatistics();
             pewp.setYdjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月缺陷降出力损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYqxjclssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYqxjclssdl).summaryStatistics();
             pewp.setYqxjclssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月手动停机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYsdtjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYsdtjssdl).summaryStatistics();
             pewp.setYsdtjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月性能损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYxnssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYxnssdl).summaryStatistics();
             pewp.setYxnssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月限电停机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYxdtjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYxdtjssdl).summaryStatistics();
             pewp.setYxdtjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月限电降出力损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYxdjclssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYxdjclssdl).summaryStatistics();
             pewp.setYxdjclssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //月场外受累电网损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYcwsldwssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYcwsldwssdl).summaryStatistics();
             pewp.setYcwsldwssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //月场外受累天气损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYcwsltqssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYcwsltqssdl).summaryStatistics();
             pewp.setYcwsltqssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月增发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYzfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYzfdl).summaryStatistics();
             pewp.setYzfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月欠发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYqfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYqfdl).summaryStatistics();
             pewp.setYqfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //月自耗电
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getYzhd()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getYzhd).summaryStatistics();
             pewp.setYzhd(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNfdl).summaryStatistics();
             pewp.setNfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年可用电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNkydl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNkydl).summaryStatistics();
             pewp.setNkydl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //年理论发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNllfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNllfdl).summaryStatistics();
             pewp.setNllfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //年故障损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNgzssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNgzssdl).summaryStatistics();
             pewp.setNgzssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
@@ -499,66 +495,64 @@ public class WindPowerInfo1Service {
             pewp.setNcnslgzssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年检修损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNjxssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNjxssdl).summaryStatistics();
             pewp.setNjxssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年场内受累检修损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNcnsljxssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNcnsljxssdl).summaryStatistics();
             pewp.setNcnsljxssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //年待机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNdjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNdjssdl).summaryStatistics();
             pewp.setNdjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年缺陷降出力损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNqxjclssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNqxjclssdl).summaryStatistics();
             pewp.setNqxjclssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年手动停机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNsdtjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNsdtjssdl).summaryStatistics();
             pewp.setNsdtjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年性能损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNxnssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNxnssdl).summaryStatistics();
             pewp.setNxnssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年限电停机损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNxdtjssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNxdtjssdl).summaryStatistics();
             pewp.setNxdtjssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年限电降出力损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNxdjclssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNxdjclssdl).summaryStatistics();
             pewp.setNxdjclssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //年场外受累电网损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNcwsldwssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNcwsldwssdl).summaryStatistics();
             pewp.setNcwsldwssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
 
             //年场外受累天气损失电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNcwsltqssdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNcwsltqssdl).summaryStatistics();
             pewp.setNcwsltqssdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年增发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNzfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNzfdl).summaryStatistics();
             pewp.setNzfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年欠发电量
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNqfdl()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNqfdl).summaryStatistics();
             pewp.setNqfdl(StringUtils.round(summaryStatistics.getSum(),2));
 
             //年自耗电
-            summaryStatistics=ls.stream().mapToDouble(n -> n.getNzhd()).summaryStatistics();
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getNzhd).summaryStatistics();
             pewp.setNzhd(StringUtils.round(summaryStatistics.getSum(),2));
 
         }
     }
     /**
      * 计算场站日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -569,7 +563,7 @@ public class WindPowerInfo1Service {
         Date begin= DateUtils.truncDay(c.getTime());
 
 
-        List<ProEconPowerstationInfoDay1> wpinfodayls=new ArrayList<>();
+
 
 
         //判断是否有重复记录,先删除重复记录
@@ -579,7 +573,7 @@ public class WindPowerInfo1Service {
                         && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay1::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay1Service.removeByIds(idls);
 
@@ -615,8 +609,8 @@ public class WindPowerInfo1Service {
                         .collect(Collectors.toList());
                 }
                 extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
-/*******************************************年信息统计*********************************************************/
-//                wpinfodayls.add(pewp);
+//*******************************************年信息统计*********************************************************/
+
                 proEconPowerstationInfoDay1Service.save(pewp);
 
             }
@@ -628,8 +622,6 @@ public class WindPowerInfo1Service {
 
     /**
      * 计算项目日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -646,7 +638,7 @@ public class WindPowerInfo1Service {
                         && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay1::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay1Service.removeByIds(idls);
 
@@ -693,8 +685,6 @@ public class WindPowerInfo1Service {
     }
     /**
      * 计算线路日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -711,7 +701,7 @@ public class WindPowerInfo1Service {
                         && i.getLocation().equals(Location.ln.getValue()) ).map(ProEconPowerstationInfoDay1::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay1Service.removeByIds(idls);
 
@@ -757,14 +747,14 @@ public class WindPowerInfo1Service {
     }
 
     private void extracted(Date recordDate, Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay1 pewp, List<ProEconPowerstationInfoDay1> pepid1ls) throws Exception {
-        /*******************************************日信息统计*********************************************************/
+        //*******************************************日信息统计*********************************************************/
         if(pointmap.containsKey(ContantXk.SSPJFS))
         {
             ProBasicPowerstationPoint point= pointmap.get(ContantXk.SSPJFS);
             List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
             if(!pointls.isEmpty())
             {
-                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                 //日最大风速
                 pewp.setRzdfs(summaryStatistics.getMax());
                 //日最小风速
@@ -781,7 +771,7 @@ public class WindPowerInfo1Service {
             List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
             if(!pointls.isEmpty())
             {
-                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                 //日最大功率
                 pewp.setRzdgl(summaryStatistics.getMax());
                 //日最小功率
@@ -1005,63 +995,56 @@ public class WindPowerInfo1Service {
             }
         }
 
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
         if(pepid1ls.isEmpty())
         {
-            setPowerandSpeedMonth(end, begin, pointmap, pewp);
+            setPowerandSpeedMonth(pewp);
         }else
         {
 
-            if(!pepid1ls.isEmpty())
-            {
-               ProEconPowerstationInfoDay1 pepid=pepid1ls.get(0);
+            ProEconPowerstationInfoDay1 pepid=pepid1ls.get(0);
 
-               //如果昨日大于今日最大功率
-                if(pepid.getYzdgl()> pewp.getRzdgl())
-                {
-                    pewp.setYzdgl(pepid.getYzdgl());
-                }else {
-                    pewp.setYzdgl(pewp.getRzdgl());
-                }
-                //如果昨日大于今日最大风速
-                if(pepid.getYzdfs()> pewp.getRzdfs())
-                {
-                    pewp.setYzdfs(pepid.getYzdfs());
-                }else
-                {
-                    pewp.setYzdfs(pewp.getRzdfs());
-                }
-
-                //如果昨日小于今日最小功率
-                if(pepid.getYzxgl()< pewp.getRzxgl())
-                {
-                    pewp.setYzxgl(pepid.getYzxgl());
-                }else
-                {
-                    pewp.setYzxgl(pewp.getRzxgl());
-                }
-                //如果昨日小于今日最小风速
-                if(pepid.getYzxfs()< pewp.getRzxfs())
-                {
-                    pewp.setYzxfs(pepid.getYzxfs());
-                }else
-                {
-                    pewp.setYzxfs(pewp.getRzxfs());
-                }
-                double   pjfs = new BigDecimal(pewp.getYpjfs()+pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-
-                pewp.setYzxfs(pjfs);
-
-                double   pjgl = new BigDecimal(pewp.getYpjgl()+pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-                pewp.setYzxgl(pjgl);
+            //如果昨日大于今日最大功率
+            if(pepid.getYzdgl()> pewp.getRzdgl())
+            {
+                pewp.setYzdgl(pepid.getYzdgl());
+            }else {
+                pewp.setYzdgl(pewp.getRzdgl());
+            }
+            //如果昨日大于今日最大风速
+            if(pepid.getYzdfs()> pewp.getRzdfs())
+            {
+                pewp.setYzdfs(pepid.getYzdfs());
+            }else
+            {
+                pewp.setYzdfs(pewp.getRzdfs());
+            }
 
+            //如果昨日小于今日最小功率
+            if(pepid.getYzxgl()< pewp.getRzxgl())
+            {
+                pewp.setYzxgl(pepid.getYzxgl());
+            }else
+            {
+                pewp.setYzxgl(pewp.getRzxgl());
+            }
+            //如果昨日小于今日最小风速
+            if(pepid.getYzxfs()< pewp.getRzxfs())
+            {
+                pewp.setYzxfs(pepid.getYzxfs());
             }else
             {
-                setPowerandSpeedMonth(end, begin, pointmap, pewp);
+                pewp.setYzxfs(pewp.getRzxfs());
             }
+            double   pjfs = BigDecimal.valueOf(pewp.getYpjfs() + pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+
+            pewp.setYzxfs(pjfs);
+
+            double   pjgl = BigDecimal.valueOf(pewp.getYpjgl() + pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            pewp.setYzxgl(pjgl);
 
         }
 
@@ -1280,62 +1263,55 @@ public class WindPowerInfo1Service {
         }
 
 
-/*******************************************月信息统计*********************************************************/
+///*******************************************月信息统计*********************************************************/
 
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
         if(pepid1ls.isEmpty())
         {
-            setPowerandSpeedYear(end, begin, pointmap, pewp);
+            setPowerandSpeedYear(pewp);
         }else
         {
 
-            if(!pepid1ls.isEmpty())
-            {
-                ProEconPowerstationInfoDay1 pepid=pepid1ls.get(0);
+            ProEconPowerstationInfoDay1 pepid=pepid1ls.get(0);
 
-                //如果昨日大于今日最大功率
-                if(pepid.getNzdgl()> pewp.getRzdgl())
-                {
-                    pewp.setNzdgl(pepid.getNzdgl());
-                }else {
-                    pewp.setNzdgl(pewp.getRzdgl());
-                }
-                //如果昨日大于今日最大风速
-                if(pepid.getNzdfs()> pewp.getRzdfs())
-                {
-                    pewp.setNzdfs(pepid.getNzdfs());
-                }else
-                {
-                    pewp.setNzdfs(pewp.getRzdfs());
-                }
-
-                //如果昨日小于今日最小功率
-                if(pepid.getNzxgl()< pewp.getRzxgl())
-                {
-                    pewp.setNzxgl(pepid.getNzxgl());
-                }else
-                {
-                    pewp.setNzxgl(pewp.getRzxgl());
-                }
-                //如果昨日小于今日最小风速
-                if(pepid.getNzxfs()< pewp.getRzxfs())
-                {
-                    pewp.setNzxfs(pepid.getNzxfs());
-                }else
-                {
-                    pewp.setNzxfs(pewp.getRzxfs());
-                }
-                double   pjfs = new BigDecimal(pewp.getNpjfs()+pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-
-                pewp.setNzxfs(pjfs);
-
-                double   pjgl = new BigDecimal(pewp.getNpjgl()+pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-                pewp.setNzxgl(pjgl);
+            //如果昨日大于今日最大功率
+            if(pepid.getNzdgl()> pewp.getRzdgl())
+            {
+                pewp.setNzdgl(pepid.getNzdgl());
+            }else {
+                pewp.setNzdgl(pewp.getRzdgl());
+            }
+            //如果昨日大于今日最大风速
+            if(pepid.getNzdfs()> pewp.getRzdfs())
+            {
+                pewp.setNzdfs(pepid.getNzdfs());
+            }else
+            {
+                pewp.setNzdfs(pewp.getRzdfs());
+            }
 
+            //如果昨日小于今日最小功率
+            if(pepid.getNzxgl()< pewp.getRzxgl())
+            {
+                pewp.setNzxgl(pepid.getNzxgl());
+            }else
+            {
+                pewp.setNzxgl(pewp.getRzxgl());
+            }
+            //如果昨日小于今日最小风速
+            if(pepid.getNzxfs()< pewp.getRzxfs())
+            {
+                pewp.setNzxfs(pepid.getNzxfs());
             }else
             {
-                setPowerandSpeedYear(end, begin, pointmap, pewp);
+                pewp.setNzxfs(pewp.getRzxfs());
             }
+            double   pjfs = BigDecimal.valueOf(pewp.getNpjfs() + pepid.getRpjfs()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+
+            pewp.setNzxfs(pjfs);
+
+            double   pjgl = BigDecimal.valueOf(pewp.getNpjgl() + pepid.getRpjgl()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            pewp.setNzxgl(pjgl);
 
         }
 
@@ -1553,7 +1529,7 @@ public class WindPowerInfo1Service {
         }
     }
 
-    private void setPowerandSpeedYear(Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay1 pewp) throws Exception {
+    private void setPowerandSpeedYear( ProEconPowerstationInfoDay1 pewp) {
         //年最大风速
         pewp.setNzdfs(pewp.getRzdfs());
         //年最小风速
@@ -1569,7 +1545,7 @@ public class WindPowerInfo1Service {
 
     }
 
-    private void setPowerandSpeedMonth(Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay1 pewp) throws Exception {
+    private void setPowerandSpeedMonth( ProEconPowerstationInfoDay1 pewp) {
 
         //月最大风速
         pewp.setYzdfs(pewp.getRzdfs());

+ 128 - 168
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java

@@ -10,8 +10,6 @@ import com.gyee.generation.service.auto.IProEconPowerstationInfoDay2Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -23,7 +21,7 @@ import java.util.stream.Collectors;
 @Service
 public class WindPowerInfo2Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo2Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo2Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -35,10 +33,8 @@ public class WindPowerInfo2Service {
 
     /**
      * 计算区域日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calRegionInfoDay(Date recordDate) throws Exception {
+    public void calRegionInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay2> wpinfodayls = proEconPowerstationInfoDay2Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -56,9 +52,9 @@ public class WindPowerInfo2Service {
             for(ProEconPowerstationInfoDay2 wpinfo:wpinfodayls)
             {
 
-                if(rgmap.containsKey(wpinfo.getCompanyId()))
+                if(rgmap.containsKey(wpinfo.getRegionId()))
                 {
-                    Map<String, List<ProEconPowerstationInfoDay2>> map=rgmap.get(wpinfo.getCompanyId());
+                    Map<String, List<ProEconPowerstationInfoDay2>> map=rgmap.get(wpinfo.getRegionId());
                     List<ProEconPowerstationInfoDay2> qbls=map.get("qb");
                     List<ProEconPowerstationInfoDay2> gfls=map.get("fd");
                     List<ProEconPowerstationInfoDay2> fdls=map.get("gf");
@@ -88,6 +84,7 @@ public class WindPowerInfo2Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    rgmap.put(wpinfo.getRegionId(),map);
                 }
             }
 
@@ -99,7 +96,7 @@ public class WindPowerInfo2Service {
                             && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay2::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay2Service.removeByIds(idls);
 
@@ -160,17 +157,15 @@ public class WindPowerInfo2Service {
 
 
 
-            };
+            }
         }
 
     }
 
     /**
      * 计算公司日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calCompanyInfoDay(Date recordDate) throws Exception {
+    public void calCompanyInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay2> wpinfodayls = proEconPowerstationInfoDay2Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -183,8 +178,6 @@ public class WindPowerInfo2Service {
             Map<String, Map<String, List<ProEconPowerstationInfoDay2>>>cpmap=new HashMap<>();
 
 
-
-
             for(ProEconPowerstationInfoDay2 wpinfo:wpinfodayls)
             {
 
@@ -220,6 +213,7 @@ public class WindPowerInfo2Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    cpmap.put(wpinfo.getCompanyId(),map);
                 }
             }
 
@@ -231,7 +225,7 @@ public class WindPowerInfo2Service {
                             && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay2::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay2Service.removeByIds(idls);
 
@@ -294,12 +288,12 @@ public class WindPowerInfo2Service {
 
 
 
-            };
+            }
         }
 
     }
 
-    private void calCp(ProEconPowerstationInfoDay2 pewp,List<ProEconPowerstationInfoDay2> ls) throws Exception {
+    private void calCp(ProEconPowerstationInfoDay2 pewp,List<ProEconPowerstationInfoDay2> ls) {
 
         if(!ls.isEmpty())
         {
@@ -399,8 +393,6 @@ public class WindPowerInfo2Service {
     }
     /**
      * 计算场站日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -411,9 +403,6 @@ public class WindPowerInfo2Service {
         Date begin= DateUtils.truncDay(c.getTime());
 
 
-        List<ProEconPowerstationInfoDay2> wpinfodayls=new ArrayList<>();
-
-
         //判断是否有重复记录,先删除重复记录
         List<String> idls = proEconPowerstationInfoDay2Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -421,7 +410,7 @@ public class WindPowerInfo2Service {
                         && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay2::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay2Service.removeByIds(idls);
 
@@ -430,7 +419,7 @@ public class WindPowerInfo2Service {
         {
             if(CacheContext.wppointmap.containsKey(wp.getId()))
             {
-                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(wp.getId());
+//                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(wp.getId());
 
                 ProEconPowerstationInfoDay2 pewp=new ProEconPowerstationInfoDay2();
                Initial.initial(pewp);
@@ -459,7 +448,7 @@ public class WindPowerInfo2Service {
                 calDetiall(pewp, end, begin, CacheContext.wpwtmap.get(wp.getId()), pepidls);
 
                 calSimple( pewp, end, begin, CacheContext.wpwtmap.get(wp.getId()),pepidls);
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
 //                wpinfodayls.add(pewp);
                 proEconPowerstationInfoDay2Service.save(pewp);
 
@@ -472,8 +461,6 @@ public class WindPowerInfo2Service {
 
     /**
      * 计算项目日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -490,7 +477,7 @@ public class WindPowerInfo2Service {
                         && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay2::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay2Service.removeByIds(idls);
 
@@ -499,7 +486,7 @@ public class WindPowerInfo2Service {
         {
             if(CacheContext.wppointmap.containsKey(pj.getId()))
             {
-                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(pj.getId());
+//                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(pj.getId());
 
                 ProEconPowerstationInfoDay2 pewp=new ProEconPowerstationInfoDay2();
                 Initial.initial(pewp);
@@ -537,8 +524,6 @@ public class WindPowerInfo2Service {
     }
     /**
      * 计算线路日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -555,7 +540,7 @@ public class WindPowerInfo2Service {
                         && i.getLocation().equals(Location.ln.getValue()) ).map(ProEconPowerstationInfoDay2::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay2Service.removeByIds(idls);
 
@@ -564,7 +549,7 @@ public class WindPowerInfo2Service {
         {
             if(CacheContext.wppointmap.containsKey(ln.getId()))
             {
-                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(ln.getId());
+//                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(ln.getId());
 
                 ProEconPowerstationInfoDay2 pewp=new ProEconPowerstationInfoDay2();
                 Initial.initial(pewp);
@@ -616,7 +601,7 @@ public class WindPowerInfo2Service {
 //                12	通讯中断
 //                13	设备离线
 
-        double lastState=-1;//上一分钟状态
+        double lastState;//上一分钟状态
 
         double djsc=0;//待机时长
         double sdtjsc=0;//手动停机时长
@@ -639,8 +624,8 @@ public class WindPowerInfo2Service {
         {
 
             lastState=-1;//上一分钟状态
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.MXZT));
+            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+            if(aimap.containsKey(ContantXk.MXZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
@@ -845,9 +830,9 @@ public class WindPowerInfo2Service {
         pewp.setRhjlxxsmx(new BigDecimal(sblxsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
 
 
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
         if(pepidls.isEmpty())
         {
@@ -856,93 +841,80 @@ public class WindPowerInfo2Service {
         }else
         {
 
-            if(!pepidls.isEmpty())
-            {
-               ProEconPowerstationInfoDay2 pepid=pepidls.get(0);
-
-                //月合计故障小时(明细)
-                pewp.setYhjgzxsmx(StringUtils.round(pepid.getYhjgzxsmx()+pewp.getRhjgzxsmx(),2));
-                //月合计场内受累故障小时(明细)
-                pewp.setYhjcnslgzxsmx(StringUtils.round(pepid.getYhjcnslgzxsmx()+pewp.getRhjcnslgzxsmx(),2));
-                //月合计检修小时(明细)
-                pewp.setYhjjxxsmx(StringUtils.round(pepid.getYhjjxxsmx()+pewp.getRhjjxxsmx(),2));
-                //月合计场内受累检修小时(明细)
-                pewp.setYhjcnsljxxsmx(StringUtils.round( pepid.getYhjcnsljxxsmx()+pewp.getRhjcnsljxxsmx(),2));
-                //月合计待机小时(明细)
-                pewp.setYhjdjxsmx(StringUtils.round(pepid.getYhjdjxsmx()+pewp.getRhjdjxsmx(),2));
-                //月合计缺陷降出力小时(明细)
-                pewp.setYhjqxjclxsmx(StringUtils.round(pepid.getYhjqxjclxsmx()+pewp.getRhjqxjclxsmx(),2));
-                //月合计手动停机小时(明细)
-                pewp.setYhjsdtjxsmx(StringUtils.round(pepid.getYhjsdtjxsmx()+pewp.getRhjsdtjxsmx(),2));
-                //月合计性能小时(明细)
-                pewp.setYhjbwxsmx(StringUtils.round(pepid.getYhjbwxsmx()+pewp.getRhjbwxsmx(),2));
-                //月合计限电停机小时(明细)
-                pewp.setYhjxdtjxsmx(StringUtils.round(pepid.getYhjxdtjxsmx()+pewp.getRhjxdtjxsmx(),2));
-                //月合计限电降出力小时(明细)
-                pewp.setYhjxdjclxsmx(StringUtils.round(pepid.getYhjxdjclxsmx()+pewp.getRhjxdjclxsmx(),2));
-                //月合计场外受累电网小时(明细)
-                pewp.setYhjcwsldwxsmx(StringUtils.round(pepid.getYhjcwsldwxsmx()+pewp.getRhjcwsldwxsmx(),2));
-                //月合计场外受累电网小时(明细)
-                pewp.setYhjcwsltqxsmx(StringUtils.round(pepid.getYhjcwsltqxsmx()+pewp.getRhjcwsltqxsmx(),2));
-                //月合计通讯中断小时(明细)
-                pewp.setYhjtxzdxsmx(StringUtils.round(pepid.getYhjtxzdxsmx()+pewp.getRhjtxzdxsmx(),2));
-                //月合计离线小时(明细)
-                pewp.setYhjlxxsmx(StringUtils.round(pepid.getYhjlxxsmx()+pewp.getRhjlxxsmx(),2));
-            }else
-            {
-                setLossHoursMonth(pewp);
-            }
+            ProEconPowerstationInfoDay2 pepid=pepidls.get(0);
+
+            //月合计故障小时(明细)
+            pewp.setYhjgzxsmx(StringUtils.round(pepid.getYhjgzxsmx()+pewp.getRhjgzxsmx(),2));
+            //月合计场内受累故障小时(明细)
+            pewp.setYhjcnslgzxsmx(StringUtils.round(pepid.getYhjcnslgzxsmx()+pewp.getRhjcnslgzxsmx(),2));
+            //月合计检修小时(明细)
+            pewp.setYhjjxxsmx(StringUtils.round(pepid.getYhjjxxsmx()+pewp.getRhjjxxsmx(),2));
+            //月合计场内受累检修小时(明细)
+            pewp.setYhjcnsljxxsmx(StringUtils.round( pepid.getYhjcnsljxxsmx()+pewp.getRhjcnsljxxsmx(),2));
+            //月合计待机小时(明细)
+            pewp.setYhjdjxsmx(StringUtils.round(pepid.getYhjdjxsmx()+pewp.getRhjdjxsmx(),2));
+            //月合计缺陷降出力小时(明细)
+            pewp.setYhjqxjclxsmx(StringUtils.round(pepid.getYhjqxjclxsmx()+pewp.getRhjqxjclxsmx(),2));
+            //月合计手动停机小时(明细)
+            pewp.setYhjsdtjxsmx(StringUtils.round(pepid.getYhjsdtjxsmx()+pewp.getRhjsdtjxsmx(),2));
+            //月合计性能小时(明细)
+            pewp.setYhjbwxsmx(StringUtils.round(pepid.getYhjbwxsmx()+pewp.getRhjbwxsmx(),2));
+            //月合计限电停机小时(明细)
+            pewp.setYhjxdtjxsmx(StringUtils.round(pepid.getYhjxdtjxsmx()+pewp.getRhjxdtjxsmx(),2));
+            //月合计限电降出力小时(明细)
+            pewp.setYhjxdjclxsmx(StringUtils.round(pepid.getYhjxdjclxsmx()+pewp.getRhjxdjclxsmx(),2));
+            //月合计场外受累电网小时(明细)
+            pewp.setYhjcwsldwxsmx(StringUtils.round(pepid.getYhjcwsldwxsmx()+pewp.getRhjcwsldwxsmx(),2));
+            //月合计场外受累电网小时(明细)
+            pewp.setYhjcwsltqxsmx(StringUtils.round(pepid.getYhjcwsltqxsmx()+pewp.getRhjcwsltqxsmx(),2));
+            //月合计通讯中断小时(明细)
+            pewp.setYhjtxzdxsmx(StringUtils.round(pepid.getYhjtxzdxsmx()+pewp.getRhjtxzdxsmx(),2));
+            //月合计离线小时(明细)
+            pewp.setYhjlxxsmx(StringUtils.round(pepid.getYhjlxxsmx()+pewp.getRhjlxxsmx(),2));
 
         }
 
 
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
             setLossHoursYear(pewp);
         }else
         {
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconPowerstationInfoDay2 pepid=pepidls.get(0);
-
-                //年合计故障小时(明细)
-                pewp.setNhjgzxsmx(StringUtils.round(pepid.getNhjgzxsmx()+pewp.getRhjgzxsmx(),2));
-                //年合计场内受累故障小时(明细)
-                pewp.setNhjcnslgzxsmx(StringUtils.round(pepid.getNhjcnslgzxsmx()+pewp.getRhjcnslgzxsmx(),2));
-                //年合计检修小时(明细)
-                pewp.setNhjjxxsmx(StringUtils.round(pepid.getNhjjxxsmx()+pewp.getRhjjxxsmx(),2));
-                //年合计场内受累检修小时(明细)
-                pewp.setNhjcnsljxxsmx(StringUtils.round( pepid.getNhjcnsljxxsmx()+pewp.getRhjcnsljxxsmx(),2));
-                //年合计待机小时(明细)
-                pewp.setNhjdjxsmx(StringUtils.round(pepid.getNhjdjxsmx()+pewp.getRhjdjxsmx(),2));
-                //年合计缺陷降出力小时(明细)
-                pewp.setNhjqxjclxsmx(StringUtils.round(pepid.getNhjqxjclxsmx()+pewp.getRhjqxjclxsmx(),2));
-                //年合计手动停机小时(明细)
-                pewp.setNhjsdtjxsmx(StringUtils.round(pepid.getNhjsdtjxsmx()+pewp.getRhjsdtjxsmx(),2));
-                //年合计性能小时(明细)
-                pewp.setNhjbwxsmx(StringUtils.round(pepid.getNhjbwxsmx()+pewp.getRhjbwxsmx(),2));
-                //年合计限电停机小时(明细)
-                pewp.setNhjxdtjxsmx(StringUtils.round(pepid.getNhjxdtjxsmx()+pewp.getRhjxdtjxsmx(),2));
-                //年合计限电降出力小时(明细)
-                pewp.setNhjxdjclxsmx(StringUtils.round(pepid.getNhjxdjclxsmx()+pewp.getRhjxdjclxsmx(),2));
-                //年合计场外受累电网小时(明细)
-                pewp.setNhjcwsldwxsmx(StringUtils.round(pepid.getNhjcwsldwxsmx()+pewp.getRhjcwsldwxsmx(),2));
-                //年合计场外受累电网小时(明细)
-                pewp.setNhjcwsltqxsmx(StringUtils.round(pepid.getNhjcwsltqxsmx()+pewp.getRhjcwsltqxsmx(),2));
-                //年合计通讯中断小时(明细)
-                pewp.setNhjtxzdxsmx(StringUtils.round(pepid.getNhjtxzdxsmx()+pewp.getRhjtxzdxsmx(),2));
-                //年合计离线小时(明细)
-                pewp.setNhjlxxsmx(StringUtils.round(pepid.getNhjlxxsmx()+pewp.getRhjlxxsmx(),2));
-
-            }else
-            {
-                setLossHoursYear(pewp);
-            }
+            ProEconPowerstationInfoDay2 pepid=pepidls.get(0);
+
+            //年合计故障小时(明细)
+            pewp.setNhjgzxsmx(StringUtils.round(pepid.getNhjgzxsmx()+pewp.getRhjgzxsmx(),2));
+            //年合计场内受累故障小时(明细)
+            pewp.setNhjcnslgzxsmx(StringUtils.round(pepid.getNhjcnslgzxsmx()+pewp.getRhjcnslgzxsmx(),2));
+            //年合计检修小时(明细)
+            pewp.setNhjjxxsmx(StringUtils.round(pepid.getNhjjxxsmx()+pewp.getRhjjxxsmx(),2));
+            //年合计场内受累检修小时(明细)
+            pewp.setNhjcnsljxxsmx(StringUtils.round( pepid.getNhjcnsljxxsmx()+pewp.getRhjcnsljxxsmx(),2));
+            //年合计待机小时(明细)
+            pewp.setNhjdjxsmx(StringUtils.round(pepid.getNhjdjxsmx()+pewp.getRhjdjxsmx(),2));
+            //年合计缺陷降出力小时(明细)
+            pewp.setNhjqxjclxsmx(StringUtils.round(pepid.getNhjqxjclxsmx()+pewp.getRhjqxjclxsmx(),2));
+            //年合计手动停机小时(明细)
+            pewp.setNhjsdtjxsmx(StringUtils.round(pepid.getNhjsdtjxsmx()+pewp.getRhjsdtjxsmx(),2));
+            //年合计性能小时(明细)
+            pewp.setNhjbwxsmx(StringUtils.round(pepid.getNhjbwxsmx()+pewp.getRhjbwxsmx(),2));
+            //年合计限电停机小时(明细)
+            pewp.setNhjxdtjxsmx(StringUtils.round(pepid.getNhjxdtjxsmx()+pewp.getRhjxdtjxsmx(),2));
+            //年合计限电降出力小时(明细)
+            pewp.setNhjxdjclxsmx(StringUtils.round(pepid.getNhjxdjclxsmx()+pewp.getRhjxdjclxsmx(),2));
+            //年合计场外受累电网小时(明细)
+            pewp.setNhjcwsldwxsmx(StringUtils.round(pepid.getNhjcwsldwxsmx()+pewp.getRhjcwsldwxsmx(),2));
+            //年合计场外受累电网小时(明细)
+            pewp.setNhjcwsltqxsmx(StringUtils.round(pepid.getNhjcwsltqxsmx()+pewp.getRhjcwsltqxsmx(),2));
+            //年合计通讯中断小时(明细)
+            pewp.setNhjtxzdxsmx(StringUtils.round(pepid.getNhjtxzdxsmx()+pewp.getRhjtxzdxsmx(),2));
+            //年合计离线小时(明细)
+            pewp.setNhjlxxsmx(StringUtils.round(pepid.getNhjlxxsmx()+pewp.getRhjlxxsmx(),2));
 
         }
 
@@ -1054,7 +1026,7 @@ public class WindPowerInfo2Service {
 //        4	限电
 //        5	受累
 //        6	离线
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
         double lastState=-1;//上一分钟状态
 
@@ -1073,8 +1045,8 @@ public class WindPowerInfo2Service {
 
         for(ProBasicEquipment wt:wtls)
         {
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.SBZT));
+            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+            if(aimap.containsKey(ContantXk.SBZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.SBZT);
@@ -1175,9 +1147,9 @@ public class WindPowerInfo2Service {
             pewp.setRhjslxs(new BigDecimal(slsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
 
 
-            /*******************************************日信息统计*********************************************************/
+            //*******************************************日信息统计*********************************************************/
 
-            /*******************************************月信息统计*********************************************************/
+            //*******************************************月信息统计*********************************************************/
             if(pepidls.isEmpty())
             {
                 setLossHoursMonthSimple(pewp);
@@ -1185,34 +1157,28 @@ public class WindPowerInfo2Service {
             }else
             {
 
-                if(!pepidls.isEmpty())
-                {
-                    ProEconPowerstationInfoDay2 pepid=pepidls.get(0);
-
-
-                    //月合计待机小时
-                    pewp.setYhjdjxs(StringUtils.round(pepid.getYhjdjxs()+pewp.getRhjdjxs(),2));
-                    //月合计维护停机小时
-                    pewp.setYhjjxtjxs(StringUtils.round(pepid.getYhjjxtjxs()+pewp.getRhjjxtjxs(),2));
-                    // 月合计故障小时
-                    pewp.setYhjgztjxs(StringUtils.round(pepid.getYhjgztjxs()+pewp.getRhjgztjxs(),2));
-                    //月合计运行小时
-                    pewp.setYhjyxxs(StringUtils.round(pepid.getYhjyxxs()+pewp.getRhjyxxs(),2));
-                    //月合计限电小时
-                    pewp.setYhjxdxs(StringUtils.round(pepid.getYhjxdxs()+pewp.getRhjxdxs(),2));
-                    //月合计通讯中断小时
-                    pewp.setYhjtxzdxs(StringUtils.round(pepid.getYhjtxzdxs()+pewp.getRhjtxzdxs(),2));
-                    //月合计受累小时
-                    pewp.setYhjslxs(StringUtils.round(pepid.getYhjslxs()+pewp.getRhjslxs(),2));
-                }else
-                {
-                    setLossHoursMonthSimple(pewp);
-                }
+                ProEconPowerstationInfoDay2 pepid=pepidls.get(0);
+
+
+                //月合计待机小时
+                pewp.setYhjdjxs(StringUtils.round(pepid.getYhjdjxs()+pewp.getRhjdjxs(),2));
+                //月合计维护停机小时
+                pewp.setYhjjxtjxs(StringUtils.round(pepid.getYhjjxtjxs()+pewp.getRhjjxtjxs(),2));
+                // 月合计故障小时
+                pewp.setYhjgztjxs(StringUtils.round(pepid.getYhjgztjxs()+pewp.getRhjgztjxs(),2));
+                //月合计运行小时
+                pewp.setYhjyxxs(StringUtils.round(pepid.getYhjyxxs()+pewp.getRhjyxxs(),2));
+                //月合计限电小时
+                pewp.setYhjxdxs(StringUtils.round(pepid.getYhjxdxs()+pewp.getRhjxdxs(),2));
+                //月合计通讯中断小时
+                pewp.setYhjtxzdxs(StringUtils.round(pepid.getYhjtxzdxs()+pewp.getRhjtxzdxs(),2));
+                //月合计受累小时
+                pewp.setYhjslxs(StringUtils.round(pepid.getYhjslxs()+pewp.getRhjslxs(),2));
 
             }
-            /*******************************************月信息统计*********************************************************/
+            //*******************************************月信息统计*********************************************************/
 
-            /*******************************************年信息统计*********************************************************/
+            //*******************************************年信息统计*********************************************************/
             if(pepidls.isEmpty())
             {
                 setLossHoursYearSimple(pewp);
@@ -1220,32 +1186,26 @@ public class WindPowerInfo2Service {
             }else
             {
 
-                if(!pepidls.isEmpty())
-                {
-                    ProEconPowerstationInfoDay2 pepid=pepidls.get(0);
-
-
-                    //年合计待机小时
-                    pewp.setNhjdjxs(StringUtils.round(pepid.getNhjdjxs()+pewp.getRhjdjxs(),2));
-                    //年合计维护停机小时
-                    pewp.setNhjjxtjxs(StringUtils.round(pepid.getNhjjxtjxs()+pewp.getRhjjxtjxs(),2));
-                    // 年合计故障小时
-                    pewp.setNhjgztjxs(StringUtils.round(pepid.getNhjgztjxs()+pewp.getRhjgztjxs(),2));
-                    //年合计运行小时
-                    pewp.setNhjyxxs(StringUtils.round(pepid.getNhjyxxs()+pewp.getRhjyxxs(),2));
-                    //年合计限电小时
-                    pewp.setNhjxdxs(StringUtils.round(pepid.getNhjxdxs()+pewp.getRhjxdxs(),2));
-                    //年合计通讯中断小时
-                    pewp.setNhjtxzdxs(StringUtils.round(pepid.getNhjtxzdxs()+pewp.getRhjtxzdxs(),2));
-                    //年合计受累小时
-                    pewp.setNhjslxs(StringUtils.round(pepid.getNhjslxs()+pewp.getRhjslxs(),2));
-                }else
-                {
-                    setLossHoursYearSimple(pewp);
-                }
+                ProEconPowerstationInfoDay2 pepid=pepidls.get(0);
+
+
+                //年合计待机小时
+                pewp.setNhjdjxs(StringUtils.round(pepid.getNhjdjxs()+pewp.getRhjdjxs(),2));
+                //年合计维护停机小时
+                pewp.setNhjjxtjxs(StringUtils.round(pepid.getNhjjxtjxs()+pewp.getRhjjxtjxs(),2));
+                // 年合计故障小时
+                pewp.setNhjgztjxs(StringUtils.round(pepid.getNhjgztjxs()+pewp.getRhjgztjxs(),2));
+                //年合计运行小时
+                pewp.setNhjyxxs(StringUtils.round(pepid.getNhjyxxs()+pewp.getRhjyxxs(),2));
+                //年合计限电小时
+                pewp.setNhjxdxs(StringUtils.round(pepid.getNhjxdxs()+pewp.getRhjxdxs(),2));
+                //年合计通讯中断小时
+                pewp.setNhjtxzdxs(StringUtils.round(pepid.getNhjtxzdxs()+pewp.getRhjtxzdxs(),2));
+                //年合计受累小时
+                pewp.setNhjslxs(StringUtils.round(pepid.getNhjslxs()+pewp.getRhjslxs(),2));
 
             }
-            /*******************************************年信息统计*********************************************************/
+            //*******************************************年信息统计*********************************************************/
     }
 
 

+ 129 - 168
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java

@@ -10,20 +10,16 @@ import com.gyee.generation.service.auto.IProEconPowerstationInfoDay3Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
 public class WindPowerInfo3Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo2Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo2Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -35,10 +31,8 @@ public class WindPowerInfo3Service {
 
     /**
      * 计算区域日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calRegionInfoDay(Date recordDate) throws Exception {
+    public void calRegionInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay3> wpinfodayls = proEconPowerstationInfoDay3Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -56,9 +50,9 @@ public class WindPowerInfo3Service {
             for(ProEconPowerstationInfoDay3 wpinfo:wpinfodayls)
             {
 
-                if(rgmap.containsKey(wpinfo.getCompanyId()))
+                if(rgmap.containsKey(wpinfo.getRegionId()))
                 {
-                    Map<String, List<ProEconPowerstationInfoDay3>> map=rgmap.get(wpinfo.getCompanyId());
+                    Map<String, List<ProEconPowerstationInfoDay3>> map=rgmap.get(wpinfo.getRegionId());
                     List<ProEconPowerstationInfoDay3> qbls=map.get("qb");
                     List<ProEconPowerstationInfoDay3> gfls=map.get("fd");
                     List<ProEconPowerstationInfoDay3> fdls=map.get("gf");
@@ -88,6 +82,7 @@ public class WindPowerInfo3Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    rgmap.put(wpinfo.getRegionId(),map);
                 }
             }
 
@@ -99,7 +94,7 @@ public class WindPowerInfo3Service {
                             && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay3::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay3Service.removeByIds(idls);
 
@@ -160,17 +155,15 @@ public class WindPowerInfo3Service {
 
 
 
-            };
+            }
         }
 
     }
 
     /**
      * 计算公司日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calCompanyInfoDay(Date recordDate) throws Exception {
+    public void calCompanyInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay3> wpinfodayls = proEconPowerstationInfoDay3Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -220,6 +213,7 @@ public class WindPowerInfo3Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    cpmap.put(wpinfo.getCompanyId(),map);
                 }
             }
 
@@ -231,7 +225,7 @@ public class WindPowerInfo3Service {
                             && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay3::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay3Service.removeByIds(idls);
 
@@ -294,12 +288,12 @@ public class WindPowerInfo3Service {
 
 
 
-            };
+            }
         }
 
     }
 
-    private void calCp(ProEconPowerstationInfoDay3 pewp,List<ProEconPowerstationInfoDay3> ls) throws Exception {
+    private void calCp(ProEconPowerstationInfoDay3 pewp,List<ProEconPowerstationInfoDay3> ls) {
 
         if(!ls.isEmpty())
         {
@@ -399,8 +393,6 @@ public class WindPowerInfo3Service {
     }
     /**
      * 计算场站日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -411,7 +403,7 @@ public class WindPowerInfo3Service {
         Date begin= DateUtils.truncDay(c.getTime());
 
 
-        List<ProEconPowerstationInfoDay3> wpinfodayls=new ArrayList<>();
+//        List<ProEconPowerstationInfoDay3> wpinfodayls=new ArrayList<>();
 
 
         //判断是否有重复记录,先删除重复记录
@@ -421,7 +413,7 @@ public class WindPowerInfo3Service {
                         && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay3::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay3Service.removeByIds(idls);
 
@@ -430,7 +422,7 @@ public class WindPowerInfo3Service {
         {
             if(CacheContext.wppointmap.containsKey(wp.getId()))
             {
-                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(wp.getId());
+//                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(wp.getId());
 
                 ProEconPowerstationInfoDay3 pewp=new ProEconPowerstationInfoDay3();
                 Initial.initial(pewp);
@@ -458,7 +450,7 @@ public class WindPowerInfo3Service {
                 }
                 calDetiall(pewp, end, begin, CacheContext.wpwtmap.get(wp.getId()), pepidls);
                 calSimple(pewp, end, begin, CacheContext.wpwtmap.get(wp.getId()), pepidls);
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
 //                wpinfodayls.add(pewp);
                 proEconPowerstationInfoDay3Service.save(pewp);
 
@@ -471,8 +463,6 @@ public class WindPowerInfo3Service {
 
     /**
      * 计算项目日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -489,7 +479,7 @@ public class WindPowerInfo3Service {
                         && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay3::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay3Service.removeByIds(idls);
 
@@ -498,7 +488,7 @@ public class WindPowerInfo3Service {
         {
             if(CacheContext.wppointmap.containsKey(pj.getId()))
             {
-                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(pj.getId());
+//                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(pj.getId());
 
                 ProEconPowerstationInfoDay3 pewp=new ProEconPowerstationInfoDay3();
                 Initial.initial(pewp);
@@ -536,8 +526,6 @@ public class WindPowerInfo3Service {
     }
     /**
      * 计算线路日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -554,7 +542,7 @@ public class WindPowerInfo3Service {
                         && i.getLocation().equals(Location.ln.getValue()) ).map(ProEconPowerstationInfoDay3::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay3Service.removeByIds(idls);
 
@@ -563,7 +551,7 @@ public class WindPowerInfo3Service {
         {
             if(CacheContext.wppointmap.containsKey(ln.getId()))
             {
-                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(ln.getId());
+//                Map<String, ProBasicPowerstationPoint> pointmap=CacheContext.wppointmap.get(ln.getId());
 
                 ProEconPowerstationInfoDay3 pewp=new ProEconPowerstationInfoDay3();
                 Initial.initial(pewp);
@@ -615,7 +603,7 @@ public class WindPowerInfo3Service {
 //                12	通讯中断
 //                13	设备离线
 
-        double lastState=-1;//上一分钟状态
+        double lastState;//上一分钟状态
 
         double djcs=0;//待机次数
         double sdtjcs=0;//手动停机次数
@@ -638,8 +626,8 @@ public class WindPowerInfo3Service {
         {
 
             lastState=-1;//上一分钟状态
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.MXZT));
+            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+            if(aimap.containsKey(ContantXk.MXZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
@@ -842,9 +830,9 @@ public class WindPowerInfo3Service {
         //日合计离线次数(明细)
         pewp.setRhjlxcsmx(sblxcs);
 
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
         if(pepidls.isEmpty())
         {
@@ -853,93 +841,80 @@ public class WindPowerInfo3Service {
         }else
         {
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconPowerstationInfoDay3 pepid=pepidls.get(0);
-
-                //月合计故障次数(明细)
-                pewp.setYhjgzcsmx(StringUtils.round(pepid.getYhjgzcsmx()+pewp.getRhjgzcsmx(),2));
-                //月合计场内受累故障次数(明细)
-                pewp.setYhjcnslgzcsmx(StringUtils.round(pepid.getYhjcnslgzcsmx()+pewp.getRhjcnslgzcsmx(),2));
-                //月合计检修次数(明细)
-                pewp.setYhjjxcsmx(StringUtils.round(pepid.getYhjjxcsmx()+pewp.getRhjjxcsmx(),2));
-                //月合计场内受累检修次数(明细)
-                pewp.setYhjcnsljxcsmx(StringUtils.round( pepid.getYhjcnsljxcsmx()+pewp.getRhjcnsljxcsmx(),2));
-                //月合计待机次数(明细)
-                pewp.setYhjdjcsmx(StringUtils.round(pepid.getYhjdjcsmx()+pewp.getRhjdjcsmx(),2));
-                //月合计缺陷降出力次数(明细)
-                pewp.setYhjqxjclcsmx(StringUtils.round(pepid.getYhjqxjclcsmx()+pewp.getRhjqxjclcsmx(),2));
-                //月合计手动停机次数(明细)
-                pewp.setYhjsdtjcsmx(StringUtils.round(pepid.getYhjsdtjcsmx()+pewp.getRhjsdtjcsmx(),2));
-                //月合计性能次数(明细)
-                pewp.setYhjbwcsmx(StringUtils.round(pepid.getYhjbwcsmx()+pewp.getRhjbwcsmx(),2));
-                //月合计限电停机次数(明细)
-                pewp.setYhjxdtjcsmx(StringUtils.round(pepid.getYhjxdtjcsmx()+pewp.getRhjxdtjcsmx(),2));
-                //月合计限电降出力次数(明细)
-                pewp.setYhjxdjclcsmx(StringUtils.round(pepid.getYhjxdjclcsmx()+pewp.getRhjxdjclcsmx(),2));
-                //月合计场外受累电网次数(明细)
-                pewp.setYhjcwsldwcsmx(StringUtils.round(pepid.getYhjcwsldwcsmx()+pewp.getRhjcwsldwcsmx(),2));
-                //月合计场外受累电网次数(明细)
-                pewp.setYhjcwsltqcsmx(StringUtils.round(pepid.getYhjcwsltqcsmx()+pewp.getRhjcwsltqcsmx(),2));
-                //月合计通讯中断次数(明细)
-                pewp.setYhjtxzdcsmx(StringUtils.round(pepid.getYhjtxzdcsmx()+pewp.getRhjtxzdcsmx(),2));
-                //月合计离线次数(明细)
-                pewp.setYhjlxcsmx(StringUtils.round(pepid.getYhjlxcsmx()+pewp.getRhjlxcsmx(),2));
-            }else
-            {
-                setLossHoursMonth(pewp);
-            }
+            ProEconPowerstationInfoDay3 pepid=pepidls.get(0);
+
+            //月合计故障次数(明细)
+            pewp.setYhjgzcsmx(StringUtils.round(pepid.getYhjgzcsmx()+pewp.getRhjgzcsmx(),2));
+            //月合计场内受累故障次数(明细)
+            pewp.setYhjcnslgzcsmx(StringUtils.round(pepid.getYhjcnslgzcsmx()+pewp.getRhjcnslgzcsmx(),2));
+            //月合计检修次数(明细)
+            pewp.setYhjjxcsmx(StringUtils.round(pepid.getYhjjxcsmx()+pewp.getRhjjxcsmx(),2));
+            //月合计场内受累检修次数(明细)
+            pewp.setYhjcnsljxcsmx(StringUtils.round( pepid.getYhjcnsljxcsmx()+pewp.getRhjcnsljxcsmx(),2));
+            //月合计待机次数(明细)
+            pewp.setYhjdjcsmx(StringUtils.round(pepid.getYhjdjcsmx()+pewp.getRhjdjcsmx(),2));
+            //月合计缺陷降出力次数(明细)
+            pewp.setYhjqxjclcsmx(StringUtils.round(pepid.getYhjqxjclcsmx()+pewp.getRhjqxjclcsmx(),2));
+            //月合计手动停机次数(明细)
+            pewp.setYhjsdtjcsmx(StringUtils.round(pepid.getYhjsdtjcsmx()+pewp.getRhjsdtjcsmx(),2));
+            //月合计性能次数(明细)
+            pewp.setYhjbwcsmx(StringUtils.round(pepid.getYhjbwcsmx()+pewp.getRhjbwcsmx(),2));
+            //月合计限电停机次数(明细)
+            pewp.setYhjxdtjcsmx(StringUtils.round(pepid.getYhjxdtjcsmx()+pewp.getRhjxdtjcsmx(),2));
+            //月合计限电降出力次数(明细)
+            pewp.setYhjxdjclcsmx(StringUtils.round(pepid.getYhjxdjclcsmx()+pewp.getRhjxdjclcsmx(),2));
+            //月合计场外受累电网次数(明细)
+            pewp.setYhjcwsldwcsmx(StringUtils.round(pepid.getYhjcwsldwcsmx()+pewp.getRhjcwsldwcsmx(),2));
+            //月合计场外受累电网次数(明细)
+            pewp.setYhjcwsltqcsmx(StringUtils.round(pepid.getYhjcwsltqcsmx()+pewp.getRhjcwsltqcsmx(),2));
+            //月合计通讯中断次数(明细)
+            pewp.setYhjtxzdcsmx(StringUtils.round(pepid.getYhjtxzdcsmx()+pewp.getRhjtxzdcsmx(),2));
+            //月合计离线次数(明细)
+            pewp.setYhjlxcsmx(StringUtils.round(pepid.getYhjlxcsmx()+pewp.getRhjlxcsmx(),2));
 
         }
 
 
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
             setLossHoursYear(pewp);
         }else
         {
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconPowerstationInfoDay3 pepid=pepidls.get(0);
-
-                //年合计故障次数(明细)
-                pewp.setNhjgzcsmx(StringUtils.round(pepid.getNhjgzcsmx()+pewp.getRhjgzcsmx(),2));
-                //年合计场内受累故障次数(明细)
-                pewp.setNhjcnslgzcsmx(StringUtils.round(pepid.getNhjcnslgzcsmx()+pewp.getRhjcnslgzcsmx(),2));
-                //年合计检修次数(明细)
-                pewp.setNhjjxcsmx(StringUtils.round(pepid.getNhjjxcsmx()+pewp.getRhjjxcsmx(),2));
-                //年合计场内受累检修次数(明细)
-                pewp.setNhjcnsljxcsmx(StringUtils.round( pepid.getNhjcnsljxcsmx()+pewp.getRhjcnsljxcsmx(),2));
-                //年合计待机次数(明细)
-                pewp.setNhjdjcsmx(StringUtils.round(pepid.getNhjdjcsmx()+pewp.getRhjdjcsmx(),2));
-                //年合计缺陷降出力次数(明细)
-                pewp.setNhjqxjclcsmx(StringUtils.round(pepid.getNhjqxjclcsmx()+pewp.getRhjqxjclcsmx(),2));
-                //年合计手动停机次数(明细)
-                pewp.setNhjsdtjcsmx(StringUtils.round(pepid.getNhjsdtjcsmx()+pewp.getRhjsdtjcsmx(),2));
-                //年合计性能次数(明细)
-                pewp.setNhjbwcsmx(StringUtils.round(pepid.getNhjbwcsmx()+pewp.getRhjbwcsmx(),2));
-                //年合计限电停机次数(明细)
-                pewp.setNhjxdtjcsmx(StringUtils.round(pepid.getNhjxdtjcsmx()+pewp.getRhjxdtjcsmx(),2));
-                //年合计限电降出力次数(明细)
-                pewp.setNhjxdjclcsmx(StringUtils.round(pepid.getNhjxdjclcsmx()+pewp.getRhjxdjclcsmx(),2));
-                //年合计场外受累电网次数(明细)
-                pewp.setNhjcwsldwcsmx(StringUtils.round(pepid.getNhjcwsldwcsmx()+pewp.getRhjcwsldwcsmx(),2));
-                //年合计场外受累电网次数(明细)
-                pewp.setNhjcwsltqcsmx(StringUtils.round(pepid.getNhjcwsltqcsmx()+pewp.getRhjcwsltqcsmx(),2));
-                //年合计通讯中断次数(明细)
-                pewp.setNhjtxzdcsmx(StringUtils.round(pepid.getNhjtxzdcsmx()+pewp.getRhjtxzdcsmx(),2));
-                //年合计离线次数(明细)
-                pewp.setNhjlxcsmx(StringUtils.round(pepid.getNhjlxcsmx()+pewp.getRhjlxcsmx(),2));
-
-            }else
-            {
-                setLossHoursYear(pewp);
-            }
+            ProEconPowerstationInfoDay3 pepid=pepidls.get(0);
+
+            //年合计故障次数(明细)
+            pewp.setNhjgzcsmx(StringUtils.round(pepid.getNhjgzcsmx()+pewp.getRhjgzcsmx(),2));
+            //年合计场内受累故障次数(明细)
+            pewp.setNhjcnslgzcsmx(StringUtils.round(pepid.getNhjcnslgzcsmx()+pewp.getRhjcnslgzcsmx(),2));
+            //年合计检修次数(明细)
+            pewp.setNhjjxcsmx(StringUtils.round(pepid.getNhjjxcsmx()+pewp.getRhjjxcsmx(),2));
+            //年合计场内受累检修次数(明细)
+            pewp.setNhjcnsljxcsmx(StringUtils.round( pepid.getNhjcnsljxcsmx()+pewp.getRhjcnsljxcsmx(),2));
+            //年合计待机次数(明细)
+            pewp.setNhjdjcsmx(StringUtils.round(pepid.getNhjdjcsmx()+pewp.getRhjdjcsmx(),2));
+            //年合计缺陷降出力次数(明细)
+            pewp.setNhjqxjclcsmx(StringUtils.round(pepid.getNhjqxjclcsmx()+pewp.getRhjqxjclcsmx(),2));
+            //年合计手动停机次数(明细)
+            pewp.setNhjsdtjcsmx(StringUtils.round(pepid.getNhjsdtjcsmx()+pewp.getRhjsdtjcsmx(),2));
+            //年合计性能次数(明细)
+            pewp.setNhjbwcsmx(StringUtils.round(pepid.getNhjbwcsmx()+pewp.getRhjbwcsmx(),2));
+            //年合计限电停机次数(明细)
+            pewp.setNhjxdtjcsmx(StringUtils.round(pepid.getNhjxdtjcsmx()+pewp.getRhjxdtjcsmx(),2));
+            //年合计限电降出力次数(明细)
+            pewp.setNhjxdjclcsmx(StringUtils.round(pepid.getNhjxdjclcsmx()+pewp.getRhjxdjclcsmx(),2));
+            //年合计场外受累电网次数(明细)
+            pewp.setNhjcwsldwcsmx(StringUtils.round(pepid.getNhjcwsldwcsmx()+pewp.getRhjcwsldwcsmx(),2));
+            //年合计场外受累电网次数(明细)
+            pewp.setNhjcwsltqcsmx(StringUtils.round(pepid.getNhjcwsltqcsmx()+pewp.getRhjcwsltqcsmx(),2));
+            //年合计通讯中断次数(明细)
+            pewp.setNhjtxzdcsmx(StringUtils.round(pepid.getNhjtxzdcsmx()+pewp.getRhjtxzdcsmx(),2));
+            //年合计离线次数(明细)
+            pewp.setNhjlxcsmx(StringUtils.round(pepid.getNhjlxcsmx()+pewp.getRhjlxcsmx(),2));
 
         }
 
@@ -1051,7 +1026,7 @@ public class WindPowerInfo3Service {
 //        4	限电
 //        5	受累
 //        6	离线
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
         double lastState=-1;//上一分钟状态
 
@@ -1070,8 +1045,8 @@ public class WindPowerInfo3Service {
 
         for(ProBasicEquipment wt:wtls)
         {
-            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getNemCode());
-            if(wtpAimap.containsKey(ContantXk.SBZT));
+            Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+            if(aimap.containsKey(ContantXk.SBZT))
             {
 
                 ProBasicEquipmentPoint point=aimap.get(ContantXk.SBZT);
@@ -1169,9 +1144,9 @@ public class WindPowerInfo3Service {
         pewp.setRhjslcs(slsc);
 
 
-        /*******************************************日信息统计*********************************************************/
+        //*******************************************日信息统计*********************************************************/
 
-        /*******************************************月信息统计*********************************************************/
+        //*******************************************月信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
             setLossHoursMonthSimple(pewp);
@@ -1180,36 +1155,28 @@ public class WindPowerInfo3Service {
         {
 
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconPowerstationInfoDay3 pepid=pepidls.get(0);
-
-
-
-
-                //月合计待机次数
-                pewp.setYhjdjcs(StringUtils.round(pepid.getYhjdjcs()+pewp.getRhjdjcs(),2));
-                //月合计维护停机次数
-                pewp.setYhjjxtjcs(StringUtils.round(pepid.getYhjjxtjcs()+pewp.getRhjjxtjcs(),2));
-                // 月合计故障次数
-                pewp.setYhjgztjcs(StringUtils.round(pepid.getYhjgztjcs()+pewp.getRhjgztjcs(),2));
-                //月合计运行次数
-                pewp.setYhjyxcs(StringUtils.round(pepid.getYhjyxcs()+pewp.getRhjyxcs(),2));
-                //月合计限电次数
-                pewp.setYhjxdcs(StringUtils.round(pepid.getYhjxdcs()+pewp.getRhjxdcs(),2));
-                //月合计通讯中断次数
-                pewp.setYhjtxzdcs(StringUtils.round(pepid.getYhjtxzdcs()+pewp.getRhjtxzdcs(),2));
-                //月合计受累次数
-                pewp.setYhjslcs(StringUtils.round(pepid.getYhjslcs()+pewp.getRhjslcs(),2));
-            }else
-            {
-                setLossHoursMonthSimple(pewp);
-            }
+            ProEconPowerstationInfoDay3 pepid=pepidls.get(0);
+
+
+            //月合计待机次数
+            pewp.setYhjdjcs(StringUtils.round(pepid.getYhjdjcs()+pewp.getRhjdjcs(),2));
+            //月合计维护停机次数
+            pewp.setYhjjxtjcs(StringUtils.round(pepid.getYhjjxtjcs()+pewp.getRhjjxtjcs(),2));
+            // 月合计故障次数
+            pewp.setYhjgztjcs(StringUtils.round(pepid.getYhjgztjcs()+pewp.getRhjgztjcs(),2));
+            //月合计运行次数
+            pewp.setYhjyxcs(StringUtils.round(pepid.getYhjyxcs()+pewp.getRhjyxcs(),2));
+            //月合计限电次数
+            pewp.setYhjxdcs(StringUtils.round(pepid.getYhjxdcs()+pewp.getRhjxdcs(),2));
+            //月合计通讯中断次数
+            pewp.setYhjtxzdcs(StringUtils.round(pepid.getYhjtxzdcs()+pewp.getRhjtxzdcs(),2));
+            //月合计受累次数
+            pewp.setYhjslcs(StringUtils.round(pepid.getYhjslcs()+pewp.getRhjslcs(),2));
 
         }
-        /*******************************************月信息统计*********************************************************/
+        //*******************************************月信息统计*********************************************************/
 
-        /*******************************************年信息统计*********************************************************/
+        //*******************************************年信息统计*********************************************************/
         if(pepidls.isEmpty())
         {
             setLossHoursYearSimple(pewp);
@@ -1218,32 +1185,26 @@ public class WindPowerInfo3Service {
         {
 
 
-            if(!pepidls.isEmpty())
-            {
-                ProEconPowerstationInfoDay3 pepid=pepidls.get(0);
-
-
-                //年合计待机次数
-                pewp.setNhjdjcs(StringUtils.round(pepid.getNhjdjcs()+pewp.getRhjdjcs(),2));
-                //年合计维护停机次数
-                pewp.setNhjjxtjcs(StringUtils.round(pepid.getNhjjxtjcs()+pewp.getRhjjxtjcs(),2));
-                // 年合计故障次数
-                pewp.setNhjgztjcs(StringUtils.round(pepid.getNhjgztjcs()+pewp.getRhjgztjcs(),2));
-                //年合计运行次数
-                pewp.setNhjyxcs(StringUtils.round(pepid.getNhjyxcs()+pewp.getRhjyxcs(),2));
-                //年合计限电次数
-                pewp.setNhjxdcs(StringUtils.round(pepid.getNhjxdcs()+pewp.getRhjxdcs(),2));
-                //年合计通讯中断次数
-                pewp.setNhjtxzdcs(StringUtils.round(pepid.getNhjtxzdcs()+pewp.getRhjtxzdcs(),2));
-                //年合计受累次数
-                pewp.setNhjslcs(StringUtils.round(pepid.getNhjslcs()+pewp.getRhjslcs(),2));
-            }else
-            {
-                setLossHoursYearSimple(pewp);
-            }
+            ProEconPowerstationInfoDay3 pepid=pepidls.get(0);
+
+
+            //年合计待机次数
+            pewp.setNhjdjcs(StringUtils.round(pepid.getNhjdjcs()+pewp.getRhjdjcs(),2));
+            //年合计维护停机次数
+            pewp.setNhjjxtjcs(StringUtils.round(pepid.getNhjjxtjcs()+pewp.getRhjjxtjcs(),2));
+            // 年合计故障次数
+            pewp.setNhjgztjcs(StringUtils.round(pepid.getNhjgztjcs()+pewp.getRhjgztjcs(),2));
+            //年合计运行次数
+            pewp.setNhjyxcs(StringUtils.round(pepid.getNhjyxcs()+pewp.getRhjyxcs(),2));
+            //年合计限电次数
+            pewp.setNhjxdcs(StringUtils.round(pepid.getNhjxdcs()+pewp.getRhjxdcs(),2));
+            //年合计通讯中断次数
+            pewp.setNhjtxzdcs(StringUtils.round(pepid.getNhjtxzdcs()+pewp.getRhjtxzdcs(),2));
+            //年合计受累次数
+            pewp.setNhjslcs(StringUtils.round(pepid.getNhjslcs()+pewp.getRhjslcs(),2));
 
         }
-        /*******************************************年信息统计*********************************************************/
+        //*******************************************年信息统计*********************************************************/
     }
 
 

File diff suppressed because it is too large
+ 374 - 397
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo4Service.java


+ 88 - 98
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java

@@ -6,12 +6,10 @@ import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.model.vo.Location;
-import com.gyee.generation.service.auto.*;
+import com.gyee.generation.service.auto.IProEconPowerstationInfoDay5Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -21,7 +19,7 @@ import java.util.stream.Collectors;
 @Service
 public class WindPowerInfo5Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo1Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo1Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -33,10 +31,8 @@ public class WindPowerInfo5Service {
 
     /**
      * 计算区域日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calRegionInfoDay(Date recordDate) throws Exception {
+    public void calRegionInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay5> wpinfodayls = proEconPowerstationInfoDay5Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -54,9 +50,9 @@ public class WindPowerInfo5Service {
             for(ProEconPowerstationInfoDay5 wpinfo:wpinfodayls)
             {
 
-                if(rgmap.containsKey(wpinfo.getCompanyId()))
+                if(rgmap.containsKey(wpinfo.getRegionId()))
                 {
-                    Map<String, List<ProEconPowerstationInfoDay5>> map=rgmap.get(wpinfo.getCompanyId());
+                    Map<String, List<ProEconPowerstationInfoDay5>> map=rgmap.get(wpinfo.getRegionId());
                     List<ProEconPowerstationInfoDay5> qbls=map.get("qb");
                     List<ProEconPowerstationInfoDay5> gfls=map.get("fd");
                     List<ProEconPowerstationInfoDay5> fdls=map.get("gf");
@@ -86,6 +82,7 @@ public class WindPowerInfo5Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    rgmap.put(wpinfo.getRegionId(),map);
                 }
             }
 
@@ -97,7 +94,7 @@ public class WindPowerInfo5Service {
                             && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay5::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay5Service.removeByIds(idls);
 
@@ -158,17 +155,15 @@ public class WindPowerInfo5Service {
 
 
 
-            };
+            }
         }
 
     }
 
     /**
      * 计算公司日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calCompanyInfoDay(Date recordDate) throws Exception {
+    public void calCompanyInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay5> wpinfodayls = proEconPowerstationInfoDay5Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -218,6 +213,7 @@ public class WindPowerInfo5Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    cpmap.put(wpinfo.getCompanyId(),map);
                 }
             }
 
@@ -229,7 +225,7 @@ public class WindPowerInfo5Service {
                             && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay5::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay5Service.removeByIds(idls);
 
@@ -292,12 +288,12 @@ public class WindPowerInfo5Service {
 
 
 
-            };
+            }
         }
 
     }
 
-    private void calCp(ProEconPowerstationInfoDay5 pewp,List<ProEconPowerstationInfoDay5> ls) throws Exception {
+    private void calCp(ProEconPowerstationInfoDay5 pewp,List<ProEconPowerstationInfoDay5> ls) {
 
         if(!ls.isEmpty())
         {
@@ -351,19 +347,17 @@ public class WindPowerInfo5Service {
     }
     /**
      * 计算场站日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
         c.setTime(recordDate);
 
-        Date end=c.getTime();
-
-        Date begin= DateUtils.truncDay(c.getTime());
+//        Date end=c.getTime();
+//
+//        Date begin= DateUtils.truncDay(c.getTime());
 
 
-        List<ProEconPowerstationInfoDay5> wpinfodayls=new ArrayList<>();
+//        List<ProEconPowerstationInfoDay5> wpinfodayls=new ArrayList<>();
 
 
         //判断是否有重复记录,先删除重复记录
@@ -373,7 +367,7 @@ public class WindPowerInfo5Service {
                         && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay5::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay5Service.removeByIds(idls);
 
@@ -393,21 +387,21 @@ public class WindPowerInfo5Service {
                 pewp.setWindpowerstationId(wp.getId());
                 pewp.setLocation(Location.wp.getValue());
 
-                //昨日的统计结果
-                List<ProEconPowerstationInfoDay5> pepid1ls =new ArrayList<>();
-                Calendar cl=Calendar.getInstance();
-                cl.setTime(recordDate);
-                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
-
-                {
-                    pepid1ls = proEconPowerstationInfoDay5Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
-                                    && i.getWindpowerstationId().equals(wp.getId())
-                                    && i.getLocation().equals(Location.wp.getValue()))
-                            .collect(Collectors.toList());
-                }
-                extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
-/*******************************************年信息统计*********************************************************/
+//                //昨日的统计结果
+//                List<ProEconPowerstationInfoDay5> pepid1ls =new ArrayList<>();
+//                Calendar cl=Calendar.getInstance();
+//                cl.setTime(recordDate);
+//                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+//
+//                {
+//                    pepid1ls = proEconPowerstationInfoDay5Service.list().stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
+//                                    && i.getWindpowerstationId().equals(wp.getId())
+//                                    && i.getLocation().equals(Location.wp.getValue()))
+//                            .collect(Collectors.toList());
+//                }
+                extracted(recordDate,  pointmap, pewp);
+//*******************************************年信息统计*********************************************************/
 //                wpinfodayls.add(pewp);
                 proEconPowerstationInfoDay5Service.save(pewp);
 
@@ -420,16 +414,14 @@ public class WindPowerInfo5Service {
 
     /**
      * 计算项目日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
         c.setTime(recordDate);
 
-        Date end=c.getTime();
-
-        Date begin= DateUtils.truncDay(c.getTime());
+//        Date end=c.getTime();
+//
+//        Date begin= DateUtils.truncDay(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
         List<String> idls = proEconPowerstationInfoDay5Service.list().stream()
@@ -438,7 +430,7 @@ public class WindPowerInfo5Service {
                         && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay5::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay5Service.removeByIds(idls);
 
@@ -458,19 +450,19 @@ public class WindPowerInfo5Service {
                 pewp.setRecordDate(DateUtils.truncDay(recordDate));
 
                 //昨日的统计结果
-                List<ProEconPowerstationInfoDay5> pepid1ls =new ArrayList<>();
-                Calendar cl=Calendar.getInstance();
-                cl.setTime(recordDate);
-                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
-
-                {
-                    pepid1ls = proEconPowerstationInfoDay5Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
-                                    && i.getProjectId().equals(pj.getId())
-                                    && i.getLocation().equals(Location.pj.getValue()))
-                            .collect(Collectors.toList());
-                }
-                extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
+//                List<ProEconPowerstationInfoDay5> pepid1ls =new ArrayList<>();
+//                Calendar cl=Calendar.getInstance();
+//                cl.setTime(recordDate);
+//                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+//
+//                {
+//                    pepid1ls = proEconPowerstationInfoDay5Service.list().stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
+//                                    && i.getProjectId().equals(pj.getId())
+//                                    && i.getLocation().equals(Location.pj.getValue()))
+//                            .collect(Collectors.toList());
+//                }
+                extracted(recordDate, pointmap, pewp);
 
 
                 proEconPowerstationInfoDay5Service.save(pewp);
@@ -483,16 +475,14 @@ public class WindPowerInfo5Service {
     }
     /**
      * 计算线路日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
         c.setTime(recordDate);
 
-        Date end=c.getTime();
-
-        Date begin= DateUtils.truncDay(c.getTime());
+//        Date end=c.getTime();
+//
+//        Date begin= DateUtils.truncDay(c.getTime());
 
         //判断是否有重复记录,先删除重复记录
         List<String> idls = proEconPowerstationInfoDay5Service.list().stream()
@@ -501,7 +491,7 @@ public class WindPowerInfo5Service {
                         && i.getLocation().equals(Location.ln.getValue()) ).map(ProEconPowerstationInfoDay5::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay5Service.removeByIds(idls);
 
@@ -521,19 +511,19 @@ public class WindPowerInfo5Service {
                 pewp.setRecordDate(DateUtils.truncDay(recordDate));
 
                 //昨日的统计结果
-                List<ProEconPowerstationInfoDay5> pepid1ls =new ArrayList<>();
-                Calendar cl=Calendar.getInstance();
-                cl.setTime(recordDate);
-                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
-
-                {
-                    pepid1ls = proEconPowerstationInfoDay5Service.list().stream()
-                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
-                                    && i.getLineId().equals(ln.getId())
-                                    && i.getLocation().equals(Location.ln.getValue()))
-                            .collect(Collectors.toList());
-                }
-                extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
+//                List<ProEconPowerstationInfoDay5> pepid1ls =new ArrayList<>();
+//                Calendar cl=Calendar.getInstance();
+//                cl.setTime(recordDate);
+//                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+//
+//                {
+//                    pepid1ls = proEconPowerstationInfoDay5Service.list().stream()
+//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(cl.getTime())) == 0
+//                                    && i.getLineId().equals(ln.getId())
+//                                    && i.getLocation().equals(Location.ln.getValue()))
+//                            .collect(Collectors.toList());
+//                }
+                extracted(recordDate,  pointmap, pewp);
 
                 proEconPowerstationInfoDay5Service.save(pewp);
 
@@ -544,14 +534,14 @@ public class WindPowerInfo5Service {
 
     }
 
-    private void extracted(Date recordDate, Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay5 pewp, List<ProEconPowerstationInfoDay5> pepid1ls) throws Exception {
-        /*******************************************日信息统计*********************************************************/
+    private void extracted(Date recordDate,  Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay5 pewp) throws Exception {
+        //*******************************************日信息统计*********************************************************/
 
                 double rfdlsyz=0.0;
                 double rswdlsyz=0.0;
                 double rgwgwdlsyz=0.0;
                 double rnwgwdlsyz=0.0;
-                if(pointmap.containsKey(ContantXk.RFDLSYZ));
+                if(pointmap.containsKey(ContantXk.RFDLSYZ))
                 {
                     ProBasicPowerstationPoint point=pointmap.get(ContantXk.RFDLSYZ);
                     PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -564,7 +554,7 @@ public class WindPowerInfo5Service {
                     }
                 }
 
-                if(pointmap.containsKey(ContantXk.RSWDL));
+                if(pointmap.containsKey(ContantXk.RSWDL))
                 {
                     ProBasicPowerstationPoint point=pointmap.get(ContantXk.RSWDL);
                     PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -577,7 +567,7 @@ public class WindPowerInfo5Service {
                     }
                 }
 
-                if(pointmap.containsKey(ContantXk.RGWGWDL));
+                if(pointmap.containsKey(ContantXk.RGWGWDL))
                 {
                     ProBasicPowerstationPoint point=pointmap.get(ContantXk.RGWGWDL);
                     PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -590,7 +580,7 @@ public class WindPowerInfo5Service {
                     }
                 }
 
-                if(pointmap.containsKey(ContantXk.RNWGWDL));
+                if(pointmap.containsKey(ContantXk.RNWGWDL))
                 {
                     ProBasicPowerstationPoint point=pointmap.get(ContantXk.RNWGWDL);
                     PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -607,7 +597,7 @@ public class WindPowerInfo5Service {
                 pewp.setRzhcydldb(StringUtils.round(rfdlsyz-rswdlsyz+rgwgwdlsyz+rnwgwdlsyz,2));
 
 
-                if(pointmap.containsKey(ContantXk.RCYDL));
+                if(pointmap.containsKey(ContantXk.RCYDL))
                 {
                     ProBasicPowerstationPoint point=pointmap.get(ContantXk.RCYDL);
                     PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -620,15 +610,15 @@ public class WindPowerInfo5Service {
                 }
 
 
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
         double yfdlsyz=0.0;
         double yswdlsyz=0.0;
         double ygwgwdlsyz=0.0;
         double ynwgwdlsyz=0.0;
-        if(pointmap.containsKey(ContantXk.YFDLSYZ));
+        if(pointmap.containsKey(ContantXk.YFDLSYZ))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.YFDLSYZ);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -641,7 +631,7 @@ public class WindPowerInfo5Service {
             }
         }
 
-        if(pointmap.containsKey(ContantXk.YSWDL));
+        if(pointmap.containsKey(ContantXk.YSWDL))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.YSWDL);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -654,7 +644,7 @@ public class WindPowerInfo5Service {
             }
         }
 
-        if(pointmap.containsKey(ContantXk.YGWGWDL));
+        if(pointmap.containsKey(ContantXk.YGWGWDL))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.YGWGWDL);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -667,7 +657,7 @@ public class WindPowerInfo5Service {
             }
         }
 
-        if(pointmap.containsKey(ContantXk.YNWGWDL));
+        if(pointmap.containsKey(ContantXk.YNWGWDL))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.YNWGWDL);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -684,7 +674,7 @@ public class WindPowerInfo5Service {
         pewp.setYzhcydldb(StringUtils.round(yfdlsyz-yswdlsyz+ygwgwdlsyz+ynwgwdlsyz,2));
 
 
-        if(pointmap.containsKey(ContantXk.YCYDL));
+        if(pointmap.containsKey(ContantXk.YCYDL))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.YCYDL);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -697,14 +687,14 @@ public class WindPowerInfo5Service {
         }
 
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
         double nfdlsyz=0.0;
         double nswdlsyz=0.0;
         double ngwgwdlsyz=0.0;
         double nnwgwdlsyz=0.0;
-        if(pointmap.containsKey(ContantXk.NFDLSYZ));
+        if(pointmap.containsKey(ContantXk.NFDLSYZ))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.NFDLSYZ);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -717,7 +707,7 @@ public class WindPowerInfo5Service {
             }
         }
 
-        if(pointmap.containsKey(ContantXk.NSWDL));
+        if(pointmap.containsKey(ContantXk.NSWDL))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.NSWDL);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -730,7 +720,7 @@ public class WindPowerInfo5Service {
             }
         }
 
-        if(pointmap.containsKey(ContantXk.NGWGWDL));
+        if(pointmap.containsKey(ContantXk.NGWGWDL))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.NGWGWDL);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -743,7 +733,7 @@ public class WindPowerInfo5Service {
             }
         }
 
-        if(pointmap.containsKey(ContantXk.NNWGWDL));
+        if(pointmap.containsKey(ContantXk.NNWGWDL))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.NNWGWDL);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);
@@ -760,7 +750,7 @@ public class WindPowerInfo5Service {
         pewp.setNzhcydldb(StringUtils.round(nfdlsyz-nswdlsyz+ngwgwdlsyz+nnwgwdlsyz,2));
 
 
-        if(pointmap.containsKey(ContantXk.NCYDL));
+        if(pointmap.containsKey(ContantXk.NCYDL))
         {
             ProBasicPowerstationPoint point=pointmap.get(ContantXk.NCYDL);
             PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(),recordDate.getTime()/1000);

+ 175 - 121
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo6Service.java

@@ -5,13 +5,11 @@ import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.model.vo.Location;
-import com.gyee.generation.service.auto.*;
+import com.gyee.generation.service.auto.IProEconPowerstationInfoDay6Service;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -24,7 +22,7 @@ import java.util.stream.Collectors;
 @Service
 public class WindPowerInfo6Service {
 
-    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo1Service.class);
+//    private static final Logger logger = LoggerFactory.getLogger(WindPowerInfo1Service.class);
     @Resource
     private IEdosUtil edosUtil;
 
@@ -37,10 +35,8 @@ public class WindPowerInfo6Service {
 
     /**
      * 计算区域日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calRegionInfoDay(Date recordDate) throws Exception {
+    public void calRegionInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay6> wpinfodayls = proEconPowerstationInfoDay6Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -58,9 +54,9 @@ public class WindPowerInfo6Service {
             for(ProEconPowerstationInfoDay6 wpinfo:wpinfodayls)
             {
 
-                if(rgmap.containsKey(wpinfo.getCompanyId()))
+                if(rgmap.containsKey(wpinfo.getRegionId()))
                 {
-                    Map<String, List<ProEconPowerstationInfoDay6>> map=rgmap.get(wpinfo.getCompanyId());
+                    Map<String, List<ProEconPowerstationInfoDay6>> map=rgmap.get(wpinfo.getRegionId());
                     List<ProEconPowerstationInfoDay6> qbls=map.get("qb");
                     List<ProEconPowerstationInfoDay6> gfls=map.get("fd");
                     List<ProEconPowerstationInfoDay6> fdls=map.get("gf");
@@ -90,6 +86,7 @@ public class WindPowerInfo6Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    rgmap.put(wpinfo.getRegionId(),map);
                 }
             }
 
@@ -101,7 +98,7 @@ public class WindPowerInfo6Service {
                             && i.getLocation().equals(Location.rg.getValue())).map(ProEconPowerstationInfoDay6::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay6Service.removeByIds(idls);
 
@@ -162,17 +159,15 @@ public class WindPowerInfo6Service {
 
 
 
-            };
+            }
         }
 
     }
 
     /**
      * 计算公司日信息
-     * @param recordDate
-     * @throws Exception
      */
-    public void calCompanyInfoDay(Date recordDate) throws Exception {
+    public void calCompanyInfoDay(Date recordDate) {
 
         List<ProEconPowerstationInfoDay6> wpinfodayls = proEconPowerstationInfoDay6Service.list().stream()
                 .filter(i -> i.getRecordDate().compareTo(DateUtils.truncDay(recordDate))==0
@@ -222,6 +217,7 @@ public class WindPowerInfo6Service {
                     map.put("qb",qbls);
                     map.put("fd",fdls);
                     map.put("gf",gfls);
+                    cpmap.put(wpinfo.getCompanyId(),map);
                 }
             }
 
@@ -233,7 +229,7 @@ public class WindPowerInfo6Service {
                             && i.getLocation().equals(Location.cp.getValue())).map(ProEconPowerstationInfoDay6::getId)
                     .collect(Collectors.toList());
 
-            if (idls != null && idls.size() > 0) {
+            if (idls.size() > 0) {
 
                 proEconPowerstationInfoDay6Service.removeByIds(idls);
 
@@ -296,23 +292,96 @@ public class WindPowerInfo6Service {
 
 
 
-            };
+            }
         }
 
     }
 
-    private void calCp(ProEconPowerstationInfoDay6 pewp,List<ProEconPowerstationInfoDay6> ls) throws Exception {
+    private void calCp(ProEconPowerstationInfoDay6 pewp,List<ProEconPowerstationInfoDay6> ls) {
 
         if(!ls.isEmpty())
         {
-
+            //日发电量
+//            DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay1::getRfdl).summaryStatistics();
+//            pewp.setRfdl(com.gyee.common.model.StringUtils.round(summaryStatistics.getSum(),2));
+
+            
+             //* 日最大风速(测风塔)
+            DoubleSummaryStatistics summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getRzdfscft).summaryStatistics();
+            pewp.setRzdfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getMax(),2));
+
+            // * 日最小风速(测风塔)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getRzxfscft).summaryStatistics();
+            pewp.setRzxfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getMin(),2));
+            
+            // * 日最大功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getRzdglcx).summaryStatistics();
+            pewp.setRzdglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getMax(),2));
+
+            // * 日最小功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getRzxglcx).summaryStatistics();
+            pewp.setRzxglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getMin(),2));
+
+            // * 日平均功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getRpjglcx).summaryStatistics();
+            pewp.setRpjglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getAverage(),2));
+
+            // * 日平均风速(测风塔)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getRpjfscft).summaryStatistics();
+            pewp.setRpjfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getAverage(),2));
+
+            // * 月最大风速(测风塔)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getYzdfscft).summaryStatistics();
+            pewp.setYzdfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getMax(),2));
+
+            // * 月最小风速(测风塔)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getYzxfscft).summaryStatistics();
+            pewp.setYzxfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getMin(),2));
+
+            // * 月最大功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getYzdglcx).summaryStatistics();
+            pewp.setYzdglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getMax(),2));
+
+            // * 月最小功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getYzxglcx).summaryStatistics();
+            pewp.setYzxglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getMin(),2));
+
+           //  * 月平均功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getYpjglcx).summaryStatistics();
+            pewp.setYpjglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getAverage(),2));
+
+            // * 月平均风速(测风塔)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getYpjfscft).summaryStatistics();
+            pewp.setYpjfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getAverage(),2));
+
+            // * 年最大风速(测风塔)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getNzdfscft).summaryStatistics();
+            pewp.setNzdfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getMax(),2));
+
+            // * 年最小风速(测风塔)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getNzxfscft).summaryStatistics();
+            pewp.setNzxfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getMin(),2));
+
+            // * 年最大功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getNzdglcx).summaryStatistics();
+            pewp.setNzdglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getMax(),2));
+
+            // * 年最小功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getNzxglcx).summaryStatistics();
+            pewp.setNzxglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getMin(),2));
+
+            // * 年平均功率(出线)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getNpjglcx).summaryStatistics();
+            pewp.setNpjglcx(com.gyee.common.model.StringUtils.round(summaryStatistics.getAverage(),2));
+
+            // * 年平均风速(测风塔)
+            summaryStatistics=ls.stream().mapToDouble(ProEconPowerstationInfoDay6::getNpjfscft).summaryStatistics();
+            pewp.setNpjfscft(com.gyee.common.model.StringUtils.round(summaryStatistics.getAverage(),2));
 
         }
     }
     /**
      * 计算场站日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -323,7 +392,7 @@ public class WindPowerInfo6Service {
         Date begin= DateUtils.truncDay(c.getTime());
 
 
-        List<ProEconPowerstationInfoDay6> wpinfodayls=new ArrayList<>();
+//        List<ProEconPowerstationInfoDay6> wpinfodayls=new ArrayList<>();
 
 
         //判断是否有重复记录,先删除重复记录
@@ -333,7 +402,7 @@ public class WindPowerInfo6Service {
                         && i.getLocation().equals(Location.wp.getValue())).map(ProEconPowerstationInfoDay6::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay6Service.removeByIds(idls);
 
@@ -366,8 +435,8 @@ public class WindPowerInfo6Service {
                                     && i.getLocation().equals(Location.wp.getValue()))
                             .collect(Collectors.toList());
                 }
-                extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
-/*******************************************年信息统计*********************************************************/
+                extracted(end, begin, pointmap, pewp,pepid1ls);
+//*******************************************年信息统计*********************************************************/
 //                wpinfodayls.add(pewp);
                 proEconPowerstationInfoDay6Service.save(pewp);
 
@@ -380,8 +449,6 @@ public class WindPowerInfo6Service {
 
     /**
      * 计算项目日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -398,7 +465,7 @@ public class WindPowerInfo6Service {
                         && i.getLocation().equals(Location.pj.getValue())).map(ProEconPowerstationInfoDay6::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay6Service.removeByIds(idls);
 
@@ -430,7 +497,7 @@ public class WindPowerInfo6Service {
                                     && i.getLocation().equals(Location.pj.getValue()))
                             .collect(Collectors.toList());
                 }
-                extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
+                extracted(end, begin, pointmap, pewp,pepid1ls);
 
 
                 proEconPowerstationInfoDay6Service.save(pewp);
@@ -443,8 +510,6 @@ public class WindPowerInfo6Service {
     }
     /**
      * 计算线路日信息
-     * @param recordDate
-     * @throws Exception
      */
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
@@ -461,7 +526,7 @@ public class WindPowerInfo6Service {
                         && i.getLocation().equals(Location.ln.getValue()) ).map(ProEconPowerstationInfoDay6::getId)
                 .collect(Collectors.toList());
 
-        if (idls != null && idls.size() > 0) {
+        if (idls.size() > 0) {
 
             proEconPowerstationInfoDay6Service.removeByIds(idls);
 
@@ -493,7 +558,7 @@ public class WindPowerInfo6Service {
                                     && i.getLocation().equals(Location.ln.getValue()))
                             .collect(Collectors.toList());
                 }
-                extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
+                extracted(end, begin, pointmap, pewp,pepid1ls);
 
                 proEconPowerstationInfoDay6Service.save(pewp);
 
@@ -504,8 +569,8 @@ public class WindPowerInfo6Service {
 
     }
 
-    private void extracted(Date recordDate, Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay6 pewp, List<ProEconPowerstationInfoDay6> pepid1ls) throws Exception {
-        /*******************************************日信息统计*********************************************************/
+    private void extracted(Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay6 pewp, List<ProEconPowerstationInfoDay6> pepid1ls) throws Exception {
+        //*******************************************日信息统计*********************************************************/
         if(pointmap.containsKey(ContantXk.FCCFTFS70))
         {
 
@@ -515,7 +580,7 @@ public class WindPowerInfo6Service {
                 List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
                 if(!pointls.isEmpty())
                 {
-                    DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                    DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                     //日最大风速
                     pewp.setRzdfscft(summaryStatistics.getMax());
                     //日最小风速
@@ -531,7 +596,7 @@ public class WindPowerInfo6Service {
                     List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
                     if(!pointls.isEmpty())
                     {
-                        DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                        DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                         //日最大风速
                         pewp.setRzdfscft(summaryStatistics.getMax());
                         //日最小风速
@@ -551,7 +616,7 @@ public class WindPowerInfo6Service {
             List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
             if(!pointls.isEmpty())
             {
-                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                 //日最大风速
                 pewp.setRzdfscft(summaryStatistics.getMax());
                 //日最小风速
@@ -572,7 +637,7 @@ public class WindPowerInfo6Service {
             List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
             if(!pointls.isEmpty())
             {
-                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+                DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
                 //日最大功率
                 pewp.setRzdglcx(summaryStatistics.getMax());
                 //日最小功率
@@ -583,118 +648,107 @@ public class WindPowerInfo6Service {
         }
 
 
-/*******************************************日信息统计*********************************************************/
+//*******************************************日信息统计*********************************************************/
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
         if(pepid1ls.isEmpty())
         {
-            setPowerandSpeedMonth(end, begin, pointmap, pewp);
+            setPowerandSpeedMonth(pewp);
         }else
         {
 
 
-            if(!pepid1ls.isEmpty())
-            {
-                ProEconPowerstationInfoDay6 pepid=pepid1ls.get(0);
-
-                //如果昨日大于今日最大功率
-                if(pepid.getYzdglcx()> pewp.getRzdglcx())
-                {
-                    pewp.setYzdglcx(pepid.getYzdglcx());
-                }else {
-                    pewp.setYzdglcx(pewp.getRzdglcx());
-                }
-                //如果昨日大于今日最大风速
-                if(pepid.getYzdfscft()> pewp.getRzdfscft())
-                {
-                    pewp.setYzdfscft(pepid.getYzdfscft());
-                }else
-                {
-                    pewp.setYzdfscft(pewp.getRzdfscft());
-                }
-
-                //如果昨日小于今日最小功率
-                if(pepid.getYzxglcx()< pewp.getRzxglcx())
-                {
-                    pewp.setYzxglcx(pepid.getYzxglcx());
-                }else
-                {
-                    pewp.setYzxglcx(pewp.getRzxglcx());
-                }
-                //如果昨日小于今日最小风速
-                if(pepid.getYzxfscft()< pewp.getRzxfscft())
-                {
-                    pewp.setYzxfscft(pepid.getYzxfscft());
-                }else
-                {
-                    pewp.setYzxfscft(pewp.getRzxfscft());
-                }
-                double   pjfs = new BigDecimal(pewp.getYpjfscft()+pepid.getRpjfscft()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-
-                pewp.setYzxfscft(pjfs);
+            ProEconPowerstationInfoDay6 pepid=pepid1ls.get(0);
 
-                double   pjgl = new BigDecimal(pewp.getYpjglcx()+pepid.getRpjglcx()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-                pewp.setYzxglcx(pjgl);
+            //如果昨日大于今日最大功率
+            if(pepid.getYzdglcx()> pewp.getRzdglcx())
+            {
+                pewp.setYzdglcx(pepid.getYzdglcx());
+            }else {
+                pewp.setYzdglcx(pewp.getRzdglcx());
+            }
+            //如果昨日大于今日最大风速
+            if(pepid.getYzdfscft()> pewp.getRzdfscft())
+            {
+                pewp.setYzdfscft(pepid.getYzdfscft());
+            }else
+            {
+                pewp.setYzdfscft(pewp.getRzdfscft());
+            }
 
+            //如果昨日小于今日最小功率
+            if(pepid.getYzxglcx()< pewp.getRzxglcx())
+            {
+                pewp.setYzxglcx(pepid.getYzxglcx());
+            }else
+            {
+                pewp.setYzxglcx(pewp.getRzxglcx());
+            }
+            //如果昨日小于今日最小风速
+            if(pepid.getYzxfscft()< pewp.getRzxfscft())
+            {
+                pewp.setYzxfscft(pepid.getYzxfscft());
             }else
             {
-                setPowerandSpeedMonth(end, begin, pointmap, pewp);
+                pewp.setYzxfscft(pewp.getRzxfscft());
             }
+            double   pjfs = BigDecimal.valueOf(pewp.getYpjfscft() + pepid.getRpjfscft()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+
+            pewp.setYzxfscft(pjfs);
+
+            double   pjgl = BigDecimal.valueOf(pewp.getYpjglcx() + pepid.getRpjglcx()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            pewp.setYzxglcx(pjgl);
 
         }
 
 
-/*******************************************月信息统计*********************************************************/
+//*******************************************月信息统计*********************************************************/
 
-/*******************************************年信息统计*********************************************************/
+//*******************************************年信息统计*********************************************************/
         if(pepid1ls.isEmpty())
         {
-            setPowerandSpeedYear(end, begin, pointmap, pewp);
+            setPowerandSpeedYear(pewp);
         }else {
 
-            if (!pepid1ls.isEmpty()) {
-                ProEconPowerstationInfoDay6 pepid = pepid1ls.get(0);
-
-                //如果昨年大于今年最大功率
-                if (pepid.getNzdglcx() > pewp.getRzdglcx()) {
-                    pewp.setNzdglcx(pepid.getNzdglcx());
-                } else {
-                    pewp.setNzdglcx(pewp.getRzdglcx());
-                }
-                //如果昨年大于今年最大风速
-                if (pepid.getNzdfscft() > pewp.getRzdfscft()) {
-                    pewp.setNzdfscft(pepid.getNzdfscft());
-                } else {
-                    pewp.setNzdfscft(pewp.getRzdfscft());
-                }
-
-                //如果昨年小于今年最小功率
-                if (pepid.getNzxglcx() < pewp.getRzxglcx()) {
-                    pewp.setNzxglcx(pepid.getNzxglcx());
-                } else {
-                    pewp.setNzxglcx(pewp.getRzxglcx());
-                }
-                //如果昨年小于今年最小风速
-                if (pepid.getNzxfscft() < pewp.getRzxfscft()) {
-                    pewp.setNzxfscft(pepid.getNzxfscft());
-                } else {
-                    pewp.setNzxfscft(pewp.getRzxfscft());
-                }
-                double pjfs = new BigDecimal(pewp.getNpjfscft() + pepid.getRpjfscft()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            ProEconPowerstationInfoDay6 pepid = pepid1ls.get(0);
 
-                pewp.setNzxfscft(pjfs);
+            //如果昨年大于今年最大功率
+            if (pepid.getNzdglcx() > pewp.getRzdglcx()) {
+                pewp.setNzdglcx(pepid.getNzdglcx());
+            } else {
+                pewp.setNzdglcx(pewp.getRzdglcx());
+            }
+            //如果昨年大于今年最大风速
+            if (pepid.getNzdfscft() > pewp.getRzdfscft()) {
+                pewp.setNzdfscft(pepid.getNzdfscft());
+            } else {
+                pewp.setNzdfscft(pewp.getRzdfscft());
+            }
 
-                double pjgl = new BigDecimal(pewp.getNpjglcx() + pepid.getRpjglcx()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
-                pewp.setNzxglcx(pjgl);
+            //如果昨年小于今年最小功率
+            if (pepid.getNzxglcx() < pewp.getRzxglcx()) {
+                pewp.setNzxglcx(pepid.getNzxglcx());
+            } else {
+                pewp.setNzxglcx(pewp.getRzxglcx());
+            }
+            //如果昨年小于今年最小风速
+            if (pepid.getNzxfscft() < pewp.getRzxfscft()) {
+                pewp.setNzxfscft(pepid.getNzxfscft());
             } else {
-                setPowerandSpeedMonth(end, begin, pointmap, pewp);
+                pewp.setNzxfscft(pewp.getRzxfscft());
             }
+            double pjfs = BigDecimal.valueOf(pewp.getNpjfscft() + pepid.getRpjfscft()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+
+            pewp.setNzxfscft(pjfs);
+
+            double pjgl = BigDecimal.valueOf(pewp.getNpjglcx() + pepid.getRpjglcx()).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
+            pewp.setNzxglcx(pjgl);
 
         }
     }
 
-    private void setPowerandSpeedYear(Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay6 pewp) throws Exception {
+    private void setPowerandSpeedYear(ProEconPowerstationInfoDay6 pewp) {
         //年最大风速
         pewp.setNzdfscft(pewp.getRzdfscft());
         //年最小风速
@@ -711,7 +765,7 @@ public class WindPowerInfo6Service {
 
     }
 
-    private void setPowerandSpeedMonth(Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay6 pewp) throws Exception {
+    private void setPowerandSpeedMonth(ProEconPowerstationInfoDay6 pewp) {
 
         //月最大风速
         pewp.setYzdfscft(pewp.getRzdfscft());