Przeglądaj źródła

公司对标问题

xushili 1 rok temu
rodzic
commit
da0b42c24e

+ 12 - 22
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/performance/PerformanceCurvefittingController.java

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -45,43 +46,32 @@ public class PerformanceCurvefittingController {
     public R curvefittinglist(@RequestParam(value = "companys",required = true) String companys,
                               @RequestParam(value = "type",required = true) String type,
                               @RequestParam(value = "wpids",required = false) String wpids,
-                              @RequestParam(value = "projectids",required = false) String projectids,
-                              @RequestParam(value = "lineids",required = false) String lineids,
-                              @RequestParam(value = "squareids",required = false) String squareids,
                               @RequestParam(value = "windturbineids",required = false) String windturbineids,
                               @RequestParam(value = "dateType", required = false) String dateType
     ) {
         Map<String, List<CurveVo>> curvefitting = null;
+        if(StringUtils.isEmpty(type)) type = "-2";
+        if(StringUtils.isEmpty(dateType)) dateType = "1";
         try {
-            /*if (StringUtils.isNotEmpty(windturbineids)) {
+            if (StringUtils.isNotEmpty(windturbineids)) {
 
-            } else if (StringUtils.isNotEmpty(squareids)) {
-                CacheContext.proBasicOrganizeTrees.stream().filter(sql->squareids.contains(sql.getParentCode()))
-                List<String> squareidList = Arrays.asList(squareids.split(","));
-                qw.in("square_id", squareidList);
-            } else if (StringUtils.isNotEmpty(lineids)) {
-                List<String> lineList = Arrays.asList(lineids.split(","));
-                qw.in("line_id", lineList).isNotNull("square_id").ne("square_id", "");
-            } else if (StringUtils.isNotEmpty(projectids)) {
-                List<String> projectList = Arrays.asList(projectids.split(","));
-                qw.in("project_id", projectList).isNotNull("square_id").ne("square_id", "");
             } else if (StringUtils.isNotEmpty(wpids)) {
-                List<String> wpList = Arrays.asList(wpids.split(","));
-                qw.in("windpowerstation_id", wpList).isNotNull("square_id").ne("square_id", "");
+                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")) {
-                            companys = s;
+                        if(s.endsWith("RGN")){
+                            windturbineids = CacheContext.organizeEquipmentList.stream().filter(oe -> s.equals(oe.getRegionId()))
+                                    .map(oe -> oe.getWindturbineId()).collect(Collectors.joining(","));
                         }
                     }
-                    qw.eq("region_id", companys);
                 } else {
-                    qw.in("company_id", Arrays.asList(split));
+                    windturbineids = CacheContext.organizeEquipmentList.stream().filter(oe -> companys.contains(oe.getCompanyId()))
+                            .map(oe -> oe.getWindturbineId()).collect(Collectors.joining(","));
                 }
-            }*/
-
+            }
 
             curvefitting = performanceCurvefittingService.curveFittingList(windturbineids, type, dateType);
             return R.data(ResultMsg.ok(curvefitting));

+ 4 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/init/CacheContext.java

@@ -86,6 +86,8 @@ public class CacheContext implements CommandLineRunner {
 
     @Resource
     private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;
+    @Resource
+    private IProEconWtPowerCurveFittingService wtPowerCurveFittingService;
 
     public static List<ProBasicBranch> bnls = new ArrayList<>();
     //    public static List<ProBasicEquipment> wtls = new ArrayList<>();
@@ -175,6 +177,7 @@ public class CacheContext implements CommandLineRunner {
     public static List<ProBasicOrganizeTree> proBasicOrganizeTrees;
     public static Map<String, ProBasicOrganizeTree> proBasicOrganizeTreesMap;
     public static List<ProBasicOrganizeEquipment> organizeEquipmentList;//把树形展开的设备列表
+    public static List<ProEconWtPowerCurveFitting> wtPowerCurveFittingList;
 
     @Override
     public void run(String... args) throws Exception {
@@ -184,6 +187,7 @@ public class CacheContext implements CommandLineRunner {
         proBasicOrganizeTreesMap = proBasicOrganizeTrees.stream().collect(Collectors.toMap(ProBasicOrganizeTree::getId, Function.identity()));
 
         organizeEquipmentList = proBasicOrganizeEquipmentService.list().stream().filter(pboe -> pboe.getIsAble() == 1).collect(Collectors.toList());
+        wtPowerCurveFittingList = wtPowerCurveFittingService.list();
 
         //List<String> pbotids = proBasicOrganizeTrees.stream().map(pbot -> pbot.getId()).collect(Collectors.toList());
         //Map<String, Object> pbotidMap = redisService.batchGetKeys(pbotids);

+ 23 - 16
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/PerformanceCurvefittingService.java

@@ -15,6 +15,7 @@ import com.gyee.runeconomy.model.auto.ProEconWtCurveFittingYear;
 import com.gyee.runeconomy.service.auto.IProEconWtCurveFittingMonthService;
 import com.gyee.runeconomy.service.auto.IProEconWtCurveFittingService;
 import com.gyee.runeconomy.service.auto.IProEconWtCurveFittingYearService;
+import com.gyee.runeconomy.service.auto.IProEconWtPowerCurveFittingService;
 import com.gyee.runeconomy.util.redis.RedisService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -51,24 +52,30 @@ public class PerformanceCurvefittingService {
             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);
+            String[] split = windturbineIds.split(",");
+
+            for (String s : split) {
+                if (znhglMap.containsKey(s)) {
+                    Map<Double, Double> zsglmap = znhglMap.get(s);
+                    Map<Double, ZllglDTO> bzglmap = zbzglMap.get(wtmap.get(s).getModelId());
+                    Set<Double> speeds = zsglmap.keySet();
+                    speeds.stream().forEach(speed -> {
+                        CurveVo vo = new CurveVo();
+                        vo.setWtid(s);
+                        vo.setNemCode(wtmap.get(s).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("list", tempList);
-                resultMap.put("chanrt", tempList.stream().filter(i ->  (i.getSpeed()%Double.valueOf(0.5))==0).collect(Collectors.toList()));
+                    resultMap.put("list", tempList);
+                    resultMap.put("chanrt", tempList.stream().filter(i ->  (i.getSpeed()%Double.valueOf(0.5))==0).collect(Collectors.toList()));
+                }
             }
+        }else {
+
         }
 
         return resultMap;

+ 16 - 3
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -113,7 +113,7 @@ public class BenchmarkingService {
     }
 
     public List<ProBasicOrganizeEquipment> wtByWplist(String wpids) {
-        return CacheContext.organizeEquipmentList.stream().filter(oe->wpids.contains(oe.getWindpowerstationId())).collect(Collectors.toList());
+        return CacheContext.organizeEquipmentList.stream().filter(oe -> wpids.contains(oe.getWindpowerstationId())).collect(Collectors.toList());
     }
 
     public List<FjjxbVo> performance(String companyid, String getype, String sttype, String beginDate, String endDate, String wpids, String projectids, String lineids, String target, String sort) {
@@ -788,7 +788,7 @@ public class BenchmarkingService {
 
             if (type.equals(TYPE_WIND)) {
                 vo.setId(i.getWindpowerstationId());
-                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getAname());
+                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getNemName());
                 vo.setOrdernum(station.get(i.getWindpowerstationId()).doubleValue());
             } else if (type.equals(TYPE_PROJECT)) {
                 vo.setId(i.getProjectId());
@@ -902,8 +902,14 @@ public class BenchmarkingService {
             qw.eq("square_id", id);
         } else if (id.endsWith("EQ")) {
             qw.eq("windturbine_id", id);
+        } else if (id.endsWith("ZGS")) {
+            qw.eq("company_id", id);
+        }
+        if (id.endsWith("ZGS")) {
+            qw.groupBy("windpowerstation_id");
+        } else {
+            qw.groupBy("windturbine_id");
         }
-        qw.groupBy("windturbine_id");
 
         List<WxsslVo> wxsslVoList = getWxsslSortVos(qw, resultList, TYPE_WINDTURBINE);
         if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)) {
@@ -915,6 +921,13 @@ public class BenchmarkingService {
         } else {
             SortUtils.sort(resultList, "ordernum", SortUtils.ASC);
         }
+        wxsslVoList = wxsslVoList.stream().filter(wv -> {
+            boolean b = false;
+            if(StringUtils.isNotEmpty(wv.getName())){
+                b = wv.getName().contains("逆变器") || wv.getName().contains("风机");
+            }
+            return b;
+        }).collect(Collectors.toList());
         return wxsslVoList;
     }