Browse Source

增加年计划电量

wangb 2 years atrás
parent
commit
8638305a5e

+ 3 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/monitor/MonitorController.java

@@ -2,6 +2,8 @@ package com.gyee.runeconomy.controller.monitor;
 
 import com.gyee.runeconomy.dto.AjaxResult;
 import com.gyee.runeconomy.dto.PowercurveVo;
+import com.gyee.runeconomy.dto.ProjectplanVo;
+import com.gyee.runeconomy.model.auto.ProBasicProjectPlan;
 import com.gyee.runeconomy.service.monitor.MonitorService;
 import com.gyee.runeconomy.util.StringUtils;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
@@ -124,7 +126,7 @@ public class MonitorController {
     })
     public AjaxResult Planproject(String wpId,String timetype) throws Exception {
 
-        List<PowercurveVo> resultList = new ArrayList<>();
+        List<ProjectplanVo> resultList = new ArrayList<>();
         if (StringUtils.notEmp(wpId)) {
             resultList = monitorService.planvalue(wpId,timetype);
         }

+ 34 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/ProjectplanVo.java

@@ -0,0 +1,34 @@
+package com.gyee.runeconomy.dto;
+
+public class ProjectplanVo {
+    private Double jhdl;
+
+    private Double sjdl;
+
+    private Integer hours;
+
+
+    public Double getJhdl() {
+        return jhdl;
+    }
+
+    public void setJhdl(Double jhdl) {
+        this.jhdl = jhdl;
+    }
+
+    public Double getSjdl() {
+        return sjdl;
+    }
+
+    public void setSjdl(Double sjdl) {
+        this.sjdl = sjdl;
+    }
+
+    public Integer getHours() {
+        return hours;
+    }
+
+    public void setHours(Integer hours) {
+        this.hours = hours;
+    }
+}

+ 86 - 64
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorService.java

@@ -7,6 +7,7 @@ import com.gyee.common.util.DateUtils;
 import com.gyee.common.util.DoubleUtils;
 import com.gyee.common.util.SortUtils;
 import com.gyee.runeconomy.dto.PowercurveVo;
+import com.gyee.runeconomy.dto.ProjectplanVo;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.IProBasicEquipmentPointService;
@@ -1448,21 +1449,6 @@ public class MonitorService {
             zjrlmap.put("zjrl", zjrl);
 
 
-//            for (int i = 0; i < 3; i++) {
-//                PowercurveVo vo = new PowercurveVo();
-//                vo.setLlgl(0.0); //理论功率
-//                vo.setRfdl(0.0); //日发电量
-//                vo.setYfdl(0.0); //月发电量
-//                vo.setNfdl(0.0); //年发电量
-//                vo.setBzgl(0.0); //保证功率
-//                vo.setSjgl(0.0); //实际功率
-//                vo.setSsfs(0.0); //实时风速
-//                vo.setGzzs(0.0); //光照指数
-//                vo.setFnlyl(0.0); //风能利用率
-//                vo.setHours(0);  //时间戳
-//                vo.setName(wpId);
-//                vos.add(vo);    }
-//
             Map<String, Map<String, ProBasicPowerstationPoint>> pointwpmap = CacheContext.pointwpmap;
             Map<String, ProBasicPowerstationPoint> wtpointmap = pointwpmap.get(wpId);
 
@@ -1567,58 +1553,94 @@ public class MonitorService {
     }
 
 
+
+
+
     //计划电量
-    public List<PowercurveVo> planvalue(String wpId, String timetype) throws Exception {
+    public List<ProjectplanVo> planvalue(String wpId, String timetype) throws Exception {
 
-//        List<ProBasicProjectPlan> pjls = proBasicProjectPlanService.getList(String.valueOf(year));
-//
-//        // 获取计划发电量信息
-//        Map<String, Map<String, Double>> planmap = new HashMap<>();
-//
-//        setPlanInfoByType(planmap, pjls, wpId);
-//
-//        for (ProBasicPowerstation wp : wplist) {
-//            if (planmap.containsKey(wp.getId())) {
-//                Map<String, Double> valuemap = planmap.get(wp.getId());
-//
-//                double yfdljh = 0.0;
-//                double yfdlsj = 0.0;
-//                double nfdljh = 0.0;
-//                double nfdlsj = 0.0;
-//                if (valuemap.containsKey("yfdljh")) {
-//                    yfdljh = valuemap.get("yfdljh");
-//                }
-//                if (valuemap.containsKey("yfdlsj")) {
-//                    yfdlsj = valuemap.get("yfdlsj");
-//                }
-//                if (valuemap.containsKey("nfdljh")) {
-//                    nfdljh = valuemap.get("nfdljh");
-//                }
-//                if (valuemap.containsKey("nfdlsj")) {
-//                    nfdlsj = valuemap.get("nfdlsj");
-//                }
-//                if (wp.getId().indexOf("FDC_STA") >= 0) {
-//                    fd_r_jhdl = fd_r_jhdl + yfdljh / 30;
-//                    fd_y_jhdl = fd_y_jhdl + yfdljh;
-//                    fd_n_jhdl = fd_n_jhdl + nfdljh;
-//
-//                    fd_r_sjdl = fd_r_sjdl + yfdlsj / 30;
-//                    fd_y_sjdl = fd_y_sjdl + yfdlsj;
-//                    fd_n_sjdl = fd_n_sjdl + nfdlsj;
-//                } else {
-//                    gf_r_jhdl = gf_r_jhdl + yfdljh / 30;
-//                    gf_y_jhdl = gf_y_jhdl + yfdljh;
-//                    gf_n_jhdl = gf_n_jhdl + nfdljh;
-//
-//                    gf_r_sjdl = gf_r_sjdl + yfdlsj / 30;
-//                    gf_y_sjdl = gf_y_sjdl + yfdlsj;
-//                    gf_n_sjdl = gf_n_sjdl + nfdlsj;
-//                }
-//            }
-//
-//        }
+        List<ProjectplanVo> vos = new ArrayList<ProjectplanVo>();
+        if (wpId.endsWith(QS) || wpId.endsWith(FD) || wpId.endsWith(GF) || CacheContext.wpmapls.containsKey(wpId)) {
 
-        return null;
+            List<ProBasicPowerstation> wplist = new ArrayList<>();
+            if (CacheContext.wpmapls.containsKey(wpId)) {
+                wplist = CacheContext.wpmapls.get(wpId);
+            }
+            for (ProBasicPowerstation wp : CacheContext.wpls) {
+                if (wpId.contains(FD)) {
+                    if (wp.getId().endsWith("FDC_STA")) {
+                        wplist.add(wp);
+                    }
+                } else if (wpId.contains(GF)) {
+                    if (wp.getId().endsWith("GDC_STA")) {
+                        wplist.add(wp);
+                    }
+                } else if (wpId.contains(QS)) {
+                    wplist.add(wp);
+                }
+            }
+
+
+            if (timetype.contains("year")) {
+                Calendar cal = Calendar.getInstance();
+                int currentyear = cal.get(Calendar.YEAR);
+                int twoyear = cal.get(Calendar.YEAR) - 1; //2021
+                int threeyear = cal.get(Calendar.YEAR) - 2;
+
+
+                for (int i = 0; i < 3; i++) {
+                    ProjectplanVo vo = new ProjectplanVo();
+                    vo.setJhdl(0.0);
+                    vo.setSjdl(0.0);
+                    vo.setHours(i);
+                    vos.add(vo);
+                }
+
+                double bnjhdlsum = 0.0;
+                double bnsjdlsum = 0.0;
+
+                double twojhdlsum = 0.0;
+                double twosjdlsum = 0.0;
+
+                double threejhdlsum = 0.0;
+                double threesjdlsum = 0.0;
+
+                List<ProBasicProjectPlan> currentls = proBasicProjectPlanService.getList(String.valueOf(currentyear)); //本年所有集合
+                List<ProBasicProjectPlan> twols = proBasicProjectPlanService.getList(String.valueOf(twoyear));
+                List<ProBasicProjectPlan> threels = proBasicProjectPlanService.getList(String.valueOf(threeyear));
+
+                if (!wplist.isEmpty()) {
+                    for (ProBasicPowerstation wpls : wplist) {
+
+                        //本年所有集合
+                        List<ProBasicProjectPlan> currentjh = currentls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
+                        //去年所有集合
+                        List<ProBasicProjectPlan> twojh = twols.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(); //本年计划电量合
+                        bnsjdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //本年实际电量合
+
+                        twojhdlsum += twojh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //去年计划电量合
+                        twosjdlsum += twojh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //去年实际电量合
+
+                        threejhdlsum += threejh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //前年计划电量合
+                        threesjdlsum += threejh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //前年实际电量合
+                    }
+
+                    vos.get(0).setJhdl(StringUtils.round(bnjhdlsum, 2));
+                    vos.get(1).setJhdl(StringUtils.round(twojhdlsum, 2));
+                    vos.get(2).setJhdl(StringUtils.round(threejhdlsum, 2));
+
+                    vos.get(0).setSjdl(StringUtils.round(bnsjdlsum, 2));
+                    vos.get(1).setSjdl(StringUtils.round(twosjdlsum, 2));
+                    vos.get(2).setSjdl(StringUtils.round(threesjdlsum, 2));
+
+                }
+            }
+        }
+        return vos;
 
     }