Переглянути джерело

光伏性能分析,性能等级评估

xushili 1 рік тому
батько
коміт
02d1d774d9

+ 12 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/bmk/BenchmarkingController.java

@@ -127,6 +127,18 @@ public class BenchmarkingController {
         }
     }
 
+    @GetMapping(value = "/wtByWplist")
+    @ApiOperation(value = "风机列表", notes = "风机列表")
+    public R wtByWplist(@RequestParam(value = "wpids", required = true) String wpids)  {
+
+        List<ProBasicOrganizeTree> resultList = benchmarkingService.wtByWplist(wpids);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
     @GetMapping(value = "/performance")
     @ApiOperation(value = "风机绩效榜", notes = "风机绩效榜")
     public R performance(@RequestParam(value = "companyid", required = true) String companyid,

+ 19 - 17
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/goodness/WindturbinegoodnessController.java

@@ -74,6 +74,25 @@ public class WindturbinegoodnessController {
         return R.data(ResultMsg.ok(resultList));
     }
 
+    @GetMapping("/pvgoodness")
+    @ResponseBody
+    @ApiOperation(value = "光伏性能分析", notes = "光伏性能分析")
+    public R pvgoodness(@RequestParam(value = "companys",required = true) String companys,
+                        @RequestParam(value = "wpid",required = true) String wpid,
+                        @RequestParam(value = "recorddate",required = true) String recorddate,
+                        @RequestParam(value = "pageNum",required = false) Integer pageNum,
+                        @RequestParam(value = "pageSize",required = false) Integer pageSize,
+                        @RequestParam(value = "target",required = true) String target,
+                        @RequestParam(value = "sort",required = true) String sort
+    ){
+        List<PvVo> resultList = windturbinegoodnessService.pvgoodness(pageNum,pageSize,companys,wpid,recorddate,target,sort);
+
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
 
     /**
      * 获得单机性能总览历史列表信息
@@ -112,23 +131,6 @@ public class WindturbinegoodnessController {
 
 
 
-    @GetMapping("/pvgoodness")
-    @ResponseBody
-    @ApiOperation(value = "光伏性能分析", notes = "光伏性能分析")
-    public R pvgoodness(@RequestParam(value = "companys",required = true) String companys,
-                  @RequestParam(value = "wpid",required = true) String wpid,
-                    @RequestParam(value = "recorddate",required = true) String recorddate,
-                  @RequestParam(value = "target",required = true) String target,
-                  @RequestParam(value = "sort",required = true) String sort
-    ){
-        List<PvVo> resultList = windturbinegoodnessService.pvgoodness(companys,wpid,recorddate,target,sort);
-
-        if (StringUtils.isNotNull(resultList)) {
-            return R.data(ResultMsg.ok(resultList));
-        } else {
-            return R.error(ResultMsg.error());
-        }
-    }
 
     @GetMapping("/pvgoodnesshis")
     @ResponseBody

+ 43 - 5
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/performance/PerformanceCurvefittingController.java

@@ -1,14 +1,17 @@
 package com.gyee.runeconomy.controller.performance;
 
 
+import com.gyee.common.model.StringUtils;
 import com.gyee.common.vo.curve.CurveVo;
 import com.gyee.runeconomy.dto.R;
 import com.gyee.runeconomy.dto.ResultMsg;
+import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.service.PerformanceCurvefittingService;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -31,7 +34,7 @@ public class PerformanceCurvefittingController {
 
     /**
      * 功率列表
-     * @param windturbineIds 风机ids
+     * @param windturbineids 风机ids
      * @param type 0:全部;-1:风电;-2:光伏(暂时默认 -1;没有光伏的功率曲线)
      * @param dateType 1:日;2:月;3:年
      * @return
@@ -39,13 +42,48 @@ 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
+    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;
         try {
-            curvefitting = performanceCurvefittingService.curveFittingList(windturbineIds, type, dateType);
+            /*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", "");
+            } else if (StringUtils.isNotEmpty(companys)) {
+                String[] split = companys.split(",");
+                if (companys.contains("RGN")) {
+                    for (String s : split) {
+                        if (s.endsWith("RGN")) {
+                            companys = s;
+                        }
+                    }
+                    qw.eq("region_id", companys);
+                } else {
+                    qw.in("company_id", Arrays.asList(split));
+                }
+            }*/
+
+
+            curvefitting = performanceCurvefittingService.curveFittingList(windturbineids, type, dateType);
             return R.data(ResultMsg.ok(curvefitting));
         } catch (Exception e) {
             e.printStackTrace();

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

@@ -222,7 +222,7 @@ public class CacheContext implements CommandLineRunner {
         treels = proBasicOrganizeTreeService.list().stream().filter(i->i.getIsAble()==1).collect(Collectors.toList());
 
         //树形方阵
-        sqls = proBasicOrganizeTreeService.list().stream().filter(i->i.getOrgType().contains("AG") && i.getIsAble()==1).collect(Collectors.toList());
+        sqls = proBasicOrganizeTreeService.list().stream().filter(i->i.getOrgType().equals("AG") && i.getIsAble()==1).collect(Collectors.toList());
         if (!sqls.isEmpty())
         {
             for (ProBasicOrganizeTree sq : sqls)

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

@@ -111,6 +111,11 @@ public class BenchmarkingService {
         return CacheContext.wtls.stream().filter(wt -> lnids.contains(wt.getParentCode())).collect(Collectors.toList());
     }
 
+    public List<ProBasicOrganizeTree> wtByWplist(String wpids) {
+
+        return null;
+    }
+
     public List<FjjxbVo> performance(String companyid, String getype, String sttype, String beginDate, String endDate, String wpids, String projectids, String lineids, String target, String sort) {
         List<FjjxbVo> resultList = new ArrayList<>();
         QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
@@ -980,18 +985,14 @@ public class BenchmarkingService {
         String sql = ",sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl";
         qw.ge("record_date", DateUtils.parseDate(beginDate)).le("record_date", DateUtils.parseDate(endDate));
 
-        String[] split = companys.split(",");
-
         if (companys.contains("RGN")) {
-            for (String s : split) {
-                if(s.endsWith("RGN")){
-                    companys = s;
-                }
-            }
-            qw.select("region_id id" + sql);
-            qw.eq("region_id", companys);
-            qw.groupBy("region_id");
+            String finalCompanys = companys;
+            List<String> collect = CacheContext.cpls.stream().filter(cpl -> finalCompanys.contains(cpl.getParentCode())).map(cpl -> cpl.getId()).collect(Collectors.toList());
+            qw.select("company_id id" + sql);
+            qw.in("company_id", collect);
+            qw.groupBy("company_id");
         } else {
+            String[] split = companys.split(",");
             qw.select("company_id id" + sql);
             qw.in("company_id", Arrays.asList(split));
             qw.groupBy("company_id");
@@ -1143,5 +1144,4 @@ public class BenchmarkingService {
         }
         return wxsslVoList;
     }
-
 }

+ 57 - 50
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/goodness/WindturbinegoodnessService.java

@@ -51,7 +51,7 @@ public class WindturbinegoodnessService {
         //构造分页构造器
         Page<ProEconWindturbineGoodness> pageInfo = new Page<>(pageNum, pageSize);
         if (StringUtils.notEmp(type) && StringUtils.notEmp(recorddate)) {
-                Date date = com.gyee.common.util.DateUtils.parseDate(recorddate);
+            Date date = com.gyee.common.util.DateUtils.parseDate(recorddate);
 
             //构造条件构造器
             LambdaQueryWrapper<ProEconWindturbineGoodness> queryWrapper = new LambdaQueryWrapper<>();
@@ -268,7 +268,7 @@ public class WindturbinegoodnessService {
                             zt = zttemp;
                             c = Calendar.getInstance();
                             c.setTime(resultDate);
-//                                c.add(Calendar.MINUTE, -6);
+                            //                                c.add(Calendar.MINUTE, -6);
                             endTime = sdf.format(c.getTime());
                             time = sdf2.format(c.getTime());
 
@@ -294,7 +294,7 @@ public class WindturbinegoodnessService {
                             zt = zttemp;
                             c = Calendar.getInstance();
                             c.setTime(resultDate);
-//                                c.add(Calendar.MINUTE, -6);
+                            //                                c.add(Calendar.MINUTE, -6);
                             endTime = sdf.format(c.getTime());
                             time = sdf2.format(c.getTime());
 
@@ -399,11 +399,11 @@ public class WindturbinegoodnessService {
         double endfdl = 0.0;
         double fdl = 0.0;
 
-//        String[] id=new String[1];
-//        DNAVal[] val= edosUtil.getHistMatrix(id,begindate.getTime() / 1000);
-//        beginfdl=val[0].DValue;
-//        val= edosUtil.getHistMatrix(id,enddate.getTime() / 1000);
-//        endfdl=val[0].DValue;
+        //        String[] id=new String[1];
+        //        DNAVal[] val= edosUtil.getHistMatrix(id,begindate.getTime() / 1000);
+        //        beginfdl=val[0].DValue;
+        //        val= edosUtil.getHistMatrix(id,enddate.getTime() / 1000);
+        //        endfdl=val[0].DValue;
         List<PointData> beginfdlls = edosUtil.getHistoryDatasSnap(fdlAi,
                 begindate.getTime() / 1000, begindate.getTime() / 1000,
                 (long) 1, 3600L);
@@ -872,53 +872,60 @@ public class WindturbinegoodnessService {
         return vos;
     }
 
-    public List<PvVo> pvgoodness(String companys, String wpid, String recorddate, String target, String sort) {
+    public List<PvVo> pvgoodness(Integer pageNum, Integer pageSize, String companys, String wpid, String recorddate, String target, String sort) {
 
         Map<String, ProEconEquipmentmodel> modelMap = CacheContext.modelMap;
         Map<String, ProBasicOrganizeTree> wtmap = CacheContext.wtmap;
         List<PvVo> resultList = new ArrayList<>();
         LambdaQueryWrapper<ProEconEquipmentInfoDay6> qw = new LambdaQueryWrapper<>();
 
-        qw.eq(ProEconEquipmentInfoDay6::getRecordDate,DateUtils.parseDate(recorddate));
+        qw.eq(ProEconEquipmentInfoDay6::getRecordDate, DateUtils.parseDate(recorddate));
 
-        if (StringUtils.isNotEmpty(companys)){
-            if (companys.endsWith("ZGS")){
-                qw.eq(ProEconEquipmentInfoDay6::getCompanyId,companys);
+        if (StringUtils.isNotEmpty(companys)) {
+            if (companys.endsWith("ZGS")) {
+                qw.eq(ProEconEquipmentInfoDay6::getCompanyId, companys);
             }
 
-            if (companys.endsWith("RGN")){
-                qw.eq(ProEconEquipmentInfoDay6::getRegionId,companys);
+            if (companys.endsWith("RGN")) {
+                qw.eq(ProEconEquipmentInfoDay6::getRegionId, companys);
             }
 
         }
-        if (StringUtils.isNotEmpty(wpid)){
-            qw.eq(ProEconEquipmentInfoDay6::getWindpowerstationId,wpid);
+        if (StringUtils.isNotEmpty(wpid)) {
+            qw.eq(ProEconEquipmentInfoDay6::getWindpowerstationId, wpid);
         }
-        List<ProEconEquipmentInfoDay6> equipmentInfoDay6s = proEconEquipmentInfoDay6Service.list(qw);
+        if (StringUtils.empty(pageNum)) {
+            pageNum = 1;
+        }
+        if (StringUtils.empty(pageSize)) {
+            pageSize = 10;
+        }
+        Page<ProEconEquipmentInfoDay6> page = new Page<>(pageNum, pageSize);
+        Page<ProEconEquipmentInfoDay6> equipmentInfoDay6s = proEconEquipmentInfoDay6Service.page(page, qw);
 
-        equipmentInfoDay6s.stream().forEach(i->{
+        equipmentInfoDay6s.getRecords().forEach(i -> {
             PvVo vo = new PvVo();
             vo.setWtid(i.getWindturbineId());
             vo.setWtname(wtmap.get(i.getWindturbineId()).getAname());
             vo.setModel(modelMap.get(wtmap.get(i.getWindturbineId()).getModelId()).getAname());
-            vo.setRxtxl(DoubleUtils.keepPrecision(i.getRxtxl(),2));
-            vo.setRlsl(DoubleUtils.keepPrecision(i.getRlsl(),2));
-            vo.setRzhxl(DoubleUtils.keepPrecision(i.getRnbqzhxl(),2));
+            vo.setRxtxl(DoubleUtils.keepPrecision(i.getRxtxl(), 2));
+            vo.setRlsl(DoubleUtils.keepPrecision(i.getRlsl(), 2));
+            vo.setRzhxl(DoubleUtils.keepPrecision(i.getRnbqzhxl(), 2));
 
-            vo.setYxtxl(DoubleUtils.keepPrecision(i.getYxtxl(),2));
-            vo.setYlsl(DoubleUtils.keepPrecision(i.getYlsl(),2));
-            vo.setYzhxl(DoubleUtils.keepPrecision(i.getYnbqzhxl(),2));
+            vo.setYxtxl(DoubleUtils.keepPrecision(i.getYxtxl(), 2));
+            vo.setYlsl(DoubleUtils.keepPrecision(i.getYlsl(), 2));
+            vo.setYzhxl(DoubleUtils.keepPrecision(i.getYnbqzhxl(), 2));
 
-            vo.setNxtxl(DoubleUtils.keepPrecision(i.getNxtxl(),2));
-            vo.setNlsl(DoubleUtils.keepPrecision(i.getNlsl(),2));
-            vo.setNzhxl(DoubleUtils.keepPrecision(i.getNnbqzhxl(),2));
+            vo.setNxtxl(DoubleUtils.keepPrecision(i.getNxtxl(), 2));
+            vo.setNlsl(DoubleUtils.keepPrecision(i.getNlsl(), 2));
+            vo.setNzhxl(DoubleUtils.keepPrecision(i.getNnbqzhxl(), 2));
             resultList.add(vo);
         });
 
-        if (StringUtils.isNotEmpty(target)){
+        if (StringUtils.isNotEmpty(target)) {
             if (sort.equals("1"))
-                SortUtils.sort(resultList,target,SortUtils.ASC);
-            SortUtils.sort(resultList,target,SortUtils.DESC);
+                SortUtils.sort(resultList, target, SortUtils.ASC);
+            SortUtils.sort(resultList, target, SortUtils.DESC);
         }
 
         return resultList;
@@ -930,42 +937,42 @@ public class WindturbinegoodnessService {
         List<PvVo> resultList = new ArrayList<>();
         LambdaQueryWrapper<ProEconEquipmentInfoDay6> qw = new LambdaQueryWrapper<>();
 
-        qw.le(ProEconEquipmentInfoDay6::getRecordDate,DateUtils.parseDate(endDate));
-        qw.ge(ProEconEquipmentInfoDay6::getRecordDate,DateUtils.parseDate(beginDate));
+        qw.le(ProEconEquipmentInfoDay6::getRecordDate, DateUtils.parseDate(endDate));
+        qw.ge(ProEconEquipmentInfoDay6::getRecordDate, DateUtils.parseDate(beginDate));
 
 
-        if (StringUtils.isNotEmpty(wpid)){
-            qw.eq(ProEconEquipmentInfoDay6::getWindpowerstationId,wpid);
+        if (StringUtils.isNotEmpty(wpid)) {
+            qw.eq(ProEconEquipmentInfoDay6::getWindpowerstationId, wpid);
         }
-        if (StringUtils.isNotEmpty(wtid)){
-            qw.eq(ProEconEquipmentInfoDay6::getWindturbineId,wtid);
+        if (StringUtils.isNotEmpty(wtid)) {
+            qw.eq(ProEconEquipmentInfoDay6::getWindturbineId, wtid);
         }
         List<ProEconEquipmentInfoDay6> equipmentInfoDay6s = proEconEquipmentInfoDay6Service.list(qw);
 
-        equipmentInfoDay6s.stream().forEach(i->{
+        equipmentInfoDay6s.stream().forEach(i -> {
             PvVo vo = new PvVo();
             vo.setWtid(i.getWindturbineId());
             vo.setWtname(wtmap.get(i.getWindturbineId()).getAname());
             vo.setDate(i.getRecordDate());
             vo.setModel(modelMap.get(wtmap.get(i.getWindturbineId()).getModelId()).getAname());
-            vo.setRxtxl(DoubleUtils.keepPrecision(i.getRxtxl(),2));
-            vo.setRlsl(DoubleUtils.keepPrecision(i.getRlsl(),2));
-            vo.setRzhxl(DoubleUtils.keepPrecision(i.getRnbqzhxl(),2));
+            vo.setRxtxl(DoubleUtils.keepPrecision(i.getRxtxl(), 2));
+            vo.setRlsl(DoubleUtils.keepPrecision(i.getRlsl(), 2));
+            vo.setRzhxl(DoubleUtils.keepPrecision(i.getRnbqzhxl(), 2));
 
-            vo.setYxtxl(DoubleUtils.keepPrecision(i.getYxtxl(),2));
-            vo.setYlsl(DoubleUtils.keepPrecision(i.getYlsl(),2));
-            vo.setYzhxl(DoubleUtils.keepPrecision(i.getYnbqzhxl(),2));
+            vo.setYxtxl(DoubleUtils.keepPrecision(i.getYxtxl(), 2));
+            vo.setYlsl(DoubleUtils.keepPrecision(i.getYlsl(), 2));
+            vo.setYzhxl(DoubleUtils.keepPrecision(i.getYnbqzhxl(), 2));
 
-            vo.setNxtxl(DoubleUtils.keepPrecision(i.getNxtxl(),2));
-            vo.setNlsl(DoubleUtils.keepPrecision(i.getNlsl(),2));
-            vo.setNzhxl(DoubleUtils.keepPrecision(i.getNnbqzhxl(),2));
+            vo.setNxtxl(DoubleUtils.keepPrecision(i.getNxtxl(), 2));
+            vo.setNlsl(DoubleUtils.keepPrecision(i.getNlsl(), 2));
+            vo.setNzhxl(DoubleUtils.keepPrecision(i.getNnbqzhxl(), 2));
             resultList.add(vo);
         });
 
-        if (StringUtils.isNotEmpty(target)){
+        if (StringUtils.isNotEmpty(target)) {
             if (sort.equals("1"))
-                SortUtils.sort(resultList,target,SortUtils.ASC);
-            SortUtils.sort(resultList,target,SortUtils.DESC);
+                SortUtils.sort(resultList, target, SortUtils.ASC);
+            SortUtils.sort(resultList, target, SortUtils.DESC);
         }
 
         return resultList;