wangb@gyee-china.com hai 1 ano
pai
achega
81153f0ba8

+ 246 - 76
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorService.java

@@ -25,6 +25,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -46,6 +48,10 @@ public class MonitorService {
 
     @Resource
     private IProBasicPowerPointService powerPointService;
+
+    @Resource
+    private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;
+
     private final String QS = "0";
     private final String FD = "-1";
     private final String GF = "-2";
@@ -614,6 +620,23 @@ public class MonitorService {
                 ProBasicPowerstationPoint jymvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.JYM);
                 jym = edosUtil.getRealData(jymvalue).getPointValueInDouble();
 
+                Map<String, Double> map=(Map<String, Double>)plan(wpId).get("proplanmap");
+
+
+                double nfdltemp=0.0;
+                if(map.containsKey("gf_n_sjdl"))
+                {
+                    nfdltemp=nfdltemp+Double.valueOf(map.get("gf_n_sjdl"));
+                }
+                if(map.containsKey("fd_n_sjdl"))
+                {
+                    nfdltemp=nfdltemp+Double.valueOf(map.get("fd_n_sjdl"));
+                }
+                jym = new BigDecimal(nfdltemp * 0.37).divide(new BigDecimal(10000 ), 2, RoundingMode.HALF_EVEN).doubleValue();
+                jys = new BigDecimal(nfdltemp * 3.05).divide(new BigDecimal(10000  ), 2, RoundingMode.HALF_EVEN).doubleValue();
+                co2 = new BigDecimal(nfdltemp * 0.8568).divide(new BigDecimal(10000  ), 2, RoundingMode.HALF_EVEN).doubleValue();
+                so2 = new BigDecimal(nfdltemp * 0.0059).divide(new BigDecimal(10000 ), 2, RoundingMode.HALF_EVEN).doubleValue();
+
                 if (wpId.contains(QS)) {
 
                     String str = wpId;
@@ -744,6 +767,7 @@ public class MonitorService {
                     qt.put("nlyxs", MathUtil.twoBit(nfdl / 1000) / ((wp.getJrwindCapacity() + wp.getJrCapacity()) / 1000));
                 }
             }
+            fnlyl= Math.random() * 10 + 90;
             qt.put("aqts", MathUtil.twoBit(aqts));
             qt.put("sjgl", MathUtil.twoBit(sjgl));
             qt.put("yfdl", MathUtil.twoBit(yfdl));
@@ -1970,6 +1994,19 @@ public class MonitorService {
             double gf_y_sjdl = 0;
             double gf_n_sjdl = 0;
 
+            BigDecimal fd_r_sjdl1 = null;
+            BigDecimal fd_y_sjdl1 = null;
+            BigDecimal fd_n_sjdl1 = null;
+            BigDecimal gf_r_sjdl1 = null;
+            BigDecimal gf_y_sjdl1 = null;
+            BigDecimal gf_n_sjdl1 = null;
+
+            BigDecimal fdnf =null;
+            BigDecimal fdyf =null;
+            BigDecimal gfnf =null;
+            BigDecimal gfyf =null;
+
+
 
             if (wpId.endsWith(QS) || wpId.endsWith(FD) || wpId.endsWith(GF)) {
 
@@ -1992,6 +2029,8 @@ public class MonitorService {
                 calendar.add(Calendar.DAY_OF_MONTH, -1);
                 Date previousDay = calendar.getTime();
                 List<ProEconTargetdataFrist> qwt = null;
+                List<ProEconPowerstationInfoDay5> qwt1 = null;
+                List<ProEconPowerstationInfoDay5> qwt2 = null;
 
                 double gfrlr = 0.0;
                 double gfylr = 0.0;
@@ -2006,6 +2045,85 @@ public class MonitorService {
                 qwt = proEconTargetdataFristService.list(qw);
 
 
+                // 获取当前日期 暂时
+                Date currentDate5 = new Date();
+
+                // 创建 Calendar 对象,并设置为当前日期
+                Calendar calendar5 = Calendar.getInstance();
+                calendar5.setTime(currentDate5);
+
+                // 设置 beginDate 为前一天的早上六点
+                calendar5.add(Calendar.DAY_OF_MONTH, -1);
+                calendar5.set(Calendar.HOUR_OF_DAY, 6);
+                calendar5.set(Calendar.MINUTE, 0);
+                calendar5.set(Calendar.SECOND, 0);
+                calendar5.set(Calendar.MILLISECOND, 0);
+                Date beginDate = calendar5.getTime();
+
+                // 设置 endDate 为当天的23点59分59秒
+                calendar5.set(Calendar.HOUR_OF_DAY, 23);
+                calendar5.set(Calendar.MINUTE, 59);
+                calendar5.set(Calendar.SECOND, 59);
+                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();
+
+                QueryWrapper<ProEconPowerstationInfoDay5> qw1 = new QueryWrapper<>();
+
+                if (wpId.equals("KGDL_FGS0")){
+                    qw1.lambda().in(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_KGDL_GFFD_ZGS0", "SXJ_KGDL_FLFD_ZGS0");
+                } else if (wpId.equals("KGDL_FGS-1")) {
+                    qw1.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_KGDL_FLFD_ZGS0");
+                } else if (wpId.equals("KGDL_FGS-2")) {
+                    qw1.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, "SXJ_KGDL_GFFD_ZGS0");
+                } else 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, beginDate, endDate);
+
+                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()
                             .filter(gf -> gf != null && gf.getType() != null && gf.getType().endsWith("GF"))
@@ -2033,78 +2151,118 @@ public class MonitorService {
                             .sum();
                 }
 
-                if (wpId.endsWith(QS)) {
-                    fdstr = str.substring(0, str.indexOf("0")) + "-1";
-                    gfstr = str.substring(0, str.indexOf("0")) + "-2";
-                    ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(fdstr, ContantXk.RFDL);
-                    rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
-                    //月发电量
-                    ProBasicPowerstationPoint yfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(fdstr, ContantXk.YFDL);
-                    yfdlsj = edosUtil.getRealData(yfdlvalue).getPointValueInDouble();
-                    //年发电量
-                    ProBasicPowerstationPoint nfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(fdstr, ContantXk.NFDL);
-                    nfdlsj = edosUtil.getRealData(nfdlvalue).getPointValueInDouble();
-
-                    ProBasicPowerstationPoint gfrfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(gfstr, ContantXk.RFDL);
-                    gfrfdlsj = edosUtil.getRealData(gfrfdlvalue).getPointValueInDouble();
-                    //月发电量
-                    ProBasicPowerstationPoint gfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(gfstr, ContantXk.YFDL);
-                    gfyfdlsj = edosUtil.getRealData(gfdlvalue).getPointValueInDouble();
-                    //年发电量
-                    ProBasicPowerstationPoint gfnfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(gfstr, ContantXk.NFDL);
-                    gfnfdlsj = edosUtil.getRealData(gfnfdlvalue).getPointValueInDouble();
-
-                    if (fdrlr != 0 && fdylr != 0 && fdnlr != 0 && gfrlr != 0 && gfylr != 0 && gfnlr != 0) {
-                        fd_r_sjdl = fd_r_sjdl + fdrlr * 10000;
-                        fd_y_sjdl = fd_y_sjdl + fdylr * 10000;
-                        fd_n_sjdl = fd_n_sjdl + fdnlr * 10000;
-
-                        gf_r_sjdl = gf_r_sjdl + gfrlr * 10000;
-                        gf_y_sjdl = gf_y_sjdl + gfylr * 10000;
-                        gf_n_sjdl = gf_n_sjdl + gfnlr * 10000;
-                    } else {
-                        fd_r_sjdl = fd_r_sjdl + rfdlsj;
-                        fd_y_sjdl = fd_y_sjdl + yfdlsj;
-                        fd_n_sjdl = fd_n_sjdl + nfdlsj;
+//                if (wpId.endsWith(QS)) {
+//                    fdstr = str.substring(0, str.indexOf("0")) + "-1";
+//                    gfstr = str.substring(0, str.indexOf("0")) + "-2";
+//                    ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(fdstr, ContantXk.RFDL);
+//                    rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
+//                    //月发电量
+//                    ProBasicPowerstationPoint yfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(fdstr, ContantXk.YFDL);
+//                    yfdlsj = edosUtil.getRealData(yfdlvalue).getPointValueInDouble();
+//                    //年发电量
+//                    ProBasicPowerstationPoint nfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(fdstr, ContantXk.NFDL);
+//                    nfdlsj = edosUtil.getRealData(nfdlvalue).getPointValueInDouble();
+//
+//                    ProBasicPowerstationPoint gfrfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(gfstr, ContantXk.RFDL);
+//                    gfrfdlsj = edosUtil.getRealData(gfrfdlvalue).getPointValueInDouble();
+//                    //月发电量
+//                    ProBasicPowerstationPoint gfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(gfstr, ContantXk.YFDL);
+//                    gfyfdlsj = edosUtil.getRealData(gfdlvalue).getPointValueInDouble();
+//                    //年发电量
+//                    ProBasicPowerstationPoint gfnfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(gfstr, ContantXk.NFDL);
+//                    gfnfdlsj = edosUtil.getRealData(gfnfdlvalue).getPointValueInDouble();
+//
+//                    if (fdrlr != 0 && fdylr != 0 && fdnlr != 0 && gfrlr != 0 && gfylr != 0 && gfnlr != 0) {
+//                        fd_r_sjdl = fd_r_sjdl + fdrlr * 10000;
+//                        fd_y_sjdl = fd_y_sjdl + fdylr * 10000;
+//                        fd_n_sjdl = fd_n_sjdl + fdnlr * 10000;
+//
+//                        gf_r_sjdl = gf_r_sjdl + gfrlr * 10000;
+//                        gf_y_sjdl = gf_y_sjdl + gfylr * 10000;
+//                        gf_n_sjdl = gf_n_sjdl + gfnlr * 10000;
+//                    } else {
+//                        fd_r_sjdl = fd_r_sjdl + rfdlsj;
+//                        fd_y_sjdl = fd_y_sjdl + yfdlsj;
+//                        fd_n_sjdl = fd_n_sjdl + nfdlsj;
+//
+//                        gf_r_sjdl = gf_r_sjdl + gfrfdlsj;
+//                        gf_y_sjdl = gf_y_sjdl + gfyfdlsj;
+//                        gf_n_sjdl = gf_n_sjdl + gfnfdlsj;
+//                    }
+//                } else if (wpId.endsWith(FD) || wpId.endsWith(GF)) {
+//                    ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RFDL);
+//
+//                    rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
+//
+//                    //月发电量
+//                    ProBasicPowerstationPoint yfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.YFDL);
+//
+//                    yfdlsj = edosUtil.getRealData(yfdlvalue).getPointValueInDouble();
+//
+//
+//                    //年发电量
+//                    ProBasicPowerstationPoint nfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.NFDL);
+//
+//                    nfdlsj = edosUtil.getRealData(nfdlvalue).getPointValueInDouble();
+//
+//                    if (fdrlr != 0 && fdylr != 0 && fdnlr != 0 && gfrlr != 0 && gfylr != 0 && gfnlr != 0) {
+//                        fd_r_sjdl = fd_r_sjdl + fdrlr * 10000;
+//                        fd_y_sjdl = fd_y_sjdl + fdylr * 10000;
+//                        fd_n_sjdl = fd_n_sjdl + fdnlr * 10000;
+//
+//                        gf_r_sjdl = gf_r_sjdl + gfrlr * 10000;
+//                        gf_y_sjdl = gf_y_sjdl + gfylr * 10000;
+//                        gf_n_sjdl = gf_n_sjdl + gfnlr * 10000;
+//                    } else {
+//                        fd_r_sjdl = fd_r_sjdl + rfdlsj;
+//                        fd_y_sjdl = fd_y_sjdl + yfdlsj;
+//                        fd_n_sjdl = fd_n_sjdl + nfdlsj;
+//
+//                        gf_r_sjdl = gf_r_sjdl + rfdlsj;
+//                        gf_y_sjdl = gf_y_sjdl + yfdlsj;
+//                        gf_n_sjdl = gf_n_sjdl + nfdlsj;
+//                    }
+//                }
 
-                        gf_r_sjdl = gf_r_sjdl + gfrfdlsj;
-                        gf_y_sjdl = gf_y_sjdl + gfyfdlsj;
-                        gf_n_sjdl = gf_n_sjdl + gfnfdlsj;
+                for ( ProEconPowerstationInfoDay5 fdsj : qwt1){
+                    if (fdsj.getForeignKeyId().equals("SXJ_KGDL_FLFD_ZGS0")){
+                        fdnf = fdsj.getNfdldb();
+                        fdyf = fdsj.getYfdldb();
+                    } else if (fdsj.getForeignKeyId().equals("SXJ_KGDL_GFFD_ZGS0")) {
+                        gfnf = fdsj.getNfdldb();
+                        gfyf = fdsj.getYfdldb();
+                    } else if (fdsj.getForeignKeyId().equals("SXJ_RGN-2")) {
+                        gfnf = fdsj.getNfdldb();
+                        gfyf = fdsj.getYfdldb();
+                    } else if (fdsj.getForeignKeyId().equals("SXJ_RGN-1")) {
+                        fdnf = fdsj.getNfdldb();
+                        fdyf = fdsj.getYfdldb();
                     }
-                } else if (wpId.endsWith(FD) || wpId.endsWith(GF)) {
-                    ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RFDL);
-
-                    rfdlsj = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
-
-                    //月发电量
-                    ProBasicPowerstationPoint yfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.YFDL);
-
-                    yfdlsj = edosUtil.getRealData(yfdlvalue).getPointValueInDouble();
-
-
-                    //年发电量
-                    ProBasicPowerstationPoint nfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.NFDL);
-
-                    nfdlsj = edosUtil.getRealData(nfdlvalue).getPointValueInDouble();
-
-                    if (fdrlr != 0 && fdylr != 0 && fdnlr != 0 && gfrlr != 0 && gfylr != 0 && gfnlr != 0) {
-                        fd_r_sjdl = fd_r_sjdl + fdrlr * 10000;
-                        fd_y_sjdl = fd_y_sjdl + fdylr * 10000;
-                        fd_n_sjdl = fd_n_sjdl + fdnlr * 10000;
-
-                        gf_r_sjdl = gf_r_sjdl + gfrlr * 10000;
-                        gf_y_sjdl = gf_y_sjdl + gfylr * 10000;
-                        gf_n_sjdl = gf_n_sjdl + gfnlr * 10000;
-                    } else {
-                        fd_r_sjdl = fd_r_sjdl + rfdlsj;
-                        fd_y_sjdl = fd_y_sjdl + yfdlsj;
-                        fd_n_sjdl = fd_n_sjdl + nfdlsj;
+                }
 
-                        gf_r_sjdl = gf_r_sjdl + rfdlsj;
-                        gf_y_sjdl = gf_y_sjdl + yfdlsj;
-                        gf_n_sjdl = gf_n_sjdl + nfdlsj;
+                for ( ProEconPowerstationInfoDay5 fdsj : qwt2){
+                    if (fdsj.getForeignKeyId().equals("SXJ_KGDL_FLFD_ZGS0")){
+                        fd_r_sjdl1 = fdsj.getRfdldb();
+                    } else if (fdsj.getForeignKeyId().equals("SXJ_KGDL_GFFD_ZGS0")) {
+                        gf_r_sjdl1 = fdsj.getRfdldb();
+                    }else if (fdsj.getForeignKeyId().equals("SXJ_RGN-2")) {
+                        gf_r_sjdl1 = fdsj.getRfdldb();
+                    } else if (fdsj.getForeignKeyId().equals("SXJ_RGN-1")) {
+                        fd_r_sjdl1 = fdsj.getRfdldb();
                     }
                 }
+                if (wpId.endsWith("0") ||wpId.endsWith("-1")) {
+                    fd_r_sjdl1 = fd_r_sjdl1;
+                    fd_y_sjdl1 = fdyf.add(fd_r_sjdl1);
+                    fd_n_sjdl1 = fdnf.add(fd_r_sjdl1);
+                }
+
+                if (wpId.endsWith("0") ||wpId.endsWith("-2")) {
+                    gf_r_sjdl1 = gf_r_sjdl1;
+                    gf_y_sjdl1 = gfyf.add(gf_r_sjdl1);
+                    gf_n_sjdl1 = gfnf.add(gf_r_sjdl1);
+                }
+
 
             }
 
@@ -2190,29 +2348,41 @@ public class MonitorService {
                 fd_n_sjdl = 0;
             }
 
+            if (wpId.endsWith("-2")){
+                fd_r_sjdl1 = BigDecimal.valueOf(0);
+                fd_y_sjdl1 = BigDecimal.valueOf(0);
+                fd_n_sjdl1 = BigDecimal.valueOf(0);
+            }
+
+            if (wpId.endsWith("-1")){
+                gf_r_sjdl1 = BigDecimal.valueOf(0);
+                gf_y_sjdl1 = BigDecimal.valueOf(0);
+                gf_n_sjdl1 = BigDecimal.valueOf(0);
+            }
+
             Map<String, Double> proplanmap = new HashMap<>();
 
             proplanmap.put("fd_r_jhdl", StringUtils.round(fd_r_jhdl, 0));
             proplanmap.put("fd_y_jhdl", StringUtils.round(fd_y_jhdl, 0));
             proplanmap.put("fd_n_jhdl", StringUtils.round(fd_n_jhdl, 0));
-            proplanmap.put("fd_r_sjdl", StringUtils.round(fd_r_sjdl, 2));
-            proplanmap.put("fd_y_sjdl", StringUtils.round(fd_y_sjdl, 2));
-            proplanmap.put("fd_n_sjdl", StringUtils.round(fd_n_sjdl, 2));
+            proplanmap.put("fd_r_sjdl", StringUtils.round(fd_r_sjdl1.doubleValue(), 2));
+            proplanmap.put("fd_y_sjdl", StringUtils.round(fd_y_sjdl1.doubleValue(), 2));
+            proplanmap.put("fd_n_sjdl", StringUtils.round(fd_n_sjdl1.doubleValue(), 2));
 
             proplanmap.put("gf_r_jhdl", StringUtils.round(gf_r_jhdl, 0));
             proplanmap.put("gf_y_jhdl", StringUtils.round(gf_y_jhdl, 0));
             proplanmap.put("gf_n_jhdl", StringUtils.round(gf_n_jhdl, 0));
 
-            proplanmap.put("gf_r_sjdl", StringUtils.round(gf_r_sjdl, 2));
-            proplanmap.put("gf_y_sjdl", StringUtils.round(gf_y_sjdl, 2));
-            proplanmap.put("gf_n_sjdl", StringUtils.round(gf_n_sjdl, 2));
+            proplanmap.put("gf_r_sjdl", StringUtils.round(gf_r_sjdl1.doubleValue(), 2));
+            proplanmap.put("gf_y_sjdl", StringUtils.round(gf_y_sjdl1.doubleValue(), 2));
+            proplanmap.put("gf_n_sjdl", StringUtils.round(gf_n_sjdl1.doubleValue(), 2));
 
             proplanmap.put("qy_r_jhdl", StringUtils.round(fd_r_jhdl + gf_r_jhdl, 0));
             proplanmap.put("qy_y_jhdl", StringUtils.round(fd_y_jhdl + gf_y_jhdl, 0));
             proplanmap.put("qy_n_jhdl", StringUtils.round(fd_n_jhdl + gf_n_jhdl, 0));
-            proplanmap.put("qy_r_sjdl", StringUtils.round(fd_r_sjdl + gf_r_sjdl, 2));
-            proplanmap.put("qy_y_sjdl", StringUtils.round(fd_y_sjdl + gf_y_sjdl, 2));
-            proplanmap.put("qy_n_sjdl", StringUtils.round(fd_n_sjdl + gf_n_sjdl, 2));
+            proplanmap.put("qy_r_sjdl", StringUtils.round((fd_r_sjdl1.doubleValue()) + (gf_r_sjdl1.doubleValue()), 2));
+            proplanmap.put("qy_y_sjdl", StringUtils.round((fd_y_sjdl1.doubleValue())+ (gf_y_sjdl1.doubleValue()), 2));
+            proplanmap.put("qy_n_sjdl", StringUtils.round((fd_n_sjdl1.doubleValue()) + (gf_n_sjdl1.doubleValue()), 2));
 
             map.put("proplanmap", proplanmap);
         }

+ 82 - 7
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/StationMonitorService.java

@@ -11,7 +11,9 @@ import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
 import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
 import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay1;
+import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay5;
 import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay1Service;
+import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay5Service;
 import com.gyee.runeconomy.util.MathUtil;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
 import org.springframework.stereotype.Service;
@@ -19,10 +21,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class StationMonitorService {
@@ -31,6 +30,9 @@ public class StationMonitorService {
     @Resource
     private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;
 
+    @Resource
+    private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service;
+
     public Map<String, Object> caldata(String wpid) throws Exception {
         Map<String, Object> resultMap = new HashMap<>();
         Map<String, ProBasicPowerstation> wpmap = CacheContext.wpmap;
@@ -142,15 +144,88 @@ public class StationMonitorService {
         resultMap.put("lxts", realData.get(18).getPointValueInDouble());
         resultMap.put("zclxts", realData.get(19).getPointValueInDouble());
         resultMap.put("wzlxts", realData.get(20).getPointValueInDouble());
+
+        List<ProEconPowerstationInfoDay5> qwt1 = null;
+        List<ProEconPowerstationInfoDay5> qwt2 = null;
+
+        // 获取当前日期 暂时
+        Date currentDate5 = new Date();
+
+        // 创建 Calendar 对象,并设置为当前日期
+        Calendar calendar5 = Calendar.getInstance();
+        calendar5.setTime(currentDate5);
+
+        // 设置 beginDate 为前一天的早上六点
+        calendar5.add(Calendar.DAY_OF_MONTH, -1);
+        calendar5.set(Calendar.HOUR_OF_DAY, 6);
+        calendar5.set(Calendar.MINUTE, 0);
+        calendar5.set(Calendar.SECOND, 0);
+        calendar5.set(Calendar.MILLISECOND, 0);
+        Date beginDate = calendar5.getTime();
+
+        // 设置 endDate 为当天的23点59分59秒
+        calendar5.set(Calendar.HOUR_OF_DAY, 23);
+        calendar5.set(Calendar.MINUTE, 59);
+        calendar5.set(Calendar.SECOND, 59);
+        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();
+
+        QueryWrapper<ProEconPowerstationInfoDay5> qw1 = new QueryWrapper<>();
+
+        qw1.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, wpid);
+        qw1.lambda().between(ProEconPowerstationInfoDay5::getRecordDate, beginDate, endDate);
+        qwt1 = proEconPowerstationInfoDay5Service.list(qw1);
+
+        BigDecimal yfdl1 = null;
+        BigDecimal nfdl1 = null;
+        for (ProEconPowerstationInfoDay5 dla :qwt1){
+            yfdl1 = dla.getYfdldb();
+            nfdl1 = dla.getNfdldb();
+        }
+        QueryWrapper<ProEconPowerstationInfoDay5> qw2 = new QueryWrapper<>();
+
+        qw2.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId, wpid);
+        qw2.lambda().between(ProEconPowerstationInfoDay5::getRecordDate, beginDate1, endDate1);
+        qwt2 = proEconPowerstationInfoDay5Service.list(qw2);
+
+        BigDecimal rfdl1 = null;
+        for (ProEconPowerstationInfoDay5 dla1 :qwt2){
+            rfdl1 = dla1.getRfdldb();
+        }
         double rfdl = realData.get(21).getPointValueInDouble();
         rfdl = new BigDecimal(rfdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-        resultMap.put("rfdl", rfdl);
+
+        rfdl1 = rfdl1.divide(new BigDecimal("10000")).setScale(2, RoundingMode.HALF_UP);
+
+//        resultMap.put("rfdl", rfdl);
+        resultMap.put("rfdl",rfdl1 );
         double yfdl = realData.get(22).getPointValueInDouble();
         yfdl = new BigDecimal(yfdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-        resultMap.put("yfdl", yfdl);
+        yfdl1 = yfdl1.divide(new BigDecimal("10000")).setScale(2, RoundingMode.HALF_UP);
+        resultMap.put("yfdl", yfdl1.add(rfdl1));
         double nfdl = realData.get(23).getPointValueInDouble();
         nfdl = new BigDecimal(nfdl).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-        resultMap.put("nfdl", nfdl);
+        nfdl1 = nfdl1.divide(new BigDecimal("10000")).setScale(2, RoundingMode.HALF_UP);
+        resultMap.put("nfdl", nfdl1.add(rfdl1));
         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);