Browse Source

功率曲线

wangb@gyee-china.com 1 year ago
parent
commit
12900c883b

+ 27 - 30
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/Economic/EconomicController.java

@@ -1,11 +1,10 @@
 package com.gyee.runeconomy.controller.Economic;
 
 import com.gyee.common.model.StringUtils;
-import com.gyee.common.vo.curve.CurveVo;
+import com.gyee.runeconomy.dto.Glqx;
 import com.gyee.runeconomy.dto.PowercurveVo;
 import com.gyee.runeconomy.dto.R;
 import com.gyee.runeconomy.dto.ResultMsg;
-import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.service.Economic.EconomicService;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.log4j.Log4j2;
@@ -15,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -92,36 +90,35 @@ public class EconomicController {
                               @RequestParam(value = "starttime", required = false) String starttime,
                               @RequestParam(value = "endtime", required = false) String  endtime,
                               @RequestParam(value = "dateType", required = false) String dateType
-    ) {
-        Map<String, List<List<CurveVo>>> curvefitting = null;
+    ) throws Exception {
+        Map<String, List<List<Glqx>>> curvefitting = null;
         if(StringUtils.isEmpty(type)) type = "-2";
         if(StringUtils.isEmpty(dateType)) dateType = "1";
-        try {
-            if (StringUtils.isNotEmpty(windturbineids)) {
-
-            } else if (StringUtils.isNotEmpty(wpids)) {
-                windturbineids = CacheContext.organizeEquipmentList.stream().filter(oe -> wpids.contains(oe.getWindpowerstationId()))
-                        .map(oe -> oe.getWindturbineId()).collect(Collectors.joining(","));
-            } else if (StringUtils.isNotEmpty(companys)) {
-                String[] split = companys.split(",");
-                if (companys.contains("RGN")) {
-                    for (String s : split) {
-                        if(s.endsWith("RGN")){
-                            windturbineids = CacheContext.organizeEquipmentList.stream().filter(oe -> s.equals(oe.getRegionId()))
-                                    .map(oe -> oe.getWindturbineId()).collect(Collectors.joining(","));
-                        }
-                    }
-                } else {
-                    windturbineids = CacheContext.organizeEquipmentList.stream().filter(oe -> companys.contains(oe.getCompanyId()))
-                            .map(oe -> oe.getWindturbineId()).collect(Collectors.joining(","));
-                }
-            }
+//        try {
+//            if (StringUtils.isNotEmpty(windturbineids)) {
+//
+//            } else if (StringUtils.isNotEmpty(wpids)) {
+//                windturbineids = CacheContext.organizeEquipmentList.stream().filter(oe -> wpids.contains(oe.getWindpowerstationId()))
+//                        .map(oe -> oe.getWindturbineId()).collect(Collectors.joining(","));
+//            } else if (StringUtils.isNotEmpty(companys)) {
+//                String[] split = companys.split(",");
+//                if (companys.contains("RGN")) {
+//                    for (String s : split) {
+//                        if(s.endsWith("RGN")){
+//                            windturbineids = CacheContext.organizeEquipmentList.stream().filter(oe -> s.equals(oe.getRegionId()))
+//                                    .map(oe -> oe.getWindturbineId()).collect(Collectors.joining(","));
+//                        }
+//                    }
+//                } else {
+//                    windturbineids = CacheContext.organizeEquipmentList.stream().filter(oe -> companys.contains(oe.getCompanyId()))
+//                            .map(oe -> oe.getWindturbineId()).collect(Collectors.joining(","));
+//                }
+//            }
 
-            curvefitting = economicService.curveFittingList(windturbineids, type, starttime,endtime,dateType);
+            curvefitting = economicService.curveFittingList(wpids, type, starttime,endtime,dateType);
             return R.data(ResultMsg.ok(curvefitting));
-        } catch (Exception e) {
-            e.printStackTrace();
-            return R.data(ResultMsg.error());
-        }
+//        } catch (Exception e) {
+//            e.printStackTrace();
+        //        }
     }
 }

+ 49 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/dto/Glqx.java

@@ -0,0 +1,49 @@
+package com.gyee.runeconomy.dto;
+
+public class Glqx {
+    private String id;
+    private String name;
+    private Double sjgl;
+    private Double ycgl;
+    private String time;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Double getSjgl() {
+        return sjgl;
+    }
+
+    public void setSjgl(Double sjgl) {
+        this.sjgl = sjgl;
+    }
+
+    public Double getYcgl() {
+        return ycgl;
+    }
+
+    public void setYcgl(Double ycgl) {
+        this.ycgl = ycgl;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    public void setTime(String time) {
+        this.time = time;
+    }
+}

+ 51 - 28
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/Economic/EconomicService.java

@@ -2,12 +2,15 @@ package com.gyee.runeconomy.service.Economic;
 
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
-import com.gyee.common.vo.curve.CurveVo;
 import com.gyee.runeconomy.dto.EconomicVo;
+import com.gyee.runeconomy.dto.Glqx;
 import com.gyee.runeconomy.dto.PowercurveVo;
 import com.gyee.runeconomy.dto.WxssVo;
 import com.gyee.runeconomy.init.CacheContext;
-import com.gyee.runeconomy.model.auto.*;
+import com.gyee.runeconomy.model.auto.ProBasicEquipmentPoint;
+import com.gyee.runeconomy.model.auto.ProBasicOrganizeTree;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
+import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay1;
 import com.gyee.runeconomy.service.auto.*;
 import com.gyee.runeconomy.util.DateUtils;
 import com.gyee.runeconomy.util.StringUtils;
@@ -343,42 +346,62 @@ public class EconomicService {
 
 
 
-    public Map<String, List<List<CurveVo>>> curveFittingList(String windturbineIds, String type, String starttime, String endtime, String dateType) throws Exception {
-        Map<String, List<List<CurveVo>>> resultMap = new HashMap<>();
+    public Map<String, List<List<Glqx>>> curveFittingList(String wpids, String type, String starttime, String endtime, String dateType) throws Exception {
+        Map<String, List<List<Glqx>>> resultMap = new HashMap<>();
         Map<String, ProBasicOrganizeTree> wtmap = CacheContext.wtmap;
 
-        Date beginDate = com.gyee.common.util.DateUtils.getSamedayZero();   //当日零点
-        Date endDate = com.gyee.common.util.DateUtils.getCurrentDate();   //当前时间
+        List<ProBasicOrganizeTree> wtls = CacheContext.wtls;
+        List<EconomicVo> wt = new ArrayList<>();
+
+//        Date beginDate = com.gyee.common.util.DateUtils.getSamedayZero();   //当日零点
+//        Date endDate = com.gyee.common.util.DateUtils.getCurrentDate();   //当前时间
+
+        Date beginDate = DateUtils.parseDate(starttime);
+        Date endDate = DateUtils.parseDate(endtime);
 
         if (type.equals("-2")) {
 
-            ProBasicEquipmentPoint sjgl = proBasicEquipmentPointService.getEquipmentPoint(windturbineIds, ContantXk.SSZGL);
-            ProBasicEquipmentPoint ycgl = proBasicEquipmentPointService.getEquipmentPoint(windturbineIds, ContantXk.ZYCGL);
-            List<CurveVo> vo = new ArrayList<CurveVo>();
-            List< List<CurveVo> > tempList = new ArrayList<>();
-            List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
-            double temp1 = 0;
-            for (int i = 0; i < sjglls.size(); i++) {
-                temp1 = sjglls.get(i).getPointValueInDouble();
-                vo.get(i).setWtid(sjgl.getId());
-                vo.get(i).setNemCode(wtmap.get(sjgl.getNemCode()).getAname());
-                vo.get(i).setTheorypower(StringUtils.round(temp1, 2));
+            for (ProBasicOrganizeTree wt1: wtls){
+                if (wpids.contains(wt1.getParentCode())){
+                    EconomicVo vo = new EconomicVo();
+                    vo.setId(wt1.getId());
+                    wt.add(vo);
+                }
             }
 
+            for ( EconomicVo wt2 : wt) {
+
+                ProBasicEquipmentPoint sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+                List<Glqx> vo = new ArrayList<Glqx>();
+                List<List<Glqx>> tempList = new ArrayList<>();
+                List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
+                double temp1 = 0;
+                for (int i = 0; i < sjglls.size(); i++) {
+                    temp1 = sjglls.get(i).getPointValueInDouble();
+                    vo.get(i).setId(sjgl.getId());
+                    vo.get(i).setName(wtmap.get(sjgl.getNemCode()).getAname());
+                    vo.get(i).setSjgl(StringUtils.round(temp1, 2));
+                }
+
+
+//            ProBasicPowerstationPoint ycgl = proBasicPowerstationPointService.getPowerstationPoint(windturbineIds, ContantXk.ZYCGL);
 
-            List<PointData> llglls = edosUtil.getHistoryDatasSnap(ycgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
-            double temp2 = 0;
-            for (int i = 0; i < llglls.size(); i++) {
-                temp2 = llglls.get(i).getPointValueInDouble();
-                vo.get(i).setWtid(sjgl.getId());
-                vo.get(i).setNemCode(wtmap.get(sjgl.getNemCode()).getAname());
-                vo.get(i).setEnsurepower(StringUtils.round(temp2, 2));
-                tempList.add(vo);
-            }
 
-            List<ProEconWtPowerCurveFitting> collect = CacheContext.wtPowerCurveFittingList.stream().filter(wpcf -> windturbineIds.contains(wpcf.getWindturbineId())).collect(Collectors.toList());
+//            List<PointData> llglls = edosUtil.getHistoryDatasSnap(ycgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
+//            double temp2 = 0;
+//            for (int i = 0; i < llglls.size(); i++) {
+//                temp2 = llglls.get(i).getPointValueInDouble();
+//                vo.get(i).setWtid(sjgl.getId());
+//                vo.get(i).setNemCode(wtmap.get(sjgl.getNemCode()).getAname());
+//                vo.get(i).setEnsurepower(StringUtils.round(temp2, 2));
+//                tempList.add(vo);
+//            }
 
-            resultMap.put("list", tempList);
+//            List<ProEconWtPowerCurveFitting> collect = CacheContext.wtPowerCurveFittingList.stream().filter(wpcf -> windturbineIds.contains(wpcf.getWindturbineId())).collect(Collectors.toList());
+
+                resultMap.put("list", tempList);
+
+            }
         }
 
         return resultMap;