Koishi vor 1 Jahr
Ursprung
Commit
b77deb0680

+ 23 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/Application/ApplicationController.java

@@ -1,6 +1,7 @@
 package com.gyee.runeconomy.controller.Application;
 
 import com.gyee.runeconomy.dto.AjaxResult;
+import com.gyee.runeconomy.model.vo.YcdlVo;
 import com.gyee.runeconomy.service.Application.ApplicationService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -11,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @RestController
@@ -58,7 +61,7 @@ public class ApplicationController {
     }
 
     @GetMapping(value = "/forecast")
-    @ApiOperation(value = "预测电量", notes = "预测电量")
+    @ApiOperation(value = "公司预测电量", notes = "公司预测电量")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "type", value = "场站编号", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "wpId", value = "场站编号", required = false, dataType = "string", paramType = "query")
@@ -78,6 +81,25 @@ public class ApplicationController {
     }
 
 
+    @GetMapping(value = "/czforecast")
+    @ApiOperation(value = "场站预测电量", notes = "场站预测电量")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "场站编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "wpId", value = "场站编号", required = false, dataType = "string", paramType = "query")
+    })
+    public AjaxResult getczforecast(String wpId) throws Exception {
+
+        List<YcdlVo> list = new ArrayList<>();
+        if (wpId!=null) {
+            list = applicationService.czforecast(wpId);
+        }
+        if (null != list) {
+            return AjaxResult.successData(200, list);
+        } else {
+            return AjaxResult.error(500, "操作失败");
+        }
+
+    }
     @GetMapping(value = "/shutdown")
     @ApiOperation(value = "故障次数", notes = "故障次数")
     @ApiImplicitParams({

+ 92 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/YcdlVo.java

@@ -0,0 +1,92 @@
+package com.gyee.runeconomy.model.vo;
+
+import java.time.LocalDate;
+import java.util.Date;
+
+public class YcdlVo {
+
+    private String name;
+    private String wpid;
+    private LocalDate Date;
+
+    private double rfdl;
+    private double ycdl;
+
+    private double sqrfdl;
+    private double sqycdl;
+
+    private double tqrfdl;
+    private double tqycdl;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getWpid() {
+        return wpid;
+    }
+
+    public void setWpid(String wpid) {
+        this.wpid = wpid;
+    }
+
+    public LocalDate getDate() {
+        return Date;
+    }
+
+    public void setDate(LocalDate date) {
+        Date = date;
+    }
+
+    public double getRfdl() {
+        return rfdl;
+    }
+
+    public void setRfdl(double rfdl) {
+        this.rfdl = rfdl;
+    }
+
+    public double getYcdl() {
+        return ycdl;
+    }
+
+    public void setYcdl(double ycdl) {
+        this.ycdl = ycdl;
+    }
+
+    public double getSqrfdl() {
+        return sqrfdl;
+    }
+
+    public void setSqrfdl(double sqrfdl) {
+        this.sqrfdl = sqrfdl;
+    }
+
+    public double getSqycdl() {
+        return sqycdl;
+    }
+
+    public void setSqycdl(double sqycdl) {
+        this.sqycdl = sqycdl;
+    }
+
+    public double getTqrfdl() {
+        return tqrfdl;
+    }
+
+    public void setTqrfdl(double tqrfdl) {
+        this.tqrfdl = tqrfdl;
+    }
+
+    public double getTqycdl() {
+        return tqycdl;
+    }
+
+    public void setTqycdl(double tqycdl) {
+        this.tqycdl = tqycdl;
+    }
+}

+ 143 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Application/ApplicationService.java

@@ -2,10 +2,12 @@ package com.gyee.runeconomy.service.Application;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
 import com.gyee.common.util.DateUtils;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
+import com.gyee.runeconomy.model.vo.YcdlVo;
 import com.gyee.runeconomy.service.auto.*;
 import com.gyee.runeconomy.util.MathUtil;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
@@ -256,10 +258,32 @@ public class ApplicationService {
 
         List<Map> list = new ArrayList<>();
         Map<Integer,Object> zb = new HashMap<>();
+        Map<Integer,Object> zb2 = new HashMap<>();
+        Map<Integer,Object> zb3 = new HashMap<>();
+        // 基准日期
         long longDate = System.currentTimeMillis();
         Date nowDate = new Date(longDate);
 
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(nowDate);
+
+        // 日期的月份和年份
+        int baseMonth = calendar.get(Calendar.MONTH);
+        int baseYear = calendar.get(Calendar.YEAR);
+
+         // 同期
+        calendar.set(Calendar.YEAR, baseYear - 1);
+        calendar.set(Calendar.MONTH, baseMonth);
+        Date sameMonthLastYear = calendar.getTime();
+
+        // 上一期
+        calendar.add(Calendar.MONTH, -1);
+        calendar.set(Calendar.YEAR,baseYear);
+        Date previousMonth = calendar.getTime();
+
         List<ProEconStationPower> qwt = null;
+        List<ProEconStationPower> qwt2 = null;
+        List<ProEconStationPower> qwt3= null;
         for (int i = 0; i < 3; i++) {
 //            zb = new HashMap<>();
             if (type.equals("0")) {
@@ -269,10 +293,17 @@ public class ApplicationService {
                 zb.put(i,qwt);
             }else {
                 QueryWrapper<ProEconStationPower> qw = new QueryWrapper<>();
+                QueryWrapper<ProEconStationPower> qw2 = new QueryWrapper<>();
+                QueryWrapper<ProEconStationPower> qw3 = new QueryWrapper<>();
                 qw.lambda().eq(ProEconStationPower::getRecordDate, nowDate);
+                qw2.lambda().eq(ProEconStationPower::getRecordDate, previousMonth);
+                qw3.lambda().eq(ProEconStationPower::getRecordDate, sameMonthLastYear);
                 qw.lambda().eq(ProEconStationPower::getWindpowerstationId,wpId);
+                qw2.lambda().eq(ProEconStationPower::getWindpowerstationId,wpId);
+                qw3.lambda().eq(ProEconStationPower::getWindpowerstationId,wpId);
                 qwt = powerService.list(qw);
-                zb.put(i,qwt);
+                qwt2 = powerService.list(qw2);
+                qwt3 = powerService.list(qw3);
             }
 //            list.add(zb);
             nowDate = DateUtils.addDays(nowDate, +1);
@@ -281,6 +312,117 @@ public class ApplicationService {
     }
 
 
+
+    public  List<YcdlVo> czforecast(String wpId) throws Exception {
+
+        List<YcdlVo> list = new ArrayList<>();
+        Map<Integer,Object> zb = new HashMap<>();
+
+        List<ProBasicPowerstation> wpls = CacheContext.wpls.stream().filter(w -> wpId.equals(w.getId())).collect(Collectors.toList());
+        // 基准日期
+        long longDate = System.currentTimeMillis();
+        Date nowDate = new Date(longDate);
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(nowDate);
+
+        // 日期的月份和年份
+        int baseMonth = calendar.get(Calendar.MONTH);
+        int baseYear = calendar.get(Calendar.YEAR);
+
+        // 同期
+        calendar.set(Calendar.YEAR, baseYear - 1);
+        calendar.set(Calendar.MONTH, baseMonth);
+        Date sameMonthLastYear = calendar.getTime();
+
+        // 上一期
+        calendar.add(Calendar.MONTH, -1);
+        calendar.set(Calendar.YEAR,baseYear);
+        Date previousMonth = calendar.getTime();
+
+        List<ProEconStationPower> qwt = null;
+        List<ProEconStationPower> qwt2 = null;
+        List<ProEconStationPower> qwt3= null;
+        List<ProEconPowerstationInfoDay5> qwt4= null;
+        List<ProEconPowerstationInfoDay5> qwt5= null;
+        List<ProEconPowerstationInfoDay5> qwt6= null;
+        for (int i = 0; i < 3; i++) {
+//            list = new ArrayList<>();
+
+                QueryWrapper<ProEconStationPower> qw = new QueryWrapper<>();
+                QueryWrapper<ProEconStationPower> qw2 = new QueryWrapper<>();
+                QueryWrapper<ProEconStationPower> qw3 = new QueryWrapper<>();
+                qw.lambda().eq(ProEconStationPower::getRecordDate, nowDate);
+                qw2.lambda().eq(ProEconStationPower::getRecordDate, previousMonth);
+                qw3.lambda().eq(ProEconStationPower::getRecordDate, sameMonthLastYear);
+                qw.lambda().eq(ProEconStationPower::getWindpowerstationId,wpId);
+                qw2.lambda().eq(ProEconStationPower::getWindpowerstationId,wpId);
+                qw3.lambda().eq(ProEconStationPower::getWindpowerstationId,wpId);
+                qwt = powerService.list(qw);
+                qwt2 = powerService.list(qw2);
+                qwt3 = powerService.list(qw3);
+
+
+//            QueryWrapper<ProEconPowerstationInfoDay5> qw4 = new QueryWrapper<>();
+//            QueryWrapper<ProEconPowerstationInfoDay5> qw5 = new QueryWrapper<>();
+//            QueryWrapper<ProEconPowerstationInfoDay5> qw6 = new QueryWrapper<>();
+//            qw4.lambda().eq(ProEconPowerstationInfoDay5::getRecordDate, nowDate);
+//            qw5.lambda().eq(ProEconPowerstationInfoDay5::getRecordDate, previousMonth);
+//            qw6.lambda().eq(ProEconPowerstationInfoDay5::getRecordDate, sameMonthLastYear);
+//            qw4.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId,wpId);
+//            qw5.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId,wpId);
+//            qw6.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId,wpId);
+//            qwt4 = proEconPowerstationInfoDay5Service.list(qw4);
+//            qwt5 = proEconPowerstationInfoDay5Service.list(qw5);
+//            qwt6 = proEconPowerstationInfoDay5Service.list(qw6);
+
+            //日发电量
+            ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RFDL);
+            PointData bq = edosUtil.getSectionData(rfdlvalue, nowDate.getTime());
+            PointData sq = edosUtil.getSectionData(rfdlvalue, previousMonth.getTime());
+            PointData tq = edosUtil.getSectionData(rfdlvalue, sameMonthLastYear.getTime());
+
+            YcdlVo vo = new YcdlVo();
+
+            vo.setName(wpls.get(0).getName());
+            vo.setWpid(wpls.get(0).getNemCode());
+            vo.setDate(qwt.get(0).getRecordDate());
+            vo.setRfdl(bq.getPointValueInDouble());
+            if (qwt.size()>0) {
+                vo.setYcdl(qwt.get(0).getDayPowerForecast().doubleValue());
+            }else {
+                vo.setYcdl(0.0);
+            }
+
+            vo.setSqrfdl(sq.getPointValueInDouble());
+            if (qwt2.size()>0) {
+                vo.setSqycdl(qwt2.get(0).getDayPowerForecast().doubleValue());
+            }else {
+                vo.setSqycdl(0.0);
+            }
+
+            vo.setTqrfdl(tq.getPointValueInDouble());
+            if (qwt3.size()>0) {
+                 vo.setTqycdl(qwt3.get(0).getDayPowerForecast().doubleValue());
+            }else {
+                vo.setTqycdl(0.0);
+            }
+
+            list.add(vo);
+
+
+
+            nowDate = DateUtils.addDays(nowDate, +1);
+            previousMonth = DateUtils.addDays(previousMonth, +1);
+            sameMonthLastYear = DateUtils.addDays(sameMonthLastYear, +1);
+
+            }
+
+       
+        return list;
+    }
+
+
     public  Map<Integer,Object> shutdown(String type,String wpId) throws Exception {
 
         long longDate = System.currentTimeMillis();