wangb@gyee-china.com 1 rok pred
rodič
commit
31e6182854

+ 27 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/Electricity/ElectricityController.java

@@ -2,6 +2,7 @@ package com.gyee.runeconomy.controller.Electricity;
 
 import com.gyee.runeconomy.dto.AjaxResult;
 import com.gyee.runeconomy.service.Electricity.Electricityservice;
+import com.gyee.runeconomy.service.StudyElectricity.StudyElectricityService;
 import com.gyee.runeconomy.util.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -23,6 +24,9 @@ public class ElectricityController {
 
     @Resource
     private Electricityservice electricityservice;
+
+    @Resource
+    private StudyElectricityService studyelectricity;
     @GetMapping("/statistics")
     @ResponseBody
     @ApiOperation(value = "首页", notes = "首页")
@@ -70,4 +74,27 @@ public class ElectricityController {
         }
 
     }
+
+    @GetMapping("/study")
+    @ResponseBody
+    @ApiOperation(value = "可研电量分析", notes = "可研电量分析")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "场站编号", required = true, dataType = "string", paramType = "query")
+    })
+
+    public AjaxResult studygf(String wpId) throws Exception {
+
+
+        Map<String, Object> resultList = new LinkedHashMap<>();
+        if (StringUtils.notEmp(wpId)) {
+            resultList = studyelectricity.studyelectricity(wpId);
+        }
+
+        if (null != resultList) {
+            return AjaxResult.successData(200, resultList);
+        } else {
+            return AjaxResult.error(500, "操作失败");
+        }
+
+    }
 }

+ 83 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/CoulometricVo.java

@@ -0,0 +1,83 @@
+package com.gyee.runeconomy.dto;
+
+public class CoulometricVo {
+
+    /**
+     * 计划电量
+     */
+    private Double jhdl;
+
+    /**
+     * 实际电量
+     */
+    private Double sjdl;
+
+    /**
+     * 小时
+     */
+
+    private Integer hours;
+
+    /**
+     * 完成情况
+     */
+    private Double wcqk;
+
+    /**
+     * 日照强度
+     */
+    private Double rzqd;
+
+    /**
+     * 等效发电小时
+     */
+    private Double dxfdxs;
+
+    public Double getJhdl() {
+        return jhdl;
+    }
+
+    public void setJhdl(Double jhdl) {
+        this.jhdl = jhdl;
+    }
+
+    public Double getSjdl() {
+        return sjdl;
+    }
+
+    public void setSjdl(Double sjdl) {
+        this.sjdl = sjdl;
+    }
+
+    public Integer getHours() {
+        return hours;
+    }
+
+    public void setHours(Integer hours) {
+        this.hours = hours;
+    }
+
+    public Double getWcqk() {
+        return wcqk;
+    }
+
+    public void setWcqk(Double wcqk) {
+        this.wcqk = wcqk;
+    }
+
+    public Double getRzqd() {
+        return rzqd;
+    }
+
+    public void setRzqd(Double rzqd) {
+        this.rzqd = rzqd;
+    }
+
+    public Double getDxfdxs() {
+        return dxfdxs;
+    }
+
+    public void setDxfdxs(Double dxfdxs) {
+        this.dxfdxs = dxfdxs;
+    }
+}

+ 82 - 61
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Electricity/Electricityservice.java

@@ -3,6 +3,7 @@ package com.gyee.runeconomy.service.Electricity;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.util.DateUtils;
 import com.gyee.common.util.SortUtils;
+import com.gyee.runeconomy.dto.CoulometricVo;
 import com.gyee.runeconomy.dto.ElectricityVo;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
@@ -45,7 +46,7 @@ public class Electricityservice {
     private final String FD = "-1";
     private final String GF = "-2";
 
-    public    Map<String, Object>  planvalue(String wpId, String timetype) throws Exception {
+    public Map<String, Object> planvalue(String wpId, String timetype) throws Exception {
 
         List<ElectricityVo> vos = new ArrayList<ElectricityVo>();
         Map<String, Object> map = new LinkedHashMap<>();
@@ -157,15 +158,15 @@ public class Electricityservice {
 
 
                             //实际电量
-                            List<ProEconPowerstationInfoDay5> sjdlls = proEconPowerstationInfoDay5Service.getmax(wpls.getId(),firstDayZeroHour);
-                            if (!sjdlls.isEmpty() && sjdlls !=null) {
+                            List<ProEconPowerstationInfoDay5> sjdlls = proEconPowerstationInfoDay5Service.getmax(wpls.getId(), firstDayZeroHour);
+                            if (!sjdlls.isEmpty() && sjdlls != null) {
                                 bysjdlhjsum += sjdlls.get(0).getYfdldb().doubleValue();
                             }
 
                             //短期预测准确率和日发电量预测
-                            List<ProEconStationPower> dqycls =  powerService.getlist(wpls.getId(),firstDayZeroHour);
+                            List<ProEconStationPower> dqycls = powerService.getlist(wpls.getId(), firstDayZeroHour);
 
-                            if (!dqycls.isEmpty() && dqycls != null){
+                            if (!dqycls.isEmpty() && dqycls != null) {
                                 dqzqlsum = dqycls.stream().map(ProEconStationPower::getPowerAccuracy).reduce(BigDecimal.ZERO, BigDecimal::add);
                                 rfdlyclsum = dqycls.stream().map(ProEconStationPower::getDayPowerForecast).reduce(BigDecimal.ZERO, BigDecimal::add);
                             }
@@ -190,14 +191,14 @@ public class Electricityservice {
 //                        //添加实际电量
 //                        PointData data = edosUtil.getSectionData(month, endOfDayOfLastDayOfMonth.getTime());
 //                        PointData data = edosUtil.getSectionData(month, date1.getTime());
-                        vo.setSjdl(StringUtils.round(bysjdlhjsum /10000,2));
+                        vo.setSjdl(StringUtils.round(bysjdlhjsum / 10000, 2));
 
 
                         //添加当月占比
-                        vo.setDyzb(StringUtils.round(((bysjdlhjsum / 10000)/bnjhdlsum ) *100,0));
+                        vo.setDyzb(StringUtils.round(((bysjdlhjsum / 10000) / bnjhdlsum) * 100, 0));
 
                         //添加全年占比
-                        vo.setQnzb(StringUtils.round(((bysjdlhjsum / 10000) / yeardlsum) *100,0));
+                        vo.setQnzb(StringUtils.round(((bysjdlhjsum / 10000) / yeardlsum) * 100, 0));
 
                         //添加超短期准确率
                         vo.setDqzql(dqzqlsum);
@@ -209,7 +210,7 @@ public class Electricityservice {
 
                         vos.add(vo);
                         SortUtils.sort(vos, "hours", SortUtils.ASC);
-                        map.put("value",vos);
+                        map.put("value", vos);
                     }
 
                     double yeardlsum = 0.0;
@@ -231,8 +232,8 @@ public class Electricityservice {
 //                        PointData bnsjdlhj = edosUtil.getHistMatrix(nfdl, currentDate.getTime() / 1000);
 //                        bnsjdlhjsum += bnsjdlhj.getPointValueInDouble();
 
-                        List<ProEconPowerstationInfoDay5> sjdlls = proEconPowerstationInfoDay5Service.getmax(wpls.getId(),yearHour);
-                        bnsjdlhjsum +=  sjdlls.get(0).getNfdldb().doubleValue();
+                        List<ProEconPowerstationInfoDay5> sjdlls = proEconPowerstationInfoDay5Service.getmax(wpls.getId(), yearHour);
+                        bnsjdlhjsum += sjdlls.get(0).getNfdldb().doubleValue();
 
                         Calendar calendar1 = Calendar.getInstance();
                         calendar1.set(Calendar.DAY_OF_YEAR, 1);
@@ -243,16 +244,16 @@ public class Electricityservice {
 
                         Date firstDayOfYearZeroHour = calendar1.getTime();
 
-                        List<ProEconStationPower> dqyc =  powerService.getlist1(wpls.getId(),firstDayOfYearZeroHour);
-                        if (!dqyc.isEmpty() && dqyc!=null) {
+                        List<ProEconStationPower> dqyc = powerService.getlist1(wpls.getId(), firstDayOfYearZeroHour);
+                        if (!dqyc.isEmpty() && dqyc != null) {
                             dqzqlhjsum = dqyc.stream().map(ProEconStationPower::getPowerAccuracy).reduce(BigDecimal.ZERO, BigDecimal::add);
                             rfdlychjsum = dqyc.stream().map(ProEconStationPower::getDayPowerForecast).reduce(BigDecimal.ZERO, BigDecimal::add);
                         }
-                        map.put("bnjhdlhj",MathUtil.twoBit(yeardlsum));
-                        map.put("rfdlychj",rfdlychjsum);
-                        map.put("bnsjdlhj",MathUtil.twoBit(bnsjdlhjsum / 10000));
-                        map.put("qnzbhj",StringUtils.round(((bnsjdlhjsum / 10000) /yeardlsum) * 100,0));
-                        map.put("dqzqlhj",dqzqlhjsum);
+                        map.put("bnjhdlhj", MathUtil.twoBit(yeardlsum));
+                        map.put("rfdlychj", rfdlychjsum);
+                        map.put("bnsjdlhj", MathUtil.twoBit(bnsjdlhjsum / 10000));
+                        map.put("qnzbhj", StringUtils.round(((bnsjdlhjsum / 10000) / yeardlsum) * 100, 0));
+                        map.put("dqzqlhj", dqzqlhjsum);
 
                     }
 
@@ -260,19 +261,19 @@ public class Electricityservice {
             }
 
 
-
         }
         return map;
 
     }
 
-    public    Map<String, Object>  coulometric(String wpId) throws Exception {
+    public Map<String, Object> coulometric(String wpId) throws Exception {
 
-        List<ProBasicPowerstation> wplsG = CacheContext.wplsG.stream().filter(g->wpId.equals(g.getId())).collect(Collectors.toList());
-        List<ElectricityVo> vos = new ArrayList<ElectricityVo>();
+        List<ProBasicPowerstation> wplsG = CacheContext.wplsG.stream().filter(g -> wpId.equals(g.getId())).collect(Collectors.toList());
+        List<CoulometricVo> vos = new ArrayList<CoulometricVo>();
         Map<String, Object> map = new LinkedHashMap<>();
 
         int day = 0;
+        int ts = 1;
         //当前年份
         Calendar cal = Calendar.getInstance();
         int currentyear = cal.get(Calendar.YEAR);//本年
@@ -286,7 +287,6 @@ public class Electricityservice {
         calendar.set(Calendar.MINUTE, 0);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
-
         Date yearHour = calendar.getTime();
 
         // 获取当前日期
@@ -306,31 +306,42 @@ public class Electricityservice {
         // 获取firstDayZeroHour的月份
         Calendar calFirstDayZeroHour = Calendar.getInstance();
         calFirstDayZeroHour.setTime(firstDayZeroHour);
-        int currentMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
+        int calFirstMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
+
+        //当前时间月份
+        int currentMonth = calendar.get(Calendar.MONTH) + 1;
+
 
         // 将calendar2的时间设置回当前日期
         calendar2.setTime(new Date());
 
-        // 获取当前月份的天数
-        int ts = calendar2.getActualMaximum(Calendar.DAY_OF_MONTH);
+        //年电量
+        double yeardlsum = 0.0;
+
+        double bnsjdlhjsum = 0.0;
+
+        double bnrzqdhjsum = 0.0;
+
+        double dxxsssum = 0.0;
 
 
         for (int i = 1; i <= 12; i++) {
 
             //本月计划电量
             double byjhdlsum = 0.0;
-
-            //年电量
-            double yeardlsum = 0.0;
-
             //本月实际电量合计
             double bysjdlhjsum = 0.0;
-
+            double dxxss = 0.0;
             //本月日照强度合计
             double byrzqdhjsum = 0.0;
 
-            BigDecimal dqzqlsum = null;
-            BigDecimal rfdlyclsum = null;
+            if (calFirstMonth == currentMonth) {
+                Calendar calendar5 = Calendar.getInstance();
+                ts = calendar5.get(Calendar.DAY_OF_MONTH);
+            } else {
+                // 获取当前月份的天数
+                ts = calFirstDayZeroHour.getActualMaximum(Calendar.DAY_OF_MONTH);
+            }
 
             day = i;
             for (ProBasicPowerstation wpls : wplsG) {
@@ -338,65 +349,75 @@ public class Electricityservice {
                 //计划电量-循环所有场站当前月集合
                 List<ProBasicProjectPlan> currentls = proBasicProjectPlanService.getmonthList(String.valueOf(day));
 
-                List<ProBasicProjectPlan> yearls = proBasicProjectPlanService.getList(String.valueOf(currentyear));
-                List<ProBasicProjectPlan> yearjh = yearls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId()))
-                        .collect(Collectors.toList()); //当前场站1-12月所有集合
-
-                yeardlsum += yearjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本年计划电量合
-
-
                 //当前场站循环当前月
                 List<ProBasicProjectPlan> currentjh = currentls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
-                byjhdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本月计划电量合
+                byjhdlsum = currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本月计划电量合
 
 
                 //当前场站循环月实际电量
-                List<ProEconPowerstationInfoDay5> sjdlls = proEconPowerstationInfoDay5Service.getmax(wpls.getId(),firstDayZeroHour);
-                if (!sjdlls.isEmpty() && sjdlls !=null) {
-                    bysjdlhjsum += sjdlls.get(0).getYfdldb().doubleValue();
+                List<ProEconPowerstationInfoDay5> sjdlls = proEconPowerstationInfoDay5Service.getmax(wpls.getId(), firstDayZeroHour);
+                if (!sjdlls.isEmpty() && sjdlls != null) {
+                    bysjdlhjsum = sjdlls.get(0).getYfdldb().doubleValue();
                 }
 
                 //当前场站循环月日照强度
-                List<ProEconPowerstationInfoDay1> rzqdls = proEconPowerstationInfoDay1Service.getmax(wpls.getId(),firstDayZeroHour);
-                if (!rzqdls.isEmpty() && rzqdls !=null) {
-                    byrzqdhjsum += rzqdls.get(0).getYpjfs().doubleValue();
+                List<ProEconPowerstationInfoDay1> rzqdls = proEconPowerstationInfoDay1Service.getmax(wpls.getId(), firstDayZeroHour);
+                if (!rzqdls.isEmpty() && rzqdls != null) {
+                    byrzqdhjsum = rzqdls.get(0).getYpjfs().doubleValue();
                 }
 
+                dxxss = (bysjdlhjsum / 10000) / wpls.getJrCapacity() * ts * 24;
+                dxxsssum += StringUtils.round(dxxss,0);
             }
 
-//            int ts = daysInMonth;
 
-            ElectricityVo vo = new ElectricityVo();
+            CoulometricVo vo = new CoulometricVo();
 
             //添加计划电量
             vo.setJhdl(StringUtils.round(byjhdlsum, 2));
             vo.setHours(i);
             //添加实际电量
-            vo.setSjdl(StringUtils.round(bysjdlhjsum /10000,2));
+            vo.setSjdl(StringUtils.round(bysjdlhjsum / 10000, 2));
 
 
-            //添加当月占比
-            vo.setDyzb(StringUtils.round(((bysjdlhjsum / 10000)/byjhdlsum ) *100,0));
+            //添加完成情况
+            vo.setWcqk(StringUtils.round(((bysjdlhjsum / 10000) / byjhdlsum) * 100, 0));
 
-//            //添加全年占比
-//            vo.setQnzb(StringUtils.round(((bysjdlhjsum / 10000) / yeardlsum) *100,0));
+            //等效小时数
+            vo.setDxfdxs(StringUtils.round(dxxss,0));
 
-            //添加日发电量预测
-            vo.setRfdlyc(BigDecimal.valueOf(byrzqdhjsum));
+            //添加日照强度
+            vo.setRzqd(byrzqdhjsum);
 
 //            firstDayZeroHour = DateUtils.addMonths(firstDayZeroHour, +1);
-
             vos.add(vo);
             SortUtils.sort(vos, "hours", SortUtils.ASC);
-            map.put("value",vos);
-
+            map.put("value", vos);
 
             // 月份增加一个月
             firstDayZeroHour = DateUtils.addMonths(firstDayZeroHour, 1);
             calFirstDayZeroHour.setTime(firstDayZeroHour);
-            currentMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
+            calFirstMonth = calFirstDayZeroHour.get(Calendar.MONTH) + 1;
+            ts = calFirstDayZeroHour.getActualMaximum(Calendar.DAY_OF_MONTH);
         }
+        List<ProBasicProjectPlan> yearls = proBasicProjectPlanService.getList(String.valueOf(currentyear));
+        List<ProBasicProjectPlan> yearjh = yearls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpId)).collect(Collectors.toList());
+
+        yeardlsum = yearjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum();
+
+        List<ProEconPowerstationInfoDay5> sjdlls = proEconPowerstationInfoDay5Service.getmax(wpId, yearHour);
+        bnsjdlhjsum += sjdlls.get(0).getNfdldb().doubleValue();
+
+        List<ProEconPowerstationInfoDay1> rzqddlls = proEconPowerstationInfoDay1Service.getmax(wpId, yearHour);
+        bnrzqdhjsum += rzqddlls.get(0).getNpjfs().doubleValue();
+
+        map.put("jhdlhj",yeardlsum);
+        map.put("sjdlhj",StringUtils.round((bnsjdlhjsum / 10000),2));
+        map.put("wcqkhj",StringUtils.round(((bnsjdlhjsum / 10000) / yeardlsum) * 100,0));
+        map.put("rzqdhj",StringUtils.round(bnrzqdhjsum,2));
+        map.put("dxxsshj",StringUtils.round(dxxsssum,0));
+
         return map;
     }
 
-    }
+}

+ 107 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/StudyElectricity/StudyElectricityService.java

@@ -0,0 +1,107 @@
+package com.gyee.runeconomy.service.StudyElectricity;
+
+import com.gyee.common.util.DateUtils;
+import com.gyee.common.util.SortUtils;
+import com.gyee.runeconomy.dto.CoulometricVo;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
+import com.gyee.runeconomy.model.auto.ProBasicProjectPlan;
+import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay1;
+import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay5;
+import com.gyee.runeconomy.service.auto.IProBasicProjectPlanService;
+import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay1Service;
+import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay5Service;
+import com.gyee.runeconomy.util.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class StudyElectricityService {
+
+    @Resource
+    private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;
+
+    @Resource
+    private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;
+
+    @Resource
+    private IProBasicProjectPlanService proBasicProjectPlanService;
+
+
+    public Map<String, Object> studyelectricity(String wpId) throws Exception {
+
+        List<ProBasicPowerstation> wplsG = CacheContext.wplsG.stream().filter(g -> wpId.equals(g.getId())).collect(Collectors.toList());
+        List<CoulometricVo> vos = new ArrayList<CoulometricVo>();
+        Map<String, Object> map = new LinkedHashMap<>();
+        int day = 0;
+
+        // 获取当前日期
+        Calendar calendar2 = Calendar.getInstance();
+        calendar2.setTime(new Date());
+        // 设置为本年一月一号0点
+        calendar2.set(Calendar.MONTH, Calendar.JANUARY); // 0表示一月
+        calendar2.set(Calendar.DAY_OF_MONTH, 1);
+        calendar2.set(Calendar.HOUR_OF_DAY, 0);
+        calendar2.set(Calendar.MINUTE, 0);
+        calendar2.set(Calendar.SECOND, 0);
+        calendar2.set(Calendar.MILLISECOND, 0);
+        Date firstDayZeroHour = calendar2.getTime();
+
+        for (int i = 1; i <= 12; i++) {
+
+            //本月计划电量
+            double byjhdlsum = 0.0;
+            //本月实际电量合计
+            double bysjdlhjsum = 0.0;
+
+            //本月可研电量合计
+            double bykydlhjsum = 0.0;
+
+            day = i;
+            for (ProBasicPowerstation wpls : wplsG) {
+
+                //计划电量-循环所有场站当前月集合
+                List<ProBasicProjectPlan> currentls = proBasicProjectPlanService.getmonthList(String.valueOf(day));
+
+                //当前场站循环当前月
+                List<ProBasicProjectPlan> currentjh = currentls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
+                byjhdlsum = currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本月计划电量合
+
+
+                //当前场站循环月实际电量
+                List<ProEconPowerstationInfoDay5> sjdlls = proEconPowerstationInfoDay5Service.getmax(wpls.getId(), firstDayZeroHour);
+                if (!sjdlls.isEmpty() && sjdlls != null) {
+                    bysjdlhjsum = sjdlls.get(0).getYfdldb().doubleValue();
+                }
+
+                //当前场站循环月日照强度
+                List<ProEconPowerstationInfoDay1> rzqdls = proEconPowerstationInfoDay1Service.getmax(wpls.getId(), firstDayZeroHour);
+                if (!rzqdls.isEmpty() && rzqdls != null) {
+                    bykydlhjsum = rzqdls.get(0).getYpjfs().doubleValue();
+                }
+            }
+
+
+            CoulometricVo vo = new CoulometricVo();
+
+            //添加计划电量
+            vo.setJhdl(StringUtils.round(byjhdlsum, 2));
+            vo.setHours(i);
+            //添加实际电量
+            vo.setSjdl(StringUtils.round(bysjdlhjsum / 10000, 2));
+            //添加完成情况
+            vo.setWcqk(StringUtils.round(((bysjdlhjsum / 10000) / byjhdlsum) * 100, 0));
+            vos.add(vo);
+
+            SortUtils.sort(vos, "hours", SortUtils.ASC);
+            map.put("value", vos);
+            // 月份增加一个月
+            firstDayZeroHour = DateUtils.addMonths(firstDayZeroHour, 1);
+        }
+
+        return map;
+    }
+}

+ 65 - 42
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorService.java

@@ -750,6 +750,54 @@ public class MonitorService {
             List<ProBasicRegion> rgls = CacheContext.rgls;
             List<ProBasicCompany> cpls = CacheContext.cpls;
 
+            // 获取当前日期 暂时
+            Date currentDate8 = new Date();
+
+            // 创建 Calendar 对象,并设置为当前日期
+            Calendar calendar8 = Calendar.getInstance();
+            calendar8.setTime(currentDate8);
+
+            // 设置 beginDate 为前一天的早上六点
+            calendar8.add(Calendar.DAY_OF_MONTH, -1);
+            calendar8.set(Calendar.HOUR_OF_DAY, 6);
+            calendar8.set(Calendar.MINUTE, 0);
+            calendar8.set(Calendar.SECOND, 0);
+            calendar8.set(Calendar.MILLISECOND, 0);
+            Date beginDate8 = calendar8.getTime();
+
+            // 设置 endDate 为当天的23点59分59秒
+            calendar8.set(Calendar.HOUR_OF_DAY, 23);
+            calendar8.set(Calendar.MINUTE, 59);
+            calendar8.set(Calendar.SECOND, 59);
+            calendar8.set(Calendar.MILLISECOND, 999);
+            Date endDate8 = calendar8.getTime();
+            List<ProEconPowerstationInfoDay5> qwt1 = null;
+            QueryWrapper<ProEconPowerstationInfoDay5> qw1 = new QueryWrapper<>();
+            double rfdlsj = 0.0;
+           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, beginDate8, endDate8);
+
+            qwt1 = proEconPowerstationInfoDay5Service.list(qw1);
+
+            ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RFDL);
+            rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
+
+            List<ProEconPowerstationInfoDay5> qwt3 = null;
+
+            QueryWrapper<ProEconPowerstationInfoDay5> qw3 = new QueryWrapper<>();
+
+            qw3.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, wpId);
+            qw3.lambda().between(ProEconPowerstationInfoDay5::getRecordDate, beginDate8, endDate8);
+            qwt3 = proEconPowerstationInfoDay5Service.list(qw3);
+
+            double yfdl8 = 0.0;
+            double nfdl8 = 0.0;
             for (ProBasicEnergyGroup gp : gpls) {
                 if (wpId.contains(gp.getId())) {
                     qt.put("fdzzjrl", gp.getWindCapacity() / 1000);
@@ -762,8 +810,15 @@ public class MonitorService {
                     qt.put("fdzzjrl", rg.getJrwindCapacity() / 1000);
                     qt.put("gfzzjrl", rg.getJrCapacity() / 1000);
                     qt.put("zzjrl", (rg.getJrwindCapacity() + rg.getJrCapacity()) / 1000);
-                    qt.put("ylyxs", MathUtil.twoBit(yfdl / 1000) / ((rg.getJrwindCapacity() + rg.getJrCapacity()) / 1000));
-                    qt.put("nlyxs", MathUtil.twoBit(nfdl / 1000) / ((rg.getJrwindCapacity() + rg.getJrCapacity()) / 1000));
+//                    qt.put("ylyxs", MathUtil.twoBit(yfdl / 1000) / ((rg.getJrwindCapacity() + rg.getJrCapacity()) / 1000));
+
+                    for (ProEconPowerstationInfoDay5 dl :qwt1){
+                       StringUtils.round(yfdl8 += dl.getYfdldb().doubleValue(),2);
+                       StringUtils.round(nfdl8 += dl.getNfdldb().doubleValue(),2);
+                    }
+                    qt.put("ylyxs", StringUtils.round(((yfdl8 + rfdlsj) / 10000) / ((rg.getJrwindCapacity() + rg.getJrCapacity()) / 1000),2));
+//                    qt.put("nlyxs", MathUtil.twoBit(nfdl / 1000) / ((rg.getJrwindCapacity() + rg.getJrCapacity()) / 1000));
+                    qt.put("nlyxs", StringUtils.round(((nfdl8 + rfdlsj) / 10000) / ((rg.getJrwindCapacity() + rg.getJrCapacity()) / 1000),2));
                 }
             }
 
@@ -779,8 +834,14 @@ public class MonitorService {
             for (ProBasicPowerstation wp : wplist) {
                 if (wpId.contains(wp.getId())) {
 
-                    qt.put("ylyxs", MathUtil.twoBit(yfdl / 1000) / ((wp.getJrwindCapacity() + wp.getJrCapacity()) / 1000));
-                    qt.put("nlyxs", MathUtil.twoBit(nfdl / 1000) / ((wp.getJrwindCapacity() + wp.getJrCapacity()) / 1000));
+                    for (ProEconPowerstationInfoDay5 czdl :qwt3){
+                       yfdl8 = czdl.getYfdldb().doubleValue();
+                       nfdl8 = czdl.getNfdldb().doubleValue();
+                    }
+//                    qt.put("ylyxs", MathUtil.twoBit(yfdl / 1000) / ((wp.getJrwindCapacity() + wp.getJrCapacity()) / 1000));
+//                    qt.put("nlyxs", MathUtil.twoBit(nfdl / 1000) / ((wp.getJrwindCapacity() + wp.getJrCapacity()) / 1000));
+                    qt.put("ylyxs", MathUtil.twoBit((yfdl8 + rfdlsj) / 10000) / ((wp.getJrwindCapacity() + wp.getJrCapacity()) / 1000));
+                    qt.put("nlyxs", MathUtil.twoBit((nfdl8 + rfdlsj)/ 10000) / ((wp.getJrwindCapacity() + wp.getJrCapacity()) / 1000));
                 }
             }
             fnlyl= Math.random() * 10 + 90;
@@ -2044,25 +2105,6 @@ public class MonitorService {
             calendar5.set(Calendar.MILLISECOND, 999);
             Date endDate = calendar5.getTime();
 
-
-            Calendar calendar6 = Calendar.getInstance();
-            calendar6.setTime(currentDate5);
-
-            // 设置 beginDate 为前一天的早上六点
-            calendar6.add(Calendar.DAY_OF_MONTH, 0);
-            calendar6.set(Calendar.HOUR_OF_DAY, 6);
-            calendar6.set(Calendar.MINUTE, 0);
-            calendar6.set(Calendar.SECOND, 0);
-            calendar6.set(Calendar.MILLISECOND, 0);
-            Date beginDate1 = calendar6.getTime();
-
-            // 设置 endDate 为当天的23点59分59秒
-            calendar6.set(Calendar.HOUR_OF_DAY, 23);
-            calendar6.set(Calendar.MINUTE, 59);
-            calendar6.set(Calendar.SECOND, 59);
-            calendar6.set(Calendar.MILLISECOND, 999);
-            Date endDate1 = calendar6.getTime();
-
             List<ProEconPowerstationInfoDay5> qwt3 = null;
 
             QueryWrapper<ProEconPowerstationInfoDay5> qw3 = new QueryWrapper<>();
@@ -2093,7 +2135,6 @@ public class MonitorService {
                 Date previousDay = calendar.getTime();
                 List<ProEconTargetdataFrist> qwt = null;
                 List<ProEconPowerstationInfoDay5> qwt1 = null;
-                List<ProEconPowerstationInfoDay5> qwt2 = null;
 
                 double gfrlr = 0.0;
                 double gfylr = 0.0;
@@ -2127,24 +2168,6 @@ public class MonitorService {
 
                 qwt1 = proEconPowerstationInfoDay5Service.list(qw1);
 
-                QueryWrapper<ProEconPowerstationInfoDay5> qw2 = new QueryWrapper<>();
-
-                if (wpId.equals("KGDL_FGS0")){
-                    qw2.lambda().in(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_KGDL_GFFD_ZGS0", "SXJ_KGDL_FLFD_ZGS0");
-                } else if (wpId.equals("KGDL_FGS-1")) {
-                    qw2.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_KGDL_FLFD_ZGS0");
-                } else if (wpId.equals("KGDL_FGS-2")) {
-                    qw2.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_KGDL_GFFD_ZGS0");
-                }else if (wpId.equals("SXJ_RGN0")) {
-                    qw2.lambda().in(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_RGN-1", "SXJ_RGN-2");
-                } else if (wpId.equals("SXJ_RGN-1")) {
-                    qw2.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_RGN-1");
-                }else if (wpId.equals("SXJ_RGN-2")) {
-                    qw2.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_RGN-2");
-                }
-                qw2.lambda().between(ProEconPowerstationInfoDay5::getRecordDate, beginDate1, endDate1);
-                qwt2 = proEconPowerstationInfoDay5Service.list(qw2);
-
 
                 if (qwt != null) {
                     gfrlr = qwt.stream()

+ 11 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/StationMonitorService.java

@@ -229,8 +229,17 @@ public class StationMonitorService {
         resultMap.put("sspjfsgzd", realData.get(24).getPointValueInDouble());
         resultMap.put("yggl", MathUtil.twoBit(realData.get(25).getPointValueInDouble() /1000));
         resultMap.put("fhl", (proBasicPowerstation.getJrwindCapacity() + proBasicPowerstation.getJrCapacity()) != 0 ? realData.get(25).getPointValueInDouble() / (proBasicPowerstation.getJrwindCapacity() + proBasicPowerstation.getJrCapacity()) * 100 : 0);
-        resultMap.put("ylyxs", realData.get(26).getPointValueInDouble());
-        resultMap.put("nlyxs", realData.get(27).getPointValueInDouble());
+//        resultMap.put("ylyxs", realData.get(26).getPointValueInDouble());
+
+        BigDecimal zjrl = null;
+        if (proBasicPowerstation.getWindType().equals("-1")) {
+            zjrl = BigDecimal.valueOf(proBasicPowerstation.getJrwindCapacity() / 1000);
+        } else if (proBasicPowerstation.getWindType().equals("-2")) {
+            zjrl = BigDecimal.valueOf(proBasicPowerstation.getJrCapacity());
+        }
+        resultMap.put("ylyxs", yfdl1.add(BigDecimal.valueOf(rfdl)).divide(zjrl ,2, RoundingMode.HALF_UP));
+//        resultMap.put("nlyxs", realData.get(27).getPointValueInDouble());
+        resultMap.put("nlyxs", nfdl1.add(BigDecimal.valueOf(rfdl)).divide(zjrl ,2, RoundingMode.HALF_UP));
         resultMap.put("yfgnlyl", realData.get(28).getPointValueInDouble());
         resultMap.put("ysbklyl", realData.get(29).getPointValueInDouble());
         resultMap.put("ysbklyl",  Math.random() * 10 + 90);