瀏覽代碼

修正拟合优度问题

shilin 1 年之前
父節點
當前提交
268b82a6ba

+ 2 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java

@@ -19,8 +19,8 @@ public class GenerationMain {
 //        InputOrOutPutService inputOrOutPutService= SpringUtils.getBean("inputOrOutPutService");
 //
 //        inputOrOutPutService.initialInputOrOutputSpeed();
-
-
+//
+//
 //        CacheService cacheService= SpringUtils.getBean("cacheService");
 //        cacheService.initRedisCache();
 //

+ 1 - 15
realtime/generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFitService.java

@@ -12,7 +12,6 @@ import com.gyee.generation.model.auto.ProEconWtCurveFittingMonth;
 import com.gyee.generation.model.vo.CurveType;
 import com.gyee.generation.model.vo.FitClassVo;
 import com.gyee.generation.model.vo.StatData;
-import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconWtCurveFittingMonthService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
@@ -217,21 +216,8 @@ public class GoodnessOfFitService {
 
         for (FitClassVo item : fitsY)
         {
-            Double speed;
-            if (windpowerstationId.contains(WpType.GDC.id))
-            {
-                speed = item.getSpeed();
-                speed /= 100;
-
-                speed = StringUtils.round(speed, 1);
-                speed *= 100;
+            Double speed=StringUtils.round(item.getSpeed(), 1);
 
-                //speed = speed;
-            }
-            else
-            {
-                speed = StringUtils.round(item.getSpeed(), 1);
-            }
             String windturbineId = item.getWindturbineId();
             if (CacheContext.theoreticalPowerMap.containsKey(item.getModelId()))
             {

+ 9 - 7
realtime/generationXK-service/src/main/java/com/gyee/generation/service/InitialRedisService.java

@@ -341,10 +341,10 @@ public  class InitialRedisService {
                         List<PointData> fss = edosUtil.getHistoryDatasSnap(fs, beginDate.getTime() / 1000, endDate.getTime() / 1000, count, pried);
 
 
-                        if (!gls.isEmpty() && !fss.isEmpty()) {
+                        if (!gls.isEmpty() && !fss.isEmpty() && gls.size()==fss.size()) {
                             for (int i = 0; i < fss.size(); i++) {
 
-                                List<Double> ds = new ArrayList<Double>();
+                                List<Double> ds = new ArrayList<>();
 
                                 double f = fss.get(i).getPointValueInDouble();
                                 ds.add(Double.valueOf(dcmFmt.format(f)));
@@ -352,13 +352,15 @@ public  class InitialRedisService {
                                 ds.add(Double.valueOf(dcmFmt.format(f)));
                                 vos.add(ds);
                             }
+
+                            // cal.add(Calendar.MONTH,1);
+                            StringBuilder sb=new StringBuilder();
+                            sb.append("scatter_").append(wtId).append("_").append(month);
+                            redisService.set(String.valueOf(sb), JSON.toJSONString(vos));
+                            System.out.println(String.valueOf(sb.append("完成")));
                         }
 
-                        // cal.add(Calendar.MONTH,1);
-                        StringBuilder sb=new StringBuilder();
-                        sb.append("scatter_").append(wtId).append("_").append(month);
-                        redisService.set(String.valueOf(sb), JSON.toJSONString(vos));
-                        System.out.println(String.valueOf(sb.append("完成")));
+
                     }
                 }
 

+ 11 - 11
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeGfService.java

@@ -155,9 +155,9 @@ public class PowerCurveFittingByTimeGfService {
 
             //拟合日功率曲线
             curveFittingBuilder(begin, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
-            List<PointVo> vos = windMap.get(key).getRsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            List<PointVo> vos = windMap.get(key).getRsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 1000).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
             windMap.get(key).setRsjglPoints(vos);
-            vos = windMap.get(key).getRzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            vos = windMap.get(key).getRzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 1000).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
             windMap.get(key).setRzyglPoints(vos);
 
         }
@@ -437,9 +437,9 @@ public class PowerCurveFittingByTimeGfService {
             //拟合月功率曲线
             curveFittingBuilder(begin, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), key);
 
-            List<PointVo> vos = windMap.get(key).getYsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            List<PointVo> vos = windMap.get(key).getYsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 1000).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
             windMap.get(key).setYsjglPoints(vos);
-            vos = windMap.get(key).getYzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            vos = windMap.get(key).getYzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 1000).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
             windMap.get(key).setYzyglPoints(vos);
 
             logger.info(key+"曲线拟合完成!");
@@ -753,9 +753,9 @@ public class PowerCurveFittingByTimeGfService {
                     sjglls.add(sjvo);
                 }
             }
-//            List<PointVo> vos = windMap.get(key).getNsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+//            List<PointVo> vos = windMap.get(key).getNsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 1000).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
 //            windMap.get(key).setNsjglPoints(vos);
-//            vos = windMap.get(key).getNzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+//            vos = windMap.get(key).getNzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 1000).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
 //            windMap.get(key).setNzyglPoints(vos);
 
 
@@ -1641,10 +1641,10 @@ public class PowerCurveFittingByTimeGfService {
 //        point.setY(power);
 //        sjPointls.add(point);
 
-        //与保证功率进行对比,偏差大于25%的进行过滤
+        //与保证功率进行对比,偏差大于1000%的进行过滤
 //        double value= pcl2( sjPointls, bzPointls, modelpower, speed);
 //
-//        if (0.25 > Math.abs(value)) {
+//        if (0.1000 > Math.abs(value)) {
 //            return false;
 //        }
 
@@ -1672,7 +1672,7 @@ public class PowerCurveFittingByTimeGfService {
                 }
             }
         }
-        if(gl.getPointValueInDouble()>(modelpower*1.25) || gl.getPointValueInDouble()<(modelpower*0.75))
+        if(gl.getPointValueInDouble()>(modelpower*1.1000) || gl.getPointValueInDouble()<(modelpower*0.75))
         {
             return false;
         }
@@ -1701,7 +1701,7 @@ public class PowerCurveFittingByTimeGfService {
     //功率曲线拟合
     private void curveFittingBuilder(Date begin, Date end, int dimension, double scale, String pointIdGL, String pointIdFS, String pointIdZT, List<PointVo> sjglPoints, List<PointVo> zyglPoints, String windturbineId) throws Exception {
         double maxPower = windturbineCapacity.get(windturbineId) * 1.3;
-        double maxSpeed = 25;
+        double maxSpeed = 1000;
         List<PointfVo> sjglnhpoints = new ArrayList<>();
         Map<Double, PointfVo> zyglnhpoints = new HashMap<>();
 
@@ -1889,7 +1889,7 @@ public class PowerCurveFittingByTimeGfService {
     private static void buildMyPoints(List<PointVo> sjglPoints, double scale) {
         int coefficient = 1;
         int dec = 0;
-        int smax = 25;
+        int smax = 1000;
         if (scale == 0.01) {
             coefficient = 100;
             dec = 2;

+ 184 - 180
realtime/generationXK-service/src/main/java/com/gyee/generation/service/initalcache/CacheService.java

@@ -5,7 +5,8 @@ package com.gyee.generation.service.initalcache;/*
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.service.auto.*;
 import com.gyee.generation.util.redis.RedisService;
 import lombok.extern.slf4j.Slf4j;
@@ -13,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -58,16 +58,20 @@ public class CacheService {
 
 
     public void initRedisCache(){
+        redisService.select(9);
         log.info("--------------------------redisWT");
-        List<ProBasicEquipment> windturbineList = windturbineService.list().stream().filter(i->i.getIsable().equals(1)).collect(Collectors.toList());
+        List<ProBasicEquipment> windturbineList = windturbineService.list().stream().filter(i->i.getWindpowerstationId().equals("SXJ_KGDL_YG_GDC_STA") && i.getIsable().equals(1)).collect(Collectors.toList());
+        log.info("--------------------------windturbineList"+windturbineList.size());
         windturbineList.stream().forEach(i->{
             Map<String, ProBasicEquipmentPoint> codeaimap = new HashMap<>();
             QueryWrapper<ProBasicEquipmentPoint> qw = new QueryWrapper<>();
             qw.eq("windturbine_id",i.getId());
             List<ProBasicEquipmentPoint> windturbinetestingpointai2List = windturbinetestingpointnewService.list(qw);
+            log.info("--------------------------windturbinetestingpointai2List"+windturbinetestingpointai2List.size());
             windturbinetestingpointai2List.stream().forEach(x->{
                 codeaimap.put(x.getUniformCode(),x);
             });
+            log.info("--------------------------codeaimap"+codeaimap.size());
             String s = JSONObject.toJSONString(codeaimap);
             redisService.set(i.getId(),s);
         });
@@ -87,182 +91,182 @@ public class CacheService {
 //                redisService.set(i.getId(),s);
 //            });
 //        }
-
-        log.info("--------------------------redisSQ");
-        List<ProBasicSquare> squareList = proBasicSquareService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-        squareList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i.getId());
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i.getId(),s);
-        });
-
-        log.info("--------------------------redisLN");
-        List<ProBasicLine> lineList = lineService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-        lineList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i.getId());
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i.getId(),s);
-        });
-
-
-
-        log.info("--------------------------redisPJ");
-        List<ProBasicProject> projectList = projectService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-        projectList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i.getId());
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i.getId(),s);
-        });
-
-        log.info("--------------------------redisSubWP");
-        List<ProBasicSubStation> subStationList = subStationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-        subStationList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i.getId());
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i.getId(),s);
-        });
-
-        log.info("--------------------------redisWeatherWP");
-        List<ProBasicWeatherStation> weatherStationList = proBasicWeatherStationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-        weatherStationList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i.getId());
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i.getId(),s);
-        });
-
-        log.info("--------------------------redisWP");
-        List<ProBasicPowerstation> wpList = windpowerstationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-
-        wpList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i.getId());
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i.getId(),s);
-        });
-
-        log.info("--------------------------redisCOMPANY");
-        List<ProBasicCompany> coms = companyService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-//        List<String> comList = coms.stream().map(i->i.getId()).collect(Collectors.toList());
-        List<String> comList = new ArrayList<>();
-        coms.stream().forEach(company -> {
-            comList.add(company.getId()+"0");
-            comList.add(company.getId()+"-1");
-            comList.add(company.getId()+"-2");
-        });
-        comList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i);
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i,s);
-        });
-
-        log.info("--------------------------redisREGION");
-        List<ProBasicRegion> regs = regionsService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
-        List<String> regList = new ArrayList<>();
-//        List<String> regList = regs.stream().map(i->i.getId()).collect(Collectors.toList());
-        regs.stream().forEach(region -> {
-            regList.add(region.getId()+"0");
-            regList.add(region.getId()+"-1");
-            regList.add(region.getId()+"-2");
-        });
-        regList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i);
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i,s);
-        });
-        log.info("--------------------------redisGroup");
-        List<ProBasicEnergyGroup> groups = energyGroupService.list().stream().filter(i->i.getIsAble().equals(1) && !i.getParentid().equals("0")).collect(Collectors.toList());
-        List<String> groupList = new ArrayList<>();
-//        List<String> regList = regs.stream().map(i->i.getId()).collect(Collectors.toList());
-        groups.stream().forEach(group -> {
-            groupList.add(group.getId()+"0");
-            groupList.add(group.getId()+"-1");
-            groupList.add(group.getId()+"-2");
-        });
-        groupList.stream().forEach(i->{
-            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
-            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
-            qw.eq("windpowerstation_id",i);
-            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
-            windpowerstationtestingpoint2List.stream().forEach(x->{
-                codeaimap.put(x.getUniformCode(),x);
-            });
-            String s = JSONObject.toJSONString(codeaimap);
-            redisService.set(i,s);
-        });
-        log.info("--------------------------redis理论保证功率");
-        Map<String, Map<Double,ProBasicModelPowerRd>> powerrdMap = new HashMap<>();
-
-        List<ProBasicModelPowerRd> proBasicModelPowerRds = proBasicModelPowerRdService.list();
-        proBasicModelPowerRds.stream().forEach(powerrd->{
-            if (powerrdMap.containsKey(powerrd.getModelId())){
-                powerrdMap.get(powerrd.getModelId()).put(powerrd.getSpeed(),powerrd);
-            }else {
-                Map<Double,ProBasicModelPowerRd> powerMap = new HashMap<>();
-                powerMap.put(powerrd.getSpeed(),powerrd);
-                powerrdMap.put(powerrd.getModelId(),powerMap);
-            }
-        });
-        redisService.set("ZLLGL", JSONObject.toJSONString(powerrdMap));
-
-        log.info("--------------------------redis十三种状态");
-        Map<String,List<ProBasicStatusPoint>> sszztMap = new HashMap<>();
-        List<ProBasicStatusPoint> windturbinestatusdis = proBasicStatusPointService.list();
-        windturbinestatusdis.stream().forEach(w->{
-            if (sszztMap.containsKey(w.getWindturbineId())){
-                sszztMap.get(w.getWindturbineId()).add(w);
-            }else {
-                List<ProBasicStatusPoint> wdisList = new ArrayList<>();
-                wdisList.add(w);
-                sszztMap.put(w.getWindturbineId(),wdisList);
-            }
-        });
-        redisService.set("SSZZT",JSONObject.toJSONString(sszztMap));
+//
+//        log.info("--------------------------redisSQ");
+//        List<ProBasicSquare> squareList = proBasicSquareService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+//        squareList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i.getId());
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i.getId(),s);
+//        });
+//
+//        log.info("--------------------------redisLN");
+//        List<ProBasicLine> lineList = lineService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+//        lineList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i.getId());
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i.getId(),s);
+//        });
+//
+//
+//
+//        log.info("--------------------------redisPJ");
+//        List<ProBasicProject> projectList = projectService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+//        projectList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i.getId());
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i.getId(),s);
+//        });
+//
+//        log.info("--------------------------redisSubWP");
+//        List<ProBasicSubStation> subStationList = subStationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+//        subStationList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i.getId());
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i.getId(),s);
+//        });
+//
+//        log.info("--------------------------redisWeatherWP");
+//        List<ProBasicWeatherStation> weatherStationList = proBasicWeatherStationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+//        weatherStationList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i.getId());
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i.getId(),s);
+//        });
+//
+//        log.info("--------------------------redisWP");
+//        List<ProBasicPowerstation> wpList = windpowerstationService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+//
+//        wpList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i.getId());
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i.getId(),s);
+//        });
+//
+//        log.info("--------------------------redisCOMPANY");
+//        List<ProBasicCompany> coms = companyService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+////        List<String> comList = coms.stream().map(i->i.getId()).collect(Collectors.toList());
+//        List<String> comList = new ArrayList<>();
+//        coms.stream().forEach(company -> {
+//            comList.add(company.getId()+"0");
+//            comList.add(company.getId()+"-1");
+//            comList.add(company.getId()+"-2");
+//        });
+//        comList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i);
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i,s);
+//        });
+//
+//        log.info("--------------------------redisREGION");
+//        List<ProBasicRegion> regs = regionsService.list().stream().filter(i->i.getIsAble().equals(1)).collect(Collectors.toList());
+//        List<String> regList = new ArrayList<>();
+////        List<String> regList = regs.stream().map(i->i.getId()).collect(Collectors.toList());
+//        regs.stream().forEach(region -> {
+//            regList.add(region.getId()+"0");
+//            regList.add(region.getId()+"-1");
+//            regList.add(region.getId()+"-2");
+//        });
+//        regList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i);
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i,s);
+//        });
+//        log.info("--------------------------redisGroup");
+//        List<ProBasicEnergyGroup> groups = energyGroupService.list().stream().filter(i->i.getIsAble().equals(1) && !i.getParentid().equals("0")).collect(Collectors.toList());
+//        List<String> groupList = new ArrayList<>();
+////        List<String> regList = regs.stream().map(i->i.getId()).collect(Collectors.toList());
+//        groups.stream().forEach(group -> {
+//            groupList.add(group.getId()+"0");
+//            groupList.add(group.getId()+"-1");
+//            groupList.add(group.getId()+"-2");
+//        });
+//        groupList.stream().forEach(i->{
+//            Map<String, ProBasicPowerstationPoint> codeaimap = new HashMap<>();
+//            QueryWrapper<ProBasicPowerstationPoint> qw = new QueryWrapper<>();
+//            qw.eq("windpowerstation_id",i);
+//            List<ProBasicPowerstationPoint> windpowerstationtestingpoint2List = windpowerstationpointnewService.list(qw);
+//            windpowerstationtestingpoint2List.stream().forEach(x->{
+//                codeaimap.put(x.getUniformCode(),x);
+//            });
+//            String s = JSONObject.toJSONString(codeaimap);
+//            redisService.set(i,s);
+//        });
+//        log.info("--------------------------redis理论保证功率");
+//        Map<String, Map<Double,ProBasicModelPowerRd>> powerrdMap = new HashMap<>();
+//
+//        List<ProBasicModelPowerRd> proBasicModelPowerRds = proBasicModelPowerRdService.list();
+//        proBasicModelPowerRds.stream().forEach(powerrd->{
+//            if (powerrdMap.containsKey(powerrd.getModelId())){
+//                powerrdMap.get(powerrd.getModelId()).put(powerrd.getSpeed(),powerrd);
+//            }else {
+//                Map<Double,ProBasicModelPowerRd> powerMap = new HashMap<>();
+//                powerMap.put(powerrd.getSpeed(),powerrd);
+//                powerrdMap.put(powerrd.getModelId(),powerMap);
+//            }
+//        });
+//        redisService.set("ZLLGL", JSONObject.toJSONString(powerrdMap));
+//
+//        log.info("--------------------------redis十三种状态");
+//        Map<String,List<ProBasicStatusPoint>> sszztMap = new HashMap<>();
+//        List<ProBasicStatusPoint> windturbinestatusdis = proBasicStatusPointService.list();
+//        windturbinestatusdis.stream().forEach(w->{
+//            if (sszztMap.containsKey(w.getWindturbineId())){
+//                sszztMap.get(w.getWindturbineId()).add(w);
+//            }else {
+//                List<ProBasicStatusPoint> wdisList = new ArrayList<>();
+//                wdisList.add(w);
+//                sszztMap.put(w.getWindturbineId(),wdisList);
+//            }
+//        });
+//        redisService.set("SSZZT",JSONObject.toJSONString(sszztMap));
     }
 }

+ 4 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java

@@ -96,7 +96,8 @@ public class SaticSchedulePgTask {
 
         XxlJobHelper.log("缓存Redis散点图数据调度程序执行开始!........");
         try {
-            initialRedisService.initialRedisAll();
+//            initialRedisService.initialRedisAll();
+            initialRedisService.intialWtScatter();
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -239,8 +240,8 @@ public class SaticSchedulePgTask {
             XxlJobHelper.log("年处理完成!........");
 
             powerCurveFittingByTimeGfService.cureFittingDay(date);
-//            powerCurveFittingByTimeGfService.cureFittingMonth(date,"0");
-//            powerCurveFittingByTimeGfService.cureFittingYear(date);
+            powerCurveFittingByTimeGfService.cureFittingMonth(date,"0");
+            powerCurveFittingByTimeGfService.cureFittingYear(date);
 
 
 

+ 10 - 4
realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/GoodnessOfFitThreadPool.java

@@ -8,6 +8,7 @@ import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.CoefficientService;
 import com.gyee.generation.service.GoodnessOfFitService;
 import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -123,8 +124,12 @@ public class GoodnessOfFitThreadPool implements Callable<String>, Serializable {
 			{
 				Map<String, Double> map=fitMap.get(wt.getId());
 				po.setDayGoodness(null!=map.get("day")?map.get("day"):0.0);
-				po.setYearGoodness(null!=map.get("month")?map.get("month"):0.0);
-				po.setMonthGoodness(null!=map.get("year")?map.get("year"):0.0);
+				po.setMonthGoodness(null!=map.get("month")?map.get("month"):0.0);
+				po.setYearGoodness(null!=map.get("year")?map.get("year"):0.0);
+
+				po.setDayGoodness(StringUtils.round(po.getDayGoodness()*100,2));
+				po.setYearGoodness(StringUtils.round(po.getYearGoodness()*100,2));
+				po.setMonthGoodness(StringUtils.round(po.getMonthGoodness()*100,2));
 			}else
 			{
 				po.setDayGoodness(0.0);
@@ -137,13 +142,14 @@ public class GoodnessOfFitThreadPool implements Callable<String>, Serializable {
 				Map<String, Double> map=coefficientMap.get(wt.getId());
 				po.setDayCoefficient(null!=map.get("day")?map.get("day"):0.0);
 				po.setMonthCoefficient(null!=map.get("month")?map.get("month"):0.0);
-				po.setMonthCoefficient(null!=map.get("year")?map.get("year"):0.0);
+				po.setYearCoefficient(null!=map.get("year")?map.get("year"):0.0);
+
 			}else
 			{
 
 				po.setDayCoefficient(0.0);
 				po.setMonthCoefficient(0.0);
-				po.setMonthCoefficient(0.0);
+				po.setYearCoefficient(0.0);
 			}
 
 

+ 2 - 2
realtime/generationXK-service/src/main/resources/application-jn.yml

@@ -1,6 +1,6 @@
 
 server:
-  port: 7011
+  port: 7020
   servlet:
     context-path: /
 
@@ -117,7 +117,7 @@ db:
 
 #参与计算的场站
 #runWindpowerstation: SXJ_KGDL_GJY_FDC_STA
-runWindpowerstation: SXJ_KGDL_NJL_FDC_STA,SXJ_KGDL_YF_FDC_STA,SXJ_KGDL_YLZ_FDC_STA,SXJ_KGDL_XWT_FDC_STA,SXJ_KGDL_PTZ_FDC_STA,SXJ_KGDL_GJY_FDC_STA,SXJ_KGDL_BHB_FDC_STA,SXJ_KGDL_HSM_FDC_STA,SXJ_KGDL_YTY_FDC_STA,SXJ_KGDL_BHB3_FDC_STA,SXJ_KGDL_SY_GDC_STA,SXJ_KGDL_PDL_FDC_STA,SXJ_KGDL_ZK_FDC_STA,SXJ_KGDL_JR_GDC_STA,SXJ_KGDL_FS_GDC_STA,SXJ_KGDL_HR_GDC_STA,SXJ_KGDL_YY_GDC_STA,SXJ_KGDL_PL_GDC_STA,SXJ_KGDL_TL_GDC_STA
+runWindpowerstation: SXJ_KGDL_YG_GDC_STA
 #计算状态用ai或者di
 clauStatus:
   ai: GJY03_GC,YLZ01_GC,PTZ02_GC   #配置期次

+ 19 - 18
realtime/generationXK-service/src/test/java/com/gyee/generation/HealthTest.java

@@ -3,6 +3,7 @@ package com.gyee.generation;
 import com.gyee.common.util.DateUtils;
 import com.gyee.generation.service.InitialRedisService;
 import com.gyee.generation.service.InputOrOutPutService;
+import com.gyee.generation.service.WindturbineGoodnessService;
 import com.gyee.generation.util.SpringUtils;
 import org.springframework.boot.SpringApplication;
 
@@ -66,16 +67,16 @@ public class HealthTest {
 //            System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
 //            System.out.println("切入切出状态切换记录调度程序执行结束!。。。。。。");
 //        }
-
-
-        begin=new Date();
-        System.out.println("初始化散点图调度程序执行开始!。。。。。。");
-
-
-        initialRedisService.intialWtScatter();
-        end=new Date();
-        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
-        System.out.println("初始化散点图度程序执行结束!。。。。。。");
+//
+//
+//        begin=new Date();
+//        System.out.println("初始化散点图调度程序执行开始!。。。。。。");
+//
+//
+//        initialRedisService.intialWtScatter();
+//        end=new Date();
+//        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
+//        System.out.println("初始化散点图度程序执行结束!。。。。。。");
 
 
 //        begin=new Date();
@@ -222,14 +223,14 @@ public class HealthTest {
 //
 //
 //
-//        begin=new Date();
-//        System.out.println("功率一致性系数和拟合优度调度程序执行开始!。。。。。。");
-//        WindturbineGoodnessService windturbineGoodnessService= SpringUtils.getBean("windturbineGoodnessService");
-//
-//        windturbineGoodnessService.calWindturbineGoodness(c.getTime());
-//        end=new Date();
-//        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
-//        System.out.println("功率一致性系数和拟合优度调度程序执行结束!。。。。。。");
+        begin=new Date();
+        System.out.println("功率一致性系数和拟合优度调度程序执行开始!。。。。。。");
+        WindturbineGoodnessService windturbineGoodnessService= SpringUtils.getBean("windturbineGoodnessService");
+
+        windturbineGoodnessService.calWindturbineGoodness(c.getTime());
+        end=new Date();
+        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
+        System.out.println("功率一致性系数和拟合优度调度程序执行结束!。。。。。。");
 //
 //        c.add(Calendar.DAY_OF_MONTH,-1);
 //        begin=new Date();