浏览代码

增加月利用小时弹窗数据

wangb 2 年之前
父节点
当前提交
b6fd8df9ff

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

@@ -115,4 +115,26 @@ public class MonitorController {
 
     }
 
+    @GetMapping("Planproject")
+    @ResponseBody
+    @ApiOperation(value = "计划电量", notes = "计划电量")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "场站编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "timetype", value = "统一编码", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult Planproject(String wpId,String timetype) throws Exception {
+
+        List<PowercurveVo> resultList = new ArrayList<>();
+        if (StringUtils.notEmp(wpId)) {
+            resultList = monitorService.planvalue(wpId,timetype);
+        }
+
+        if (null != resultList) {
+            return AjaxResult.successData(200, resultList);
+        } else {
+            return AjaxResult.error(500, "操作失败");
+        }
+
+    }
+
 }

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

@@ -19,6 +19,26 @@ public class PowercurveVo {
 
     private Double rfdl;
 
+    private Double nfdl;
+
+    private Double yfdl;
+
+    public Double getYfdl() {
+        return yfdl;
+    }
+
+    public void setYfdl(Double yfdl) {
+        this.yfdl = yfdl;
+    }
+
+    public Double getNfdl() {
+        return nfdl;
+    }
+
+    public void setNfdl(Double nfdl) {
+        this.nfdl = nfdl;
+    }
+
     public Double getRfdl() {
         return rfdl;
     }

+ 93 - 20
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorService.java

@@ -9,6 +9,7 @@ import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.IProBasicEquipmentPointService;
 import com.gyee.runeconomy.service.auto.IProBasicPowerstationPointService;
 import com.gyee.runeconomy.service.auto.IProBasicProjectPlanService;
+import com.gyee.runeconomy.util.DateUtils;
 import com.gyee.runeconomy.util.MathUtil;
 import com.gyee.runeconomy.util.StringUtils;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
@@ -1362,24 +1363,32 @@ public class MonitorService {
     //利用小时
     public List<PowercurveVo> hoursvalue(String wpId, String timetype) throws Exception {
 
-//        Date year = com.gyee.common.util.DateUtils.getYearFirstZero();   //当年第一天0点
-//        Integer endDate = com.gyee.common.util.DateUtils.getCurrentYear();   //当前时间
-//
-//        Calendar cal = Calendar.getInstance();
-//        cal.setTime(new Date());
-//        Integer year = cal.get(Calendar.YEAR) - 2;
-//        Integer month = cal.get(Calendar.MONTH) + 1;
 
-        SimpleDateFormat format = new SimpleDateFormat("yyyy");
+        Calendar twoyear = Calendar.getInstance();
+        twoyear.add(Calendar.YEAR, -2);
+        Date twoDate = twoyear.getTime();
+//        Date beginDate = DateUtils.truncate(beginDate1);
 
-        Calendar cal = Calendar.getInstance();
-        cal.add(Calendar.YEAR, -2);
-        Date beginDate = cal.getTime();
+        Calendar oneyear = Calendar.getInstance();
+        oneyear.add(Calendar.YEAR, -1);
+        Date oneDate = oneyear.getTime();
+
+        Calendar currentyear = Calendar.getInstance();
+        currentyear.add(Calendar.YEAR, 1);
+        Date currentDate = currentyear.getTime();
 
-        Calendar call = Calendar.getInstance();
-        cal.add(Calendar.YEAR, 1);
+        Calendar twomonth = Calendar.getInstance();
+        twomonth.add(Calendar.MONTH, -2);
+        Date twoDatemonth = twomonth.getTime();
+
+        Calendar onemonth = Calendar.getInstance();
+        onemonth.add(Calendar.MONTH, -1);
+        Date oneDatemonth = onemonth.getTime();
+
+        Calendar currentmonth = Calendar.getInstance();
+        currentmonth.add(Calendar.MONTH, 1);
+        Date currentDatemonth = currentmonth.getTime();
 
-        Date endDate = call.getTime();
 
         double zjrl = 0.0;
 
@@ -1432,10 +1441,12 @@ public class MonitorService {
             zjrlmap.put("zjrl", zjrl);
 
 
-            for (int i = 0; i < 24; i++) {
+            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); //实时风速
@@ -1446,16 +1457,71 @@ public class MonitorService {
                 vos.add(vo);
             }
 
-            ProBasicPowerstationPoint rfdl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RFDL);
+
+            Map<String, Map<String, ProBasicPowerstationPoint>> pointwpmap = CacheContext.pointwpmap;
+            Map<String, ProBasicPowerstationPoint> wtpointmap = pointwpmap.get(wpId);
+
+            List<String> year = new ArrayList<>();
+            year.add(wtpointmap.get(ContantXk.NFDL).getNemCode());
+            List<String> month = new ArrayList<>();
+            month.add(wtpointmap.get(ContantXk.YFDL).getNemCode());
 
             if (timetype.contains("year")) {
 
-                List<PointData> rfdlls = edosUtil.getHistoryDatasSnap(rfdl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
+                List<PointData> currentls = edosUtil.getHistMatrix(year, currentDate.getTime() / 1000);
+                List<PointData> onels = edosUtil.getHistMatrix(year, oneDate.getTime() / 1000);
+                List<PointData> twols = edosUtil.getHistMatrix(year, twoDate.getTime() / 1000);
+
+                List<PointData> sj = new ArrayList<>();
+                if(!currentls.isEmpty() && !onels.isEmpty() && !twols.isEmpty())
+                {
+                    sj.add(currentls.get(0));
+                    sj.add(onels.get(0));
+                    sj.add(twols.get(0));
+                }
+
+
+                double temp0 = 0;
+                double temp1 = 0;
+                double temp2 = 0;
+
+                if (!sj.isEmpty() && sj.size()==3) {
+                    temp0 = sj.get(0).getPointValueInDouble();
+                    temp1 = sj.get(1).getPointValueInDouble();
+                    temp2 = sj.get(2).getPointValueInDouble();
+                    vos.get(0).setNfdl(StringUtils.round(temp0 / zjrl, 2));
+                    vos.get(1).setNfdl(StringUtils.round(temp1 / zjrl, 2));
+                    vos.get(2).setNfdl(StringUtils.round(temp2 / zjrl, 2));
+                }
+
+            }
+
+            if (timetype.contains("month")) {
+
+                List<PointData> currentls = edosUtil.getHistMatrix(month, currentDatemonth.getTime() / 1000);
+                List<PointData> onels = edosUtil.getHistMatrix(month, oneDatemonth.getTime() / 1000);
+                List<PointData> twols = edosUtil.getHistMatrix(month, twoDatemonth.getTime() / 1000);
+
+                List<PointData> sj = new ArrayList<>();
+                if(!currentls.isEmpty() && !onels.isEmpty() && !twols.isEmpty())
+                {
+                    sj.add(currentls.get(0));
+                    sj.add(onels.get(0));
+                    sj.add(twols.get(0));
+                }
+
 
+                double temp0 = 0;
                 double temp1 = 0;
-                for (int i = 0; i < rfdlls.size(); i++) {
-                    temp1 = rfdlls.get(i).getPointValueInDouble();
-                    vos.get(i).setSjgl(StringUtils.round(temp1, 2));
+                double temp2 = 0;
+
+                if (!sj.isEmpty() && sj.size()==3) {
+                    temp0 = sj.get(0).getPointValueInDouble();
+                    temp1 = sj.get(1).getPointValueInDouble();
+                    temp2 = sj.get(2).getPointValueInDouble();
+                    vos.get(0).setYfdl(StringUtils.round(temp0 / zjrl, 2));
+                    vos.get(1).setYfdl(StringUtils.round(temp1 / zjrl, 2));
+                    vos.get(2).setYfdl(StringUtils.round(temp2 / zjrl, 2));
                 }
 
             }
@@ -1464,6 +1530,13 @@ public class MonitorService {
     }
 
 
+    //计划电量
+    public List<PowercurveVo> planvalue(String wpId, String timetype) throws Exception {
+        return null;
+
+    }
+
+
     /**********************************************计划电量统计**********************************************************/
     private void setPlanInfoByType
     (Map<String, Map<String, Double>> gxkmap, List<ProBasicProjectPlan> planls, String wpId) {