wangchangsheng 2 年之前
父节点
当前提交
fa1b809b98

+ 27 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/performance/PerformanceCurvefittingController.java

@@ -30,7 +30,7 @@ public class PerformanceCurvefittingController {
     private PerformanceCurvefittingService performanceCurvefittingService;
 
     /**
-     *
+     * 功率列表
      * @param windturbineIds 风机ids
      * @param type 0:全部;-1:风电;-2:光伏(暂时默认 -1;没有光伏的功率曲线)
      * @param dateType 1:日;2:月;3:年
@@ -39,6 +39,32 @@ public class PerformanceCurvefittingController {
     @GetMapping("/curvefitting")
     @ResponseBody
     @CrossOrigin(origins = "*", maxAge = 3600)
+    public R curvefittinglist(@RequestParam(value = "windturbineIds", required = true) String windturbineIds,
+                          @RequestParam(value = "type", required = true) String type,
+                          @RequestParam(value = "dateType", required = true) String dateType
+    ) {
+        Map<String, List<CurveVo>> curvefitting = null;
+        try {
+            curvefitting = performanceCurvefittingService.curveFittingList(windturbineIds, type, dateType);
+            return R.data(ResultMsg.ok(curvefitting));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.data(ResultMsg.error());
+        }
+    }
+
+
+
+    /**
+     * 功率曲线拟合
+     * @param windturbineIds 风机ids
+     * @param type 0:全部;-1:风电;-2:光伏(暂时默认 -1;没有光伏的功率曲线)
+     * @param dateType 1:日;2:月;3:年
+     * @return
+     */
+    @GetMapping("/curve-fitting")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
     public R curvefitting(@RequestParam(value = "windturbineIds", required = true) String windturbineIds,
                           @RequestParam(value = "type", required = true) String type,
                           @RequestParam(value = "dateType", required = true) String dateType
@@ -51,6 +77,5 @@ public class PerformanceCurvefittingController {
             e.printStackTrace();
             return R.data(ResultMsg.error());
         }
-
     }
 }

+ 30 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/PerformanceCurvefittingService.java

@@ -38,7 +38,7 @@ public class PerformanceCurvefittingService {
     private IProEconWtCurveFittingYearService proEconWtCurveFittingYearService;
 
 
-    public Map<String, List<CurveVo>> curvefitting(String windturbineIds, String type,String dateType) {
+    public Map<String, List<CurveVo>> curveFittingList(String windturbineIds, String type, String dateType) {
         Map<String, List<CurveVo>> resultMap = new HashMap<>();
         Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
         if (type.equals("-1")) {
@@ -71,7 +71,36 @@ public class PerformanceCurvefittingService {
         return resultMap;
     }
 
+    public Map<String, List<CurveVo>> curvefitting(String windturbineIds, String type,String dateType) {
+        Map<String, List<CurveVo>> resultMap = new HashMap<>();
+        Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
+        if (type.equals("-1")) {
+            String zbzgl = redisService.get("ZLLGL");
+            Map<String, Map<Double, ZllglDTO>> zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String, Map<Double, ZllglDTO>>>() {
+            });
+            Map<String, Map<Double, Double>> znhglMap = getWtCurveFitting(windturbineIds, dateType);
+
+            List<CurveVo> tempList = new ArrayList<>();
+            if (znhglMap.containsKey(windturbineIds)) {
+                Map<Double, Double> zsglmap = znhglMap.get(windturbineIds);
+                Map<Double, ZllglDTO> bzglmap = zbzglMap.get(wtmap.get(windturbineIds).getModelId());
+                Set<Double> speeds = zsglmap.keySet();
+                speeds.stream().forEach(speed -> {
+                    CurveVo vo = new CurveVo();
+                    vo.setWtid(windturbineIds);
+                    vo.setNemCode(wtmap.get(windturbineIds).getAname());
+                    vo.setSpeed(speed);
+                    vo.setTheorypower(DoubleUtils.keepPrecision(zsglmap.get(speed), 2));
+                    vo.setEnsurepower(DoubleUtils.keepPrecision(bzglmap.containsKey(speed) ? bzglmap.get(speed).getEnsurePower() : zsglmap.get(speed), 2));
+                    tempList.add(vo);
+                });
+                SortUtils.sort(tempList, "speed", SortUtils.ASC);
+                resultMap.put("chanrt", tempList.stream().filter(i ->  (i.getSpeed()%Double.valueOf(0.5))==0).collect(Collectors.toList()));
+            }
+        }
 
+        return resultMap;
+    }
     /**
      * 获取风机拟合曲线
      *

+ 3 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconPointCodeServiceImpl.java

@@ -127,6 +127,9 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
         for (String i : reduce1) {
             ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
             dto.setDescription(proEconPointCode.getDescription() + "(" + proEconPointCode.getUnit() + ")");
+            if(null == CacheContext.wpmap.get(i)){
+                continue;
+            }
             dto.setStationcode(null == CacheContext.wpmap.get(i) ? "" : CacheContext.wpmap.get(i).getNemCode());
             dto.setStationname(null == CacheContext.wpmap.get(i) ? "" : CacheContext.wpmap.get(i).getName());
             dtos.add(dto);

+ 7 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconWtPowerCurveFittingServiceImpl.java

@@ -49,11 +49,16 @@ public class ProEconWtPowerCurveFittingServiceImpl extends ServiceImpl<ProEconWt
         }
 
         qw.lambda().orderByAsc(ProEconWtPowerCurveFitting::getSpeed);
+        System.out.println("开始查询"+System.currentTimeMillis());
         List<ProEconWtPowerCurveFitting> list = baseMapper.selectList(qw);
-        list.stream().forEach(i->{
+        System.out.println("查询结束"+System.currentTimeMillis());
+
+        List<ProEconWtPowerCurveFitting> fittingList = list.stream().filter(i ->  (i.getSpeed()%Double.valueOf(0.5))==0).collect(Collectors.toList());;
+
+        fittingList.stream().forEach(i->{
             i.setNemCode(CacheContext.wtmap.get(i.getWindturbineId()).getAname());
         });
-        Map<String, List<ProEconWtPowerCurveFitting>> map =  list.stream().collect(Collectors.groupingBy(ProEconWtPowerCurveFitting::getNemCode));
+        Map<String, List<ProEconWtPowerCurveFitting>> map =  fittingList.stream().collect(Collectors.groupingBy(ProEconWtPowerCurveFitting::getNemCode));
         return map;
     }
 }

+ 0 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/homepage/EconomyPointHomePageService.java

@@ -193,7 +193,6 @@ public class EconomyPointHomePageService {
                 break;
         }
         allmap.put("zbl", dto);//页面第一行的
-        allmap.put("stationinfo", powerstationList);//场站性息(装机容量)
         allmap.put("stainfo", stainfo);//场站性息(装机容量)
         allmap.put("sldlfx", wsdlfx);//损失电量分析
         allmap.put("zhcydl", zhcydl);//综合场用电率

+ 2 - 8
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/performacompare/EquipmentPerformaCompareService.java

@@ -58,14 +58,8 @@ public class EquipmentPerformaCompareService {
     public Map<String, List<ProEconWtPowerCurveFitting>> getgroupProEconWtPowerCurveFittingList(String windturbineIds) {
 
         Map<String, List<ProEconWtPowerCurveFitting>> map =  proEconWtPowerCurveFittingService.getgroupProEconWtPowerCurveFittingList(windturbineIds);
-
-        Map<String, List<ProEconWtPowerCurveFitting>> newmap = new HashMap<>();
-        for (Map.Entry<String, List<ProEconWtPowerCurveFitting>> list : map.entrySet()) {
-            System.out.println(list.getKey() + "--->" + list.getValue());
-            List<ProEconWtPowerCurveFitting> fittingList = list.getValue().stream().filter(i ->  (i.getSpeed()%Double.valueOf(0.5))==0).collect(Collectors.toList());;
-            newmap.put(list.getKey(),fittingList);
-        }
-        return newmap;
+        System.out.println("返回查询"+System.currentTimeMillis());
+        return map;
     }