Browse Source

增加24小时功率曲线

wangb 2 years atrás
parent
commit
93ebedc682

+ 24 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/monitor/MonitorController.java

@@ -1,7 +1,9 @@
 package com.gyee.runeconomy.controller.monitor;
 
 import com.gyee.runeconomy.dto.AjaxResult;
+import com.gyee.runeconomy.dto.PowercurveVo;
 import com.gyee.runeconomy.service.monitor.MonitorService;
+import com.gyee.runeconomy.util.StringUtils;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -12,7 +14,9 @@ import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -47,4 +51,24 @@ public class MonitorController {
 
     }
 
+    @GetMapping("/Powercurve24")
+    @ResponseBody
+    @ApiOperation(value = "24小时功率曲线", notes = "24小时功率曲线")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "场站编号", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult Powercurve24(String wpId) throws Exception {
+
+        List<PowercurveVo> resultList = new ArrayList<>();
+        if (StringUtils.notEmp(wpId)) {
+            resultList = monitorService.Powercurve24(wpId);
+        }
+
+        if (null != resultList) {
+            return AjaxResult.successData(200, resultList);
+        } else {
+            return AjaxResult.error(500, "操作失败");
+        }
+
+    }
+
 }

+ 65 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/PowercurveVo.java

@@ -0,0 +1,65 @@
+package com.gyee.runeconomy.dto;
+
+public class PowercurveVo {
+    private Double bzgl;
+
+    private Double sjgl;
+
+    private Double ssfs;
+
+    private Double llgl;
+
+    public Double getBzgl() {
+        return bzgl;
+    }
+
+    public void setBzgl(Double bzgl) {
+        this.bzgl = bzgl;
+    }
+
+    public Double getSjgl() {
+        return sjgl;
+    }
+
+    public void setSjgl(Double sjgl) {
+        this.sjgl = sjgl;
+    }
+
+    public Double getSsfs() {
+        return ssfs;
+    }
+
+    public void setSsfs(Double ssfs) {
+        this.ssfs = ssfs;
+    }
+
+    public Double getLlgl() {
+        return llgl;
+    }
+
+    public void setLlgl(Double llgl) {
+        this.llgl = llgl;
+    }
+
+    public Integer getHours() {
+        return hours;
+    }
+
+    public void setHours(Integer hours) {
+        this.hours = hours;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    private Integer hours;
+
+    private String name;
+
+
+}

+ 84 - 10
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorService.java

@@ -3,6 +3,7 @@ package com.gyee.runeconomy.service.monitor;
 
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
+import com.gyee.runeconomy.dto.PowercurveVo;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.IProBasicEquipmentPointService;
@@ -16,6 +17,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -319,6 +321,7 @@ public class MonitorService {
             double llgl = 0.0;
             double ssfs = 0.0;
             double gzzs = 0.0;
+            double fnlyl = 0.0;
             double yfdl = 0.0;
             double nfdl = 0.0;
             double jys = 0.0;
@@ -384,6 +387,10 @@ public class MonitorService {
                 ProBasicPowerstationPoint gzzsvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RPJGZD);
                 gzzs = edosUtil.getRealData(gzzsvalue).getPointValueInDouble();
 
+                //风能利用率
+                ProBasicPowerstationPoint fnlylvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.FNLYL);
+                fnlyl = edosUtil.getRealData(fnlylvalue).getPointValueInDouble();
+
                 //理论功率
                 ProBasicPowerstationPoint llglvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZLLGL);
                 llgl = edosUtil.getRealData(llglvalue).getPointValueInDouble();
@@ -406,7 +413,7 @@ public class MonitorService {
 
 
                 for (ProBasicPowerstation wp : wplist) {
-                    if (wp.getId().contains("F")) {
+                    if (wp.getSpare4().equals("1")) {
                         //实时功率
                         ProBasicPowerstationPoint fdglvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZGL);
                         fdsjgl += edosUtil.getRealData(fdglvalue).getPointValueInDouble();
@@ -426,16 +433,16 @@ public class MonitorService {
                 ProBasicPowerstationPoint sjglvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZGL);
                 sjgl = edosUtil.getRealData(sjglvalue).getPointValueInDouble();
 
+                //实时风速
+                ProBasicPowerstationPoint ssfsvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSPJFS);
+                ssfs = edosUtil.getRealData(ssfsvalue).getPointValueInDouble();
 
-                if (wpId.contains("F")) {
-                    //实时风速
-                    ProBasicPowerstationPoint ssfsvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSPJFS);
-                    ssfs = edosUtil.getRealData(ssfsvalue).getPointValueInDouble();
-                } else if (wpId.contains("G")) {
-                    //光照指数
-                    ProBasicPowerstationPoint gzzsvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RPJGZD);
-                    gzzs = edosUtil.getRealData(gzzsvalue).getPointValueInDouble();
-                }
+                //光照指数
+                ProBasicPowerstationPoint gzzsvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RPJGZD);
+                gzzs = edosUtil.getRealData(gzzsvalue).getPointValueInDouble();
+                //风能利用率
+                ProBasicPowerstationPoint fnlylvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.FNLYL);
+                fnlyl = edosUtil.getRealData(fnlylvalue).getPointValueInDouble();
 
                 //月发电量
                 ProBasicPowerstationPoint yfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.YFDL);
@@ -473,6 +480,7 @@ public class MonitorService {
             qt.put("nfdl", MathUtil.twoBit(nfdl));
             qt.put("llgl", MathUtil.twoBit(llgl));
             qt.put("gzzs", MathUtil.twoBit(gzzs));
+            qt.put("fnlyl", MathUtil.twoBit(fnlyl));
             qt.put("ssfs", MathUtil.twoBit(ssfs));
             qt.put("jys", MathUtil.twoBit(jys));
             qt.put("jym", MathUtil.twoBit(jym));
@@ -1032,6 +1040,72 @@ public class MonitorService {
     }
 
 
+    //24小时功率曲线
+    public List<PowercurveVo> Powercurve24(String wpId) throws Exception {
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        Date beginDate = com.gyee.common.util.DateUtils.getSamedayZero();   //当日零点
+        Date endDate = com.gyee.common.util.DateUtils.getCurrentDate();   //当前时间
+        List<PowercurveVo> vos = new ArrayList<PowercurveVo>();
+
+//        //初始化场站信息
+//        List<ProBasicPowerstation> wplist = new ArrayList<>();
+//        List<ProBasicProject> projects = new ArrayList<>();
+//        List<ProBasicLine> lines = new ArrayList<>();
+//
+//        if (CacheContext.wpmapls.containsKey(wpId)) {
+//            wplist = CacheContext.wpmapls.get(wpId);
+//        } else {
+//            if (CacheContext.projmap.containsKey(wpId)){
+//                projects = CacheContext.projmap.get(wpId);
+//            }else {
+//                if (CacheContext.prolinemap.containsKey(wpId)){
+//                    lines = CacheContext.prolinemap.get(wpId);
+//                }
+//            }
+//        }
+
+        for (int i = 0; i < 24; i++) {
+            PowercurveVo vo = new PowercurveVo();
+            vo.setLlgl(0.0); //理论功率
+            vo.setSjgl(0.0); //实际功率
+            vo.setSsfs(0.0); //实时风速
+            vo.setBzgl(0.0); //保证功率
+            vo.setHours(i);  //时间戳
+            vo.setName(wpId);
+            vos.add(vo);
+        }
+
+        ProBasicPowerstationPoint bzgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.BZGL);
+        ProBasicPowerstationPoint llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.LLGL);
+        ProBasicPowerstationPoint sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZGL);
+
+        List<PointData> bzglls = edosUtil.getHistoryDatasSnap(bzgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
+        double temp1 = 0;
+        for (int i = 0; i < bzglls.size(); i++) {
+            temp1 = bzglls.get(i).getPointValueInDouble();
+            vos.get(i).setBzgl(StringUtils.round(temp1, 2));
+        }
+
+        List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
+        double temp2 = 0;
+        for (int i = 0; i < llglls.size(); i++) {
+            temp2 = llglls.get(i).getPointValueInDouble();
+            vos.get(i).setLlgl(StringUtils.round(temp2, 2));
+        }
+
+
+        List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
+        double temp4 = 0;
+        for (int i = 0; i < sjglls.size(); i++) {
+            temp4 = sjglls.get(i).getPointValueInDouble();
+            vos.get(i).setSjgl(StringUtils.round(temp4, 2));
+
+        }
+        return vos;
+    }
+
     /**********************************************计划电量统计**********************************************************/
     private void setPlanInfoByType
     (Map<String, Map<String, Double>> gxkmap, List<ProBasicProjectPlan> planls, String wpId) {