浏览代码

明细矩阵预测功率取值调整

wangb@gyee-china.com 1 年之前
父节点
当前提交
d89841afa7
共有 1 个文件被更改,包括 73 次插入10 次删除
  1. 73 10
      web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MatrixService.java

+ 73 - 10
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MatrixService.java

@@ -4,6 +4,7 @@ package com.gyee.runeconomy.service.monitor;
 @date   2023/3/28-8:49
 */
 
+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.DoubleUtils;
@@ -12,9 +13,12 @@ import com.gyee.common.vo.monitor.MatrixLineVo;
 import com.gyee.common.vo.monitor.MatrixPowerVo;
 import com.gyee.common.vo.monitor.MatrixProVo;
 import com.gyee.common.vo.monitor.MatrixVo;
+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.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;
@@ -35,6 +39,15 @@ public class MatrixService {
     @Resource
     private TokenService tokenService;
 
+    @Resource
+    private IProBasicPowerPointService powerPointService;
+
+    @Resource
+    private IProBasicPowerstationPointService proBasicPowerstationPointService;
+
+    @Resource
+    private IProBasicPowerstationPointService pointService;
+
     public Map<String, Object> matrixMX(String company, String type) throws Exception {
 
         HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
@@ -171,7 +184,15 @@ public class MatrixService {
 
                     ProBasicPowerstationPoint agcPoint = powerstationPointMap.get(ContantXk.TPOINT_WP_AGC);
 
-                    ProBasicPowerstationPoint ycglPoint = powerstationPointMap.get(ContantXk.TPOINT_WP_YCGL);
+
+//                    ycgl.updateAndGet(v -> {
+//                        try {
+//                            return new Double((double) (v + edosUtil.getHistMatrix(ycglcd.getNemCode(), new Date().getTime() / 1000).getPointValueInDouble()));
+//                        } catch (Exception e) {
+//                            e.printStackTrace();
+//                        }
+//                        return v;
+//                    });
 
 
                     cxgl.updateAndGet(v -> {
@@ -190,18 +211,60 @@ public class MatrixService {
                         }
                         return v;
                     });
-                    ycgl.updateAndGet(v -> {
-                        try {
-                            return new Double((double) (v + edosUtil.getHistMatrix(ycglPoint.getNemCode(), new Date().getTime() / 1000).getPointValueInDouble()));
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                        return v;
-                    });
+//                    ycgl.updateAndGet(v -> {
+//                        try {
+//                            return new Double((double) (v + edosUtil.getHistMatrix(ycglPoint.getNemCode(), new Date().getTime() / 1000).getPointValueInDouble()));
+//                        } catch (Exception e) {
+//                            e.printStackTrace();
+//                        }
+//                        return v;
+//                    });
                 });
+
+                QueryWrapper<ProBasicPowerPoint> qw = new QueryWrapper<>();
+                List<ProBasicPowerPoint> powerls = new ArrayList<>();
+                List<ProBasicPowerPoint> qyls = null;
+                List<ProBasicProject> qcls = null;
+                powerls = powerPointService.getBaseMapper().selectList(qw);
+
+                qyls = powerls.stream().filter(c-> c.getWindpowerstationId().equals(wp.getId())).collect(Collectors.toList());
+
+                if (qyls.isEmpty() || qyls.size()<=0){
+                    qcls = CacheContext.pjls.stream().filter(p->wp.getId().equals(p.getWindpowerstationId())).collect(Collectors.toList());
+                    for (ProBasicProject p : qcls) {
+                        for (ProBasicPowerPoint a : powerls)
+                        {
+                            if (a.getWindpowerstationId().equals(p.getId())){
+                                qyls.add(a);
+                            }
+                        }
+                    }
+                }
+
+//                ProBasicPowerstationPoint ycglPoint = pointService.getPowerstationPoint.get(ContantXk.GLYC);
+
+                List<List<PowercurveVo>> ls = new ArrayList<>();
+
+                ProBasicPowerstationPoint ycglcd = null;
+
+                double sum = 0.0;
+                for (ProBasicPowerPoint pp: qyls){
+
+                    if (wp.getId().contains("MLJ_FDC_STA") ||wp.getId().contains("FS_GDC_STA"))continue;
+                    ycglcd = proBasicPowerstationPointService.getPowerstationPoint(pp.getWindpowerstationId(), ContantXk.GLYC);
+
+                    double aDouble = 0.0;
+                    try {
+                        aDouble = edosUtil.getHistMatrix(ycglcd.getNemCode(), new Date().getTime() / 1000).getPointValueInDouble();
+                        powerVo.setYcgl(aDouble + sum);
+                        sum += aDouble;
+                    } catch (Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                }
                 powerVo.setCxgl(cxgl.get());
                 powerVo.setAgc(agc.get());
-                powerVo.setYcgl(ycgl.get());
+//                powerVo.setYcgl(ycgl.get());
                 jrts.addAndGet(powerVo.getJrts());
                 dfts.addAndGet((int) wpRealdatas.get(0).getPointValueInDouble());
                 sdtj.addAndGet((int) wpRealdatas.get(1).getPointValueInDouble());