Kaynağa Gözat

实际电量取值修改

wangb 2 yıl önce
ebeveyn
işleme
5279231c56

+ 92 - 36
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorService.java

@@ -653,37 +653,59 @@ public class MonitorService {
                     Map<String, Double> valuemap = planmap.get(wp.getId());
                     Map<String, Double> valuemap = planmap.get(wp.getId());
 
 
                     double yfdljh = 0.0;
                     double yfdljh = 0.0;
+                    double rfdlsj = 0.0;
                     double yfdlsj = 0.0;
                     double yfdlsj = 0.0;
                     double nfdljh = 0.0;
                     double nfdljh = 0.0;
                     double nfdlsj = 0.0;
                     double nfdlsj = 0.0;
                     if (valuemap.containsKey("yfdljh")) {
                     if (valuemap.containsKey("yfdljh")) {
                         yfdljh = valuemap.get("yfdljh");
                         yfdljh = valuemap.get("yfdljh");
                     }
                     }
-                    if (valuemap.containsKey("yfdlsj")) {
-                        yfdlsj = valuemap.get("yfdlsj");
-                    }
+//                    if (valuemap.containsKey("yfdlsj")) {
+//                        yfdlsj = valuemap.get("yfdlsj");
+//                    }
                     if (valuemap.containsKey("nfdljh")) {
                     if (valuemap.containsKey("nfdljh")) {
                         nfdljh = valuemap.get("nfdljh");
                         nfdljh = valuemap.get("nfdljh");
                     }
                     }
-                    if (valuemap.containsKey("nfdlsj")) {
-                        nfdlsj = valuemap.get("nfdlsj");
-                    }
+//                    if (valuemap.containsKey("nfdlsj")) {
+//                        nfdlsj = valuemap.get("nfdlsj");
+//                    }
                     if (wp.getId().indexOf("FDC_STA") >= 0) {
                     if (wp.getId().indexOf("FDC_STA") >= 0) {
+                        //日发电量
+                        ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.RFDL);
+                        rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
+                        //月发电量
+                        ProBasicPowerstationPoint yfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.YFDL);
+                        yfdlsj = edosUtil.getRealData(yfdlvalue).getPointValueInDouble();
+                        //年发电量
+                        ProBasicPowerstationPoint nfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.NFDL);
+                        nfdlsj = edosUtil.getRealData(nfdlvalue).getPointValueInDouble();
+
                         fd_r_jhdl = fd_r_jhdl + yfdljh / 30;
                         fd_r_jhdl = fd_r_jhdl + yfdljh / 30;
                         fd_y_jhdl = fd_y_jhdl + yfdljh;
                         fd_y_jhdl = fd_y_jhdl + yfdljh;
                         fd_n_jhdl = fd_n_jhdl + nfdljh;
                         fd_n_jhdl = fd_n_jhdl + nfdljh;
 
 
-                        fd_r_sjdl = fd_r_sjdl + yfdlsj / 30;
+                        fd_r_sjdl = fd_r_sjdl + rfdlsj;
                         fd_y_sjdl = fd_y_sjdl + yfdlsj;
                         fd_y_sjdl = fd_y_sjdl + yfdlsj;
                         fd_n_sjdl = fd_n_sjdl + nfdlsj;
                         fd_n_sjdl = fd_n_sjdl + nfdlsj;
                     } else {
                     } else {
+                        //日发电量
+                        ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.RFDL);
+                        rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
+                        //月发电量
+                        ProBasicPowerstationPoint yfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.YFDL);
+                        yfdlsj = edosUtil.getRealData(yfdlvalue).getPointValueInDouble();
+
+                        //年发电量
+                        ProBasicPowerstationPoint nfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.NFDL);
+                        nfdlsj = edosUtil.getRealData(nfdlvalue).getPointValueInDouble();
+
                         gf_r_jhdl = gf_r_jhdl + yfdljh / 30;
                         gf_r_jhdl = gf_r_jhdl + yfdljh / 30;
                         gf_y_jhdl = gf_y_jhdl + yfdljh;
                         gf_y_jhdl = gf_y_jhdl + yfdljh;
                         gf_n_jhdl = gf_n_jhdl + nfdljh;
                         gf_n_jhdl = gf_n_jhdl + nfdljh;
 
 
-                        gf_r_sjdl = gf_r_sjdl + yfdlsj / 30;
+                        gf_r_sjdl = gf_r_sjdl + rfdlsj;
                         gf_y_sjdl = gf_y_sjdl + yfdlsj;
                         gf_y_sjdl = gf_y_sjdl + yfdlsj;
-                        gf_n_sjdl = gf_n_sjdl + nfdlsj;
+                        gf_n_sjdl = gf_n_sjdl + rfdlsj;
                     }
                     }
                 }
                 }
 
 
@@ -1404,7 +1426,7 @@ public class MonitorService {
         Date oneDate = oneyear.getTime();
         Date oneDate = oneyear.getTime();
 
 
         Calendar currentyear = Calendar.getInstance();
         Calendar currentyear = Calendar.getInstance();
-        currentyear.add(Calendar.YEAR, 1);
+        currentyear.add(Calendar.YEAR,0);
         Date currentDate = currentyear.getTime();
         Date currentDate = currentyear.getTime();
 
 
 //        Calendar threemonth = Calendar.getInstance();
 //        Calendar threemonth = Calendar.getInstance();
@@ -1577,7 +1599,10 @@ public class MonitorService {
                     wplist.add(wp);
                     wplist.add(wp);
                 }
                 }
             }
             }
-
+            Map<String, Map<String, ProBasicPowerstationPoint>> pointwpmap = CacheContext.pointwpmap;
+            Map<String, ProBasicPowerstationPoint> wtpointmap = pointwpmap.get(wpId);
+            String month = wtpointmap.get(ContantXk.YFDL).getNemCode();
+            String rfdl = wtpointmap.get(ContantXk.RFDL).getNemCode();
 
 
             if (timetype.contains("year")) {
             if (timetype.contains("year")) {
                 Calendar cal = Calendar.getInstance();
                 Calendar cal = Calendar.getInstance();
@@ -1586,6 +1611,18 @@ public class MonitorService {
                 int threeyear = cal.get(Calendar.YEAR) - 2;
                 int threeyear = cal.get(Calendar.YEAR) - 2;
 
 
 
 
+                Calendar twoyearsj = Calendar.getInstance();
+                twoyearsj.add(Calendar.YEAR, -2);
+                Date threeDate = twoyearsj.getTime();
+
+                Calendar oneyearsj = Calendar.getInstance();
+                oneyearsj.add(Calendar.YEAR, -1);
+                Date twoDate = oneyearsj.getTime();
+
+                Calendar currentyearsj = Calendar.getInstance();
+                currentyearsj.add(Calendar.YEAR, 0);
+                Date currentDate = currentyearsj.getTime();
+
                 for (int i = 0; i < 3; i++) {
                 for (int i = 0; i < 3; i++) {
                     ProjectplanVo vo = new ProjectplanVo();
                     ProjectplanVo vo = new ProjectplanVo();
                     vo.setJhdl(0.0);
                     vo.setJhdl(0.0);
@@ -1618,13 +1655,25 @@ public class MonitorService {
                         List<ProBasicProjectPlan> threejh = threels.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
                         List<ProBasicProjectPlan> threejh = threels.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
 
 
                         bnjhdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本年计划电量合
                         bnjhdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本年计划电量合
-                        bnsjdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //本年实际电量合
+//                        bnsjdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //本年实际电量合
+
+                        Map<String, ProBasicPowerstationPoint> wtpointmap1 = pointwpmap.get(wpls.getId());
+                        String yearsjdl = wtpointmap1.get(ContantXk.NFDL).getNemCode();
+
+
+                        PointData bnsjdl = edosUtil.getHistMatrix(yearsjdl, currentDate.getTime() / 1000);
+
+                        bnsjdlsum += bnsjdl.getPointValueInDouble();
 
 
                         twojhdlsum += twojh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //去年计划电量合
                         twojhdlsum += twojh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //去年计划电量合
-                        twosjdlsum += twojh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //去年实际电量合
+//                        twosjdlsum += twojh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //去年实际电量合
+                        PointData qnsjdl = edosUtil.getHistMatrix(yearsjdl, twoDate.getTime() / 1000);
+                        twosjdlsum += qnsjdl.getPointValueInDouble();
 
 
                         threejhdlsum += threejh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //前年计划电量合
                         threejhdlsum += threejh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //前年计划电量合
-                        threesjdlsum += threejh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //前年实际电量合
+//                        threesjdlsum += threejh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //前年实际电量合
+                        PointData threensjdl = edosUtil.getHistMatrix(yearsjdl, threeDate.getTime() / 1000);
+                        threesjdlsum += threensjdl.getPointValueInDouble();
                     }
                     }
 
 
                     vos.get(0).setJhdl(StringUtils.round(bnjhdlsum, 2));
                     vos.get(0).setJhdl(StringUtils.round(bnjhdlsum, 2));
@@ -1643,21 +1692,25 @@ public class MonitorService {
                 if (!wplist.isEmpty()) {
                 if (!wplist.isEmpty()) {
                     int day = 0;
                     int day = 0;
                     int month2 = DateUtils.getMonth(new Date());//4
                     int month2 = DateUtils.getMonth(new Date());//4
+                    DateUtils.getMonthLast(new Date());
+                    Date date = DateUtils.getCurrentDate();
+
                     for (int i = month2; i > 0; i--) {
                     for (int i = month2; i > 0; i--) {
                         double bnjhdlsum = 0.0;
                         double bnjhdlsum = 0.0;
-                        double bnsjdlsum = 0.0;
                         day = i;
                         day = i;
                         for (ProBasicPowerstation wpls : wplist) {
                         for (ProBasicPowerstation wpls : wplist) {
                             List<ProBasicProjectPlan> currentls = proBasicProjectPlanService.getmonthList(String.valueOf(day)); //本月所有集合
                             List<ProBasicProjectPlan> currentls = proBasicProjectPlanService.getmonthList(String.valueOf(day)); //本月所有集合
                             //本年所有集合
                             //本年所有集合
                             List<ProBasicProjectPlan> currentjh = currentls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
                             List<ProBasicProjectPlan> currentjh = currentls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
                             bnjhdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本月计划电量合
                             bnjhdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本月计划电量合
-                            bnsjdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //本月实际电量合
                         }
                         }
                         ProjectplanVo vo = new ProjectplanVo();
                         ProjectplanVo vo = new ProjectplanVo();
                         vo.setJhdl(StringUtils.round(bnjhdlsum, 2));
                         vo.setJhdl(StringUtils.round(bnjhdlsum, 2));
-                        vo.setSjdl(StringUtils.round(bnsjdlsum, 2));
                         vo.setHours(i);
                         vo.setHours(i);
+
+                        PointData data = edosUtil.getSectionData(month, DateUtils.getEndOfDay(DateUtils.getMonthLast(date)).getTime());
+                        vo.setSjdl(DoubleUtils.keepPrecision(data.getPointValueInDouble(), 2));
+                        date = DateUtils.addMonths(date, -1);
                         vos.add(vo);
                         vos.add(vo);
                         SortUtils.sort(vos, "hours", SortUtils.ASC);
                         SortUtils.sort(vos, "hours", SortUtils.ASC);
                     }
                     }
@@ -1667,28 +1720,31 @@ public class MonitorService {
                 if (!wplist.isEmpty()) {
                 if (!wplist.isEmpty()) {
                     int day = 0;
                     int day = 0;
                     Calendar cal = Calendar.getInstance();
                     Calendar cal = Calendar.getInstance();
-                    int dom = cal.get(Calendar.DAY_OF_MONTH);//26
-                    int month2 = DateUtils.getMonth(new Date());//4
+                    int dom = cal.get(Calendar.DAY_OF_MONTH);
+                    int month2 = DateUtils.getMonth(new Date());
 
 
+                    Date date = DateUtils.getCurrentDate(); //当前时间
 
 
+                    double byjhdlsum = 0.0;
+                    double bysjdlsum = 0.0;
+                    for (ProBasicPowerstation wpls : wplist) {
+                        List<ProBasicProjectPlan> currentls = proBasicProjectPlanService.getmonthList(String.valueOf(month2)); //本月所有集合
+                        //本年所有集合
+                        List<ProBasicProjectPlan> currentjh = currentls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
+                        byjhdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本月计划电量合
+                        bysjdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //本月实际电量合
+                    }
+                    for (int i = dom; i>0;i--) {
+                        ProjectplanVo vo = new ProjectplanVo();
+                        vo.setJhdl(StringUtils.round(byjhdlsum / 30, 2));
+                        PointData data = edosUtil.getSectionData(rfdl, DateUtils.getEndOfDay(date).getTime());
+                        vo.setSjdl(DoubleUtils.keepPrecision(data.getPointValueInDouble(), 2));
+                        date = DateUtils.addDays(date, -1);
 
 
-                        double byjhdlsum = 0.0;
-                        double bysjdlsum = 0.0;
-                        for (ProBasicPowerstation wpls : wplist) {
-                            List<ProBasicProjectPlan> currentls = proBasicProjectPlanService.getmonthList(String.valueOf(month2)); //本月所有集合
-                            //本年所有集合
-                            List<ProBasicProjectPlan> currentjh = currentls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
-                            byjhdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本月计划电量合
-                            bysjdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //本月实际电量合
-                        }
-                            for (int i = dom; i>0;i--) {
-                            ProjectplanVo vo = new ProjectplanVo();
-                            vo.setJhdl(StringUtils.round(byjhdlsum / 30, 2));
-                            vo.setSjdl(StringUtils.round(bysjdlsum / 30, 2));
-                            vo.setHours(i);
-                            vos.add(vo);
-                            SortUtils.sort(vos, "hours", SortUtils.ASC);
-                        }
+                        vo.setHours(i);
+                        vos.add(vo);
+                        SortUtils.sort(vos, "hours", SortUtils.ASC);
+                    }
 
 
                 }
                 }
             }
             }