Browse Source

场站性能分析时间改到时分秒

宁檬 1 year ago
parent
commit
038b5816a8

+ 0 - 26
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/goodness/WindturbinegoodnessController.java

@@ -154,30 +154,4 @@ public class WindturbinegoodnessController {
         }
     }
 
-
-    /**
-     * 场站性能分析
-     */
-    @GetMapping("/stationanalysis")
-    @ResponseBody
-    @ApiOperation(value = "场站性能分析", notes = "场站性能分析")
-    public R cndb(@RequestParam(value = "companys",required = true) String companys,
-                  @RequestParam(value = "type",required = true) String type,
-                  @RequestParam(value = "wpid",required = true) String wpid,
-                  @RequestParam(value = "beginDate",required = true) String beginDate,
-                  @RequestParam(value = "endDate",required = true) String endDate,
-                  @RequestParam(value = "target",required = false) String target,
-                  @RequestParam(value = "sort",required = false) String sort
-    ) throws Exception {
-
-
-        Map<String, List<StationAnalysis>> resultList = windturbinegoodnessService.stationAnalysis(companys, type, wpid, beginDate, endDate, target, sort);
-
-        if (StringUtils.isNotNull(resultList)) {
-            return R.data(ResultMsg.ok(resultList));
-        } else {
-            return R.error(ResultMsg.error());
-        }
-    }
-
 }

+ 20 - 13
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/goodness/WindturbinegoodnessService.java

@@ -1001,16 +1001,23 @@ public class WindturbinegoodnessService {
      */
     public Map<String, List<StationAnalysis>> stationAnalysis(String companys, String type, String wpid, String beginDate, String endDate, String target, String sort) throws Exception {
 
+
         Map<String, List<StationAnalysis>> resultMap = new HashMap<>();
         List<ProBasicOrganizeTree> eqs = CacheContext.proBasicOrganizeTrees;
         //拿到场站下的环境监测仪id
         List<String> emils = eqs.stream().filter(v -> "EMI".equals(v.getEqType()) && v.getParentCode().equals(wpid))
                 .map(ProBasicOrganizeTree::getId)
                 .collect(Collectors.toList());
-
-        List<String> emil = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> emils.contains(pbep.getWindturbineId())&&"AIEMI002".equals(pbep.getUniformCode()))
-                .map(ProBasicEquipmentPoint::getNemCode).collect(Collectors.toList());
-
+        List<String> emil=null;
+        if ("-1".equals(type)) {
+            resultMap.put("list", new ArrayList<>());
+            resultMap.put("chanrt", new ArrayList<>());
+
+            return resultMap;
+        }else {
+            emil = CacheContext.proBasicEquipmentPointList.stream().filter(pbep -> emils.contains(pbep.getWindturbineId()) && "AIEMI002".equals(pbep.getUniformCode()))
+                    .map(ProBasicEquipmentPoint::getNemCode).collect(Collectors.toList());
+        }
         Optional<ProBasicPowerstationPoint> sszglpbpp = CacheContext.proBasicPowerstationPoint.stream().filter(pbpp -> "SSZGL".equals(pbpp.getUniformCode()) && wpid.equals(pbpp.getWindpowerstationId())).findFirst();
         String sszgl = null;
         if (sszglpbpp.isPresent()) {
@@ -1026,7 +1033,7 @@ public class WindturbinegoodnessService {
         double count = 0;
         Map<Long, PointData> gzpd = new HashMap<>();
         for (String em : emil) {
-            List<PointData> historyEmilDatas = edosUtil.getHistoryDatasSnap(em, DateUtils.parseDate(beginDate).getTime(), DateUtils.parseDate(endDate).getTime(), null, 900L);
+            List<PointData> historyEmilDatas = edosUtil.getHistoryDatasSnap(em, DateUtils.parseDate1(beginDate).getTime()/1000, DateUtils.parseDate1(endDate).getTime()/1000, null, 900L);
             for (PointData pd : historyEmilDatas) {
                 if(i==0){
                     PointData data = new PointData();
@@ -1044,9 +1051,9 @@ public class WindturbinegoodnessService {
 
         List<PointData> historyEmilDatas = gzpd.values().stream().peek(g -> g.setPointValueInDouble(g.getPointValueInDouble() / finalI)).collect(Collectors.toList());
         Map<Long, PointData> collect1 = historyEmilDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
-        List<PointData> historySszglDatas = edosUtil.getHistoryDatasSnap(sszgl, DateUtils.parseDate(beginDate).getTime(), DateUtils.parseDate(endDate).getTime(), null, 900L);
+        List<PointData> historySszglDatas = edosUtil.getHistoryDatasSnap(sszgl, DateUtils.parseDate1(beginDate).getTime()/1000, DateUtils.parseDate1(endDate).getTime()/1000, null, 900L);
         Map<Long, PointData> collect2 = historySszglDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
-        List<PointData> historySsznhglzsDatas = edosUtil.getHistoryDatasSnap(ssznhglzs, DateUtils.parseDate(beginDate).getTime(), DateUtils.parseDate(endDate).getTime(), null, 900L);
+        List<PointData> historySsznhglzsDatas = edosUtil.getHistoryDatasSnap(ssznhglzs, DateUtils.parseDate1(beginDate).getTime()/1000, DateUtils.parseDate1(endDate).getTime()/1000, null, 900L);
         Map<Long, PointData> collect3 = historySsznhglzsDatas.stream().collect(Collectors.toMap(PointData::getPointTime, Function.identity()));
 
         List<StationAnalysis> lpds = new ArrayList<>();
@@ -1055,14 +1062,14 @@ public class WindturbinegoodnessService {
             StationAnalysis sa = new StationAnalysis();
             sa.setTime(pointTime);
             sa.setStationName(CacheContext.proBasicOrganizeTreesMap.get(wpid).getAname());
-            sa.setIrradiance(DoubleUtils.keepPrecision(collect1.get(pointTime).getPointValueInDouble(),2));
-            sa.setActualPower(DoubleUtils.keepPrecision(collect2.get(pointTime).getPointValueInDouble(),2));
-            sa.setTheoreticalPower(DoubleUtils.keepPrecision(collect3.get(pointTime).getPointValueInDouble(),2));
+            sa.setIrradiance(collect1.get(pointTime).getPointValueInDouble());
+            sa.setActualPower(collect2.get(pointTime).getPointValueInDouble());
+            sa.setTheoreticalPower(collect3.get(pointTime).getPointValueInDouble());
             lpds.add(sa);
         }
-
-        resultMap.put("list", lpds);
-        resultMap.put("chanrt", lpds);
+        List<StationAnalysis> lsas = lpds.stream().sorted(Comparator.comparing(StationAnalysis::getTime)).collect(Collectors.toList());
+        resultMap.put("list", lsas);
+        resultMap.put("chanrt", lsas);
 
         return resultMap;
     }