Commit 37eeb4dd authored by KeYong's avatar KeYong

Merge branch 'developer' of http://36.40.66.175:5000/moa/amos-boot-biz into developer

parents 4ab95f48 ecfce0c2
......@@ -633,6 +633,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
* @return
*/
public HashMap<String,Object> getWaringCycleAndMaxValueByWaring(String warningPeriod,String warningContenct,String pointName){
// 汇流箱机内温度连续30分钟健康指数≤74.0
HashMap<String,Object> result = new HashMap<>();
warningContenct=warningContenct.replace(pointName+"连续","");
String spiltStr =CommonConstans.waringPeriodTowaringCycle.get(warningPeriod);
......@@ -645,8 +647,8 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
}else {
warningCycle=Integer.valueOf(strings[0].replace(".0", ""));
}
if(strings[1].contains("<")){
maxValue = Double.valueOf(strings[1].split("<")[1]);
if(strings[1].contains("")){
maxValue = Double.valueOf(strings[1].split("")[1]);
}
}
result.put("maxValue",maxValue);
......
......@@ -249,7 +249,7 @@ public class HealthStatusIndicatorServiceImpl {
// redisUtils.set(gateWayId+"_"+address+"_health_notice_minute","notice");
level ="注意";
num = ""+healthValueNotice;
content = healthValueNotice*10 + "分钟";
content = healthValueNoticeCount*10 + "分钟";
}else if (warnNum == healthValueWarnCount ){
// redisUtils.set(gateWayId+"_"+address+"_health_warn_minute","warn");
level ="警告";
......@@ -284,7 +284,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setDisposotionState("待确认");
idxBizPvWarningRecord.setStatus("0");
idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按时刻");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
......@@ -451,7 +451,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setDisposotionState("待确认");
idxBizPvWarningRecord.setStatus("0");
idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按小时");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
......@@ -616,7 +616,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setDisposotionState("待确认");
idxBizPvWarningRecord.setStatus("0");
idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按天");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
......@@ -785,7 +785,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setDisposotionState("待确认");
idxBizFanWarningRecord.setStatus("0");
idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按时刻");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
......@@ -953,7 +953,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setDisposotionState("待确认");
idxBizFanWarningRecord.setStatus("0");
idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按小时");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
......@@ -1124,7 +1124,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setDisposotionState("待确认");
idxBizFanWarningRecord.setStatus("0");
idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数"+num );
idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按天");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
......
......@@ -97,7 +97,9 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
if(!ObjectUtils.isEmpty(equipments)) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
}
return result;
}
......@@ -128,7 +130,9 @@ public class CommonServiceImpl {
// }
public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double totalvalue = 0.0;
totalvalue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
if(!ObjectUtils.isEmpty(mapList)) {
totalvalue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
}
return Double.valueOf(String.format("%.2f", totalvalue));
}
......@@ -139,7 +143,9 @@ public class CommonServiceImpl {
*/
public Double getAvgvalueByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double avageValue = 0.0;
avageValue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
if(!ObjectUtils.isEmpty(mapList)) {
avageValue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
}
return Double.valueOf(String.format("%.2f", avageValue));
}
......@@ -232,7 +238,11 @@ public class CommonServiceImpl {
stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
Double installedCapacity = 0.0d;
if(!ObjectUtils.isEmpty(sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber()))){
installedCapacity =sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber());
}
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", installedCapacity));
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
......@@ -371,7 +381,10 @@ public class CommonServiceImpl {
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
if(equipments!=null)
{
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result;
}
......
......@@ -868,9 +868,8 @@ public Map<String,Object> gettimedateyfd( ){
// List<String> fdGatewayId = stationBasicListfd.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.joining(","));
// List<String> gfGatewayId = stationBasicListgf.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.toList());
String fdGatewayIds= stationBasicListfd.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.joining(","));
String gfGatewayIds=stationBasicListgf.stream().map(StationBasic::getBoosterGatewayId).collect(Collectors.joining(","));
String fdGatewayIds= stationBasicListfd.stream().map(stationBasic -> "'"+stationBasic.getBoosterGatewayId()+"'").collect(Collectors.joining(","));
String gfGatewayIds=stationBasicListgf.stream().map(stationBasic -> "'"+stationBasic.getBoosterGatewayId()+"'").collect(Collectors.joining(","));
List<StationBasic> stationBasicListAll=new ArrayList<>();
......@@ -891,22 +890,22 @@ public Map<String,Object> gettimedateyfd( ){
List<IndicatorData> activePowerListGF = new ArrayList<>();
// String startTime = cn.hutool.core.date.DateUtil.today() + " 00:00:00";
// String endTime = cn.hutool.core.date.DateUtil.today() + " 23:59:59";
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime);
String endTime= sdf.format(currentDayEndTime);
// Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
// Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
// Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
// sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
// String startTime = sdf.format(currentDayStartTime);
// String endTime= sdf.format(currentDayEndTime);
activePowerListFD = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeqg(CommonConstans.xiazaoActivePowerPoint, startTime, endTime, fdGatewayIds);
activePowerListFD = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeqgNew(CommonConstans.xiazaoActivePowerPoint, fdGatewayIds);
activePowerListGF = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeqg(CommonConstans.taiheActivePowerPoint, startTime, endTime, gfGatewayIds);
activePowerListGF = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeqgNew(CommonConstans.taiheActivePowerPoint, gfGatewayIds);
System.out.println(JSON.toJSONString(activePowerListFD));
for (int i = 0; i < activePowerListFD.size(); i++) {
IndicatorData indicatorData = activePowerListFD.get(i);
IndicatorData indicatorData2 = activePowerListGF.get(i);
time.add(indicatorData.getXtime());
time.add(cn.hutool.core.date.DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
// Double vl= indicatorData.getValueF()+indicatorData2.getValueF() * CommonConstans.kwToMv;
Double vl= Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()))+
Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData2.getValueF() * CommonConstans.kwToMv));
......
......@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Double powerOfDay = 0.0000;
Double powerOfMonth = 0.0000;
Double powerOfAnnual = 0.0000;
if(ObjectUtils.isEmpty(query)){
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}else {
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
if(result!=null)
{
if(ObjectUtils.isEmpty(query)){
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}else {
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
}
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("日发电量",powerOfDay);
hashMap.put("月发电量",powerOfMonth);
......
......@@ -30,114 +30,112 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
public class MonitoringServiceImpl {
Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class);
@Value("${plannedPowerGenerationTotal:10000}")
Long plannedPowerGenerationTotal;
/**
* 区域mapper
*/
@Autowired
RegionMapper regionMapper;
@Autowired
StationPlanMapper stationPlanMapper;
@Autowired
IndicatorDataMapper indicatorDataMapper;
/**
* 场站mapper
*/
@Autowired
StationBasicMapper stationBasicMapper;
/**
* 场站坐标mapper
*/
@Autowired
StationCoordinateMapper stationCoordinateMapper;
/***
* 设备基础信息中间表数据-热工院
*/
@Autowired
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired
CommonServiceImpl commonServiceImpl;
//维护的接口信息
@Autowired
MapRegionMapper mapRegionMapper;
@Autowired
EmqKeeper emqKeeper;
Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class);
@Value("${plannedPowerGenerationTotal:10000}")
Long plannedPowerGenerationTotal;
/**
* 区域mapper
*/
@Autowired
RegionMapper regionMapper;
@Autowired
StationPlanMapper stationPlanMapper;
@Autowired
IndicatorDataMapper indicatorDataMapper;
/**
* 场站mapper
*/
@Autowired
StationBasicMapper stationBasicMapper;
/**
* 场站坐标mapper
*/
@Autowired
StationCoordinateMapper stationCoordinateMapper;
/***
* 设备基础信息中间表数据-热工院
*/
@Autowired
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired
CommonServiceImpl commonServiceImpl;
// 维护的接口信息
@Autowired
MapRegionMapper mapRegionMapper;
@Autowired
EmqKeeper emqKeeper;
// @Autowired
// InfluxdbUtil influxdbUtil;
/**
* 根据场站编号获取该场站的装机容量
*
* @param werks
* @return
*/
public Double getStationCaPACITYL(String werks) {
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
}
/***
* 获取风站场站
*
* */
public Map<String, String> getStationfs(StationBasic stationBasic) {
String value = "0";
Map<String, String> map = new HashMap<>();
Map<String, List<String>> queryCondtion = new HashMap<>();
if (stationBasic.getStationType().equals("FDZ")) {
String gatewayId = stationBasic.getFanGatewayId();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> result2 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
value = String.format("%.2f", commonServiceImpl.getAvagerByEquipmentIndxName(result2, "30秒平均风速"));
map.put("name", "风速/辐照度");
map.put("value", value + "m/s");
} else {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
value = String.format("%.2f", commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"));
map.put("name", "风速/辐照度");
map.put("value", value + "W/㎡");
}
return map;
}
/***
* 电站容量
* */
public Map<String, String> getStationrl(StationBasic stationBasic) {
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
String value = ObjectUtils.isEmpty(installCapacity) ? "0.00" : String.format("%.2f", installCapacity);
Map<String, String> map = new HashMap<>();
map.put("name", "容量");
map.put("value", value + "MW");
return map;
}
/**
* 根据省份名称查询电站详情
*
* @param provinceName
* @return
*/
/**
* 根据场站编号获取该场站的装机容量
*
* @param werks
* @return
*/
public Double getStationCaPACITYL(String werks) {
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
}
/***
* 获取风站场站
*
*/
public Map<String, String> getStationfs(StationBasic stationBasic) {
String value = "0";
Map<String, String> map = new HashMap<>();
Map<String, List<String>> queryCondtion = new HashMap<>();
if (stationBasic.getStationType().equals("FDZ")) {
String gatewayId = stationBasic.getFanGatewayId();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> result2 = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
value = String.format("%.2f", commonServiceImpl.getAvagerByEquipmentIndxName(result2, "30秒平均风速"));
map.put("name", "风速/辐照度");
map.put("value", value + "m/s");
} else {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
value = String.format("%.2f",
commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"));
map.put("name", "风速/辐照度");
map.put("value", value + "W/㎡");
}
return map;
}
/***
* 电站容量
*/
public Map<String, String> getStationrl(StationBasic stationBasic) {
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl
.getStationCapactityByStationWerks(stationBasic.getStationNumber());
String value = ObjectUtils.isEmpty(installCapacity) ? "0.00" : String.format("%.2f", installCapacity);
Map<String, String> map = new HashMap<>();
map.put("name", "容量");
map.put("value", value + "MW");
return map;
}
/**
* 根据省份名称查询电站详情
*
* @param provinceName
* @return
*/
// public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
// List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
......@@ -226,7 +224,6 @@ public class MonitoringServiceImpl {
// return regionNationWideDtoList;
// }
// public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) {
//
// List<ColModel> colModels = new ArrayList<>();
......@@ -368,82 +365,95 @@ public class MonitoringServiceImpl {
// logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
// }
// }
public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
List<TabDto> tabDtoList = new ArrayList<>();
if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) {
TabDto tab0 = new TabDto("风机布置图", "0");
TabDto tab1 = new TabDto("集电线路图", "1");
TabDto tab2 = new TabDto("运行列表", "2");
TabDto tab3 = new TabDto("升压站监控", "3");
TabDto tab4 = new TabDto("电量表计", "4");
TabDto tab5 = new TabDto("故障信息", "5");
tabDtoList.add(tab0);
tabDtoList.add(tab1);
tabDtoList.add(tab2);
tabDtoList.add(tab3);
tabDtoList.add(tab4);
tabDtoList.add(tab5);
} else {
TabDto tab6 = new TabDto("光伏区布置图", "6");
TabDto tab7 = new TabDto("集电线路图", "7");
TabDto tab8 = new TabDto("运行列表", "8");
TabDto tab9 = new TabDto("升压站监控", "9");
TabDto tab10 = new TabDto("电量表计", "10");
TabDto tab11 = new TabDto("故障信息", "11");
public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
List<TabDto> tabDtoList = new ArrayList<>();
if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) {
TabDto tab0 = new TabDto("风机布置图", "0");
TabDto tab1 = new TabDto("集电线路图", "1");
TabDto tab2 = new TabDto("运行列表", "2");
TabDto tab3 = new TabDto("升压站监控", "3");
TabDto tab4 = new TabDto("电量表计", "4");
TabDto tab5 = new TabDto("故障信息", "5");
tabDtoList.add(tab0);
tabDtoList.add(tab1);
tabDtoList.add(tab2);
tabDtoList.add(tab3);
tabDtoList.add(tab4);
tabDtoList.add(tab5);
} else {
TabDto tab6 = new TabDto("光伏区布置图", "6");
TabDto tab7 = new TabDto("集电线路图", "7");
TabDto tab8 = new TabDto("运行列表", "8");
TabDto tab9 = new TabDto("升压站监控", "9");
TabDto tab10 = new TabDto("电量表计", "10");
TabDto tab11 = new TabDto("故障信息", "11");
// TabDto tab12 = new TabDto("集中式-离散率", "12");
// TabDto tab13 = new TabDto("组串式-离散率", "13");
TabDto tab14 = new TabDto("离散率", "14");
tabDtoList.add(tab6);
tabDtoList.add(tab7);
tabDtoList.add(tab8);
tabDtoList.add(tab9);
tabDtoList.add(tab10);
tabDtoList.add(tab11);
TabDto tab14 = new TabDto("离散率", "14");
tabDtoList.add(tab6);
tabDtoList.add(tab7);
tabDtoList.add(tab8);
tabDtoList.add(tab9);
tabDtoList.add(tab10);
tabDtoList.add(tab11);
// tabDtoList.add(tab12);
// tabDtoList.add(tab13);
tabDtoList.add(tab14);
}
return tabDtoList;
}
public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
mapRegionList.forEach(mapRegion -> {
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
//开始处理省份名称-三维与二维的名称有差异
ArrayList<String> stringArrayList = mapRegion.getProvince();
List<Region> regions = regionList.stream().filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2)) || stringArrayList.contains(region.getRegionName().substring(0, 3))).collect(Collectors.toList());
List<String> regionNames = regions.stream().map(region -> region.getRegionName()).collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode())).collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream().filter(stationBasic -> regionCodes.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0])).collect(Collectors.toList());
mapAreaInfoDto.setProvince(regionNames);
// --------------------省份名称处理结束----------------------------
//设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
//设置片区code
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
//风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
//集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
//分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
//储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
//获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
//获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
return mapAreaInfoDtoList;
}
tabDtoList.add(tab14);
}
return tabDtoList;
}
public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
mapRegionList.forEach(mapRegion -> {
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
// 开始处理省份名称-三维与二维的名称有差异
ArrayList<String> stringArrayList = mapRegion.getProvince();
List<Region> regions = regionList.stream()
.filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2))
|| stringArrayList.contains(region.getRegionName().substring(0, 3)))
.collect(Collectors.toList());
List<String> regionNames = regions.stream().map(region -> region.getRegionName())
.collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode()))
.collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream()
.filter(stationBasic -> regionCodes
.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0]))
.collect(Collectors.toList());
mapAreaInfoDto.setProvince(regionNames);
// --------------------省份名称处理结束----------------------------
// 设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
// 设置片区code
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
// 风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
// 集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
// 分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
// 储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
// 获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
// 获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
return mapAreaInfoDtoList;
}
// public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
// List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
......@@ -488,160 +498,172 @@ public class MonitoringServiceImpl {
// return homeMapStationInfoDtoList;
// }
public Map<String, Object> getDetailsWindSpeedAlldata(StationBasic stationBasic) {
Map<String, Object> map = new HashMap<>();
List<String> values = new ArrayList<>();
Map<Date, Double> groupMap = new HashMap<>();
List<String> time = new ArrayList<>();
Map<String, Object> activePowerInfo = new HashMap<>();
List<IndicatorData> activePowerList = new ArrayList<>();
public Map<String, Object> getDetailsWindSpeedAlldata(StationBasic stationBasic) {
Map<String, Object> map = new HashMap<>();
List<String> values = new ArrayList<>();
Map<Date, Double> groupMap = new HashMap<>();
List<String> time = new ArrayList<>();
Map<String, Object> activePowerInfo = new HashMap<>();
List<IndicatorData> activePowerList = new ArrayList<>();
// String startTime = DateUtil.today() + " 00:00:00";
// String endTime = DateUtil.today() + " 23:59:59";
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime);
String endTime = sdf.format(currentDayEndTime);
Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
if ("FDZ".equals(stationBasic.getStationType())) {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
} else {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
}
for (int i = 0; i < activePowerList.size(); i++) {
IndicatorData indicatorData = activePowerList.get(i);
time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
if ("FDZ".equals(stationBasic.getStationType())) {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()));
} else {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF() * CommonConstans.kwToMv));
}
}
String max = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String min = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String mean = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
activePowerInfo.put("mean", mean);
activePowerInfo.put("max", max);
activePowerInfo.put("min", min);
activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max)));
activePowerInfo.put("minTime", time.get(values.lastIndexOf(min)));
activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces, Double.valueOf(values.get(values.size() - 1)) / installedCapacity));
List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map3 = new HashMap<>();
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map1.put("data", values);
seriesData.add(map1);
map.put("seriesData", seriesData);
map.put("axisData", time);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_table", JSON.toJSON(map).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_info", JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"), 1, true);
} catch (Exception exception) {
exception.printStackTrace();
}
return map;
}
public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getStationNumber() != null) {
try {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
} catch (Exception e) {
}
}
});
return String.format("%.2f", total.get());
}
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getFanGatewayId() != null) {
try {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) {
}
}
});
return String.format("%.2f", total.get());
}
public List<Map<String, String>> getStaionCategoryInfo(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<Map<String, String>> result = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> {
Map<String, String> stringStringMap = new HashMap<>();
stringStringMap.put("name", key);
stringStringMap.put("value", String.valueOf(listMap.get(key).size()));
result.add(stringStringMap);
});
return result;
}
//获取装机容量
public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
});
hashMap.put("title", String.format("%.2f", total.get()));
return hashMap;
}
//获取有功功率
public HashMap<String, String> getActivePowerByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
});
//有功功率换算
hashMap.put("title", String.format("%.2f", total.get() / 1000));
return hashMap;
}
//获取社会贡献
/**
* @param areaName 片区名称
* @param stationId 场站id
* @return 社会贡献列表
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果 areaName 与stationId都传 则取场站id
*/
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime);
String endTime = sdf.format(currentDayEndTime);
Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
if ("FDZ".equals(stationBasic.getStationType())) {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
} else {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
}
for (int i = 0; i < activePowerList.size(); i++) {
IndicatorData indicatorData = activePowerList.get(i);
time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
if ("FDZ".equals(stationBasic.getStationType())) {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()));
} else {
values.add(String.format(CommonConstans.Twodecimalplaces,
indicatorData.getValueF() * CommonConstans.kwToMv));
}
}
String max = String.format(CommonConstans.Twodecimalplaces,
values.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String min = String.format(CommonConstans.Twodecimalplaces,
values.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String mean = String.format(CommonConstans.Twodecimalplaces,
values.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
activePowerInfo.put("mean", mean);
activePowerInfo.put("max", max);
activePowerInfo.put("min", min);
activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max)));
activePowerInfo.put("minTime", time.get(values.lastIndexOf(min)));
activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces,
Double.valueOf(values.get(values.size() - 1)) / installedCapacity));
List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map3 = new HashMap<>();
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map1.put("data", values);
seriesData.add(map1);
map.put("seriesData", seriesData);
map.put("axisData", time);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_table",
JSON.toJSON(map).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_info",
JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"), 1, true);
} catch (Exception exception) {
exception.printStackTrace();
}
return map;
}
public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getStationNumber() != null) {
try {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
} catch (Exception e) {
}
}
});
return String.format("%.2f", total.get());
}
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getFanGatewayId() != null) {
try {
total.updateAndGet(
v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) {
}
}
});
return String.format("%.2f", total.get());
}
public List<Map<String, String>> getStaionCategoryInfo(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<Map<String, String>> result = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream()
.collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> {
Map<String, String> stringStringMap = new HashMap<>();
stringStringMap.put("name", key);
stringStringMap.put("value", String.valueOf(listMap.get(key).size()));
result.add(stringStringMap);
});
return result;
}
// 获取装机容量
public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
});
hashMap.put("title", String.format("%.2f", total.get()));
return hashMap;
}
// 获取有功功率
public HashMap<String, String> getActivePowerByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
});
// 有功功率换算
hashMap.put("title", String.format("%.2f", total.get() / 1000));
return hashMap;
}
// 获取社会贡献
/**
* @param areaName 片区名称
* @param stationId 场站id
* @return 社会贡献列表
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果
* areaName 与stationId都传 则取场站id
*/
// public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
// AtomicReference<Double> total = new AtomicReference<>(0.0);
// List<StationBasic> stationBasicListAll = new ArrayList<>();
......@@ -731,20 +753,21 @@ public class MonitoringServiceImpl {
// hashMapPage.setRecords(hashMapList);
// return hashMapPage;
// }
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
return stationBasicListAll;
}
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
// 获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
// 变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper
.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
return stationBasicListAll;
}
// public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) {
// List<StationBasic> stationBasicListAll = new ArrayList<>();
......@@ -774,7 +797,6 @@ public class MonitoringServiceImpl {
// return hashMap;
// }
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
// Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
// List<HashMap<String, String>> mapList = new ArrayList<>();
......@@ -811,18 +833,17 @@ public class MonitoringServiceImpl {
// return hashMapPage;
// }
public List<String> getXListofRecentOneYear() {
List<String> xList = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
Date date = new Date();
for (int i = 1; i < 13; i++) {
calendar.setTime(date);
calendar.add(Calendar.MONTH, i - 12);
xList.add(String.valueOf(calendar.get(Calendar.YEAR)).substring(2, 4) + "-" + calendar.get(Calendar.MONTH));
}
return xList;
}
public List<String> getXListofRecentOneYear() {
List<String> xList = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
Date date = new Date();
for (int i = 1; i < 13; i++) {
calendar.setTime(date);
calendar.add(Calendar.MONTH, i - 12);
xList.add(String.valueOf(calendar.get(Calendar.YEAR)).substring(2, 4) + "-" + calendar.get(Calendar.MONTH));
}
return xList;
}
//
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
......@@ -893,21 +914,23 @@ public class MonitoringServiceImpl {
// return page;
// }
@Scheduled(cron = "0/5 * * * * *")
public void getTotalData() {
//计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR);
int Moon = Calendar.getInstance().get(Calendar.MONTH) + 1;
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear, String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ")).mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
double moonValue = stationPlans.stream().filter(e -> e.getMonthly().equals(String.valueOf(Moon))).mapToDouble(StationPlan::getValue).sum();
//查询风电站年计划完成量
@Scheduled(cron = "0/5 * * * * *")
public void getTotalData() {
// 计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR);
int Moon = Calendar.getInstance().get(Calendar.MONTH) + 1;
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear, String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ"))
.mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
double moonValue = stationPlans.stream().filter(e -> e.getMonthly().equals(String.valueOf(Moon)))
.mapToDouble(StationPlan::getValue).sum();
// 查询风电站年计划完成量
//
// List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
// List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
......@@ -917,142 +940,178 @@ public class MonitoringServiceImpl {
// List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
// double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
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());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10);
Page<HashMap<String, String>> page1 = new Page<>(1, 10);
Page<HashMap<String, String>> page2 = new Page<>(1, 10);
Page<HashMap<String, String>> page3 = new Page<>(1, 10);
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());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream()
.filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10);
Page<HashMap<String, String>> page1 = new Page<>(1, 10);
Page<HashMap<String, String>> page2 = new Page<>(1, 10);
Page<HashMap<String, String>> page3 = new Page<>(1, 10);
// ----------------装机容量开始-----------------------
List<HashMap<String, String>> list = new ArrayList<>();
//装机容量
HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
// stringHashMap.put("title", totalInstall.toString());
//stringHashMap.put("data", "");
// list.add(stringHashMap);
//风电站
HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1);
//集中式光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList));
stringHashMap2.put("title", jzsInstall.toString());
stringHashMap2.put("data", String.valueOf(jzsgfdzList.size()));
list.add(stringHashMap2);
//分布式光伏电站
HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList));
stringHashMap3.put("title", fbsInstall.toString());
stringHashMap3.put("data", String.valueOf(fbsgfdzList.size()));
list.add(stringHashMap3);
page.setRecords(list);
BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList));
List<HashMap<String, String>> list = new ArrayList<>();
// 装机容量
HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
// stringHashMap.put("title", totalInstall.toString());
// stringHashMap.put("data", "");
// list.add(stringHashMap);
// 风电站
HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1);
// 集中式光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList));
stringHashMap2.put("title", jzsInstall.toString());
stringHashMap2.put("data", String.valueOf(jzsgfdzList.size()));
list.add(stringHashMap2);
// 分布式光伏电站
HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList));
stringHashMap3.put("title", fbsInstall.toString());
stringHashMap3.put("data", String.valueOf(fbsgfdzList.size()));
list.add(stringHashMap3);
page.setRecords(list);
BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList));
//----------------------装机容量结束----------------------------------------
// ----------------装机容量开始-----------------------
List<HashMap<String, String>> list1 = new ArrayList<>();
List<HashMap<String, String>> list2 = new ArrayList<>();
List<HashMap<String, String>> list3 = new ArrayList<>();
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
List<HashMap<String, String>> list1 = new ArrayList<>();
List<HashMap<String, String>> list2 = new ArrayList<>();
List<HashMap<String, String>> list3 = new ArrayList<>();
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
// powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
// powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
// powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
powerOfDayFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfMonthFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
powerOfAnnualFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
});
gfList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
});
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
list1.add(stringHashMap4);
HashMap<String, String> stringHashMap5 = new HashMap<>();
stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
list1.add(stringHashMap5);
HashMap<String, String> stringHashMap6 = new HashMap<>();
stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get()));
list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() / fdzValue) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() / gfvalue));
list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF.get() * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
list1.add(stringHashMap8);
page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap9.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
list2.add(stringHashMap9);
HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap10.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("Moon", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100));
list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
resultMap.put("Year", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
list2.add(stringHashMap12);
page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get());
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide)));
stringHashMap13.put("unit", "二氧化碳减排量(t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal)));
stringHashMap14.put("unit", "节约标准煤(t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner)));
stringHashMap15.put("unit", "碳粉尘减排量(t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide)));
stringHashMap16.put("unit", "二氧化硫减排量(t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
try {
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic", JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1, true);
} catch (Exception ex) {
}
}
powerOfDayFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfMonthFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
powerOfAnnualFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
});
gfList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
powerOfDayGF.updateAndGet(
v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v
+ commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF.updateAndGet(
v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
});
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/"
+ String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
list1.add(stringHashMap4);
HashMap<String, String> stringHashMap5 = new HashMap<>();
stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/"
+ String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
list1.add(stringHashMap5);
HashMap<String, String> stringHashMap6 = new HashMap<>();
stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/"
+ String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get()));
list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() / fdzValue)
+ "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() / gfvalue));
list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title",
String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/"
+ String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualGF.get() * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
list1.add(stringHashMap8);
page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap9.put("title",
String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
list2.add(stringHashMap9);
HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap10.put("title",
String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("Moon",
String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces,
(powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100));
list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title",
String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
resultMap.put("Year",
String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
list2.add(stringHashMap12);
page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get());
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide)));
stringHashMap13.put("unit", "二氧化碳减排量(t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal)));
stringHashMap14.put("unit", "节约标准煤(t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner)));
stringHashMap15.put("unit", "碳粉尘减排量(t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide)));
stringHashMap16.put("unit", "二氧化硫减排量(t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
try {
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1,
true);
emqKeeper.getMqttClient().publish("bigscreen_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"),
1, true);
emqKeeper.getMqttClient().publish("bigscreen_zssscsj_topic",
JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic",
JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"),
1, true);
} catch (Exception ex) {
}
}
// public List<HashMap<String, Object>> getNationalPowerGenerationData() {
// List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
......@@ -1076,40 +1135,44 @@ public class MonitoringServiceImpl {
// return resultHashMap;
// }
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList, String color) {
HashMap<String, Object> hashMap = new HashMap<>();
List<String> xData = new ArrayList<>();
List<String> yData = new ArrayList<>();
stationBasicList.forEach(stationBasic -> {
xData.add(stationBasic.getStationName());
yData.add(stationBasic.getAddress());
});
hashMap.put("title", title);
hashMap.put("color", color);
hashMap.put("xData", xData);
hashMap.put("yData", yData);
return hashMap;
}
public List<HashMap<String, Object>> getSelectDataForNational() {
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
regionList.forEach(region -> {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("label", region.getRegionName());
hashMap.put("value", region.getRegionCode());
List<HashMap<String, Object>> children = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode()))).map(stationBasic -> {
HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap1.put("label", stationBasic.getStationName());
hashMap1.put("value", stationBasic.getSequenceNbr());
return hashMap1;
}).collect(Collectors.toList());
hashMap.put("children", children);
hashMapList.add(hashMap);
});
return hashMapList;
}
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList,
String color) {
HashMap<String, Object> hashMap = new HashMap<>();
List<String> xData = new ArrayList<>();
List<String> yData = new ArrayList<>();
stationBasicList.forEach(stationBasic -> {
xData.add(stationBasic.getStationName());
yData.add(stationBasic.getAddress());
});
hashMap.put("title", title);
hashMap.put("color", color);
hashMap.put("xData", xData);
hashMap.put("yData", yData);
return hashMap;
}
public List<HashMap<String, Object>> getSelectDataForNational() {
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
regionList.forEach(region -> {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("label", region.getRegionName());
hashMap.put("value", region.getRegionCode());
List<HashMap<String, Object>> children = stationBasicList.stream().filter(
stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())))
.map(stationBasic -> {
HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap1.put("label", stationBasic.getStationName());
hashMap1.put("value", stationBasic.getSequenceNbr());
return hashMap1;
}).collect(Collectors.toList());
hashMap.put("children", children);
hashMapList.add(hashMap);
});
return hashMapList;
}
// const data = {
// xData: [],
......@@ -1127,234 +1190,298 @@ public class MonitoringServiceImpl {
// ]
// };
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
//x轴数据
List<String> xdata = new ArrayList<>();
//实时有功功率
List<String> currentPowerYdata = new ArrayList<>();
//短期功率预测
List<String> shortPowerYdata = new ArrayList<>();
//超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00");
currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0));
shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0));
superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0));
}
result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>();
currentPowerHashMap.put("title", "实时有功 " + date);
currentPowerHashMap.put("yData", currentPowerYdata);
result.put("currentPower", currentPowerHashMap);
HashMap<String, Object> shortPowerHashMap = new HashMap<>();
shortPowerHashMap.put("title", "短期功率预测 " + date);
shortPowerHashMap.put("yData", currentPowerYdata);
result.put("shortPower", shortPowerHashMap);
HashMap<String, Object> superShortPowerHashMap = new HashMap<>();
superShortPowerHashMap.put("title", "超短期功率预测 " + date);
superShortPowerHashMap.put("yData", currentPowerYdata);
result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String shortMin = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> gz = new ArrayList<>();
List<String> sj1 = new ArrayList<>();
gz.add(currentMin);
sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin)));
gz.add(shortMin);
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin)));
gz.add(supreMin);
sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin)));
String currentMax = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String shortMax = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String supreMax = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>();
List<String> sj2 = new ArrayList<>();
zdz.add(currentMax);
zdz.add(shortMax);
zdz.add(supreMax);
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax)));
sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax)));
String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString();
List<String> pjz = new ArrayList<>();
List<String> fjl = new ArrayList<>();
pjz.add(currentAvg);
pjz.add(shortAvg);
pjz.add(supreAvg);
fjl = Arrays.asList("0.68", "0.89", "0.56");
footerList.put("gz", gz);
footerList.put("sj1", sj1);
footerList.put("zdz", zdz);
footerList.put("sj2", sj2);
footerList.put("pjz", pjz);
footerList.put("fjl", fjl);
result.put("footerList", footerList);
return result;
}
public Double keepFourdecimalPlaces(Double param) {
return Double.valueOf(String.format("%.4f", param));
}
public Map<String, String> getGenPowerInfoForBuDun(String areaCode, String stationId) {
HashMap<String, String> returnResult = new HashMap<>();
returnResult.put("monthCompleteRate", "0.00%");
returnResult.put("monthValue", "0.0000");
returnResult.put("monthPlanValue", "0.0000");
returnResult.put("yearCompleteRate", "0.00%");
returnResult.put("yearValue", "0.0000");
returnResult.put("yearPlanValue", "0.0000");
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
if (StringUtils.isNotBlank(areaCode)) {
stationCacheInfoDtos = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode)).collect(Collectors.toList());
}
if (StringUtils.isNotBlank(stationId)) {
stationCacheInfoDtos = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId)).collect(Collectors.toList());
}
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
for (StationCacheInfoDto stationCacheInfoDto : stationCacheInfoDtos) {
if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
}
List<String> stationIds = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
List<StationPlan> stationPlans = stationPlanMapper.selectList(new QueryWrapper<StationPlan>().in("station_basic_id", stationIds));
String currentYearAndMonth = DateUtil.format(new Date(), DatePattern.NORM_MONTH_PATTERN);
String currentYear = currentYearAndMonth.split("-")[0];
Integer currentMonth = Integer.valueOf(currentYearAndMonth.split("-")[1]);
Double yearPlanValue = stationPlans.stream().filter(stationPlan -> stationPlan.getYear().equals(currentYear)).mapToDouble(i -> i.getValue()).sum();
Double monthPlanValue = stationPlans.stream().filter(stationPlan -> currentMonth == Integer.valueOf(stationPlan.getMonthly())).mapToDouble(i -> i.getValue()).sum();
if (monthlyPower.get() > 0 && monthPlanValue > 0) {
returnResult.put("monthCompleteRate", String.format(CommonConstans.Twodecimalplaces, (monthlyPower.get() / monthPlanValue) * 100) + "%");
returnResult.put("monthValue", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get()));
returnResult.put("monthPlanValue", String.format(CommonConstans.Fourdecimalplaces, monthPlanValue));
}
if (annualPower.get() > 0 && yearPlanValue > 0) {
returnResult.put("yearCompleteRate", String.format(CommonConstans.Twodecimalplaces, (annualPower.get() / yearPlanValue) * 100) + "%");
returnResult.put("yearValue", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()));
returnResult.put("yearPlanValue", String.format(CommonConstans.Fourdecimalplaces, yearPlanValue));
}
return returnResult;
}
public Map<String, Object> getGenPowerInfo(String areaCode) {
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
if (StringUtils.isNotBlank(areaCode)) {
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code",areaCode));
List<StationCacheInfoDto> filterData = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode)).collect(Collectors.toList());
stationCacheInfoDtos = filterData.size() > 0 ? filterData : stationCacheInfoDtos;
if(!ObjectUtils.isEmpty(mapRegion)){
stationCacheInfoDtos =filterData;
}
}
List<StationCacheInfoDto> fanStationList = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> pvStationList = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
Map<String, List<StationCacheInfoDto>> groupByProvince = stationCacheInfoDtos.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongProvince));
HashMap<String, Object> returnResult = new HashMap<>();
HashMap<String, Object> pv_interval = new HashMap<>();
HashMap<String, Object> fan_interval = new HashMap<>();
HashMap<String, Double> dayGenCache = new HashMap();
HashMap<String, Double> monthGenCache = new HashMap();
returnResult.put("pv_station_count", pvStationList.size());
returnResult.put("fan_station_count", fanStationList.size());
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfGF = new AtomicReference<>(new Double(0.00));
fanStationList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfMonthFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
planOfFD.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
pvStationList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
planOfGF.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
returnResult.put("today_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
returnResult.put("today_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()));
returnResult.put("month_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
returnResult.put("month_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()));
returnResult.put("month_pv_quota_schedule", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthGF.get() / planOfGF.get()) * 100));
if(returnResult.get("month_pv_quota_schedule").toString().equals("NaN")){
returnResult.put("month_pv_quota_schedule",0.00f);
}
returnResult.put("month_fan_quota_schedule", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() / planOfFD.get()) * 100));
if(returnResult.get("month_fan_quota_schedule").toString().equals("NaN")){
returnResult.put("month_fan_quota_schedule",0.00f);
}
groupByProvince.keySet().forEach(s -> {
HashMap<String, Object> fan = new HashMap<>();
HashMap<String, Object> pv = new HashMap<>();
List<StationCacheInfoDto> list = groupByProvince.get(s);
List<String> fanStationIds = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
List<String> pvStationIds = list.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
fan.put("station_count", fanStationIds.size());
pv.put("station_count", pvStationIds.size());
fan.put("today_power", getTotalPowerFromCache(fanStationIds, dayGenCache));
pv.put("today_power", getTotalPowerFromCache(pvStationIds, dayGenCache));
fan.put("month_power", getTotalPowerFromCache(fanStationIds, monthGenCache));
pv.put("month_power", getTotalPowerFromCache(pvStationIds, monthGenCache));
pv_interval.put(s, pv);
fan_interval.put(s, fan);
});
returnResult.put("pv_interval", pv_interval);
returnResult.put("fan_interval", fan_interval);
return returnResult;
}
public Double getPlanGenByStationIdAndMonth(String stationId) {
String[] dates = DateUtil.today().split("-");
return stationPlanMapper.getPlanGenByStationIdAndMonth(stationId, dates[0], String.valueOf(Integer.valueOf(dates[1])));
}
public Double getTotalPowerFromCache(List<String> keys, HashMap<String, Double> cache) {
AtomicReference<Double> result = new AtomicReference<>(0.0);
keys.forEach(s -> {
result.set(result.get() + cache.get(s));
});
return keepFourdecimalPlaces(result.get());
}
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// x轴数据
List<String> xdata = new ArrayList<>();
// 实时有功功率
List<String> currentPowerYdata = new ArrayList<>();
// 短期功率预测
List<String> shortPowerYdata = new ArrayList<>();
// 超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00");
currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0));
shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0));
superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0));
}
result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>();
currentPowerHashMap.put("title", "实时有功 " + date);
currentPowerHashMap.put("yData", currentPowerYdata);
result.put("currentPower", currentPowerHashMap);
HashMap<String, Object> shortPowerHashMap = new HashMap<>();
shortPowerHashMap.put("title", "短期功率预测 " + date);
shortPowerHashMap.put("yData", currentPowerYdata);
result.put("shortPower", shortPowerHashMap);
HashMap<String, Object> superShortPowerHashMap = new HashMap<>();
superShortPowerHashMap.put("title", "超短期功率预测 " + date);
superShortPowerHashMap.put("yData", currentPowerYdata);
result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format("%.2f",
currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String shortMin = String.format("%.2f",
shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f",
superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> gz = new ArrayList<>();
List<String> sj1 = new ArrayList<>();
gz.add(currentMin);
sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin)));
gz.add(shortMin);
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin)));
gz.add(supreMin);
sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin)));
String currentMax = String.format("%.2f",
currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String shortMax = String.format("%.2f",
shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String supreMax = String.format("%.2f",
superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>();
List<String> sj2 = new ArrayList<>();
zdz.add(currentMax);
zdz.add(shortMax);
zdz.add(supreMax);
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax)));
sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax)));
String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString();
List<String> pjz = new ArrayList<>();
List<String> fjl = new ArrayList<>();
pjz.add(currentAvg);
pjz.add(shortAvg);
pjz.add(supreAvg);
fjl = Arrays.asList("0.68", "0.89", "0.56");
footerList.put("gz", gz);
footerList.put("sj1", sj1);
footerList.put("zdz", zdz);
footerList.put("sj2", sj2);
footerList.put("pjz", pjz);
footerList.put("fjl", fjl);
result.put("footerList", footerList);
return result;
}
public Double keepFourdecimalPlaces(Double param) {
return Double.valueOf(String.format("%.4f", param));
}
public Map<String, String> getGenPowerInfoForBuDun(String areaCode, String stationId) {
HashMap<String, String> returnResult = new HashMap<>();
returnResult.put("monthCompleteRate", "0.00%");
returnResult.put("monthValue", "0.0000");
returnResult.put("monthPlanValue", "0.0000");
returnResult.put("yearCompleteRate", "0.00%");
returnResult.put("yearValue", "0.0000");
returnResult.put("yearPlanValue", "0.0000");
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
if (StringUtils.isNotBlank(areaCode)) {
stationCacheInfoDtos = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode))
.collect(Collectors.toList());
}
if (StringUtils.isNotBlank(stationId)) {
stationCacheInfoDtos = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId))
.collect(Collectors.toList());
}
// 月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
// 年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
for (StationCacheInfoDto stationCacheInfoDto : stationCacheInfoDtos) {
if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
monthlyPower.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
}
List<String> stationIds = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId)
.collect(Collectors.toList());
List<StationPlan> stationPlans = stationPlanMapper
.selectList(new QueryWrapper<StationPlan>().in("station_basic_id", stationIds));
String currentYearAndMonth = DateUtil.format(new Date(), DatePattern.NORM_MONTH_PATTERN);
String currentYear = currentYearAndMonth.split("-")[0];
Integer currentMonth = Integer.valueOf(currentYearAndMonth.split("-")[1]);
Double yearPlanValue = stationPlans.stream().filter(stationPlan -> stationPlan.getYear().equals(currentYear))
.mapToDouble(i -> i.getValue()).sum();
Double monthPlanValue = stationPlans.stream()
.filter(stationPlan -> currentMonth == Integer.valueOf(stationPlan.getMonthly()))
.mapToDouble(i -> i.getValue()).sum();
if (monthlyPower.get() > 0 && monthPlanValue > 0) {
returnResult.put("monthCompleteRate",
String.format(CommonConstans.Twodecimalplaces, (monthlyPower.get() / monthPlanValue) * 100) + "%");
returnResult.put("monthValue", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get()));
returnResult.put("monthPlanValue", String.format(CommonConstans.Fourdecimalplaces, monthPlanValue));
}
if (annualPower.get() > 0 && yearPlanValue > 0) {
returnResult.put("yearCompleteRate",
String.format(CommonConstans.Twodecimalplaces, (annualPower.get() / yearPlanValue) * 100) + "%");
returnResult.put("yearValue", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()));
returnResult.put("yearPlanValue", String.format(CommonConstans.Fourdecimalplaces, yearPlanValue));
}
return returnResult;
}
public Map<String, Object> getGenPowerInfo(String areaCode) {
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
if (StringUtils.isNotBlank(areaCode)) {
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code", areaCode));
List<StationCacheInfoDto> filterData = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode))
.collect(Collectors.toList());
stationCacheInfoDtos = filterData.size() > 0 ? filterData : stationCacheInfoDtos;
if (!ObjectUtils.isEmpty(mapRegion)) {
stationCacheInfoDtos = filterData;
}
}
List<StationCacheInfoDto> fanStationList = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList());
List<StationCacheInfoDto> pvStationList = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList());
Map<String, List<StationCacheInfoDto>> groupByProvince = stationCacheInfoDtos.stream()
.collect(Collectors.groupingBy(StationCacheInfoDto::getBelongProvince));
HashMap<String, Object> returnResult = new HashMap<>();
HashMap<String, Object> pv_interval = new HashMap<>();
HashMap<String, Object> fan_interval = new HashMap<>();
HashMap<String, Double> dayGenCache = new HashMap();
HashMap<String, Double> monthGenCache = new HashMap();
returnResult.put("pv_station_count", pvStationList.size());
returnResult.put("fan_station_count", fanStationList.size());
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfGF = new AtomicReference<>(new Double(0.00));
fanStationList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
if (result != null) {
powerOfDayFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfMonthFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
dayGenCache.put(stationBasic.getStationId(),
keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthGenCache.put(stationBasic.getStationId(),
keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
}
planOfFD.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
pvStationList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
if (result != null) {
powerOfDayGF.updateAndGet(v -> v
+ commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v
+ commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
}
planOfGF.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
returnResult.put("today_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
returnResult.put("today_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()));
returnResult.put("month_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
returnResult.put("month_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()));
returnResult.put("month_pv_quota_schedule",
String.format(CommonConstans.Twodecimalplaces, (powerOfMonthGF.get() / planOfGF.get()) * 100));
if (returnResult.get("month_pv_quota_schedule").toString().equals("NaN")) {
returnResult.put("month_pv_quota_schedule", 0.00f);
}
returnResult.put("month_fan_quota_schedule",
String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() / planOfFD.get()) * 100));
if (returnResult.get("month_fan_quota_schedule").toString().equals("NaN")) {
returnResult.put("month_fan_quota_schedule", 0.00f);
}
groupByProvince.keySet().forEach(s -> {
HashMap<String, Object> fan = new HashMap<>();
HashMap<String, Object> pv = new HashMap<>();
List<StationCacheInfoDto> list = groupByProvince.get(s);
List<String> fanStationIds = list.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList()).stream()
.map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
List<String> pvStationIds = list.stream()
.filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList()).stream()
.map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
fan.put("station_count", fanStationIds.size());
pv.put("station_count", pvStationIds.size());
fan.put("today_power", getTotalPowerFromCache(fanStationIds, dayGenCache));
pv.put("today_power", getTotalPowerFromCache(pvStationIds, dayGenCache));
fan.put("month_power", getTotalPowerFromCache(fanStationIds, monthGenCache));
pv.put("month_power", getTotalPowerFromCache(pvStationIds, monthGenCache));
pv_interval.put(s, pv);
fan_interval.put(s, fan);
});
returnResult.put("pv_interval", pv_interval);
returnResult.put("fan_interval", fan_interval);
return returnResult;
}
public Double getPlanGenByStationIdAndMonth(String stationId) {
String[] dates = DateUtil.today().split("-");
Double plan = stationPlanMapper.getPlanGenByStationIdAndMonth(stationId, dates[0],
String.valueOf(Integer.valueOf(dates[1])));
if (plan == null) {
plan = 0.0;
}
return plan;
}
public Double getTotalPowerFromCache(List<String> keys, HashMap<String, Double> cache) {
AtomicReference<Double> result = new AtomicReference<>(0.0);
if (keys != null && !keys.isEmpty() && cache != null && !cache.isEmpty()) {
keys.forEach(s -> {
if(cache.get(s)!=null)
{
result.set(result.get() + cache.get(s));
}
});
}
return keepFourdecimalPlaces(result.get());
}
}
......@@ -25,7 +25,11 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select sum(valueFs) valueF,xtime from (select SUBSTR(`created_time`, 11,6) xtime, `value_f` as valueFs from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= #{startTime} and ts <= #{endTime} and gateway_id in (#{gatewayId})) group by xtime order by xtime ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeqg(@Param("equipmentIndexName") String equipmentIndexName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= TODAY()-8h and gateway_id in ( ${gatewayId} )")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeqgNew(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id = #{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("equipmentIndexName") String equipmentIndexName, @Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF, equipment_index_name from iot_data.indicator_data where equipment_index_name like '%路电流%' and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
......
......@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
@Slf4j
public class CommonServiceImpl {
// @Autowired
// @Autowired
// InfluxdbUtil influxdbUtil;
@Autowired
SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
......@@ -246,7 +246,7 @@ public class CommonServiceImpl {
} catch (Exception e) {
return totalvalue;
}
return Double.valueOf(String.format("%.4f", totalvalue ));
return Double.valueOf(String.format("%.4f", totalvalue));
}
// public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) {
......@@ -371,10 +371,10 @@ public class CommonServiceImpl {
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 )));
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 )));
so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide)));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
......@@ -390,11 +390,12 @@ public class CommonServiceImpl {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del","0").isNotNull("WERKS"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
//.isNotNull("fan_gateway_id"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del", "0").isNotNull("WERKS"));
for (int i = 0; i < stationBasicList.size(); i++) {
StationBasic stationBasic = stationBasicList.get(i);
Double StationCapactity = sjglZsjZsbtzList.stream().filter(sjglZsjZsbtz -> sjglZsjZsbtz.getWerks().equals(stationBasic.getStationNumber())&& !StringUtils.isEmpty(sjglZsjZsbtz.getCapacityl())).collect(Collectors.toList()).stream().mapToDouble(l->Double.valueOf(l.getCapacityl())).sum();
Double StationCapactity = sjglZsjZsbtzList.stream().filter(sjglZsjZsbtz -> sjglZsjZsbtz.getWerks().equals(stationBasic.getStationNumber()) && !StringUtils.isEmpty(sjglZsjZsbtz.getCapacityl())).collect(Collectors.toList()).stream().mapToDouble(l -> Double.valueOf(l.getCapacityl())).sum();
StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto();
stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString());
stationCacheInfoDto.setStationName(stationBasic.getStationName());
......@@ -560,13 +561,17 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
if (!ObjectUtils.isEmpty(equipments)) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
}
return result;
}
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
if (equipments != null) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result;
}
......
......@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private UserEmpowerMapper userEmpowerMapper;
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
String table = gateway;
Map<String, List<String>> queryCodntion = new HashMap<>();
......@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) {
String userId = reginParams.getUserModel().getUserId();
String companyLevel ="";
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String companyLevel = "";
StdUserEmpower stdUserEmpower = userEmpowerMapper
.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!");
}else{
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String,String> companyInfo= userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString();
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString();
}
StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr);
List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class);
......@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
gfzTreeDto.setChildren(gfz);
List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto);
treeDto.setChildren(treeDtos);
if(companyLevel.equals("station")){
List<TreeDto> children = stationListByRegionCode.stream().filter(t->t.getCode().equals(sequenceNbr)).collect(Collectors.toList());
if(stationBasic.getStationType().equals("FDZ")){
treeDto = fdzTreeDto;
}else {
if (companyLevel.equals("station")) {
List<TreeDto> children = stationListByRegionCode.stream().filter(t -> t.getCode().equals(sequenceNbr))
.collect(Collectors.toList());
if (stationBasic.getStationType().equals("FDZ")) {
treeDto = fdzTreeDto;
} else {
treeDto = gfzTreeDto;
}
treeDto.setChildren(children);
......@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return new ArrayList<ESEquipmentsDTO>();
}
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态","30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态",
"停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态", "30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>();
......@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Override
public Map<String, Object> partofWaring3D(String stationId, String equipNum) {
Map<String, Object> resultMap = new HashMap<>();
if (stationId == null || equipNum == null || "null".equals(stationId) || "equipNum".equals(equipNum)) {
return resultMap;
}
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
......
......@@ -252,16 +252,22 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速", "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzInstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
if(result!=null)
{
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
if(result1!=null)
{
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))));
}
fdzInstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
......@@ -271,15 +277,21 @@ public class MonitoringServiceImpl {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, null);
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
if(result!=null)
{
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
if(result1!=null)
{
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv));
}
gfzinstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
}
} catch (Exception exception) {
......@@ -539,17 +551,20 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
//homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
if(result!=null)
{
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
//homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
}
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")));
if(esEquipmentsList!=null)
{
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")));
}
} else {
// Map<String, List<String>> queryCondtion = new HashMap<>();
// queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率"));
......@@ -565,14 +580,19 @@ public class MonitoringServiceImpl {
queryCondtion2.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion2.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion2, null, ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")));
if(esEquipmentsList!=null)
{
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")));
}
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
if(result1!=null)
{
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
}
}
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
//获取场站经纬度
......@@ -610,13 +630,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
if(result!=null)
{
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorDay));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
if(result!=null)
{
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
}
}
} catch (Exception e) {
......@@ -652,13 +678,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear);
if(result!=null)
{
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear);
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
if(result!=null)
{
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
}
Double finalTotal = total1;
total.updateAndGet(v -> v + finalTotal);
......@@ -684,13 +716,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
}
Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal);
......@@ -725,17 +763,23 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
if(result!=null)
{
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
if(result!=null)
{
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
}
});
HashMap<String, String> dayHashMap = new HashMap<>();
......@@ -787,13 +831,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
}
Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal);
......@@ -829,15 +879,28 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorMonth));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
if(result!=null)
{
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator));
if(result!=null)
{
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator));
}
}
Double PlanGen = getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId());
if(PlanGen!=null)
{
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get()) * 100 /PlanGen));
}else
{
stationCacheInfoDto.setAddress("0.0");
}
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get()) * 100 / getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId())));
});
List<StationCacheInfoDto> sorted = stationCacheInfoDtoList.stream().sorted(Comparator.comparing(StationCacheInfoDto::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> {
......@@ -899,14 +962,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
}
}
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, (total * 10) / gfInstall.doubleValue()));
if (stationBasic.getAddress().equals("NaN")) {
......@@ -1017,9 +1085,12 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayFD = powerOfDayFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD = powerOfMonthFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD = powerOfAnnualFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
if(result!=null)
{
powerOfDayFD = powerOfDayFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD = powerOfMonthFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD = powerOfAnnualFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}
}
for (int i = 0; i < gfList.size(); i++) {
StationBasic stationBasic = gfList.get(i);
......@@ -1027,10 +1098,12 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
if(result!=null)
{
powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
}
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
......@@ -1099,14 +1172,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
if(result!=null)
{
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
if(result!=null)
{
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
}
});
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
......@@ -1320,18 +1398,22 @@ public class MonitoringServiceImpl {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
if (stationBasic.getStationType().equals("FDZ")) {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
if(esEquipmentsList!=null)
{
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
}
} else {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P") * CommonConstans.kwToMv);
if(esEquipmentsList!=null)
{
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P") * CommonConstans.kwToMv);
}
}
});
//有功功率换算
......
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