Browse Source

修改表底计算逻辑

xieshengjie 3 years ago
parent
commit
86f0458f48

+ 513 - 159
src/main/java/cn/gyee/tamplate/service/analysis/AnalysisNewService.java

@@ -66,6 +66,13 @@ public class AnalysisNewService {
     @Resource
     private IAnalysissubcompanyService analysissubcompanyService;
 
+    //首风五乙线
+    private static String SFWYX = "SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG109";
+    //#4主变高压侧
+    private static String SHZBGYC = "SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG117";
+    //吴光二九线
+    private static String WGEJX = "SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG181";
+
     /**
      * 保存风电统计分析主表
      *
@@ -208,8 +215,7 @@ public class AnalysisNewService {
                     analysissubtablebottom.setRecorddate(DateUtils.parseDate(day));
                     analysissubtablebottom.setStopcode(m.getNow());
                     analysissubtablebottom.setStopcodemodify(m.getNow());
-                    double yestdayNow = getYestdayNow(day,m.getMeterid());
-                    double dayvalue = DoubleUtils.GetResult(DoubleUtils.GetResult(m.getNow(),yestdayNow,"-"),meterMap.get(m.getMeterid()).getMagnification(),"*");
+                    double dayvalue = DoubleUtils.GetResult(DoubleUtils.GetResult(m.getNow(),m.getDay(),"-"),meterMap.get(m.getMeterid()).getMagnification(),"*");
                     analysissubtablebottom.setDayvalue(dayvalue);
                     analysissubtablebottom.setDayvaluemodify(dayvalue);
                     analysissubtablebottomService.save(analysissubtablebottom);
@@ -218,64 +224,245 @@ public class AnalysisNewService {
         }
     }
 
-
     /**
-     * 计算单场电量
+     * 保存风电项目表
      *
      * @param beginDate
      * @param endDate
      */
-    public void saveAnalysisGfTableBottomone(String beginDate, String endDate,String wpid) {
-        Map<String, Meterpoint2> meterMap = CacheContext.meterMap;
-        List<String> days = getDays(beginDate, endDate);
-        for (String day : days) {
+//    public void saveWindProject(String beginDate, String endDate) throws Exception {
+//        Map<String, List<Meterpoint2>> wpmeterMap = CacheContext.wpmeterMap;
+//        List<String> days = getDays(beginDate, endDate);
+//        for (String day : days) {
+//            Map<String, Object> bdzmap = new HashMap<>();
+//            bdzmap.put("recorddate", DateUtils.parseDate(day));
+//            List<Analysissubtablebottom> currentDayBdz = analysissubtablebottomService.listByMap(bdzmap);
+//
+//
 //            Map<String, Object> deleteparam = new HashMap<>();
 //            deleteparam.put("recorddate", DateUtils.parseDate(day));
-//            analysissubtablebottomService.removeByMap(deleteparam);
-
-            QueryWrapper<Analysissubtablebottom> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("recorddate", DateUtils.parseDate(day)).like("wpid","GDC");
-            analysissubtablebottomService.remove(queryWrapper);
-
-            Map<String, Object> deleteparam = new HashMap<>();
-            Date selDate = DateUtils.parseDate(day);
-            deleteparam.put("recorddate", DateUtils.addDays(selDate,1));
-
-            List<Meterpointvalue> meterpointvalues = meterpointvalueService.listByMap(deleteparam);
-            List<Meterpointvalue> collect = meterpointvalues.stream().filter(i -> meterMap.get(i.getMeterid()) != null).filter(i -> meterMap.get(i.getMeterid()).getDescription() != null).collect(Collectors.toList());
-
-            Analysismain mainValues = getMainValues(day, wpid);
-            collect.stream().filter(i -> meterMap.get(i.getMeterid()).getWindpowerstationid().equals(wpid)).forEach(m -> {
-                Analysissubtablebottom analysissubtablebottom = new Analysissubtablebottom();
-                analysissubtablebottom.setTid(mainValues.getId());
-                analysissubtablebottom.setWpid(wpid);
-                analysissubtablebottom.setMeterid(m.getMeterid());
-                analysissubtablebottom.setMetername(meterMap.get(m.getMeterid()).getDescription());
-                analysissubtablebottom.setRecorddate(DateUtils.parseDate(day));
-                analysissubtablebottom.setStopcode(m.getNow());
-                analysissubtablebottom.setStopcodemodify(m.getNow());
-                double yestdayNow = getYestdayNow(day,m.getMeterid());
-                double dayvalue = DoubleUtils.GetResult(DoubleUtils.GetResult(m.getNow(),yestdayNow,"-"),meterMap.get(m.getMeterid()).getMagnification(),"*");
-                analysissubtablebottom.setDayvalue(dayvalue);
-                analysissubtablebottom.setDayvaluemodify(dayvalue);
-                analysissubtablebottomService.save(analysissubtablebottom);
-            });
-        }
-    }
-
-    /**
-     * 获取昨天的止码(针对光伏不过12点就计算,起码取昨天止码)
-     * @param day
-     * @return
-     */
-    private double getYestdayNow(String day,String meterid) {
-        QueryWrapper<Analysissubtablebottom> queryWrapper = new QueryWrapper<>();
-        Date yestday = DateUtils.getYestday(DateUtils.parseDate(day));
-        queryWrapper.eq("recorddate",yestday);
-        queryWrapper.eq("meterid",meterid);
-        Analysissubtablebottom one = analysissubtablebottomService.getOne(queryWrapper);
-        return null != one ? one.getStopcodemodify() :0.0;
-    }
+//            analysissubprojectwindcannotService.removeByMap(deleteparam);
+//            analysissubprojectwindcanService.removeByMap(deleteparam);
+//            for (Project project : CacheContext.projects) {
+//
+//                if (project.getWindpowerstationid().endsWith("GDC")) {
+//                    continue;
+//                }
+//                List<Analysissubtablebottom> currentDay = currentDayBdz.stream().filter(i -> i.getWpid().equals(project.getWindpowerstationid())).collect(Collectors.toList());
+//                List<String> fcswmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                        .filter(i -> (
+//                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
+//                        )).map(i -> i.getId()).collect(Collectors.toList());
+//                double fcfdl = 0.0;
+//                double fcswfdl = 0.0;
+//                double fcgwfdl = 0.0;
+//                double fczyb = 0.0;
+//                if (fcswmeterids.size() == 1) {
+//                    List<String> fcfdlmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                            .filter(i -> (
+//                                    i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
+//                            )).map(i -> i.getId()).collect(Collectors.toList());
+//                    for (String meterid : fcfdlmeterids) {
+//                        fcfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+//                    }
+//                    for (String meterid : fcswmeterids) {
+//                        fcswfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+//                    }
+//                    List<String> fcgwmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                            .filter(i -> (
+//                                    i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
+//                            )).map(i -> i.getId()).collect(Collectors.toList());
+//                    for (String meterid : fcgwmeterids) {
+//                        fcgwfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+//                    }
+//
+//                } else {
+//                    List<Meterpoint2> collect = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                            .filter(i -> (
+//                                    i.getProjectid().contains(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
+//                            )).collect(Collectors.toList());
+//                    List<Meterpoint2> gwdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                            .filter(i -> (
+//                                    i.getProjectid().contains(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
+//                            )).collect(Collectors.toList());
+//                    if (StringUtils.isNotEmpty(gwdls)) {
+//                        fcgwfdl += currentDay.stream().filter(i -> i.getMeterid().equals(gwdls.get(0).getId())).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(gwdls.get(0).getId())).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+//
+//                    }
+//                    for (Meterpoint2 m : collect) {
+//                        String[] projects = m.getProjectid().split("\\|");
+//                        for (String projectid : projects) {
+//                            List<Meterpoint2> fcfdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                                    .filter(i -> (
+//                                            i.getProjectid().equals(projectid) && i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
+//                                    )).collect(Collectors.toList());
+//                            for (Meterpoint2 meterpoint2 : fcfdls) {
+//                                fcfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterpoint2.getId())).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterpoint2.getId())).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+//                            }
+//                        }
+//                        fcswfdl += currentDay.stream().filter(i -> i.getMeterid().equals(m.getId())).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(m.getId())).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+//                    }
+//
+//                }
+//
+//                List<String> fczybmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                        .filter(i -> (
+//                                i.getMetersort().equals("主") && i.getMetertype().equals("站用变") && i.getDisplaytype().equals("正向有功")
+//                        )).map(i -> i.getId()).collect(Collectors.toList());
+//                for (String meterid : fczybmeterids) {
+//                    fczyb += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+//                }
+//
+//
+////                //-------------------------------------------------------------------------------------------------------------------------------------------------
+////                List<String> fcswmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+////                        .filter(i -> (
+////                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
+////                        )).map(i -> i.getId()).collect(Collectors.toList());
+////                double fcswfdl = 0.0;
+////                for (String meterid : fcswmeterids) {
+////                    fcswfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+////                }
+////                //-------------------------------------------------------------------------------------------------------------------------------------------------
+////                List<String> fcgwmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+////                        .filter(i -> (
+////                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
+////                        )).map(i -> i.getId()).collect(Collectors.toList());
+////                double fcgwfdl = 0.0;
+////                for (String meterid : fcgwmeterids) {
+////                    fcgwfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+////                }
+//                //-------------------------------------------------------------------------------------------------------------------------------------------------
+//
+//
+//                List<String> fdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                        .filter(i -> (
+//                                i.getProjectid().equals(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
+//                        )).map(i -> i.getId()).collect(Collectors.toList());
+//                double generatingcapacity = 0;
+//                for (String meterid : fdls) {
+//                    generatingcapacity += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+//                }
+//
+//
+//                Analysissubprojectwindcan can = new Analysissubprojectwindcan();
+//                Analysissubprojectwindcannot cannot = new Analysissubprojectwindcannot();
+//                Analysismain mainValues = getMainValues(day, project.getWindpowerstationid());
+//                can.setTid(mainValues.getId());
+//                can.setProjectid(project.getId());
+//                can.setWpid(project.getWindpowerstationid());
+//                can.setRecorddate(DateUtils.parseDate(day));
+//                can.setZjrl(project.getCapacity() / 10);
+//
+//
+//                can.setFdl(generatingcapacity / 10000);
+//                can.setSwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcswfdl) / 10000 : 0.0);
+//                can.setGwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcgwfdl) / 10000 : 0.0);
+//                can.setCydl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fczyb) / 10000 : 0.0);
+//
+//                QueryWrapper<Windpowerinfoday> queryWrapper = new QueryWrapper<>();
+//                queryWrapper.eq("recorddate", DateUtils.parseDate(day));
+//                queryWrapper.eq("foreignkeyid", project.getId());
+//                Windpowerinfoday w = windpowerinfodayService.getOne(queryWrapper);
+//                QueryWrapper<Windpowerinfoday3> wWrapper = new QueryWrapper<>();
+//                wWrapper.eq("recorddate", DateUtils.parseDate(day));
+//                wWrapper.eq("foreignkeyid", project.getId());
+//                Windpowerinfoday3 one = windpowerinfoday3Service.getOne(wWrapper);
+//                QueryWrapper<Shutdownevent2> shutparams = new QueryWrapper<>();
+//                shutparams.eq("stoptime", DateUtils.parseDate(day));
+//                shutparams.eq("projectid", project.getId());
+//                //shutparams.put("statuscode",4);
+//                List<Shutdownevent2> shut = shutdownevent2Service.list(shutparams);
+//
+//                Map<String, Object> inputparam = new HashMap<>();
+//                inputparam.put("recorddate", DateUtils.parseDate(day));
+//                inputparam.put("projectid", project.getId());
+//                List<Inputoroutputspeedtotal> inputoroutputspeedtotals = inputoroutputspeedtotalService.listByMap(inputparam);
+//                if (StringUtils.isNotEmpty(inputoroutputspeedtotals)) {
+//                    OptionalDouble average = inputoroutputspeedtotals.stream().filter(i -> i.getDayinputsmall() != null).mapToDouble(Inputoroutputspeedtotal::getDayinputsmall).average();
+//                    if (average.isPresent()) {
+//                        can.setPjqrfs(average.getAsDouble());
+//                    } else {
+//                        can.setPjqrfs(0.0);
+//                    }
+//                }
+//                if (StringUtils.isNotNull(w)) {
+//
+//                    can.setQpjfx(w.getSpeed());
+//                    can.setFjgzsj(w.getFaulttime());
+//                    can.setFjjxsj(w.getMaintaintime());
+//                    can.setZdcl(w.getMaxpower());
+//                    can.setZxcl(w.getMinpower());
+//                } else {
+//
+//                    can.setQpjfx(0.0);
+//                    can.setFjgzsj(0.0);
+//                    can.setFjjxsj(0.0);
+//                    can.setZdcl(0.0);
+//                    can.setZxcl(0.0);
+//                }
+//
+//                if (StringUtils.isNotNull(one)) {
+//                    can.setFjgzdl(one.getDaynhgzssdl() / 10000);
+//                    can.setXddl(one.getDaynhxdssdl() / 10000);
+//                    can.setXnssdl(one.getDaynhqfdl() / 10000);
+//                    can.setFjjxdl(one.getDaynhwhssdl() / 10000);
+//                } else {
+//                    can.setFjgzdl(0.0);
+//                    can.setXddl(0.0);
+//                    can.setXnssdl(0.0);
+//                    can.setFjjxdl(0.0);
+//                }
+//                if (StringUtils.isNotEmpty(shut)) {
+//                    can.setGzcs(Double.valueOf(shut.stream().filter(i -> i.getStatuscode() == 2).collect(Collectors.toList()).size()));
+//                } else {
+//                    can.setGzcs(0.0);
+//                }
+//                can.setFdlscada(can.getFdl() * 1.005);
+//                can.setZhcydl(can.getFdl() + can.getGwdl() - can.getSwdl());
+//                can.setZhcydll(can.getFdl() != 0 ? can.getZhcydl() / can.getFdl() * 100 : 0.0);
+//                can.setZhcydlscada(can.getFdlscada() + can.getGwdl() - can.getSwdl());
+//                can.setZhcydllscada(can.getFdlscada() != 0 ? can.getZhcydlscada() / can.getFdlscada() * 100 : 0.0);
+//                can.setCydll(can.getFdl() != 0 ? can.getCydl() / can.getFdl() : 0.0);
+//                can.setLyxs(can.getFdl() / can.getZjrl());
+//                can.setLyxsscada(can.getFdlscada() / can.getZjrl());
+//                can.setQfl((can.getXddl() + can.getFdl()) != 0 ? can.getXddl() / (can.getXddl() + can.getFdl()) * 100 : 0.0);
+//                can.setLlfdl(can.getFdl() + can.getFjgzdl() + can.getFjjxdl() + can.getXddl());  //+can.getXnssdl()
+//                can.setLlfdlscada(can.getFdlscada() + can.getFjgzdl() + can.getFjjxdl() + can.getXddl());//+can.getXnssdl()
+//                can.setYjhfdl(getYjhfdl(project.getId(), day));
+//                can.setDnaqts(getDnljts(day));
+//                can.setCnsldwdl(0.0);
+//                can.setCnsldwsj(0.0);
+//                can.setCnsljxdl(0.0);
+//                can.setCnsljxsj(0.0);
+//                can.setCwsldwdl(0.0);
+//                can.setCwsldwsj(0.0);
+//                can.setCwsljxdl(0.0);
+//                can.setCwsljxsj(0.0);
+//                can.setZrzhdl(0.0);
+//                can.setZrzhsj(0.0);
+//                can.setXdsj(0.0);
+//                can.setSyzgzdl(0.0);
+//                can.setSyzgzsj(0.0);
+//                can.setJdxlgzdl(0.0);
+//                can.setJdxlgzsj(0.0);
+//                can.setSyzjxdl(0.0);
+//                can.setSyzjxsj(0.0);
+//                can.setJdxljx(0.0);
+//                can.setJdxljxsj(0.0);
+//                can.setLjaqts(0.0);
+//                can.setQw(0.0);
+//                can.setTq("");
+//                can.setFx("");
+//                can.setEdpjfs(0.0);
+//                can.setYpjkqmd(0.0);
+//
+//                CopyUtils.copy(can, cannot);
+//                analysissubprojectwindcanService.save(can);
+//                analysissubprojectwindcannotService.save(cannot);
+//            }
+//        }
+//    }
 
     /**
      * 保存风电项目表
@@ -302,62 +489,46 @@ public class AnalysisNewService {
                     continue;
                 }
                 List<Analysissubtablebottom> currentDay = currentDayBdz.stream().filter(i -> i.getWpid().equals(project.getWindpowerstationid())).collect(Collectors.toList());
-                List<String> fcswmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                //算出发电量
+                List<String> fdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
                         .filter(i -> (
-                                i.getMetersort().equals("主") && i.getMetertype().equals("线") && i.getDisplaytype().equals("正向有功")
+                                i.getProjectid().equals(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("线") && i.getDisplaytype().equals("正向有功")
                         )).map(i -> i.getId()).collect(Collectors.toList());
-                double fcfdl = 0.0;
-                double fcswfdl = 0.0;
-                double fcgwfdl = 0.0;
-                double fczyb = 0.0;
-                if (fcswmeterids.size() == 1) {
-                    List<String> fcfdlmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
-                            .filter(i -> (
-                                    i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
-                            )).map(i -> i.getId()).collect(Collectors.toList());
-                    for (String meterid : fcfdlmeterids) {
-                        fcfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
-                    }
-                    for (String meterid : fcswmeterids) {
-                        fcswfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
-                    }
-                    List<String> fcgwmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
-                            .filter(i -> (
-                                    i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
-                            )).map(i -> i.getId()).collect(Collectors.toList());
-                    for (String meterid : fcgwmeterids) {
-                        fcgwfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
-                    }
+                double generatingcapacity = 0;
+                for (String meterid : fdls) {
+                    generatingcapacity += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+                }
 
-                } else {
-                    List<Meterpoint2> collect = wpmeterMap.get(project.getWindpowerstationid()).stream()
-                            .filter(i -> (
-                                    i.getProjectid().contains(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
-                            )).collect(Collectors.toList());
-                    List<Meterpoint2> gwdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
-                            .filter(i -> (
-                                    i.getProjectid().contains(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
-                            )).collect(Collectors.toList());
-                    if (StringUtils.isNotEmpty(gwdls)) {
-                        fcgwfdl += currentDay.stream().filter(i -> i.getMeterid().equals(gwdls.get(0).getId())).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(gwdls.get(0).getId())).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
 
-                    }
-                    for (Meterpoint2 m : collect) {
-                        String[] projects = m.getProjectid().split("\\|");
-                        for (String projectid : projects) {
-                            List<Meterpoint2> fcfdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
-                                    .filter(i -> (
-                                            i.getProjectid().equals(projectid) && i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
-                                    )).collect(Collectors.toList());
-                            for (Meterpoint2 meterpoint2 : fcfdls) {
-                                fcfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterpoint2.getId())).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterpoint2.getId())).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
-                            }
-                        }
-                        fcswfdl += currentDay.stream().filter(i -> i.getMeterid().equals(m.getId())).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(m.getId())).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
-                    }
+                List<String> zfdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                        .filter(i -> (
+                                i.getMetersort().contains("主") && i.getMetertype().contains("进线") && i.getUniformcode().contains("ZXYG")
+                        )).map(i->i.getId()).collect(Collectors.toList());
 
+                double zfdl = 0;
+                for (String meterid : zfdls) {
+                    zfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
                 }
+                //算上网电量和购网电量
+                double swdl = 0;
+                double gwdl = 0;
+                Meterpoint2 fcswmeter = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                        .filter(i -> (
+                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功") && i.getProjectid().contains(project.getId())
+                        )).findFirst().get();
+                Meterpoint2 fcgwmeter = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                        .filter(i -> (
+                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功") && i.getProjectid().contains(project.getId())
+                        )).findFirst().get();
+                String[] lineids = fcswmeter.getLineid().split("\\|");
+                Double fcfdl = Arrays.stream(lineids).map(lineid -> wpmeterMap.get(project.getWindpowerstationid()).stream().filter(j -> j.getMetersort().equals("主") && j.getMetertype().equals("进线") && j.getDisplaytype().equals("正向有功") && j.getLineid().equals(lineid)).findFirst().get()).mapToDouble(linemeterpoint2 -> currentDay.stream().filter(currentBdz -> currentBdz.getMeterid().equals(linemeterpoint2.getId())).findFirst().get().getDayvaluemodify()).sum();
 
+                Double dayvaluesw = currentDay.stream().filter(currentBdz -> currentBdz.getMeterid().equals(fcswmeter.getId())).findFirst().get().getDayvaluemodify();
+                Double dayvaluegw = currentDay.stream().filter(currentBdz -> currentBdz.getMeterid().equals(fcgwmeter.getId())).findFirst().get().getDayvaluemodify();
+                swdl = fcfdl!=0?generatingcapacity/fcfdl*dayvaluesw:0;
+                gwdl = fcfdl!=0?generatingcapacity/fcfdl*dayvaluegw:0;
+
+                double fczyb = 0;
                 List<String> fczybmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
                         .filter(i -> (
                                 i.getMetersort().equals("主") && i.getMetertype().equals("站用变") && i.getDisplaytype().equals("正向有功")
@@ -367,36 +538,6 @@ public class AnalysisNewService {
                 }
 
 
-//                //-------------------------------------------------------------------------------------------------------------------------------------------------
-//                List<String> fcswmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
-//                        .filter(i -> (
-//                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
-//                        )).map(i -> i.getId()).collect(Collectors.toList());
-//                double fcswfdl = 0.0;
-//                for (String meterid : fcswmeterids) {
-//                    fcswfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
-//                }
-//                //-------------------------------------------------------------------------------------------------------------------------------------------------
-//                List<String> fcgwmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
-//                        .filter(i -> (
-//                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
-//                        )).map(i -> i.getId()).collect(Collectors.toList());
-//                double fcgwfdl = 0.0;
-//                for (String meterid : fcgwmeterids) {
-//                    fcgwfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
-//                }
-                //-------------------------------------------------------------------------------------------------------------------------------------------------
-
-
-                List<String> fdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
-                        .filter(i -> (
-                                i.getProjectid().equals(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
-                        )).map(i -> i.getId()).collect(Collectors.toList());
-                double generatingcapacity = 0;
-                for (String meterid : fdls) {
-                    generatingcapacity += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
-                }
-
 
                 Analysissubprojectwindcan can = new Analysissubprojectwindcan();
                 Analysissubprojectwindcannot cannot = new Analysissubprojectwindcannot();
@@ -409,9 +550,16 @@ public class AnalysisNewService {
 
 
                 can.setFdl(generatingcapacity / 10000);
-                can.setSwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcswfdl) / 10000 : 0.0);
-                can.setGwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcgwfdl) / 10000 : 0.0);
-                can.setCydl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fczyb) / 10000 : 0.0);
+                if (project.getId().equals("SBQ04_GC")){
+                    List<Analysissubstationpv> analysissubstationpvs = analysissubstationpvService.listByMap(bdzmap);
+                    Double hzj_swdl = analysissubstationpvs.stream().filter(i -> i.getWpid().equals("HZJ_GDC")).findFirst().get().getSwdl();
+                    Double wgejx = currentDayBdz.stream().filter(i -> i.getMeterid().equals(WGEJX)).findFirst().get().getDayvaluemodify();
+                    can.setSwdl((swdl-wgejx)/10000-hzj_swdl);
+                }else {
+                    can.setSwdl(swdl / 10000);
+                }
+                can.setGwdl(gwdl/ 10000);
+                can.setCydl(fcfdl != 0.0 ? (generatingcapacity / zfdl * fczyb) / 10000 : 0.0);
 
                 QueryWrapper<Windpowerinfoday> queryWrapper = new QueryWrapper<>();
                 queryWrapper.eq("recorddate", DateUtils.parseDate(day));
@@ -518,6 +666,7 @@ public class AnalysisNewService {
     }
 
 
+
     /**
      * 保存光伏项目表
      *
@@ -599,33 +748,176 @@ public class AnalysisNewService {
 
                 can.setFdl(generatingcapacity / 10000);
                 if (project.getWindpowerstationid().equals("HZJ_GDC")){
-                    Double sfwyx = 0.0;
-                    Optional<Analysissubtablebottom> sfwyxFirst = currentDayBdz.stream().filter(i -> i.getMeterid().equals("SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG109")).findFirst();
-                    if (sfwyxFirst.isPresent()){
-                        sfwyx = sfwyxFirst.get().getDayvaluemodify();
-                    }
-                    List<String> ffdls = wpmeterMap.get("SBQ_FDC").stream()
-                            .filter(i -> (
-                                    i.getProjectid().equals("SBQ04_GC") && i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
-                            )).map(i -> i.getId()).collect(Collectors.toList());
-                    double ffdl = 0;
-                    for (String meterid : fdls) {
-                        ffdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
-                    }
-                    can.setSwdl(ffdl!=0.0?sfwyx*(generatingcapacity/ffdl)/10000:0.0);
+                    //首风五乙线
+                    double sfwyx = currentDayBdz.stream().filter(i -> i.getMeterid().equals(SFWYX)).findFirst().get().getDayvaluemodify();
+                    //#4主变高压侧
+                    double jszbgyc = currentDayBdz.stream().filter(i -> i.getMeterid().equals(SHZBGYC)).findFirst().get().getDayvaluemodify();
+                    //(sfwyx*fcswfdl/(jszbgyc+fcswfdl))/10000
+                    can.setSwdl((jszbgyc+fcswfdl)!=0?(sfwyx*fcswfdl/(jszbgyc+fcswfdl))/10000:0);
+                }else {
+                    can.setSwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcswfdl) / 10000 : 0.0);
+                }
 
+                can.setGwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcgwfdl) / 10000 : 0.0);
+                can.setFdcydl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fczyb) / 10000 : 0.0);
 
-                    Double gwdls = 0.0;
-                    Optional<Analysissubtablebottom> gwdlFirst = currentDayBdz.stream().filter(i -> i.getMeterid().equals("HZJDJL.NX_GD_HZJG_DD_P1_L1_001_ZXYG001")).findFirst();
-                    if (sfwyxFirst.isPresent()){
-                        gwdls = sfwyxFirst.get().getDayvaluemodify();
-                    }
-                    can.setGwdl(gwdls/10000);
-                }else{
-                    can.setSwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcswfdl) / 10000 : 0.0);
-                    can.setGwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcgwfdl) / 10000 : 0.0);
+                QueryWrapper<Windpowerinfoday> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("recorddate", DateUtils.parseDate(day));
+                queryWrapper.eq("foreignkeyid", project.getId());
+                Windpowerinfoday w = windpowerinfodayService.getOne(queryWrapper);
+                QueryWrapper<Windpowerinfoday3> wWrapper = new QueryWrapper<>();
+                wWrapper.eq("recorddate", DateUtils.parseDate(day));
+                wWrapper.eq("foreignkeyid", project.getId());
+                Windpowerinfoday3 one = windpowerinfoday3Service.getOne(wWrapper);
+                QueryWrapper<Shutdownevent2> shutparams = new QueryWrapper<>();
+                shutparams.eq("stoptime", DateUtils.parseDate(day));
+                shutparams.eq("projectid", project.getId());
+                //shutparams.put("statuscode",4);
+                List<Shutdownevent2> shut = shutdownevent2Service.list(shutparams);
+
+
+                if (StringUtils.isNotNull(w)) {
+
+                    can.setZdcl(w.getMaxpower());
+                    can.setZxcl(w.getMinpower());
+                    can.setGzsj(w.getFaulttime());
+                    can.setJxsj(w.getMaintaintime());
+                    can.setZdcl(w.getMaxpower());
+                    can.setZxcl(w.getMinpower());
+                } else {
+
+                    can.setZdcl(0.0);
+                    can.setZxcl(0.0);
+                    can.setGzsj(0.0);
+                    can.setJxsj(0.0);
+                    can.setZdcl(0.0);
+                    can.setZxcl(0.0);
                 }
+                if (StringUtils.isNotNull(one)) {
+                    can.setXddl(one.getDaynhxdssdl());
+                    can.setGzdl(one.getDaynhgzssdl());
+                    can.setJxdl(one.getDaynhwhssdl());
+
+                } else {
+                    can.setXddl(0.0);
+                    can.setGzdl(0.0);
+                    can.setJxdl(0.0);
+                }
+                can.setLlfdl(can.getFdl() + can.getXddl() + can.getGzdl() + can.getJxdl());
+
+                can.setFdcydll(can.getFdl() != 0.0 ? can.getFdcydl() / can.getFdl() * 100 : 0.0);
+                can.setZhcydl(can.getFdl() + can.getGwdl() - can.getSwdl());
+                can.setZhcydll(can.getFdl() != 0 ? can.getZhcydl() / can.getFdl() * 100 : 0.0);
+                can.setLyxs(can.getFdl() / project.getCapacity() * 10);
+                can.setRzxs(0.0);
+                can.setTq("");
+                can.setWd(0.0);
+                can.setRljfs(0.0);
+                can.setXdsj(0.0);
+                can.setRzgwd(0.0);
+                can.setLxaqts(0.0);
+                can.setNljaqts(0.0);
+                can.setYjhfdl(getYjhfdl(project.getId(), day));
+                can.setRzdfsqd(0.0);
+                can.setLjfsl(0.0);
+                CopyUtils.copy(can, cannot);
+                analysissubprojectpvcanService.save(can);
+                analysissubprojectpvcannotService.save(cannot);
+            }
+        }
+    }
+
+    /**
+     * 保存海子井项目表
+     *
+     * @param beginDate
+     * @param endDate
+     */
+    public void saveHzjProject(String beginDate, String endDate) throws Exception {
+        Map<String, List<Meterpoint2>> wpmeterMap = CacheContext.wpmeterMap;
+        List<String> days = getDays(beginDate, endDate);
+        for (String day : days) {
+            Map<String, Object> bdzmap = new HashMap<>();
+            bdzmap.put("recorddate", DateUtils.parseDate(day));
+            List<Analysissubtablebottom> currentDayBdz = analysissubtablebottomService.listByMap(bdzmap);
+
+
+            Map<String, Object> deleteparam = new HashMap<>();
+            deleteparam.put("recorddate", DateUtils.parseDate(day));
+            analysissubprojectpvcannotService.removeByMap(deleteparam);
+            analysissubprojectpvcanService.removeByMap(deleteparam);
+            for (Project project : CacheContext.projects) {
+                if (!project.getWindpowerstationid().equals("HZJ_GDC")) {
+                    continue;
+                }
+                List<Analysissubtablebottom> currentDay = currentDayBdz.stream().filter(i -> i.getWpid().equals(project.getWindpowerstationid())).collect(Collectors.toList());
+                List<String> fcfdlmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                        .filter(i -> (
+                                i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
+                        )).map(i -> i.getId()).collect(Collectors.toList());
+                double fcfdl = 0.0;
+                for (String meterid : fcfdlmeterids) {
+                    fcfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+                }
+
+
+                //-------------------------------------------------------------------------------------------------------------------------------------------------
+                List<String> fcswmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                        .filter(i -> (
+                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
+                        )).map(i -> i.getId()).collect(Collectors.toList());
+                double fcswfdl = 0.0;
+                for (String meterid : fcswmeterids) {
+                    fcswfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+                }
+                //-------------------------------------------------------------------------------------------------------------------------------------------------
+                List<String> fcgwmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                        .filter(i -> (
+                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
+                        )).map(i -> i.getId()).collect(Collectors.toList());
+                double fcgwfdl = 0.0;
+                for (String meterid : fcgwmeterids) {
+                    fcgwfdl += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+                }
+                //-------------------------------------------------------------------------------------------------------------------------------------------------
+                List<String> fczybmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                        .filter(i -> (
+                                i.getMetersort().equals("主") && i.getMetertype().equals("站用变") && i.getDisplaytype().equals("正向有功")
+                        )).map(i -> i.getId()).collect(Collectors.toList());
+                double fczyb = 0.0;
+                for (String meterid : fczybmeterids) {
+                    fczyb += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+                }
+
+                List<String> fdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                        .filter(i -> (
+                                i.getProjectid().equals(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
+                        )).map(i -> i.getId()).collect(Collectors.toList());
+                double generatingcapacity = 0;
+                for (String meterid : fdls) {
+                    generatingcapacity += currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().isPresent() ? currentDay.stream().filter(i -> i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue() : 0.0;
+                }
+
+                Analysissubprojectpvcan can = new Analysissubprojectpvcan();
+                Analysissubprojectpvcannot cannot = new Analysissubprojectpvcannot();
+                Analysismain mainValues = getMainValues(day, project.getWindpowerstationid());
+                can.setTid(mainValues.getId());
+                can.setProjectid(project.getId());
+                can.setWpid(project.getWindpowerstationid());
+                can.setRecorddate(DateUtils.parseDate(day));
+
+                can.setFdl(generatingcapacity / 10000);
+
+//                can.setSwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcswfdl) / 10000 : 0.0);
+                //首风五乙线
+                double sfwyx = currentDayBdz.stream().filter(i -> i.getMeterid().equals("SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG109")).findFirst().get().getDayvaluemodify();
+                //#4主变高压侧
+                double jszbgyc = currentDayBdz.stream().filter(i -> i.getMeterid().equals("SBQDJL.NX_GD_SBQF_DD_P1_L1_001_ZXYG117")).findFirst().get().getDayvaluemodify();
+                //(sfwyx*fcswfdl/(jszbgyc+fcswfdl))/10000
+                can.setSwdl((jszbgyc+fcswfdl)!=0?(sfwyx*fcswfdl/(jszbgyc+fcswfdl))/10000:0);
+                can.setGwdl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fcgwfdl) / 10000 : 0.0);
                 can.setFdcydl(fcfdl != 0.0 ? (generatingcapacity / fcfdl * fczyb) / 10000 : 0.0);
+
                 QueryWrapper<Windpowerinfoday> queryWrapper = new QueryWrapper<>();
                 queryWrapper.eq("recorddate", DateUtils.parseDate(day));
                 queryWrapper.eq("foreignkeyid", project.getId());
@@ -794,7 +1086,69 @@ public class AnalysisNewService {
             deleteparam.put("recorddate", DateUtils.parseDate(day));
             analysissubstationpvService.removeByMap(deleteparam);
             for (Windpowerstation station : CacheContext.stations) {
-                if (station.getId().endsWith("FDC") || station.getId().equals("MCH_GDC")) {
+                if (station.getId().endsWith("FDC") || station.getId().equals("MCH_GDC") ) {
+                    continue;
+                }
+                Analysismain mainValues = getMainValues(day, station.getId());
+                Map<String, Object> params = new HashMap<>();
+                params.put("tid", mainValues.getId());
+                List<Analysissubprojectpvcan> prodatas = analysissubprojectpvcanService.listByMap(params);
+
+                Analysissubstationpv analysis = new Analysissubstationpv();
+                analysis.setTid(mainValues.getId());
+                analysis.setWpid(station.getId());
+                analysis.setRecorddate(DateUtils.parseDate(day));
+
+                analysis.setFdl(prodatas.stream().map(Analysissubprojectpvcan::getFdl).reduce(DoubleUtils::sum).get());
+                analysis.setSwdl(prodatas.stream().map(Analysissubprojectpvcan::getSwdl).reduce(DoubleUtils::sum).get());
+                analysis.setGwdl(prodatas.stream().map(Analysissubprojectpvcan::getGwdl).reduce(DoubleUtils::sum).get());
+                analysis.setZhcydl(analysis.getFdl() + analysis.getGwdl() - analysis.getSwdl());
+                analysis.setZhcydll(analysis.getFdl() != 0.0 ? analysis.getZhcydl() / analysis.getFdl() * 100 : 0.0);
+                analysis.setFdcydl(prodatas.stream().map(Analysissubprojectpvcan::getFdcydl).reduce(DoubleUtils::sum).get());
+                analysis.setFdcydll(analysis.getFdl() != 0.0 ? analysis.getFdcydl() / analysis.getFdl() * 100 : 0.0);
+                analysis.setLyxs(analysis.getFdl() / station.getCapacity() * 10);
+                analysis.setRzdfsqd(prodatas.stream().map(Analysissubprojectpvcan::getRzdfsqd).reduce(DoubleUtils::max).get());
+                analysis.setLjfsl(prodatas.stream().map(Analysissubprojectpvcan::getLjfsl).reduce(DoubleUtils::sum).get());
+
+
+                analysis.setXddl(prodatas.stream().map(Analysissubprojectpvcan::getXddl).reduce(DoubleUtils::sum).get());
+                analysis.setXdsj(prodatas.stream().map(Analysissubprojectpvcan::getXdsj).reduce(DoubleUtils::sum).get());
+
+                analysis.setGzdl(prodatas.stream().map(Analysissubprojectpvcan::getGzdl).reduce(DoubleUtils::sum).get());
+                analysis.setGzsj(prodatas.stream().map(Analysissubprojectpvcan::getGzsj).reduce(DoubleUtils::sum).get());
+
+                analysis.setJxdl(prodatas.stream().map(Analysissubprojectpvcan::getJxdl).reduce(DoubleUtils::sum).get());
+                analysis.setJxsj(prodatas.stream().map(Analysissubprojectpvcan::getJxsj).reduce(DoubleUtils::sum).get());
+
+                analysis.setRzxs(prodatas.stream().map(Analysissubprojectpvcan::getRzxs).reduce(DoubleUtils::ave).get());
+                analysis.setTq(prodatas.get(0).getTq());
+                analysis.setWd(prodatas.stream().map(Analysissubprojectpvcan::getWd).reduce(DoubleUtils::ave).get());
+                analysis.setRljfs(prodatas.stream().map(Analysissubprojectpvcan::getRljfs).reduce(DoubleUtils::sum).get());
+                analysis.setZdcl(prodatas.stream().map(Analysissubprojectpvcan::getZdcl).reduce(DoubleUtils::max).get());
+                analysis.setZxcl(prodatas.stream().map(Analysissubprojectpvcan::getZxcl).reduce(DoubleUtils::min).get());
+                analysis.setLlfdl(analysis.getFdl() + analysis.getGzdl() + analysis.getJxdl() + analysis.getXddl());
+                analysis.setRzgwd(prodatas.stream().map(Analysissubprojectpvcan::getRzgwd).reduce(DoubleUtils::max).get());
+                analysis.setLxaqts(prodatas.stream().map(Analysissubprojectpvcan::getLxaqts).reduce(DoubleUtils::max).get());
+                analysis.setNljaqts(prodatas.stream().map(Analysissubprojectpvcan::getNljaqts).reduce(DoubleUtils::max).get());
+                analysis.setYjhfdl(prodatas.stream().map(Analysissubprojectpvcan::getYjhfdl).reduce(DoubleUtils::sum).get());
+                analysissubstationpvService.save(analysis);
+            }
+        }
+    }
+    /**
+     * 保存海子井场站表
+     *
+     * @param beginDate
+     * @param endDate
+     */
+    public void saveHzjStation(String beginDate, String endDate) {
+        List<String> days = getDays(beginDate, endDate);
+        for (String day : days) {
+            Map<String, Object> deleteparam = new HashMap<>();
+            deleteparam.put("recorddate", DateUtils.parseDate(day));
+            analysissubstationpvService.removeByMap(deleteparam);
+            for (Windpowerstation station : CacheContext.stations) {
+                if (!station.getId().equals("HZJ_GDC")) {
                     continue;
                 }
                 Analysismain mainValues = getMainValues(day, station.getId());

+ 4 - 16
src/main/java/cn/gyee/tamplate/task/SaticScheduleTask.java

@@ -62,6 +62,8 @@ public class SaticScheduleTask {
 //        }
 //    }
 
+
+
     /**
      * 风电统计分析
      */
@@ -71,18 +73,10 @@ public class SaticScheduleTask {
     private void analysisTasks() {
         String yesterday = DateUtils.getYesterdayStr("yyyy-MM-dd");
         try {
-//            analysisService.toblebottomtask(yesterday,yesterday);
-//            analysisService.analysiswindprojecttask(yesterday,yesterday);
-//            analysisService.analysispvprojecttask(yesterday,yesterday);
-//            analysisService.analysiswindstationtask(yesterday,yesterday);
-//            analysisService.analysispvstationtask(yesterday,yesterday);
-
             analysisNewService.savaAnalysismain(yesterday, yesterday);
             analysisNewService.saveAnalysisTableBottom(yesterday, yesterday);
             analysisNewService.saveWindProject(yesterday, yesterday);
-//            analysisNewService.savePvProject(yesterday,yesterday);
             analysisNewService.saveWindStation(yesterday, yesterday);
-//            analysisNewService.savePvStation(yesterday,yesterday);
             analysisNewService.saveCompany(yesterday, yesterday);
         } catch (Exception e) {
             e.printStackTrace();
@@ -99,17 +93,11 @@ public class SaticScheduleTask {
 //        String yesterday = DateUtils.getYesterdayStr("yyyy-MM-dd");
         String yesterday = DateUtils.toDate1(DateUtils.today());
         try {
-//            analysisService.toblebottomtask(yesterday,yesterday);
-//            analysisService.analysiswindprojecttask(yesterday,yesterday);
-//            analysisService.analysispvprojecttask(yesterday,yesterday);
-//            analysisService.analysiswindstationtask(yesterday,yesterday);
-//            analysisService.analysispvstationtask(yesterday,yesterday);
-
+            analysisNewService.savaAnalysismain(yesterday, yesterday);
+            analysisNewService.saveAnalysisTableBottom(yesterday, yesterday);
             analysisNewService.savaAnalysisGfmain(yesterday, yesterday);
             analysisNewService.saveAnalysisGfTableBottom(yesterday, yesterday);
-//            analysisNewService.saveWindProject(yesterday,yesterday);
             analysisNewService.savePvProject(yesterday, yesterday);
-//            analysisNewService.saveWindStation(yesterday,yesterday);
             analysisNewService.savePvStation(yesterday, yesterday);
         } catch (Exception e) {
             e.printStackTrace();

+ 12 - 19
src/test/java/cn/gyee/tamplate/AnalysisTest.java

@@ -27,29 +27,22 @@ public class AnalysisTest {
     public void test3() throws  Exception{
 
 
-//       analysisNewService.savaAnalysisGfmain("2021-08-31", "2021-09-18");
-//        analysisNewService.saveAnalysisGfTableBottom("2021-08-31", "2021-09-18");
-        analysisNewService.savePvProject("2021-09-01", "2021-09-26");
-        analysisNewService.savePvStation("2021-09-01", "2021-09-26");
-
-
-              //  analysisNewService.savaAnalysismain("2021-04-25", "2021-04-25");
-//        analysisNewService.saveAnalysisTableBottom("2021-08-31", "2021-09-21");
-//        analysisNewService.saveWindProject("2021-08-31", "2021-09-21");
-//        analysisNewService.saveWindStation("2021-08-31", "2021-09-21");
+//       analysisNewService.savaAnalysisGfmain("2021-04-01", "2021-04-22");
+//        analysisNewService.saveAnalysisGfTableBottom("2021-07-10", "2021-08-02");
+//        analysisNewService.savePvProject("2021-04-01", "2021-04-22");
+//        analysisNewService.savePvStation("2021-04-01", "2021-04-22");
+//        analysisNewService.saveAnalysisTableBottom("2021-10-28", "2021-10-28");
+//        analysisNewService.savePvProject("2021-10-29", "2021-10-29");
+//        analysisNewService.savePvStation("2021-10-29", "2021-10-29");
+        analysisNewService.saveWindStation("2021-10-29", "2021-10-29");
+        //  analysisNewService.savaAnalysismain("2021-04-25", "2021-04-25");
+//        analysisNewService.saveAnalysisTableBottom("2021-07-10", "2021-08-02");
+//        analysisNewService.saveWindProject("2021-10-30", "2021-10-30");
+//        analysisNewService.saveWindStation("2021-04-26", "2021-04-26");
 //        analysisNewService.saveCompany("2021-04-26", "2021-04-26");
 
 
 
     }
 
-    /**
-     * 计算单场
-     * @throws Exception
-     */
-    @Test
-    public void test4() throws  Exception{
-        analysisNewService.saveAnalysisGfTableBottomone("2021-09-01", "2021-09-26","XH_GDC");
-    }
-
 }