Browse Source

指标排行和功率曲线方法修改

wangchangsheng 2 years ago
parent
commit
503cb280b1

+ 28 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/homepage/EconomyHomePageController.java

@@ -3,6 +3,7 @@ package com.gyee.runeconomy.controller.homepage;
 
 import com.gyee.runeconomy.dto.R;
 import com.gyee.runeconomy.dto.ResultMsg;
+import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO;
 import com.gyee.runeconomy.service.homepage.EconomyPointHomePageService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -59,6 +61,32 @@ public class EconomyHomePageController {
     }
 
 
+    /**
+     * 首页指标排行
+     * @param foreignKeyId
+     * @param dateType
+     * @param pointCode
+     * @return
+     * @throws Exception
+     */
+    @GetMapping(value = "/point-ranking")
+    @ApiOperation(value = "经济运行-首页指标排行", notes = "经济运行-首页指标排行")
+    public R getEconomyPointRanking(
+            @RequestParam(value = "foreignKeyId", required = true) String foreignKeyId,
+            @RequestParam(value = "dateType", required = true) String dateType,
+            @RequestParam(value = "pointCode", required = true) String pointCode
+    )  {
+
+        List<ProEconPointCodeDTO> dtos = null;
+        try {
+            dtos = economyPointHomePageService.getEconomyPointRanking(foreignKeyId, dateType, pointCode);
+        } catch (Exception e) {
+            return R.error(ResultMsg.error());
+        }
+        return R.data(ResultMsg.ok(dtos));
+    }
+
+
 
 
 }

+ 11 - 9
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/performacompare/EquipmentPerformaCompareController.java

@@ -32,9 +32,10 @@ public class EquipmentPerformaCompareController {
 
     /**
      * 单机横向对比列表
-     *
-     * @param windturbineIds
-     * @param date
+     * @param type 风场 -1 ;光伏 -2
+     * @param dateType  日 1;月 2; 年 3
+     * @param windturbineIds 设别ids
+     * @param date 日期
      * @return
      */
     @GetMapping("/equipment-performa-compare")
@@ -42,17 +43,18 @@ public class EquipmentPerformaCompareController {
     @CrossOrigin(origins = "*", maxAge = 3600)
     public R daydjhxdbtop(
             @RequestParam(value = "type", required = true) String type,
+            @RequestParam(value = "dateType", required = true) String dateType,
             @RequestParam(value = "windturbineIds", required = true) String windturbineIds,
             @RequestParam(value = "date", required = true) String date) {
 
-        List<Object> objects =  equipmentPerformaCompareService.getEquipmentPerformaCompareList(type, windturbineIds, date);
-
-
-        if (null != objects) {
+        List<Object> objects = null;
+        try {
+            objects = equipmentPerformaCompareService.getEquipmentPerformaCompareList(dateType, windturbineIds, date,type);
             return R.data(ResultMsg.ok(objects));
-        } else {
-            return R.error(ResultMsg.error());
+        } catch (Exception e) {
+            return R.data(ResultMsg.error());
         }
+
     }
 
 

+ 13 - 3
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/PerformanceCurvefittingService.java

@@ -89,7 +89,10 @@ public class PerformanceCurvefittingService {
             switch (dateType) {
 
                 case "1":
-                    List<ProEconWtCurveFitting> daylist = proEconWtCurveFittingService.getProEconWtCurveFittingList(wt,date);
+                    String dayCurve = redisService.get("dayCurve_"+wt);
+                    List<ProEconWtCurveFitting> daylist = JSONObject.parseObject(dayCurve, new TypeReference<List<ProEconWtCurveFitting>>() {
+                    });
+//                    List<ProEconWtCurveFitting> daylist = proEconWtCurveFittingService.getProEconWtCurveFittingList(wt,date);
 
                     daylist.stream().forEach(w -> {
                         doubleMap.put(w.getSpeed(), w.getActualPower());
@@ -97,7 +100,11 @@ public class PerformanceCurvefittingService {
                     zzsglMap.put(wt, doubleMap);
                     break;
                 case "2":
-                    List<ProEconWtCurveFittingMonth> monthlist = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wt,String.valueOf(month),String.valueOf(year));
+
+                    String monthCurve = redisService.get("monthCurve_"+wt);
+                    List<ProEconWtCurveFittingMonth> monthlist = JSONObject.parseObject(monthCurve, new TypeReference<List<ProEconWtCurveFittingMonth>>() {
+                    });
+//                    List<ProEconWtCurveFittingMonth> monthlist = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wt,String.valueOf(month),String.valueOf(year));
 
                     monthlist.stream().forEach(w -> {
                         doubleMap.put(w.getSpeed(), w.getActualPower());
@@ -105,7 +112,10 @@ public class PerformanceCurvefittingService {
                     zzsglMap.put(wt, doubleMap);
                     break;
                 case "3":
-                    List<ProEconWtCurveFittingYear>  yearslist = proEconWtCurveFittingYearService.getProEconWtCurveFittingYearList(wt,String.valueOf(year));
+                    String yearCurve = redisService.get("yearCurve_"+wt);
+                    List<ProEconWtCurveFittingYear> yearslist = JSONObject.parseObject(yearCurve, new TypeReference<List<ProEconWtCurveFittingYear>>() {
+                    });
+//                    List<ProEconWtCurveFittingYear>  yearslist = proEconWtCurveFittingYearService.getProEconWtCurveFittingYearList(wt,String.valueOf(year));
 
                     yearslist.stream().forEach(w -> {
                         doubleMap.put(w.getSpeed(), w.getActualPower());

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

@@ -53,7 +53,7 @@ public class ProEconWtPowerCurveFittingServiceImpl extends ServiceImpl<ProEconWt
         list.stream().forEach(i->{
             i.setNemCode(CacheContext.wtmap.get(i.getWindturbineId()).getAname());
         });
-        Map<String, List<ProEconWtPowerCurveFitting>> map =  list.stream().collect(Collectors.groupingBy(ProEconWtPowerCurveFitting::getWindturbineId));
+        Map<String, List<ProEconWtPowerCurveFitting>> map =  list.stream().collect(Collectors.groupingBy(ProEconWtPowerCurveFitting::getNemCode));
         return map;
     }
 }

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

@@ -206,7 +206,20 @@ public class EconomyPointHomePageService {
         return allmap;
     }
 
-
+    /**
+     * 指标排行榜
+     * @param foreignKeyId
+     * @param dateType
+     * @param pointCode
+     * @return
+     */
+    public List<ProEconPointCodeDTO> getEconomyPointRanking(String foreignKeyId, String dateType,String pointCode){
+        //获取当前时间
+        String strdate = DateUtils.toDate1(new Date());
+        Date date = DateUtils.parseDate(strdate);
+        List<ProEconPointCodeDTO> pointCodeDTO = proEconPointCodeService.getEconPointRanking("", foreignKeyId, pointCode,date,dateType);
+        return pointCodeDTO;
+    }
     /**
      * (风能利用率、发电量、欠发电量)
      */

+ 15 - 14
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/performacompare/EquipmentPerformaCompareService.java

@@ -33,19 +33,19 @@ public class EquipmentPerformaCompareService {
 
     /**
      * 单机横向对比列表
-     * @param type
+     * @param dateType
      * @param windturbineIds
      * @param date
      * @return
      */
-    public List<Object> getEquipmentPerformaCompareList(String type, String windturbineIds, String date) {
-
+    public List<Object> getEquipmentPerformaCompareList(String dateType, String windturbineIds, String date,String type) {
         List<Object> objects = new ArrayList<>();
-        List<ProEconWtAlysisDay>  list =  proEconWtAlysisDayService.getProEconWtAlysisDayList(windturbineIds,date);//风机性能分析数据
-        List<ProEconWtwindDayInfo> fzyList =  proEconWtwindDayInfoService.getProEconWtwindDayInfoList(windturbineIds,date);//风资源
-        List<DjhxdbtopVo> resultList = alysisConversionMethod(list,fzyList,type);//日月年指标转换记录
-        objects = convert(resultList);
-
+        if("-1".equals(type)){
+            List<ProEconWtAlysisDay>  list =  proEconWtAlysisDayService.getProEconWtAlysisDayList(windturbineIds,date);//风机性能分析数据
+            List<ProEconWtwindDayInfo> fzyList =  proEconWtwindDayInfoService.getProEconWtwindDayInfoList(windturbineIds,date);//风资源
+            List<DjhxdbtopVo> resultList = alysisConversionMethod(list,fzyList,dateType);//日月年指标转换记录
+            objects = convert(resultList);
+        }
         return objects;
     }
 
@@ -76,6 +76,7 @@ public class EquipmentPerformaCompareService {
     private List<Object> convert(List<DjhxdbtopVo> resultList) {
         List<Object> rList = new ArrayList<>();
         List<String> wtids = resultList.stream().map(i -> i.getWtid()).collect(Collectors.toList());
+        List<String> nemcode = resultList.stream().map(i -> i.getNemCode()).collect(Collectors.toList());
         DjhxdbInitVo fdj = new DjhxdbInitVo();
         fdj.setName("风电机");
         try {
@@ -83,7 +84,7 @@ public class EquipmentPerformaCompareService {
             LinkedHashMap addValMap = new LinkedHashMap();
             for (int j=0;j<wtids.size();j++){
                 addMap.put(String.valueOf(j+1), Class.forName("java.lang.String"));
-                addValMap.put(String.valueOf(j+1), wtids.get(j));
+                addValMap.put(String.valueOf(j+1), nemcode.get(j));
             }
             Object blo = new ClassUtil().dynamicClass(fdj, addMap, addValMap);
             rList.add(blo);
@@ -468,15 +469,15 @@ public class EquipmentPerformaCompareService {
     }
 
     //日月年指标转换方法
-    List<DjhxdbtopVo> alysisConversionMethod(List<ProEconWtAlysisDay>  list ,List<ProEconWtwindDayInfo>  fzyList ,String type ){
+    List<DjhxdbtopVo> alysisConversionMethod(List<ProEconWtAlysisDay>  list ,List<ProEconWtwindDayInfo>  fzyList ,String dateType ){
         List<DjhxdbtopVo> resultList = new ArrayList<>();
         list.stream().forEach(i->{
             DjhxdbtopVo vo = new DjhxdbtopVo();
             vo.setWtid(i.getWindturbineId());
             vo.setNemCode(CacheContext.wtmap.get(i.getWindturbineId()).getAname());
             Optional<ProEconWtwindDayInfo> first = fzyList.stream().filter(fzy -> fzy.getWindturbineId().equals(i.getWindturbineId())).findFirst();
-            List<FzyVo> vos = getFzyVos(first,type);
-            switch (type){
+            List<FzyVo> vos = getFzyVos(first,dateType);
+            switch (dateType){
                 case "1" :
                     vo.setFdl(i.getRfdl());
                     vo.setYfdl(i.getRyfdl());
@@ -556,11 +557,11 @@ public class EquipmentPerformaCompareService {
 
 
 
-    List<FzyVo>  getFzyVos( Optional<ProEconWtwindDayInfo> first ,String type) {
+    List<FzyVo>  getFzyVos( Optional<ProEconWtwindDayInfo> first ,String dateType) {
         List<FzyVo> vos = new ArrayList<>();
         ProEconWtwindDayInfo winfo = first.get();
 
-        switch (type) {
+        switch (dateType) {
             case "1":
                 for (int j = 0; j < 16; j++) {
                     FzyVo vo = new FzyVo();