Commit c12f7f05 authored by tangwei's avatar tangwei

解决冲突

parents 66f50370 70daa26e
......@@ -19,5 +19,11 @@
<artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.22</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
package com.yeejoin.amos.boot.module.jxiop.api.dto;
import lombok.Data;
@Data
public class BuDunGenDto {
private Double day;
private Double month;
private Double year;
private Double year_complete;
private Double year_hour_number;
}
package com.yeejoin.amos.boot.module.jxiop.api.dto;
import lombok.Data;
import java.util.List;
@Data
public class BuDunPvFanDto {
List<BudunStationValueDto> fan;
List<BudunStationValueDto> pv;
}
package com.yeejoin.amos.boot.module.jxiop.api.dto;
import lombok.Data;
@Data
public class BudunStationValueDto {
private String station_name;
private Double value;
}
......@@ -69,6 +69,17 @@ public class Constants {
* 江西电建证书字典key
*/
public static final String JXIOP_DICT_CERTIFICATES = "jxIop:dict:certificates";
public static final String BASE_URL = "http://iiet-jepcc.powerchina.cn:8088/screen_api";
public static final String REQUEST_GET="GET";
public static final String REQUEST_POST="POST";
public static final String get_province_item_url="method=scene_screen.data_interface.get_province_item";
public static final String get_month_generation_trend_url="method=scene_screen.data_interface.get_month_generation_trend";
public static final String get_area_item_url="method=scene_screen.data_interface.get_area_item";
public static final String get_month_top_url="method=scene_screen.data_interface.get_month_top";
public static final String get_hours_num_top="scene_screen.data_interface.get_hours_num_top";
public static final String resovleRule_data = "data";
public static final String areaChinese="区域";
}
package com.yeejoin.amos.boot.module.jxiop.api.util;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Component
public class HttpRequestUtil {
public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) {
String respone = "";
if (requestMethod.equals("POST")) {
respone = HttpUtil.createPost(url).headerMap(headMap, false).
body(params).execute().body();
}
if (requestMethod.equals("GET")) {
respone = HttpUtil.createGet(url).headerMap(headMap, true).
body(params).execute().body();
}
return respone;
}
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
JSONObject jsonObject = JSONObject.parseObject(response);
JSONArray jsonArray = new JSONArray();
if (ObjectUtil.isNotEmpty(resultResovle)) {
String[] rules = resultResovle.split(",");
if (rules.length > 0) {
for (int i = 0; i < rules.length; i++) {
try {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
if (jsonObject == null) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
} catch (Exception exception) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
}
}
if (jsonArray.size() == 0) {
jsonArray.add(jsonObject);
}
}
return jsonArray;
}
public <T> List<T> getResPonse(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule, Class<T> tClass) {
String respone = "";
String params = "";
JSONArray jsonArray = null;
List<T> result = new ArrayList<>();
try {
respone = sendRequest(requestMethod, apiurl, requestParmInfo, null);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
}
} catch (Exception exception) {
return result;
}
return result;
}
}
......@@ -27,4 +27,6 @@ public interface MonitorService {
* @return Map<String, Object>
*/
Map<String, Object> qyAccessSituation();
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.constants;
import com.sun.javafx.logging.PulseLogger;
import org.checkerframework.checker.units.qual.C;
import org.elasticsearch.search.fetch.subphase.FieldAndFormat;
import java.util.*;
......@@ -181,7 +182,6 @@ public class CommonConstans {
public static final String TOTAL_RADIATION = "辐照度";
public static final String ACTIVE_POWER = "有功功率";
//------------------监盘服务改造新增常量结束------------------------------
}
......@@ -94,8 +94,8 @@ public class DemoController extends BaseController {
Logger logger = LoggerFactory.getLogger(DemoController.class);
@Autowired
StationBasicServiceImpl stationBasicServiceimpl;
@Autowired
TestServiceImpl testServiceimpl;
// @Autowired
// TestServiceImpl testServiceimpl;
@Autowired
EmqKeeper emqKeeper;
@Autowired
......@@ -511,16 +511,16 @@ public class DemoController extends BaseController {
commonServiceImpl.getListDataByCondtions(queryConditon, null, ESEquipments.class);
}
@TycloudOperation( ApiLevel = UserType.AGENCY)
@TycloudOperation( ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "测试feign调用")
@GetMapping("/testFeignCall")
public List<CoreValuesDto> testFeignCall() {
List<CoreValuesDto> coreValuesDtos =coreCommonService.getValuesByStationNamesAndPointsNames(null,null);
// List<CoreValuesDto> coreValuesDtos =coreCommonService.getValuesByStationNamesAndPointsNames(null,null);
// monitorService.getTotalData();
// monitorService.getNationWideInfo("江西省","gis");
monitorService.getCompletionOfPowerIndicatorsByProvinceName(1,20,"陕西省");
monitorService.getNationWideInfo("江西省","gis");
// monitorService.getCompletionOfPowerIndicatorsByProvinceName(1,20,"陕西省");
// Double sum = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// Double avg = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
return coreValuesDtos;
return null;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import java.util.HashMap;
import java.util.List;
......@@ -35,4 +37,28 @@ public interface MonitorService {
* @return 有功功率
*/
public HashMap<String, String> getActivePowerByAreaName(String areaName);
/**
* @description 根据地区名称获取发电数据
* @param areaName
* @return
*/
public Page<HashMap<String, String>> getDetailsOnPowergeneration(String areaName);
/**
* @description 根据地区名称获取社会贡献数据
* @param areaName
* @param stationId
* @return
*/
public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) ;
/**
* @description 根据地区名称获取发电量完成度排名前五的数据
* @param areaName
* @return
*/
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName);
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.dto.BuDunGenDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.BudunStationValueDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.BuDunPvFanDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.*;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.*;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.api.util.Constants;
import com.yeejoin.amos.boot.module.jxiop.api.util.HttpRequestUtil;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService;
......@@ -23,8 +26,6 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static io.lettuce.core.ZStoreArgs.Builder.sum;
@Service
@Slf4j
@RequiredArgsConstructor
......@@ -35,12 +36,13 @@ public class MonitorServiceImpl implements MonitorService {
private final RegionMapper regionMapper;
private final StationCoordinateMapper stationCoordinateMapper;
private final MapRegionMapper mapRegionMapper;
private final HttpRequestUtil httpRequestUtil;
@Override
public void getTotalData() {
//获取所有的场站数据
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
// List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
......@@ -97,34 +99,67 @@ public class MonitorServiceImpl implements MonitorService {
Double completeRateOfAnnualGF = 0.00;
Double useHoursOfAnnualGF = 0.00;
if (coreValuesDtos.size() > 0) {
powerOfDay = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
powerOfMonth = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.MONTH_POWER_GENERATION);
powerOfAnnual = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_POWER_GENERATION);
completeRateOfAnnual = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_ATTAINMENT_RATE);
//年利用小时数
useHoursOfAnnual = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_HOURS);
List<String> fdNames = fdzList.stream().map(StationBasic::getStationCoreName).collect(Collectors.toList());
List<String> gfNames = gfList.stream().map(StationBasic::getStationCoreName).collect(Collectors.toList());
List<CoreValuesDto> fdcoreValuesDtos = coreValuesDtos.stream().filter(dto -> fdNames.contains(dto.getName())).collect(Collectors.toList());
List<CoreValuesDto> gfcoreValuesDtos = coreValuesDtos.stream().filter(dto -> gfNames.contains(dto.getName())).collect(Collectors.toList());
if (fdcoreValuesDtos.size() > 0) {
powerOfDayFD = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
powerOfMonthFD = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.MONTH_POWER_GENERATION);
powerOfAnnualFD = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_POWER_GENERATION);
completeRateOfAnnualFD = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_ATTAINMENT_RATE);
//年利用小时数
useHoursOfAnnualFD = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_HOURS);
}
if (gfcoreValuesDtos.size() > 0) {
powerOfDayGF = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
powerOfMonthGF = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.MONTH_POWER_GENERATION);
powerOfAnnualGF = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_POWER_GENERATION);
completeRateOfAnnualGF = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_ATTAINMENT_RATE);
//年利用小时数
useHoursOfAnnualGF = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_HOURS);
}
//获取全国数据
String nationalUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url;
//获取风电
String nationalFanUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&type=fan";
//获取光伏
String nationalPVUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&type=pv";
List<BuDunGenDto> nationalGendto = httpRequestUtil.getResPonse(nationalPVUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> fanGendto = httpRequestUtil.getResPonse(nationalPVUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> pvGendto = httpRequestUtil.getResPonse(nationalPVUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
if (nationalGendto.size() > 0) {
BuDunGenDto buDunGenDto = nationalGendto.get(0);
powerOfDay = buDunGenDto.getDay();
powerOfMonth = buDunGenDto.getMonth();
powerOfAnnual = buDunGenDto.getYear();
completeRateOfAnnual = buDunGenDto.getYear_complete();
useHoursOfAnnual = buDunGenDto.getYear_hour_number();
}
if (fanGendto.size() > 0) {
BuDunGenDto buDunGenDto = nationalGendto.get(0);
powerOfDayFD = buDunGenDto.getDay();
powerOfMonthFD = buDunGenDto.getMonth();
powerOfAnnualFD = buDunGenDto.getYear();
completeRateOfAnnualFD = buDunGenDto.getYear_complete();
useHoursOfAnnualFD = buDunGenDto.getYear_hour_number();
}
if (pvGendto.size() > 0) {
BuDunGenDto buDunGenDto = nationalGendto.get(0);
powerOfDayGF = buDunGenDto.getDay();
powerOfMonthGF = buDunGenDto.getMonth();
powerOfAnnualGF = buDunGenDto.getYear();
completeRateOfAnnualGF = buDunGenDto.getYear_complete();
useHoursOfAnnualGF = buDunGenDto.getYear_hour_number();
}
// if (coreValuesDtos.size() > 0) {
// powerOfDay = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// powerOfMonth = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.MONTH_POWER_GENERATION);
// powerOfAnnual = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_POWER_GENERATION);
// completeRateOfAnnual = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_ATTAINMENT_RATE);
// //年利用小时数
// useHoursOfAnnual = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_HOURS);
// List<String> fdNames = fdzList.stream().map(StationBasic::getStationCoreName).collect(Collectors.toList());
// List<String> gfNames = gfList.stream().map(StationBasic::getStationCoreName).collect(Collectors.toList());
// List<CoreValuesDto> fdcoreValuesDtos = coreValuesDtos.stream().filter(dto -> fdNames.contains(dto.getName())).collect(Collectors.toList());
// List<CoreValuesDto> gfcoreValuesDtos = coreValuesDtos.stream().filter(dto -> gfNames.contains(dto.getName())).collect(Collectors.toList());
// if (fdcoreValuesDtos.size() > 0) {
// powerOfDayFD = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// powerOfMonthFD = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.MONTH_POWER_GENERATION);
// powerOfAnnualFD = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_POWER_GENERATION);
// completeRateOfAnnualFD = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_ATTAINMENT_RATE);
// //年利用小时数
// useHoursOfAnnualFD = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_HOURS);
// }
// if (gfcoreValuesDtos.size() > 0) {
// powerOfDayGF = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// powerOfMonthGF = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.MONTH_POWER_GENERATION);
// powerOfAnnualGF = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_POWER_GENERATION);
// completeRateOfAnnualGF = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_ATTAINMENT_RATE);
// //年利用小时数
// useHoursOfAnnualGF = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_HOURS);
// }
// }
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
......@@ -226,7 +261,7 @@ public class MonitorServiceImpl implements MonitorService {
} else if (stationCacheInfoDto.getStationType().contains("GFDZ") && stationCacheInfoDto.getStationCoreName() != null && stationCacheInfoDto.getBoosterCoreName() != null) {
List<CoreValuesDto> coreValuesDtoList = coreValuesDtos.stream().filter(coreValuesDto -> coreValuesDto.getName().equals(stationCacheInfoDto.getStationCoreName()) || coreValuesDto.getName().equals(stationCacheInfoDto.getBoosterCoreName())).collect(Collectors.toList());
if (coreValuesDtoList != null && coreValuesDtoList.size() > 0) {
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, coreCommonService.getAverageOfByPointName(coreValuesDtoList, CommonConstans.WIND_SPEED_THIRTY_SECONDS));
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, coreCommonService.getAverageOfByPointName(coreValuesDtoList, CommonConstans.TOTAL_RADIATION));
}
}
......@@ -347,7 +382,7 @@ public class MonitorServiceImpl implements MonitorService {
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, coreCommonService.getSumOfByPointName(coreValuesDtoList, CommonConstans.ACTIVE_POWER)));
gfzinstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
}
}else {
} else {
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance("----");
completionOfPowerIndicatorsDto.setActivePower("----");
completionOfPowerIndicatorsDto.setDailyPower("----");
......@@ -365,9 +400,18 @@ public class MonitorServiceImpl implements MonitorService {
}
completionOfPowerIndicatorsDtoList.add(completionOfPowerIndicatorsDto);
});
String provincelUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&provinceName=" + provinceName;
List<BuDunGenDto> provinceDtos = httpRequestUtil.getResPonse(provincelUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
if (provinceDtos.size() > 0) {
BuDunGenDto buDunGenDto = provinceDtos.get(0);
dailyPower.set(buDunGenDto.getDay());
monthlyPower.set(buDunGenDto.getMonth());
annualPower.set(buDunGenDto.getYear());
completionRatio = String.format(CommonConstans.Twodecimalplaces, buDunGenDto.getYear_complete());
}
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
completionRatio = String.format(CommonConstans.Twodecimalplaces, coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_ATTAINMENT_RATE));
// completionRatio = String.format(CommonConstans.Twodecimalplaces, coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.YEAR_GEN_ATTAINMENT_RATE));
SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(String.format(CommonConstans.Fourdecimalplaces, dailyPower.get()));
dailyPowerdto.setUnit("万kWh");
......@@ -434,35 +478,101 @@ public class MonitorServiceImpl implements MonitorService {
return stationCacheInfoDtos;
}
public HashMap<String, String> getActivePowerByAreaName(String areaName) {
List<StationCacheInfoDto> stationCacheInfoDtoList = this.getListStationCacheInfoDto();
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null,null);
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
HashMap<String, String> hashMap = new HashMap<>();
Double total =0.00;
Double total = 0.00;
if (!ObjectUtils.isEmpty(areaName)) {
stationCacheInfoDtoList =stationCacheInfoDtoList.stream().filter(stationCacheInfoDto ->stationCacheInfoDto.getBelongArea().equals(areaName)&&stationCacheInfoDto.getStationCoreName()!=null&&stationCacheInfoDto.getBoosterCoreName()!=null).collect(Collectors.toList());
List<String> stationNames =new ArrayList<>();
stationNames.addAll( stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getStationCoreName).collect(Collectors.toList()));
stationNames.addAll( stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getBoosterCoreName).collect(Collectors.toList()));
coreValuesDtos = coreValuesDtos.stream().filter(coreValuesDto ->stationNames.contains(coreValuesDto.getName())).collect(Collectors.toList());
stationCacheInfoDtoList = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName) && stationCacheInfoDto.getStationCoreName() != null && stationCacheInfoDto.getBoosterCoreName() != null).collect(Collectors.toList());
List<String> stationNames = new ArrayList<>();
stationNames.addAll(stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getStationCoreName).collect(Collectors.toList()));
stationNames.addAll(stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getBoosterCoreName).collect(Collectors.toList()));
coreValuesDtos = coreValuesDtos.stream().filter(coreValuesDto -> stationNames.contains(coreValuesDto.getName())).collect(Collectors.toList());
}
total = coreCommonService.getSumOfByPointName(coreValuesDtos,CommonConstans.ACTIVE_POWER);
total = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.ACTIVE_POWER);
//有功功率换算
hashMap.put("title", String.format(CommonConstans.Twodecimalplaces,total));
hashMap.put("title", String.format(CommonConstans.Twodecimalplaces, total));
return hashMap;
}
@Override
public Page<HashMap<String, String>> getDetailsOnPowergeneration(String areaName) {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 99);
List<HashMap<String, String>> hashMapList = new ArrayList<>();
List<StationCacheInfoDto> stationCacheInfoDtoList = new ArrayList<>();
String requestUrl = Constants.BASE_URL + "?" + Constants.get_area_item_url;
if (!ObjectUtils.isEmpty(areaName)) {
if (!areaName.contains(Constants.areaChinese)) {
areaName = Constants.areaChinese;
}
requestUrl = requestUrl + "&areaName=" + areaName;
}
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
//日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
List<BuDunGenDto> buDunGenDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
if (buDunGenDtos.size() > 0) {
BuDunGenDto buDunGenDto = buDunGenDtos.get(0);
dailyPower.set(buDunGenDto.getDay());
monthlyPower.set(buDunGenDto.getMonth());
annualPower.set(buDunGenDto.getYear());
annualPower.set(buDunGenDto.getYear());
}
HashMap<String, String> dayHashMap = new HashMap<>();
dayHashMap.put("title", String.format(CommonConstans.Fourdecimalplaces, dailyPower.get()) + "万kWh");
HashMap<String, String> monthHashMap = new HashMap<>();
monthHashMap.put("title", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get()) + "万kWh");
HashMap<String, String> annualHashMap = new HashMap<>();
annualHashMap.put("title", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()) + "万kWh");
HashMap<String, String> totalHashMap = new HashMap<>();
totalHashMap.put("title", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()) + "万kWh");
hashMapList.add(dayHashMap);
hashMapList.add(monthHashMap);
hashMapList.add(annualHashMap);
hashMapList.add(totalHashMap);
hashMapPage.setRecords(hashMapList);
return hashMapPage;
}
public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
String requestUrl = Constants.BASE_URL + "?" + Constants.get_area_item_url;
if (!ObjectUtils.isEmpty(stationId)) {
stationBasicListAll.add(stationBasicMapper.selectById(stationId));
} else if (!ObjectUtils.isEmpty(areaName)) {
if (!areaName.contains(Constants.areaChinese)) {
areaName = areaName + Constants.areaChinese;
}
requestUrl = requestUrl+"&areaName="+areaName;
}
List<BuDunGenDto> buDunGenDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
if (buDunGenDtos.size() > 0) {
BuDunGenDto buDunGenDto = buDunGenDtos.get(0);
total.set(buDunGenDto.getYear());
}
return getSocialContributionDtoList(total.get());
}
public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
List<StationCacheInfoDto> stationCacheInfoDtoList = this.getListStationCacheInfoDto();
Double total = 0.0;
if (!ObjectUtils.isEmpty(areaName)) {
stationCacheInfoDtoList =stationCacheInfoDtoList.stream().filter(stationCacheInfoDto ->stationCacheInfoDto.getBelongArea().equals(areaName)).collect(Collectors.toList());
stationCacheInfoDtoList = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName)).collect(Collectors.toList());
}
total = stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getInstalledCapacity).collect(Collectors.toList()).stream().mapToDouble(Double::parseDouble).sum();
hashMap.put("title", String.format(CommonConstans.Twodecimalplaces, total));
return hashMap;
}
public Double keepFourdecimalPlaces(Double param) {
return Double.valueOf(String.format("%.4f", param));
}
......@@ -480,4 +590,113 @@ public class MonitorServiceImpl implements MonitorService {
}
return stationBasicListAll;
}
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
List<HashMap<String, String>> mapList = new ArrayList<>();
String requestUrl = Constants.BASE_URL+"?"+Constants.get_month_top_url+"&topValue=5";
if (!ObjectUtils.isEmpty(areaName)) {
if(areaName.contains(Constants.areaChinese)){
areaName = areaName+Constants.areaChinese;
}
requestUrl = requestUrl + "&areaName="+ areaName;
}
List<BudunStationValueDto> budunStationValueDtoList =httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BudunStationValueDto.class);
HashMap<String, List<String>> hashMap = new HashMap<>();
budunStationValueDtoList.forEach(budunStationValueDto -> {
HashMap<String, String> hashMap1 = new HashMap<>();
hashMap1.put("stationName",budunStationValueDto.getStation_name());
hashMap1.put("value", budunStationValueDto.getValue() + "%");
hashMap1.put("value1", String.valueOf(budunStationValueDto.getValue()));
mapList.add(hashMap1);
});
hashMapPage.setRecords(mapList);
return hashMapPage;
}
public Page<SocialContributionDto> getSocialContributionDtoList(Double totalSocialContribution) {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
//获取所有网关id不为空的数据
//二氧化碳贡献数
SocialContributionDto co2 = new SocialContributionDto();
//标准煤贡献度
SocialContributionDto coal = new SocialContributionDto();
//碳粉尘计算公式
SocialContributionDto toner = new SocialContributionDto();
//二氧化硫贡献度
SocialContributionDto so2 = new SocialContributionDto();
/** 社会贡献原始计算公式,后边的数据已经经过处理
发电量完成率=(月/年)发电量/(月/年)发电量指标
小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标
可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW)
二氧化碳减排量(万t)=发电量(万kW·h)*0.79
节约标准煤(万t)=发电量(万kW·h)*0.29
炭粉尘减排量(t)=发电量(万kW·h)*0.30
二氧化硫减排量(t)=发电量(万kW·h)*1.51
氮氧化物减排量(t)=发电量(万kW·h)*1.69
*/
co2.setUnit(CommonConstans.ER_YANG_HUA_TAN_JIANPAILIANG);
co2.setTitle(String.format("%.2f", totalSocialContribution * CommonConstans.carbonDioxide));
socialContributionDtoList.add(co2);
coal.setUnit(CommonConstans.BIAO_ZHUN_MEI_JIANPAILIANG);
coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal)));
socialContributionDtoList.add(coal);
toner.setUnit(CommonConstans.TAN_FEN_CHEN_ZHUBIANDIYACE);
toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner)));
socialContributionDtoList.add(toner);
so2.setUnit(CommonConstans.ER_YANG_HUA_LIU_ZHUBIANDIYACE);
so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide)));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
socialContributionDtoPage.setCurrent(1);
return socialContributionDtoPage;
}
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
Page<HashMap<String, String>> page = new Page<>(1, 3);
List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> fdzList = new ArrayList<>();
List<StationBasic> gfdzlist = new ArrayList<>();
String requestUrl = Constants.BASE_URL+"?"+Constants.get_hours_num_top+"&topValue=3&tabValue="+tabValue;
if (!ObjectUtils.isEmpty(areaName)) {
if(areaName.contains(Constants.areaChinese)){
areaName =areaName+Constants.areaChinese;
}
requestUrl = requestUrl + "&areaName=" + areaName;
}
List<BuDunPvFanDto> buDunPvFanDtos = httpRequestUtil.getResPonse(requestUrl,Constants.REQUEST_GET,"",Constants.resovleRule_data, BuDunPvFanDto.class);
if(buDunPvFanDtos.size()>0){
BuDunPvFanDto buDunPvFanDto = buDunPvFanDtos.get(0);
int length = buDunPvFanDto.getFan().size()>=buDunPvFanDto.getPv().size()?buDunPvFanDto.getFan().size():buDunPvFanDto.getPv().size();
for (int i = 0; i < length; i++) {
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("sortNumber", String.valueOf(i + 1));
if (i < (buDunPvFanDto.getFan().size())) {
BudunStationValueDto budunStationValueDto = buDunPvFanDto.getFan().get(i);
stringHashMap.put("stationName1", budunStationValueDto.getStation_name());
stringHashMap.put("hours1", budunStationValueDto.getValue() + "h");
} else {
stringHashMap.put("stationName1", "");
stringHashMap.put("hours1", "0.00h");
}
if (i < (buDunPvFanDto.getPv().size())) {
BudunStationValueDto budunStationValueDto = buDunPvFanDto.getPv().get(i);
stringHashMap.put("stationName2", budunStationValueDto.getStation_name());
stringHashMap.put("hours2", budunStationValueDto.getValue() + "h");
} else {
stringHashMap.put("stationName2", "");
stringHashMap.put("hours2", "0.00h");
}
mapList.add(stringHashMap);
}
}
page.setRecords(mapList);
//组装数据
return page;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.netflix.loadbalancer.RetryRule;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TestMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.ItestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TestServiceImpl implements ItestService {
@Autowired
TestMapper testMapper;
public List<Test> getList(){
return testMapper.selectList(new QueryWrapper<Test>().isNotNull("name"));
}
}
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