Parcourir la source

单机月度分析接口修改

shilin il y a 2 ans
Parent
commit
d81ab1f99f

+ 5 - 5
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/OutputSpeedController.java

@@ -35,8 +35,8 @@ public class OutputSpeedController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "cmId", value = "公司编号", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "type", value = "光伏(-2)/风场(-1)", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "cmId", value = "公司编号或者区域编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "0全部、光伏(-2)、风场(-1)", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
 
@@ -68,14 +68,14 @@ public class OutputSpeedController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "cmId", value = "公司编号", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "type", value = "光伏(-2)/风场(-1)", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "cmId", value = "公司编号或者区域编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "0全部、光伏(-2)、风场(-1)", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "wtId", value = "风机编号", required = false, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")})
 
-    public R outputspeedhistorylist(Integer pageNum, Integer pageSize,String cmId,String type, String wpId,String wtId, String beginDate,String endDate) {
+    public R outputspeedhistorylist(Integer pageNum, Integer pageSize,String  cmId,String type, String wpId,String wtId, String beginDate,String endDate) {
 
 
         Page<ProEconInOrOutSpeedTotal> pageInfo=outputSpeedService.outputspeedhistorylist(pageNum,pageSize,cmId,type,wpId,wtId,beginDate,endDate);

+ 3 - 3
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/SingleAnalysisController.java

@@ -36,8 +36,8 @@ public class SingleAnalysisController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "cmId", value = "公司编号", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "type", value = "光伏(-2)/风场(-1)", required = true, dataType = "string", paramType = "query"),
+             @ApiImplicitParam(name = "cmId", value = "公司编号或者区域编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "0全部、光伏(-2)、风场(-1)", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})
@@ -47,7 +47,7 @@ public class SingleAnalysisController {
         Map<String,Object> map=new HashMap<>();
         List<SingleAnalysisVo> vos =new ArrayList<>();
 
-        if (StringUtils.notEmp(cmId) && StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
+        if ( StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
 
             Calendar cal = Calendar.getInstance();
             int newyear=cal.get(Calendar.YEAR);

+ 2 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/goodness/WindturbinegoodnessController.java

@@ -43,8 +43,8 @@ public class WindturbinegoodnessController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "cmId", value = "公司编号", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "type", value = "光伏(-2)/风场(-1)", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "cmId", value = "公司编号或者区域编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "0全部、光伏(-2)、风场(-1)", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
 

+ 11 - 4
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/init/CacheContext.java

@@ -93,6 +93,7 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,List<ProBasicEquipment>> pjwtmap = new HashMap<>();
     public static Map<String,List<ProBasicEquipment>> lnwtmap = new HashMap<>();
     public static Map<String,List<ProBasicEquipment>> cmwtlsmap = new HashMap<>();
+    public static Map<String,List<ProBasicEquipment>> rgwtlsmap = new HashMap<>();
     public static Map<String,Map<String,ProBasicEquipment>> cmwtmap = new HashMap<>();
     public static Map<String,List<ProBasicEquipment>> sqwtmap = new HashMap<>();
     public static Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = new HashMap<>();// 风电机测点AI表
@@ -295,11 +296,17 @@ public class CacheContext implements CommandLineRunner {
             if (cmwtlsmap.containsKey(wt.getCompanyId())){
                 cmwtlsmap.get(wt.getCompanyId()).add(wt);
             }else {
-                List<ProBasicEquipment> lnls = new ArrayList<>();
-                lnls.add(wt);
-                cmwtlsmap.put(wt.getCompanyId(),lnls);
+                List<ProBasicEquipment> cmls = new ArrayList<>();
+                cmls.add(wt);
+                cmwtlsmap.put(wt.getCompanyId(),cmls);
+            }
+            if (rgwtlsmap.containsKey(wt.getRegionId())){
+                rgwtlsmap.get(wt.getRegionId()).add(wt);
+            }else {
+                List<ProBasicEquipment> rgls = new ArrayList<>();
+                rgls.add(wt);
+                rgwtlsmap.put(wt.getRegionId(),rgls);
             }
-
 
             if (sqwtmap.containsKey(wt.getSquareId())){
                 sqwtmap.get(wt.getSquareId()).add(wt);

+ 1 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProEconInOrOutSpeedTotal.java

@@ -375,6 +375,7 @@ public class ProEconInOrOutSpeedTotal extends Model {
      */
     private String lineId;
     private String companyId;
+    private String regionId;
     private String types;
     @TableField(exist = false)
     private String wtcode;

+ 1 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProEconInOrOutSpeedTotal2.java

@@ -474,5 +474,5 @@ public class ProEconInOrOutSpeedTotal2 extends Model {
      */
     private String lineId;
 
-
+    private String regionId;
 }

+ 2 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProEconWindturbineGoodness.java

@@ -102,4 +102,6 @@ public class ProEconWindturbineGoodness extends Model {
     @TableField(exist = false)
     private String wtcode;
 
+    private String regionId;
+
 }

+ 18 - 5
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/goodness/WindturbinegoodnessService.java

@@ -45,7 +45,7 @@ public class WindturbinegoodnessService {
         }
         //构造分页构造器
         Page<ProEconWindturbineGoodness> pageInfo = new Page<>(pageNum, pageSize);
-        if (StringUtils.notEmp(cmId) && StringUtils.notEmp(type) && StringUtils.notEmp(recorddate)) {
+        if (StringUtils.notEmp(type) && StringUtils.notEmp(recorddate)) {
             Date date = DateUtils.parseDate(recorddate);
 
             //构造条件构造器
@@ -54,13 +54,26 @@ public class WindturbinegoodnessService {
 
             if (StringUtils.notEmp(wpId)) {
                 queryWrapper.eq(ProEconWindturbineGoodness::getWindtpowerstationId, wpId).
+
+                        eq(ProEconWindturbineGoodness::getRecordDate, date);
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconWindturbineGoodness::getTypes, type);
+                }
+            } else if (StringUtils.notEmp(cmId) && CacheContext.cpmap.containsKey(cmId)) {
+                queryWrapper.
                         eq(ProEconWindturbineGoodness::getCompanyId, cmId).
-                        eq(ProEconWindturbineGoodness::getTypes, type).
+
                         eq(ProEconWindturbineGoodness::getRecordDate, date);
-            } else {
-                queryWrapper.eq(ProEconWindturbineGoodness::getCompanyId, cmId).
-                        eq(ProEconWindturbineGoodness::getTypes, type).
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconWindturbineGoodness::getTypes, type);
+                }
+            } else if (StringUtils.notEmp(cmId) && CacheContext.rgmap.containsKey(cmId)) {
+                queryWrapper.eq(ProEconWindturbineGoodness::getRegionId, cmId).
+
                         eq(ProEconWindturbineGoodness::getRecordDate, date);
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconWindturbineGoodness::getTypes, type);
+                }
             }
 
             //执行查询

+ 65 - 55
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/outputspeed/OutputSpeedService.java

@@ -3,6 +3,7 @@ package com.gyee.runeconomy.service.outputspeed;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.ProEconInOrOutSpeedTotal;
 import com.gyee.runeconomy.service.auto.IProEconInOrOutSpeedTotalService;
 import com.gyee.runeconomy.util.DateUtils;
@@ -18,39 +19,45 @@ public class OutputSpeedService {
     @Resource
     private IProEconInOrOutSpeedTotalService proEconInOrOutSpeedTotalService;
 
-    public Page<ProEconInOrOutSpeedTotal> outputSpeedlist(Integer pageNum, Integer pageSize, String cmId,String type, String wpId, String recorddate) {
+    public Page<ProEconInOrOutSpeedTotal> outputSpeedlist(Integer pageNum, Integer pageSize, String cmId, String type, String wpId, String recorddate) {
 
-        if(StringUtils.empty(pageNum))
-        {
-            pageNum=1;
+        if (StringUtils.empty(pageNum)) {
+            pageNum = 1;
         }
-        if(StringUtils.empty(pageSize))
-        {
-            pageSize=10;
+        if (StringUtils.empty(pageSize)) {
+            pageSize = 10;
         }
         //构造分页构造器
         Page<ProEconInOrOutSpeedTotal> pageInfo = new Page<>(pageNum, pageSize);
-        if (StringUtils.notEmp(cmId) && StringUtils.notEmp(recorddate))
-        {
-            Date date= DateUtils.parseDate(recorddate);
+        if (StringUtils.notEmp(cmId) && StringUtils.notEmp(recorddate)) {
+            Date date = DateUtils.parseDate(recorddate);
             //构造条件构造器
             LambdaQueryWrapper<ProEconInOrOutSpeedTotal> queryWrapper = new LambdaQueryWrapper<>();
             //添加过滤条件
 
 
-            if(StringUtils.notEmp(wpId))
-            {
-
-                queryWrapper.eq(ProEconInOrOutSpeedTotal::getWindpowerstationId, wpId).
-                        eq(ProEconInOrOutSpeedTotal::getCompanyId,cmId).
-                        eq(ProEconInOrOutSpeedTotal::getTypes,type).
+            if (StringUtils.notEmp(wpId)) {
+                queryWrapper.eq(ProEconInOrOutSpeedTotal::getWindpowerstationId, wpId).eq(ProEconInOrOutSpeedTotal::getTypes, type).
                         eq(ProEconInOrOutSpeedTotal::getRecordDate, date);
-            }else
-            {
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getTypes, type);
+                }
+
+            } else if (StringUtils.notEmp(cmId) && CacheContext.cpmap.containsKey(cmId)) {
                 queryWrapper.
-                        eq(ProEconInOrOutSpeedTotal::getCompanyId,cmId).
-                        eq(ProEconInOrOutSpeedTotal::getTypes,type).
+                        eq(ProEconInOrOutSpeedTotal::getCompanyId, cmId).
+
                         eq(ProEconInOrOutSpeedTotal::getRecordDate, date);
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getTypes, type);
+                }
+            } else if (StringUtils.notEmp(cmId) && CacheContext.rgmap.containsKey(cmId)) {
+                queryWrapper.eq(ProEconInOrOutSpeedTotal::getRegionId, cmId).
+
+                        eq(ProEconInOrOutSpeedTotal::getRecordDate, date);
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getTypes, type);
+                }
             }
 
             //执行查询
@@ -62,56 +69,59 @@ public class OutputSpeedService {
     }
 
 
-    public Page<ProEconInOrOutSpeedTotal> outputspeedhistorylist(Integer pageNum, Integer pageSize,String cmId,String type, String wpId, String wtId, String beginDate, String endDate) {
+    public Page<ProEconInOrOutSpeedTotal> outputspeedhistorylist(Integer pageNum, Integer pageSize, String cmId, String type, String wpId, String wtId, String beginDate, String endDate) {
 
 
-        if(StringUtils.empty(pageNum))
-        {
-            pageNum=1;
+        if (StringUtils.empty(pageNum)) {
+            pageNum = 1;
         }
-        if(StringUtils.empty(pageSize))
-        {
-            pageSize=10;
+        if (StringUtils.empty(pageSize)) {
+            pageSize = 10;
         }
         //构造分页构造器
         Page<ProEconInOrOutSpeedTotal> pageInfo = new Page<>(pageNum, pageSize);
 
 
+        if (StringUtils.notEmp(type) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
 
-        if (StringUtils.notEmp(cmId)  && StringUtils.notEmp(type) && StringUtils.notEmp(beginDate) &&  StringUtils.notEmp(endDate))
-        {
-
-            Date begin=DateUtils.parseDate(beginDate);
-            Date end=DateUtils.parseDate(endDate);
+            Date begin = DateUtils.parseDate(beginDate);
+            Date end = DateUtils.parseDate(endDate);
 
             //构造条件构造器
             LambdaQueryWrapper<ProEconInOrOutSpeedTotal> queryWrapper = new LambdaQueryWrapper<>();
             //添加过滤条件
-            if(StringUtils.notEmp(wpId))
-            {
-
-                if(StringUtils.notEmp(wtId))
-                {
-                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getWindpowerstationId, wpId).
-                            eq(ProEconInOrOutSpeedTotal::getCompanyId,cmId).
-                            eq(ProEconInOrOutSpeedTotal::getTypes,type).
-                            eq(ProEconInOrOutSpeedTotal::getWindturbineId,wtId).
-                            ge(ProEconInOrOutSpeedTotal::getRecordDate, begin).
-                            le(ProEconInOrOutSpeedTotal::getRecordDate,end);
-                }else
-                {
-                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getWindpowerstationId, wpId).
-                            eq(ProEconInOrOutSpeedTotal::getCompanyId,cmId).
-                            eq(ProEconInOrOutSpeedTotal::getTypes,type).
-                            ge(ProEconInOrOutSpeedTotal::getRecordDate, begin).
-                            le(ProEconInOrOutSpeedTotal::getRecordDate,end);
+
+
+            if (StringUtils.notEmp(wtId)) {
+                queryWrapper.eq(ProEconInOrOutSpeedTotal::getWindturbineId, wtId).
+                        ge(ProEconInOrOutSpeedTotal::getRecordDate, begin).
+                        le(ProEconInOrOutSpeedTotal::getRecordDate, end);
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getTypes, type);
+                }
+            } else if (StringUtils.notEmp(wpId)) {
+                queryWrapper.eq(ProEconInOrOutSpeedTotal::getWindpowerstationId, wpId).
+                        ge(ProEconInOrOutSpeedTotal::getRecordDate, begin).
+                        le(ProEconInOrOutSpeedTotal::getRecordDate, end);
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getTypes, type);
                 }
-            }else
-            {
-                queryWrapper.eq(ProEconInOrOutSpeedTotal::getCompanyId,cmId).
-                        eq(ProEconInOrOutSpeedTotal::getTypes,type).
+            } else if (StringUtils.notEmp(cmId) && CacheContext.cpmap.containsKey(cmId)) {
+                queryWrapper.
+                        eq(ProEconInOrOutSpeedTotal::getCompanyId, cmId).
                         ge(ProEconInOrOutSpeedTotal::getRecordDate, begin).
-                        le(ProEconInOrOutSpeedTotal::getRecordDate,end);
+                        le(ProEconInOrOutSpeedTotal::getRecordDate, end);
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getTypes, type);
+                }
+            } else if (StringUtils.notEmp(cmId) && CacheContext.rgmap.containsKey(cmId)) {
+                queryWrapper.eq(ProEconInOrOutSpeedTotal::getRegionId, cmId).
+                        eq(ProEconInOrOutSpeedTotal::getTypes, type).
+                        ge(ProEconInOrOutSpeedTotal::getRecordDate, begin).
+                        le(ProEconInOrOutSpeedTotal::getRecordDate, end);
+                if (StringUtils.notEmp(type) && !type.equals("0")) {
+                    queryWrapper.eq(ProEconInOrOutSpeedTotal::getTypes, type);
+                }
             }
 
             //执行查询

+ 10 - 4
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/singleanalysis/SingleAnalysisService.java

@@ -249,7 +249,7 @@ public class SingleAnalysisService {
 
 
 
-    public Map<String,Object>  SingleAnalysisList(Integer pageNum, Integer pageSize, String cmId,String type, String wpId,Date recordDate) {
+    public Map<String,Object>  SingleAnalysisList(Integer pageNum, Integer pageSize,String cmId,String type, String wpId,Date recordDate) {
 
         List<SingleAnalysisVo> vos = new ArrayList<>();
 
@@ -264,14 +264,20 @@ public class SingleAnalysisService {
             List<ProBasicEquipment> wtls =new ArrayList<>();
             if(StringUtils.isNotEmpty(wpId))
             {
-                if (CacheContext.wpwtmap.containsKey(cmId)) {
+                if (CacheContext.wpwtmap.containsKey(wpId)) {
                    wtls = CacheContext.wpwtmap.get(wpId);
                 }
 
-            }else
+            }else if(StringUtils.isNotEmpty(cmId) && CacheContext.cpmap.containsKey(cmId))
             {
                 if (CacheContext.cmwtlsmap.containsKey(cmId)) {
-                     wtls = CacheContext.cmwtlsmap.get(cmId);
+                    wtls = CacheContext.cmwtlsmap.get(cmId);
+                }
+
+            }else  if(StringUtils.isNotEmpty(cmId) && CacheContext.rgmap.containsKey(cmId))
+            {
+                if (CacheContext.rgwtlsmap.containsKey(cmId)) {
+                     wtls = CacheContext.rgwtlsmap.get(cmId);
                 }
             }