Pārlūkot izejas kodu

功率曲线修改

wangb@gyee-china.com 1 gadu atpakaļ
vecāks
revīzija
35435800a9

+ 4 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/Forecast/ForecastController.java

@@ -2,6 +2,7 @@ package com.gyee.runeconomy.controller.Forecast;
 
 import com.gyee.runeconomy.dto.AjaxResult;
 import com.gyee.runeconomy.service.Forecast.ForecastService;
+import com.gyee.runeconomy.service.Forecast.NewForecastService;
 import com.gyee.runeconomy.util.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -23,7 +24,8 @@ public class ForecastController {
 
     @Autowired
     private ForecastService forecastService;
-
+    @Autowired
+    private NewForecastService newForecastService;
 
     @GetMapping("/short")
     @ResponseBody
@@ -39,7 +41,7 @@ public class ForecastController {
 
         Map<String, Object>  resultList = new LinkedHashMap<>();
         if (StringUtils.notEmp(wpId)) {
-            resultList = forecastService.getcockpit(wpId,beginDate,endDate);
+            resultList = newForecastService.getcockpit(wpId,beginDate,endDate);
         }
 
         if (null != resultList) {

+ 333 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Forecast/NewForecastService.java

@@ -0,0 +1,333 @@
+package com.gyee.runeconomy.service.Forecast;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.util.DateUtils;
+import com.gyee.runeconomy.dto.ForecastVo;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.ProBasicPowerPoint;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
+import com.gyee.runeconomy.model.auto.ProBasicProject;
+import com.gyee.runeconomy.service.TokenService;
+import com.gyee.runeconomy.service.auto.IProBasicPowerPointService;
+import com.gyee.runeconomy.service.auto.IProBasicPowerstationPointService;
+import com.gyee.runeconomy.util.StringUtils;
+import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class NewForecastService {
+    @Resource
+    private IEdosUtil edosUtil;
+    @Resource
+    private IProBasicPowerPointService powerPointService;
+    @Resource
+    private TokenService tokenService;
+    @Resource
+    private IProBasicPowerstationPointService proBasicPowerstationPointService;
+
+    public Map<String, Object> getcockpit(String wpId, String beginDate, String endDate) throws Exception {
+
+        Date starttime = DateUtils.parseDate(beginDate);
+        Date endtime = DateUtils.parseDate(endDate);
+        Date currentDate = new Date();
+        List<ProBasicPowerstation> station =  CacheContext.wpls.stream().filter(w->wpId.equals(w.getId())).collect(Collectors.toList());
+
+        List<ProBasicProject> pjls = CacheContext.pjls;
+
+        QueryWrapper<ProBasicPowerPoint> qw = new QueryWrapper<>();
+        List<ProBasicPowerPoint> powerls = new ArrayList<>();
+
+        qw.lambda().eq(ProBasicPowerPoint::getWindpowerstationId, wpId);
+        powerls = powerPointService.getBaseMapper().selectList(qw);
+
+        if (powerls.size()<0 || powerls.isEmpty()){
+            powerls = powerPointService.getBaseMapper().selectList(null);
+            List<ProBasicProject> collect = pjls.stream().filter(p -> wpId.equals(p.getWindpowerstationId())).collect(Collectors.toList());
+            List<ProBasicPowerPoint> filteredPowerls = powerls.stream().filter(p -> collect.stream().anyMatch(c -> c.getId().equals(p.getWindpowerstationId()))).
+                    collect(Collectors.toList());
+            powerls = filteredPowerls;
+        }
+
+
+
+
+        List<ForecastVo> vos = null;
+        Map<String, Object> map = new LinkedHashMap<>();
+        ProBasicPowerstationPoint pjfs = null;
+        ProBasicPowerstationPoint fsyc = null;
+        ProBasicPowerstationPoint ycgl = null;
+        ProBasicPowerstationPoint sjgl = null;
+        ProBasicPowerstationPoint llgl = null;
+
+        List<ProBasicProject> projects = null;
+        for (ProBasicPowerPoint wp : powerls) {
+
+            projects = pjls.stream().filter(j -> wp.getWindpowerstationId().equals(j.getId())).collect(Collectors.toList());
+
+            vos = new ArrayList<>();
+            if (wpId.endsWith("FDC_STA")) {
+                pjfs = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSPJFS);
+                fsyc = proBasicPowerstationPointService.getPowerstationPoint(wp.getWindpowerstationId(), ContantXk.FSYC);
+                ycgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getWindpowerstationId(), ContantXk.GLYC);
+                sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZGL);
+                llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZLLGL);
+
+            }
+            if (wpId.endsWith("GDC_STA")) {
+                pjfs = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.GCGZQD);
+                fsyc = proBasicPowerstationPointService.getPowerstationPoint(wp.getWindpowerstationId(), ContantXk.GZYC);
+                ycgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getWindpowerstationId(), ContantXk.GLYC);
+                sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZGL);
+                llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZLLGL);
+            }
+
+
+            List<PointData> pjfsls = edosUtil.getHistoryDatasSnap(pjfs, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+            List<PointData> fsycls = edosUtil.getHistoryDatasSnap(fsyc, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
+            List<PointData> ycglls = edosUtil.getHistoryDatasSnap(ycgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
+            List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+            List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+
+            double temp1 = 0;
+            double temp2 = 0;
+            double temp3 = 0;
+            double temp4 = 0;
+            double temp5 = 0;
+            for (int i = 0; i < fsycls.size(); i++) {
+
+                ForecastVo vo = new ForecastVo();
+//                    vo.setPjfs(0.0); //平均风速
+                vo.setYcfs(0.0); //预测风速
+//                    vo.setSjgl(0.0); //实际功率
+                vo.setYcgl(0.0); //功率预测
+//                    vo.setLlgl(0.0); //理论功率
+                vo.setHours(2023L);  //时间戳
+                vo.setName(wpId);
+
+                if (pjfsls != null && !pjfsls.isEmpty() && i < pjfsls.size() && pjfsls.get(i).getPointName() != null) {
+                    temp1 = pjfsls.get(i).getPointValueInDouble();
+                    vo.setPjfs(StringUtils.round(temp1, 2));
+                }
+
+                if (fsycls != null && !fsycls.isEmpty() && fsycls.get(0).getPointName() != null) {
+                    temp2 = fsycls.get(i).getPointValueInDouble();
+                    vo.setYcfs(StringUtils.round(temp2, 2));
+                }
+                if (ycglls != null && !ycglls.isEmpty() && ycglls.get(0).getPointName() != null) {
+                    temp3 = ycglls.get(i).getPointValueInDouble();
+                    vo.setYcgl(StringUtils.round(temp3, 2));
+                }
+
+                if (sjglls != null && !sjglls.isEmpty() && i < sjglls.size() && sjglls.get(i).getPointName() != null) {
+                    temp4 = sjglls.get(i).getPointValueInDouble();
+                    vo.setSjgl(StringUtils.round(temp4 / 1000, 2));
+                }
+                if (llglls != null && !llglls.isEmpty() && i < llglls.size() && llglls.get(i).getPointName() != null) {
+                    temp5 = llglls.get(i).getPointValueInDouble();
+                    vo.setLlgl(StringUtils.round(temp5 / 1000, 2));
+                }
+                vo.setHours(fsycls.get(i).getPointTime());
+
+                if (!projects.isEmpty() || projects.size()>0) {
+                    vo.setName(projects.get(0).getName());
+                } else {
+                    vo.setName(station.get(0).getName());
+                }
+                vo.setId(wpId);
+
+                vos.add(vo);
+            }
+            map.put(wp.getWindpowerstationId(), vos);
+
+        }
+        return map;
+    }
+
+
+    public Map<String, Object> getcockpittype(String beginDate, String endDate, String type) throws Exception {
+
+        Date starttime = DateUtils.parseDate(beginDate);
+        Date endtime = DateUtils.parseDate(endDate);
+        Date currentDate = new Date();
+
+        List<ProBasicProject> pjls = CacheContext.pjls;
+
+        List<ProBasicPowerstation> wpls = CacheContext.wpls;
+
+        List<ProBasicPowerPoint> powerls = new ArrayList<>();
+        powerls = powerPointService.getBaseMapper().selectList(null);
+
+        List<ForecastVo> vos = null;
+        Map<String, Object> map = new LinkedHashMap<>();
+        ProBasicPowerstationPoint pjfs = null;
+        ProBasicPowerstationPoint fsyc = null;
+        ProBasicPowerstationPoint ycgl = null;
+        ProBasicPowerstationPoint sjgl = null;
+        ProBasicPowerstationPoint llgl = null;
+
+        List<ProBasicProject> projects = null;
+        for (ProBasicPowerstation wp : wpls) {
+            powerls.stream().filter(p -> wp.getId().equals(p.getWindpowerstationId()));
+            if (!powerls.isEmpty() || powerls.size() > 0) {
+                vos = new ArrayList<>();
+                if (wp.getId().endsWith("FDC_STA")) {
+                    pjfs = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSPJFS);
+                    fsyc = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.FSYC);
+                    ycgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.GLYC);
+                    sjgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZGL);
+                    llgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZLLGL);
+
+                }
+                if (wp.getId().endsWith("GDC_STA")) {
+                    pjfs = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.GCGZQD);
+                    fsyc = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.GZYC);
+                    ycgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.GLYC);
+                    sjgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZGL);
+                    llgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZLLGL);
+                }
+
+
+                List<PointData> pjfsls = edosUtil.getHistoryDatasSnap(pjfs, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+                List<PointData> fsycls = edosUtil.getHistoryDatasSnap(fsyc, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
+                List<PointData> ycglls = edosUtil.getHistoryDatasSnap(ycgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
+                List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+                List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+
+                double temp1 = 0;
+                double temp2 = 0;
+                double temp3 = 0;
+                double temp4 = 0;
+                double temp5 = 0;
+                for (int i = 0; i < fsycls.size(); i++) {
+
+                    ForecastVo vo = new ForecastVo();
+//                    vo.setPjfs(0.0); //平均风速
+                    vo.setYcfs(0.0); //预测风速
+//                    vo.setSjgl(0.0); //实际功率
+                    vo.setYcgl(0.0); //功率预测
+//                    vo.setLlgl(0.0); //理论功率
+                    vo.setHours(2023L);  //时间戳
+                    vo.setName(wp.getId());
+
+                    if (pjfsls != null && !pjfsls.isEmpty() && i < pjfsls.size() && pjfsls.get(i).getPointName() != null) {
+                        temp1 = pjfsls.get(i).getPointValueInDouble();
+                        vo.setPjfs(StringUtils.round(temp1, 2));
+                    }
+
+                    if (fsycls != null && !fsycls.isEmpty() && fsycls.get(0).getPointName() != null) {
+                        temp2 = fsycls.get(i).getPointValueInDouble();
+                        vo.setYcfs(StringUtils.round(temp2, 2));
+                    }
+                    if (ycglls != null && !ycglls.isEmpty() && ycglls.get(0).getPointName() != null) {
+                        temp3 = ycglls.get(i).getPointValueInDouble();
+                        vo.setYcgl(StringUtils.round(temp3, 2));
+                    }
+
+                    if (sjglls != null && !sjglls.isEmpty() && i < sjglls.size() && sjglls.get(i).getPointName() != null) {
+                        temp4 = sjglls.get(i).getPointValueInDouble();
+                        vo.setSjgl(StringUtils.round(temp4 / 1000, 2));
+                    }
+                    if (llglls != null && !llglls.isEmpty() && i < llglls.size() && llglls.get(i).getPointName() != null) {
+                        temp5 = llglls.get(i).getPointValueInDouble();
+                        vo.setLlgl(StringUtils.round(temp5 / 1000, 2));
+                    }
+                    vo.setHours(fsycls.get(i).getPointTime());
+
+                    if (!projects.isEmpty() || projects.size() > 0) {
+                        vo.setName(projects.get(0).getName());
+                    }
+                    vo.setId(wp.getId());
+
+                    vos.add(vo);
+                }
+                map.put(wp.getId(), vos);
+
+            } else {
+                for (ProBasicProject pj : pjls){
+                    powerls.stream().filter(p -> pj.getId().equals(p.getWindpowerstationId()));
+
+                    vos = new ArrayList<>();
+                    if (wp.getId().endsWith("FDC_STA")) {
+                        pjfs = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSPJFS);
+                        fsyc = proBasicPowerstationPointService.getPowerstationPoint(pj.getId(), ContantXk.FSYC);
+                        ycgl = proBasicPowerstationPointService.getPowerstationPoint(pj.getId(), ContantXk.GLYC);
+                        sjgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZGL);
+                        llgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZLLGL);
+
+                    }
+                    if (wp.getId().endsWith("GDC_STA")) {
+                        pjfs = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.GCGZQD);
+                        fsyc = proBasicPowerstationPointService.getPowerstationPoint(pj.getId(), ContantXk.GZYC);
+                        ycgl = proBasicPowerstationPointService.getPowerstationPoint(pj.getId(), ContantXk.GLYC);
+                        sjgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZGL);
+                        llgl = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.SSZLLGL);
+                    }
+
+
+                    List<PointData> pjfsls = edosUtil.getHistoryDatasSnap(pjfs, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+                    List<PointData> fsycls = edosUtil.getHistoryDatasSnap(fsyc, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
+                    List<PointData> ycglls = edosUtil.getHistoryDatasSnap(ycgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
+                    List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+                    List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, starttime.getTime() / 1000, currentDate.getTime() / 1000, null, 900L);
+
+                    double temp1 = 0;
+                    double temp2 = 0;
+                    double temp3 = 0;
+                    double temp4 = 0;
+                    double temp5 = 0;
+                    for (int i = 0; i < fsycls.size(); i++) {
+
+                        ForecastVo vo = new ForecastVo();
+//                    vo.setPjfs(0.0); //平均风速
+                        vo.setYcfs(0.0); //预测风速
+//                    vo.setSjgl(0.0); //实际功率
+                        vo.setYcgl(0.0); //功率预测
+//                    vo.setLlgl(0.0); //理论功率
+                        vo.setHours(2023L);  //时间戳
+                        vo.setName(wp.getId());
+
+                        if (pjfsls != null && !pjfsls.isEmpty() && i < pjfsls.size() && pjfsls.get(i).getPointName() != null) {
+                            temp1 = pjfsls.get(i).getPointValueInDouble();
+                            vo.setPjfs(StringUtils.round(temp1, 2));
+                        }
+
+                        if (fsycls != null && !fsycls.isEmpty() && fsycls.get(0).getPointName() != null) {
+                            temp2 = fsycls.get(i).getPointValueInDouble();
+                            vo.setYcfs(StringUtils.round(temp2, 2));
+                        }
+                        if (ycglls != null && !ycglls.isEmpty() && ycglls.get(0).getPointName() != null) {
+                            temp3 = ycglls.get(i).getPointValueInDouble();
+                            vo.setYcgl(StringUtils.round(temp3, 2));
+                        }
+
+                        if (sjglls != null && !sjglls.isEmpty() && i < sjglls.size() && sjglls.get(i).getPointName() != null) {
+                            temp4 = sjglls.get(i).getPointValueInDouble();
+                            vo.setSjgl(StringUtils.round(temp4 / 1000, 2));
+                        }
+                        if (llglls != null && !llglls.isEmpty() && i < llglls.size() && llglls.get(i).getPointName() != null) {
+                            temp5 = llglls.get(i).getPointValueInDouble();
+                            vo.setLlgl(StringUtils.round(temp5 / 1000, 2));
+                        }
+                        vo.setHours(fsycls.get(i).getPointTime());
+
+                        if (!projects.isEmpty() || projects.size() > 0) {
+                            vo.setName(projects.get(0).getName());
+                        }
+                        vo.setId(wp.getId());
+
+                        vos.add(vo);
+                    }
+                    map.put(wp.getId(), vos);
+                }
+            }
+        }
+        return map;
+    }
+}

+ 8 - 12
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/HourpowerService.java

@@ -113,28 +113,26 @@ public class HourpowerService {
         List<ProBasicPowerPoint> qyls = null;
         powerls = powerPointService.getBaseMapper().selectList(qw);
 
-        List<ProBasicPowerPoint> sxfd = powerls.stream().filter(i -> i.getTypeId().equals("SXJ_RGN-1")).collect(Collectors.toList());
-        List<ProBasicPowerPoint> sxgf = powerls.stream().filter(i -> i.getTypeId().equals("SXJ_RGN-2")).collect(Collectors.toList());
+        List<ProBasicPowerPoint> sxfd = powerls.stream().filter(i -> i.getTypeId().endsWith(FD)).collect(Collectors.toList());
+        List<ProBasicPowerPoint> sxgf = powerls.stream().filter(i -> i.getTypeId().endsWith(GF)).collect(Collectors.toList());
 
-        if (wpId.equals("SXJ_RGN0")){
+        if (wpId.endsWith(QS)){
             qyls = powerls;
-        }else if (wpId.equals("SXJ_RGN-1")){
+        }else if (wpId.endsWith(FD)){
             qyls = sxfd;
-        }else if (wpId.equals("SXJ_RGN-2")){
+        }else if (wpId.endsWith(GF)){
             qyls = sxgf;
         }
-        if (wpId.contains("SXJ_RGN")) {
+        if ( wpId.endsWith(QS) ||wpId.endsWith(FD) || wpId.endsWith(GF)) {
 
             List<List<PowercurveVo>> ls = new ArrayList<>();
             for (ProBasicPowerPoint pp : qyls) {
-                if (pp.getWindpowerstationId().contains("MLJ_FDC_STA"))continue;
+                if (pp.getWindpowerstationId().contains("MLJ_FDC"))continue;
                 ProBasicPowerstationPoint ycgl = proBasicPowerstationPointService.getPowerstationPoint(pp.getWindpowerstationId(), ContantXk.GLYC);
                 List<PointData> ycglls = edosUtil.getHistoryDatasSnap(ycgl, beginDate.getTime() / 1000, nextDayZeroTime.getTime() / 1000, null, 3600L);
                 vos = new ArrayList<>();
                 double temp1 = 0;
                 for (int i = 0; i < ycglls.size(); i++) {
-//                    PointData po =new PointData();
-//                    po.setPointTime(ycglls.get(i).getPointTime()*1000);
                     temp1 = ycglls.get(i).getPointValueInDouble();
                     PowercurveVo vo = new PowercurveVo();
                     vo.setHours(i);
@@ -182,9 +180,7 @@ public class HourpowerService {
 
             }
 
-        }
-
-        if (!wpId.contains("SXJ_RGN")) {
+        } else {
             //单场请求特殊场站进行处理
             if (wpId.contains("GJY") || wpId.contains("PTZ") || wpId.contains("NJL") || wpId.contains("TZ_GDC_STA") || wpId.contains("SY_GDC_STA")) {
                 Map<String, Object> map1 = new HashMap<>();

+ 236 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorvalueService.java

@@ -0,0 +1,236 @@
+package com.gyee.runeconomy.service.monitor;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.util.DateUtils;
+import com.gyee.common.util.SortUtils;
+import com.gyee.runeconomy.dto.PowercurveVo;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.*;
+import com.gyee.runeconomy.service.TokenService;
+import com.gyee.runeconomy.service.auto.*;
+import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
+import org.springframework.stereotype.Service;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+
+@Service
+public class MonitorvalueService {
+
+    @Resource
+    private IProBasicProjectPlanService proBasicProjectPlanService;
+    @Resource
+    private IProBasicPowerstationPointService proBasicPowerstationPointService;
+    @Resource
+    private IProBasicEquipmentPointService proBasicEquipmentPointService;
+    @Resource
+    private IProBasicCompanyService proBasicCompanyService;
+    @Resource
+    private IProEconTargetdataService proEconTargetdataService;
+    @Resource
+    private IProEconTargetdataFristService proEconTargetdataFristService;
+
+    @Resource
+    private IProBasicPowerPointService powerPointService;
+
+    @Resource
+    private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;
+
+    private final String QS = "0";
+    private final String FD = "-1";
+    private final String GF = "-2";
+
+    @Resource
+    private IEdosUtil edosUtil;
+    Map<String, Object> map = new HashMap<>();
+    @Resource
+    private TokenService tokenService;
+
+    //利用小时
+    public List<PowercurveVo> hoursvalue(String wpId, String timetype) throws Exception {
+
+
+//        Calendar twoyear = Calendar.getInstance();
+//        twoyear.add(Calendar.YEAR, -2);
+//        Date twoDate = twoyear.getTime();
+////        Date beginDate = DateUtils.truncate(beginDate1);
+//
+//        Calendar oneyear = Calendar.getInstance();
+//        oneyear.add(Calendar.YEAR, -1);
+//        Date oneDate = oneyear.getTime();
+//
+//        Calendar currentyear = Calendar.getInstance();
+//        currentyear.add(Calendar.YEAR, 0);
+//        Date currentDate = currentyear.getTime();
+
+
+        Calendar calendar = Calendar.getInstance();
+        int currentYear = calendar.get(Calendar.YEAR);
+
+        // 设置开始时间为本年最后一天早上六点
+        calendar.set(Calendar.YEAR, currentYear);
+        calendar.set(Calendar.MONTH, Calendar.DECEMBER);
+        calendar.set(Calendar.DAY_OF_MONTH, 31);
+        calendar.set(Calendar.HOUR_OF_DAY, 6);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+
+        Date startDate = calendar.getTime();
+
+        // 设置结束时间为本年最后一天晚上23点59分59秒
+        calendar.set(Calendar.HOUR_OF_DAY, 23);
+        calendar.set(Calendar.MINUTE, 59);
+        calendar.set(Calendar.SECOND, 59);
+
+        Date endDate = calendar.getTime();
+
+        // 判断是否是本年
+        boolean isCurrentYear = currentYear == Calendar.getInstance().get(Calendar.YEAR);
+
+        if (isCurrentYear) {
+            // 如果是本年,最后一天就是当天
+//            Calendar today = Calendar.getInstance();
+//            today.set(Calendar.HOUR_OF_DAY, 6);
+//            today.set(Calendar.MINUTE, 0);
+//            today.set(Calendar.SECOND, 0);
+//            startDate = today.getTime();
+//            endDate = new Date();
+            Calendar today = Calendar.getInstance();
+            today.add(Calendar.DAY_OF_MONTH,-1);
+            today.set(Calendar.HOUR_OF_DAY, 6);
+            today.set(Calendar.MINUTE, 0);
+            today.set(Calendar.SECOND, 0);
+            startDate = today.getTime();
+
+            Calendar end = Calendar.getInstance();
+            end.setTime(new Date());
+            end.add(Calendar.DAY_OF_MONTH, -1);
+            end.set(Calendar.HOUR_OF_DAY, 23);
+            end.set(Calendar.MINUTE, 59);
+            end.set(Calendar.SECOND, 59);
+            endDate = end.getTime();
+        }
+
+
+        double zjrl = 0.0;
+
+        Map<String, Object> zjrlmap = new HashMap<>();
+        List<PowercurveVo> vos = new ArrayList<PowercurveVo>();
+        if (wpId.endsWith(QS) || wpId.endsWith(FD) || wpId.endsWith(GF) || CacheContext.wpmapls.containsKey(wpId)) {
+
+            List<ProBasicPowerstation> wplist = new ArrayList<>();
+            if (CacheContext.wpmapls.containsKey(wpId)) {
+                wplist = CacheContext.wpmapls.get(wpId);
+            }
+            HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
+            List<ProBasicPowerstation> wplsToken = tokenService.getWpls(request);
+            for (ProBasicPowerstation wp : wplsToken) {
+                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 (wpId.contains(QS) || wpId.contains(FD) || wpId.contains(GF)) {
+                for (ProBasicRegion rg : CacheContext.rgls) {
+                    if (wpId.contains(rg.getId())) {
+                        zjrl += rg.getJrCapacity() + rg.getJrwindCapacity();
+                    }
+                }
+                for (ProBasicCompany cp : CacheContext.cpls) {
+                    if (wpId.contains(cp.getId())) {
+                        zjrl += cp.getJrCapacity() + cp.getJrwindCapacity();
+                    }
+                }
+            }
+
+            for (ProBasicPowerstation wp : wplsToken) {
+                if (wpId.equals(wp.getId())) {
+                    zjrl += wp.getJrCapacity() + wp.getJrwindCapacity();
+                }
+            }
+            for (ProBasicProject pj : CacheContext.pjls) {
+                if (wpId.equals(pj.getId())) {
+                    zjrl += pj.getCapacity();
+                }
+            }
+            for (ProBasicLine ln : CacheContext.lnls) {
+                if (wpId.equals(ln.getId())) {
+                    zjrl += ln.getCapacity();
+                }
+            }
+
+
+            zjrlmap.put("zjrl", zjrl);
+
+            List<ProEconPowerstationInfoDay5> qwt1 = null;
+            QueryWrapper<ProEconPowerstationInfoDay5> qw1 = new QueryWrapper<>();
+
+            if (timetype.contains("year")) {
+
+                for (int i = 0; i < 3; i++) {
+
+
+                    if (wpId.contains("RGN")) {
+                        if (wpId.equals("SXJ_RGN0")) {
+                            qw1.lambda().in(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_RGN-1", "SXJ_RGN-2");
+                        } else if (wpId.equals("SXJ_RGN-1")) {
+                            qw1.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_RGN-1");
+                        } else if (wpId.equals("SXJ_RGN-2")) {
+                            qw1.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_RGN-2");
+                        }
+                        qw1.lambda().between(ProEconPowerstationInfoDay5::getRecordDate, startDate, endDate);
+                    } else {
+                        qw1.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, wpId);
+                        qw1.lambda().between(ProEconPowerstationInfoDay5::getRecordDate, startDate, endDate);
+                    }
+                    qwt1 = proEconPowerstationInfoDay5Service.list(qw1);
+
+
+                    if (!qwt1.isEmpty()) {
+
+//                    vos.get(0).setNfdl(StringUtils.round((temp0 / 1000) / (zjrl / 1000), 2));
+//                    vos.get(1).setNfdl(StringUtils.round((temp1 / 1000) / (zjrl / 1000), 2));
+//                    vos.get(2).setNfdl(StringUtils.round((temp2 / 1000) / (zjrl / 1000), 2));
+                        PowercurveVo vo = new PowercurveVo();
+
+
+                    }
+                }
+            }
+
+            if (timetype.contains("month")) {
+
+                int month1 = DateUtils.getMonth(new Date());//4
+                DateUtils.getMonthLast(new Date());//4.30
+                Date date = DateUtils.getCurrentDate();
+
+                for (int i = month1; i > 0; i--) {
+
+//                    PointData data = edosUtil.getSectionData(month, DateUtils.getEndOfDay(DateUtils.getMonthLast(date)).getTime());
+                    PowercurveVo vo1 = new PowercurveVo();
+//                    vo1.setYfdl(DoubleUtils.keepPrecision((data.getPointValueInDouble() / 1000) / (zjrl / 1000), 2));
+                    vo1.setHours(i);
+                    vos.add(vo1);
+                    date = DateUtils.addMonths(date, -1);
+                }
+                SortUtils.sort(vos, "hours", SortUtils.ASC);
+
+
+            }
+        }
+        return vos;
+    }
+
+}