Procházet zdrojové kódy

计划电量功能取数调整

wangb před 2 roky
rodič
revize
b4b67d517f

+ 10 - 0
web/consumer-hb/src/main/java/com/gyee/consumer/controller/monitor/GenreSetPushController.java

@@ -255,4 +255,14 @@ public class GenreSetPushController {
         return ajax;
     }
 
+    @GetMapping(value = "/getprojectplan")
+    @ApiOperation(value = "24小时功率曲线", notes = "24小时功率曲线")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpid", value = "场站编号", required = true, dataType = "string", paramType = "query")})
+    @ResponseBody
+    public AjaxResult getprojectplan(@RequestParam("wpid") String wpid) throws Exception {
+        AjaxResult ajax= genreSetPushService.plan(wpid);
+        return ajax;
+    }
+
 }

+ 5 - 0
web/consumer-hb/src/main/java/com/gyee/consumer/fallback/monitor/GenreSetPushServiceFallbackFactory.java

@@ -79,6 +79,11 @@ public class GenreSetPushServiceFallbackFactory implements FallbackFactory<Genre
             }
 
             @Override
+            public AjaxResult plan(String wpid) throws Exception {
+                return AjaxResult.error(throwable.getMessage());
+            }
+
+            @Override
             public AjaxResult findBasicDataInfo_fcmap(@RequestParam("id") String id) throws Exception{
                 return  AjaxResult.error(throwable.getMessage());
             }

+ 3 - 0
web/consumer-hb/src/main/java/com/gyee/consumer/service/monitor/GenreSetPushService.java

@@ -72,4 +72,7 @@ public interface GenreSetPushService {
 
     @GetMapping("/genreset/Powercurve24")
     public AjaxResult  Powercurve24(@RequestParam("wpId")String wpId) throws Exception;
+
+    @GetMapping("/genreset/getprojectplan")
+    public AjaxResult  plan(@RequestParam("wpid")String wpid) throws Exception;
 }

+ 3 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/common/spring/InitialRunner.java

@@ -105,6 +105,7 @@ public class InitialRunner implements CommandLineRunner {
     public static List<LinePG> linepgallls = new ArrayList<LinePG>(); // 线路LIST集合(包含光电电)
     public static List<Windturbine> wtallls = new ArrayList<Windturbine>(); // 风电机LIST集合(包含光电电)
     public static List<WindturbinePG> wtpgallls = new ArrayList<WindturbinePG>(); // 风电机LIST集合(包含光电电)
+    public static List<ProjectPlan> plans = new ArrayList<ProjectPlan>();
 
     public static List<Windpowerstation> wpls = new ArrayList<Windpowerstation>(); // 风电场LIST集合
     public static List<Windpowerstation> spls = new ArrayList<Windpowerstation>(); // 光伏场LIST集合
@@ -134,6 +135,7 @@ public class InitialRunner implements CommandLineRunner {
     public static Map<String, List<LinePG>> pjlnpgmap = new HashMap<String, List<LinePG>>(); // 线路(包含光电电)
     public static Map<String, Windturbine> wtmap = new HashMap<String, Windturbine>();//风机(包含光电电)
     public static Map<String, WindturbinePG> wtpgmap = new HashMap<String, WindturbinePG>();//风机(包含光电电)
+    public static Map<String, ProjectPlan> planMap = new HashMap<String, ProjectPlan>();
 
     public static Map<String, Stoptype> stoptypemap = new HashMap<String, Stoptype>();//停机类型
     public static List<Warning2> warnls = new ArrayList<Warning2>(); // 报警LIST集合
@@ -172,6 +174,7 @@ public class InitialRunner implements CommandLineRunner {
     public static Map<String, Map<String, Object>> appendYcglMap = new HashMap<String, Map<String, Object>>();// 预测功率追加
 
     public static Map<String, List<Windpowerstation>> wpmapls = new HashMap<String, List<Windpowerstation>>();
+    public static Map<String, List<ProjectPlan>> plmals = new HashMap<String, List<ProjectPlan>>();
 
     /***********************************************光伏初始化*************************************************************/
     public static Map<String,Square> sqmap = new HashMap<String, Square>();

+ 18 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/monitor/GenreSetPushController.java

@@ -593,4 +593,22 @@ public class GenreSetPushController {
         }
 
     }
+
+    @GetMapping("/getprojectplan")
+    @ResponseBody
+    @ApiOperation(value = "计划电量", notes = "计划电量")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpid", value = "场站编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult getprojectplan(String wpid) throws Exception {
+
+        Map m = genreSetPushService.plan(wpid);
+
+        if (null != m) {
+            return AjaxResult.successData(AjaxStatus.success.code, m);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, m);
+        }
+
+    }
 }

+ 3 - 3
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/auto/ProjectPlan.java

@@ -37,7 +37,7 @@ public class ProjectPlan implements Serializable {
      *
      * @mbg.generated
      */
-    private Double outagehours;
+    private String outagehours;
 
     /**
      *
@@ -154,7 +154,7 @@ public class ProjectPlan implements Serializable {
      *
      * @mbg.generated
      */
-    public Double getOutagehours() {
+    public String getOutagehours() {
         return outagehours;
     }
 
@@ -166,7 +166,7 @@ public class ProjectPlan implements Serializable {
      *
      * @mbg.generated
      */
-    public void setOutagehours(Double outagehours) {
+    public void setOutagehours(String outagehours) {
         this.outagehours = outagehours;
     }
 

+ 3 - 3
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/ProjectPlanVo.java

@@ -4,7 +4,7 @@ public class ProjectPlanVo {
 	private String id;
 	private String projectid;
 	private String generatingcapacity;
-	private Double outagehours;
+	private String outagehours;
 	private String year;
 	private String month;
 	private String windpower;
@@ -40,10 +40,10 @@ public class ProjectPlanVo {
 	public void setGeneratingcapacity(String generatingcapacity) {
 		this.generatingcapacity = generatingcapacity;
 	}
-	public Double getOutagehours() {
+	public String getOutagehours() {
 		return outagehours;
 	}
-	public void setOutagehours(Double outagehours) {
+	public void setOutagehours(String outagehours) {
 		this.outagehours = outagehours;
 	}
 	public String getYear() {

+ 114 - 14
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/GenreSetPushService.java

@@ -21,6 +21,7 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class GenreSetPushService {
@@ -1725,16 +1726,16 @@ public class GenreSetPushService {
 
             Map<String, Object> fcmap = new HashMap<>();
 
-            if (id.endsWith(QS) || id.endsWith(FD) || id.endsWith(GF) || InitialRunner.re_wpmap.containsKey(id)) {
+            if (id.endsWith(QS) || id.endsWith(FD) || id.endsWith(GF) || InitialRunner.re_wpmap.containsKey(id) || InitialRunner.wpmapls.containsKey(id)) {
 
 
                 //初始化场站信息
 
                 List<Windpowerstation> wplist = new ArrayList<>();
-//
-//                if (InitialRunner.wpmapls.containsKey(id)) {
-//                    wplist = InitialRunner.wpmapls.get(id);
-//                }
+
+                if (InitialRunner.wpmapls.containsKey(id)) {
+                    wplist = InitialRunner.wpmapls.get(id);
+                }
 
                 if (InitialRunner.re_wpmap.containsKey(id)) {
                     wplist = InitialRunner.re_wpmap.get(id);
@@ -1794,6 +1795,11 @@ public class GenreSetPushService {
                 double gf_y_jhfdl = 0;
                 double gf_n_jhfdl = 0;
 
+                double fd_y_sjfdl = 0;
+                double fd_n_sjfdl = 0;
+                double gf_y_sjfdl = 0;
+                double gf_n_sjfdl = 0;
+
                 double jr_fd_sjgl = 0;
                 double jr_gf_sjgl = 0;
                 double jr_fd_zygl = 0;
@@ -1907,45 +1913,62 @@ public class GenreSetPushService {
                                 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().endsWith("FDC")) {
-                                    fd_r_ycdl = fd_r_ycdl + (rfdl * RYCFDLXS);
+//                                    fd_r_ycdl = fd_r_ycdl + (rfdl * RYCFDLXS);
+                                    fd_r_ycdl = fd_r_ycdl + (yfdljh / 30);
 //                                    fd_r_fdl =fd_r_fdl+rfdl;
 
-                                    double yycfdl = yfdljh * YCFDLXS;
+//                                    double yycfdl = yfdljh * YCFDLXS;
+                                    double yycfdl = yfdljh;
                                     fd_y_ycdl = fd_y_ycdl + yycfdl;
 //                                    fd_y_fdl=fd_y_fdl+yfdl;
-                                    double nycfdl = nfdljh * NYCFDLXS;
+//                                    double nycfdl = nfdljh * NYCFDLXS;
+                                    double nycfdl = nfdljh;
                                     fd_n_ycdl = fd_n_ycdl + nycfdl;
 //                                    fd_n_fdl=fd_n_fdl+nfdl;
 
                                     fd_y_jhfdl = fd_y_jhfdl + yfdljh;
                                     fd_n_jhfdl = fd_n_jhfdl + nfdljh;
 
-
+                                    fd_y_sjfdl = fd_y_sjfdl + yfdlsj;
+                                    fd_n_sjfdl = fd_n_sjfdl + nfdlsj;
 //                                    jr_fd_sjgl=jr_fd_sjgl+sjgl;
 //                                    jr_fd_zygl=jr_fd_zygl+zygl;
                                 } else {
                                     gf_r_ycdl = gf_r_ycdl + (rfdl * RYCFDLXS);
 //                                    gf_r_fdl =gf_r_fdl+rfdl ;
 
-                                    double yycfdl = yfdljh * YCFDLXS;
+//                                    double yycfdl = yfdljh * YCFDLXS;
+                                    double yycfdl = yfdljh;
+
                                     gf_y_ycdl = gf_y_ycdl + yycfdl;
 //                                    gf_y_fdl=gf_y_fdl+yfdl;
-                                    double nycfdl = nfdljh * NYCFDLXS;
+//                                    double nycfdl = nfdljh * NYCFDLXS;
+                                    double nycfdl = nfdljh;
                                     gf_n_ycdl = gf_n_ycdl + nycfdl;
 //                                    gf_n_fdl=gf_n_fdl+nfdl;
 
                                     gf_y_jhfdl = fd_y_jhfdl + yfdljh;
                                     gf_n_jhfdl = fd_n_jhfdl + nfdljh;
 
+                                    gf_y_sjfdl = fd_y_sjfdl + yfdlsj;
+                                    gf_n_sjfdl = fd_n_sjfdl + nfdlsj;
 
 //                                    jr_gf_sjgl=jr_gf_sjgl+sjgl;
 //                                    jr_gf_zygl=jr_gf_zygl+zygl;
@@ -2116,6 +2139,16 @@ public class GenreSetPushService {
                 newpointmap.put("gf_y_jhfdl", StringUtils.round(gf_y_jhfdl, 2));
                 //光伏年计划发电量
                 newpointmap.put("gf_n_jhfdl", StringUtils.round(gf_n_jhfdl, 2));
+
+                //风场月计划发电量
+                newpointmap.put("fd_y_sjfdl", StringUtils.round(fd_y_sjfdl, 2));
+                //风场年计划发电量
+                newpointmap.put("fd_n_sjfdl", StringUtils.round(fd_n_sjfdl, 2));
+                //光伏月计划发电量
+                newpointmap.put("gf_y_sjfdl", StringUtils.round(gf_y_sjfdl, 2));
+                //光伏年计划发电量
+                newpointmap.put("gf_n_sjfdl", StringUtils.round(gf_n_sjfdl, 2));
+
                 //光伏负荷率
                 newpointmap.put("gf_fhl", StringUtils.round(jr_gf_sjgl, 2));
 
@@ -2288,7 +2321,8 @@ public class GenreSetPushService {
                 }
 
 
-            } else if (InitialRunner.wpmap.containsKey(id)) {
+            }
+//            else if (InitialRunner.wpmap.containsKey(id)) {
 
                 if (InitialRunner.pjsmap.containsKey(id)) {
                     List<Project> pjls = InitialRunner.pjsmap.get(id);
@@ -2352,7 +2386,8 @@ public class GenreSetPushService {
                         }
                     }
                 }
-            } else if (InitialRunner.pjmap.containsKey(id)) {
+//            }
+            else if (InitialRunner.pjmap.containsKey(id)) {
                 Project pj = InitialRunner.pjmap.get(id);
                 if (InitialRunner.lnsmap.containsKey(id)) {
                     List<Line> lnls = InitialRunner.lnsmap.get(id);
@@ -4122,7 +4157,9 @@ public class GenreSetPushService {
     private void setPlanInfoByType(Map<String, Map<String, Double>> gxkmap, List<ProjectPlan> planls, String id) {
 
         double yfdljh = 0.0;
+        double yfdlsj = 0.0;
         double nfdljh = 0.0;
+        double nfdlsj = 0.0;
 
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
@@ -4134,6 +4171,8 @@ public class GenreSetPushService {
 
             double fdl = null != plan.getGeneratingcapacity() ? Double.valueOf(plan.getGeneratingcapacity()) : 0.0;
 
+            double sjfdl = null != plan.getOutagehours() ? Double.valueOf(plan.getOutagehours()) : 0.0;
+
 
             if (gxkmap.containsKey(plan.getWindpower())) {
 
@@ -4143,13 +4182,22 @@ public class GenreSetPushService {
                     if (planmonth == month) {
 
                         yfdljh = map.get("yfdljh");
+                        yfdlsj = map.get("yfdlsj");
+
                         yfdljh = yfdljh + fdl;
+                        yfdlsj = yfdlsj + sjfdl;
+
                         map.put("yfdljh", yfdljh);
+                        map.put("yfdlsj", yfdlsj);
                     }
 
                     nfdljh = map.get("nfdljh");
-                    nfdljh = nfdljh + fdl;
+                    nfdlsj = map.get("nfdlsj");
+                    nfdlsj = nfdlsj + sjfdl;
+                    nfdljh = nfdljh + Double.parseDouble(plan.getGeneratingcapacity());
+//                    nfdlsj = nfdlsj + Double.parseDouble(plan.getOutagehours());
                     map.put("nfdljh", nfdljh);
+                    map.put("nfdlsj", nfdlsj);
 
                 }
             } else {
@@ -4160,10 +4208,14 @@ public class GenreSetPushService {
                     if (planmonth == month) {
 
                         map.put("yfdljh", fdl);
+                        map.put("yfdlsj", sjfdl);
                         map.put("nfdljh", 0.00);
+                        map.put("nfdlsj", 0.00);
                     } else {
                         map.put("nfdljh", fdl);
+                        map.put("nfdlsj", sjfdl);
                         map.put("yfdljh", 0.00);
+                        map.put("yfdlsj", 0.00);
                     }
 
 
@@ -4494,7 +4546,55 @@ public class GenreSetPushService {
         return vos;
         }
 
+    public Map plan(String wpid) {
+
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(new Date());
+        int year = cal.get(Calendar.YEAR);
+        int month = cal.get(Calendar.MONTH) + 1;
+
+        List<ProjectPlan> pjls = projectPlanService.getProjectPlanList(String.valueOf(year));
+
+        // 获取计划发电量信息
+        Map<String, Map<String, Double>> planmap = new HashMap<>();
+        Map<String,Double> jhdljh = new HashMap<>();
+        setPlanInfoByType(planmap, pjls, wpid);
+
+        List<ProjectPlan> collect = pjls.stream().filter(plan -> plan.getWindpower().equals(wpid) && plan.getYear()
+                .endsWith(String.valueOf(year))).collect(Collectors.toList());
+        List<ProjectPlan> collect1 = pjls.stream().filter(plan -> plan.getWindpower().equals(wpid) && plan.getMonth()
+                .endsWith(String.valueOf(month))).collect(Collectors.toList());
+
+        double yjhdl = 0;
+        double njhdl = 0;
+        double ysjdl = 0;
+        double nsjdl = 0;
 
+        for (ProjectPlan plan:collect
+        ) {
+            njhdl+=Double.parseDouble(plan.getGeneratingcapacity());
+        }
+        for (ProjectPlan plan:collect1
+             ) {
+            yjhdl+=Double.parseDouble(plan.getGeneratingcapacity());
+        }
+        for (ProjectPlan plan:collect
+        ) {
+            nsjdl+=Double.parseDouble(plan.getOutagehours());
+        }
+        for (ProjectPlan plan:collect1
+        ) {
+            ysjdl+=Double.parseDouble(plan.getOutagehours());
+        }
+
+
+        jhdljh.put("rjhdl",MathUtil.twoBit(yjhdl/30));
+        jhdljh.put("yjhdl",MathUtil.twoBit(yjhdl));
+        jhdljh.put("njhdl",MathUtil.twoBit(njhdl));
+        jhdljh.put("ysjdl",MathUtil.twoBit(ysjdl));
+        jhdljh.put("nsjdl",MathUtil.twoBit(nsjdl));
+        return jhdljh;
+    }
 }