Browse Source

功率曲线

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

+ 5 - 23
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/Economic/EconomicController.java

@@ -94,31 +94,13 @@ public class EconomicController {
         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(","));
-//                }
-//            }
 
             curvefitting = economicService.curveFittingList(wpids, type, starttime,endtime,dateType);
+        if (StringUtils.isNotNull(curvefitting)) {
             return R.data(ResultMsg.ok(curvefitting));
-//        } catch (Exception e) {
-//            e.printStackTrace();
-        //        }
+        } else {
+            return R.error(ResultMsg.error());
+        }
+
     }
 }

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

@@ -5,7 +5,7 @@ public class Glqx {
     private String name;
     private Double sjgl;
     private Double ycgl;
-    private String time;
+    private long time;
 
     public String getId() {
         return id;
@@ -39,11 +39,11 @@ public class Glqx {
         this.ycgl = ycgl;
     }
 
-    public String getTime() {
+    public long getTime() {
         return time;
     }
 
-    public void setTime(String time) {
+    public void setTime(long time) {
         this.time = time;
     }
 }

+ 44 - 30
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/Economic/EconomicService.java

@@ -296,7 +296,7 @@ public class EconomicService {
         // 获取 list 集合中的前五个元素
         List<Map<String, Object>>  subList = null;
         if (czpx.size()>=5) {
-          subList = czpx.subList(0, 5);
+            subList = czpx.subList(0, 5);
         }else {
             subList=czpx;
         }
@@ -348,13 +348,16 @@ public class EconomicService {
 
     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;
+
 
         List<ProBasicOrganizeTree> wtls = CacheContext.wtls;
         List<EconomicVo> wt = new ArrayList<>();
+        List<List<Glqx>> tempList = new ArrayList<>();
+
+        List<Glqx> vo = new ArrayList<Glqx>();
+        Glqx vos = new Glqx();
+
 
-//        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);
@@ -363,45 +366,56 @@ public class EconomicService {
 
             for (ProBasicOrganizeTree wt1: wtls){
                 if (wpids.contains(wt1.getParentCode())){
-                    EconomicVo vo = new EconomicVo();
-                    vo.setId(wt1.getId());
-                    wt.add(vo);
+                    EconomicVo vo1 = new EconomicVo();
+                    vo1.setId(wt1.getId());
+                    vo1.setName(wt1.getAname());
+                    wt.add(vo1);
                 }
             }
 
+
             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);
+                ProBasicEquipmentPoint llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+                if (sjgl.getId()==null){
+                    continue;
+                }
+
+
+                List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 15000L);
+                List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 15000L);
                 double temp1 = 0;
+                double temp2 = 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));
+                    for (EconomicVo wt3 : wt){
+                        if (sjgl.getWindturbineId().contains(wt3.getId())){
+                            vos.setTime(sjglls.get(i).getPointTime());
+                            vos.setId(wt3.getId());
+                            vos.setName(wt3.getName());
+                        }
+                    }
+                    vos.setSjgl(StringUtils.round(temp1, 2));
                 }
 
+                for (int i = 0; i < llglls.size(); i++) {
+                    temp2 = llglls.get(i).getPointValueInDouble();
+                    for (EconomicVo wt3 : wt){
+                        if (sjgl.getWindturbineId().contains(wt3.getId())){
+                            vos.setTime(llglls.get(i).getPointTime());
+                            vos.setId(wt3.getId());
+                            vos.setName(wt3.getName());
+                        }
+                    }
+                    vos.setYcgl(StringUtils.round(temp2, 2));
+                }
+            }
+            vo.add(vos);
+            tempList.add(vo);
+            resultMap.put("list", tempList);
 
-//            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());
-
-                resultMap.put("list", tempList);
 
-            }
         }
 
         return resultMap;