Commit a64d58ce authored by ZWT's avatar ZWT

feat[零碳项目]: 松原演示

[1.修改井口日用电趋势统计表,增加谷电时段发电时长及谷电占比字段,同时在代码中添加对应字段并修改数据库mapper文件相关业务处理逻辑sql语句;
2.修改线路日用电趋势统计表,增加谷电时段发电时长及谷电占比字段,同时在代码中添加对应字段并修改数据库mapper文件相关业务处理逻辑sql语句;
3.修改井口/线路日用电趋势统计定时任务,增加环境区分,通过读取配置表来获取当前部署环境,针对不同环境进行不同业务处理,同时增加获取每日井口及线路谷电运行时长统计逻辑,完成功能冒烟测试;
4.修改首页总览接口逻辑,增加环境区分,通过读取配置表来获取当前部署环境,针对不同环境进行不同业务处理;]
parent 58050b64
......@@ -38,6 +38,11 @@ public class BusinessConstant {
*/
public static final String PHOTOVOLTAIC_POWER_STATION = "photovoltaic_power_station";
/**
* 默认值
*/
public static final String DEFAULT_VALUE = "--";
/**
* 井口
*/
......@@ -83,6 +88,18 @@ public class BusinessConstant {
*/
public static final String NO_OPTIMIZATION_C = "未优化";
/*------------------------------环境------------------------------*/
/**
* 长庆
*/
public static final String ENV_CQ = "CQ";
/**
* 松原
*/
public static final String ENV_SY = "SY";
/*------------------------------数字------------------------------*/
/**
......
......@@ -104,7 +104,7 @@ public class DailyElectricityTrendCloudServiceImpl implements IDailyElectricityT
.collect(Collectors.toMap(GetBasePhotovoltaicPlantCloudOutput::getStationName, GetBasePhotovoltaicPlantCloudOutput::getStrategyId));
//获取当前配置
GetConfigOilFieldOutput currentConfig = ServiceUtil.getCurrentConfig(context);
String oilFieldCode = ObjectUtil.defaultIfNull(currentConfig.getOilFieldCode(), "--");
String oilFieldCode = ObjectUtil.defaultIfNull(currentConfig.getOilFieldCode(), BusinessConstant.DEFAULT_VALUE);
SpaceOptimizeShortDurationView wellInfo;
BigDecimal currentServiceRating;
String wellNumber;
......
......@@ -24,6 +24,7 @@ import pps.cloud.base.service.data.base_power_line_wellhead.DynamicQueryBasePowe
import pps.cloud.base.service.data.base_power_line_wellhead.DynamicQueryBasePowerLineWellheadViewOutput;
import pps.cloud.base.service.data.base_wellhead.DynamicQueryBaseWellheadInput;
import pps.cloud.base.service.data.base_wellhead.DynamicQueryBaseWellheadOutput;
import pps.cloud.base.service.data.config_oil_field.GetConfigOilFieldOutput;
import pps.cloud.system.service.SysOrganizationCloudService;
import pps.cloud.system.service.SystemAreaService;
import pps.cloud.system.service.data.sys_area.GetSysAreaInput;
......@@ -36,6 +37,7 @@ import pps.core.prediction.enums.BusinessError;
import pps.core.prediction.mapper.*;
import pps.core.prediction.service.data.energy_consumption_analysis.DynamicQueryEnergyConsumptionAnalysisViewOutput;
import pps.core.prediction.service.data.home_page.*;
import pps.core.prediction.utils.ServiceUtil;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
......@@ -111,39 +113,58 @@ public class HomePageService {
* @return {@link XSingleResult}<{@link GetOverviewViewOutput}>
*/
@XText("首页模块--总览")
@XApiGet
@XApiGet(anonymous = true)
public XSingleResult<GetOverviewViewOutput> getOverview(XContext context, GetStationViewInput input) {
String stationId = input.getStationId();
List<DynamicQueryBaseWellheadOutput> wellList = this.getWellList(context, stationId);
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId, null);
List<DynamicQueryBasePowerLineOutput> lineList = this.getLineList(context, stationId, "10", null);
//判断部署环境
GetConfigOilFieldOutput currentConfig = ServiceUtil.getCurrentConfig(context);
String oilFieldCode = ObjectUtil.defaultIfNull(currentConfig.getOilFieldCode(), BusinessConstant.DEFAULT_VALUE);
BigDecimal photovoltaicPower;
BigDecimal storagePower;
if (CharSequenceUtil.isBlank(stationId)) {
photovoltaicPower = new BigDecimal("3914.46");
storagePower = new BigDecimal("852.96");
} else {
switch (stationId) {
case "bb1bff9d-7068-48c9-9be8-c80eb0d49152":
//第一采油场
photovoltaicPower = new BigDecimal("226.12");
storagePower = new BigDecimal("852.96");
break;
case "2c4c9d1c-ad55-4c14-b889-4dc33e3461e2":
//第二采油场
photovoltaicPower = new BigDecimal("2650.86");
storagePower = BigDecimal.ZERO;
break;
case "0ffe6c33-ea02-476c-b28a-fd978184b2b3":
//第五采油场
photovoltaicPower = new BigDecimal("1178.28");
storagePower = BigDecimal.ZERO;
break;
default:
switch (oilFieldCode) {
case BusinessConstant.ENV_CQ:
if (CharSequenceUtil.isBlank(stationId)) {
photovoltaicPower = new BigDecimal("3914.46");
storagePower = new BigDecimal("852.96");
}
} else {
switch (stationId) {
case "bb1bff9d-7068-48c9-9be8-c80eb0d49152":
//第一采油场
photovoltaicPower = new BigDecimal("226.12");
storagePower = new BigDecimal("852.96");
break;
case "2c4c9d1c-ad55-4c14-b889-4dc33e3461e2":
//第二采油场
photovoltaicPower = new BigDecimal("2650.86");
storagePower = BigDecimal.ZERO;
break;
case "0ffe6c33-ea02-476c-b28a-fd978184b2b3":
//第五采油场
photovoltaicPower = new BigDecimal("1178.28");
storagePower = BigDecimal.ZERO;
break;
default:
photovoltaicPower = new BigDecimal("3914.46");
storagePower = new BigDecimal("852.96");
}
}
break;
case BusinessConstant.ENV_SY:
List<DynamicQueryBaseEnergyStorageDeviceOutput> storageList = this.getStorageList(context, stationId);
photovoltaicPower = plantList.stream()
.map(GetBasePhotovoltaicPlantCloudOutput::getTotalPower)
.reduce(BigDecimal.ZERO, BigDecimal::add);
storagePower = storageList.stream()
.map(DynamicQueryBaseEnergyStorageDeviceOutput::getApparatusCapacity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
break;
default:
photovoltaicPower = BigDecimal.ZERO;
storagePower = BigDecimal.ZERO;
}
List<DynamicQueryBaseWellheadOutput> wellList = this.getWellList(context, stationId);
List<DynamicQueryBasePowerLineOutput> lineList = this.getLineList(context, stationId, "10", null);
return XSingleResult.success(GetOverviewViewOutput.builder()
.wellNumber(wellList.size())
.stationNumber(plantList.size())
......
......@@ -10,6 +10,8 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import pps.cloud.base.service.IConfigOilFieldCloudService;
import pps.cloud.base.service.data.config_oil_field.GetConfigOilFieldOutput;
import pps.core.auth.HttpRequestClient;
import pps.core.common.cache.ThirdPartyConfigCache;
import pps.core.common.constant.BusinessConstant;
......@@ -21,6 +23,7 @@ import xstartup.base.XContext;
import xstartup.base.XStartup;
import xstartup.base.exception.XServiceException;
import xstartup.base.util.XHttpUtils;
import xstartup.data.XSingleResult;
import java.math.BigDecimal;
import java.util.*;
......@@ -255,6 +258,19 @@ public class ServiceUtil {
return outputs;
}
/**
* 获取当前配置
*
* @param context 上下文
* @return {@link GetConfigOilFieldOutput }
*/
public static GetConfigOilFieldOutput getCurrentConfig(XContext context) {
IConfigOilFieldCloudService bean = context.getBean(IConfigOilFieldCloudService.class);
XSingleResult<GetConfigOilFieldOutput> currentConfig = bean.getCurrentConfig(context);
currentConfig.throwIfFail();
return currentConfig.getResult();
}
/*----------------------------------- 私有方法 -----------------------------------*/
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment