Commit 359cc226 authored by caotao's avatar caotao

1.大屏及监盘问题修改。

parent 67b3b380
......@@ -1463,7 +1463,7 @@ public class MonitorFanIdxController extends BaseController {
map.put("total", list.size());
map.put("num", sum);
try {
emqKeeper.getMqttClient().publish("/accessSituation/topic/" + s, JSON.toJSONString(map).getBytes(), 0, false);
emqKeeper.getMqttClient().publish("/accessSituation/topic/" + s, JSON.toJSONString(map).getBytes(), 1, true);
} catch (MqttException e) {
}
......
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PowerGenerationImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
......@@ -25,92 +26,90 @@ import java.util.List;
@EnableScheduling
public class PowerGeneration {
private final String dayvalue = "日发电量";
private final String moonValue = "月发电量";
private final String yearValue = "年发电量";
private final String dayDateFormat = "yyyy-MM-dd";
private final String moonDateFormat = "yyyy-MM";
private final String yearDateFormat = "yyyy";
private final String dayType = "day";
private final String moonType = "moon";
private final String yearType = "year";
@Autowired
PowerGenerationImpl powerGenerationImpl;
@Autowired
CommonServiceImpl commonServiceImpl;
private final String dayvalue="日发电量";
private final String moonValue="月发电量";
private final String yearValue="年发电量";
private final String dayDateFormat="yyyy-MM-dd";
private final String moonDateFormat="yyyy-MM";
private final String yearDateFormat="yyyy";
private final String dayType="day";
private final String moonType="moon";
private final String yearType="year";
@Async
//定时更新日发电量
@Scheduled(cron = "${daily.power.generation.cron}")
public void addESDailyPowerGeneration(){
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
public void addESDailyPowerGeneration() {
List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto();
//获取时间天字符串
SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd");
Date now=new Date();
String daty= myFmt2.format(now);
SimpleDateFormat myFmt2 = new SimpleDateFormat("yyyy-MM-dd");
Date now = new Date();
String daty = myFmt2.format(now);
for (StationCacheInfoDto stationCacheInfoDto : list) {
if("FDZ".equals(stationCacheInfoDto.getStationType())){
if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
//风机
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"FDZ",daty);
}else{
powerGenerationImpl.addPowerGeneration(stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType, "FDZ", daty);
} else {
//光伏
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"GFDZ",daty);
powerGenerationImpl.addPowerGeneration(stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType, "GFDZ", daty);
}
}
}
//定时更新月发电量
@Async
@Scheduled(cron = "${moon.power.generation.cron}")
public void addESMoonPowerGeneration(){
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
public void addESMoonPowerGeneration() {
List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto();
//获取时间天字符串
SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd");
Date now=new Date();
String daty= myFmt2.format(now);
SimpleDateFormat myFmt2 = new SimpleDateFormat("yyyy-MM-dd");
Date now = new Date();
String daty = myFmt2.format(now);
for (StationCacheInfoDto stationCacheInfoDto : list) {
//风机
if("FDZ".equals(stationCacheInfoDto.getStationType())){
if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
//风机
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"FDZ",daty);
powerGenerationImpl.addPowerGeneration(stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType, "FDZ", daty);
}else{
} else {
//光伏
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"GFDZ",daty);
powerGenerationImpl.addPowerGeneration(stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType, "GFDZ", daty);
}
}
}
//定时更新年发电量
@Async
@Scheduled(cron = "${year.power.generation.cron}")
public void addESYearPowerGeneration(){
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
public void addESYearPowerGeneration() {
List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto();
//获取时间天字符串
SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd");
Date now=new Date();
String daty= myFmt2.format(now);
SimpleDateFormat myFmt2 = new SimpleDateFormat("yyyy-MM-dd");
Date now = new Date();
String daty = myFmt2.format(now);
for (StationCacheInfoDto stationCacheInfoDto : list) {
//风机
if("FDZ".equals(stationCacheInfoDto.getStationType())){
if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
//风机
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"FDZ",daty);
powerGenerationImpl.addPowerGeneration(stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType, "FDZ", daty);
}else{
} else {
//光伏
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"GFDZ",daty);
powerGenerationImpl.addPowerGeneration(stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType, "GFDZ", daty);
}
......
......@@ -356,7 +356,7 @@ public class LargeScreenImpl {
mapdta.put("NJHWC", ybfbn);
try {
System.out.println(JSON.toJSONString(mapdta));
emqKeeper.getMqttClient().publish("qyyxzb/"+s, JSON.toJSONString(mapdta).getBytes(),0,false);
emqKeeper.getMqttClient().publish("qyyxzb/"+s, JSON.toJSONString(mapdta).getBytes(),1,true);
} catch (MqttException e) {
e.printStackTrace();
}
......@@ -446,7 +446,7 @@ public class LargeScreenImpl {
List<String> listdate= dayReportnq(new Date());
seriesData.setAxisData(listdate);
try {
emqKeeper.getMqttClient().publish("qy/fdqs/"+areaCode, JSON.toJSONString(seriesData).getBytes(),0,false);
emqKeeper.getMqttClient().publish("qy/fdqs/"+areaCode, JSON.toJSONString(seriesData).getBytes(),1,true);
} catch (MqttException e) {
e.printStackTrace();
}
......
......@@ -14,12 +14,16 @@ public class RegionNationWideDto {
private String staitionId;
@ApiModelProperty(value = "光伏电站数量")
private String guangfu = "0";
@ApiModelProperty(value = "储能电站数量")
private String chuneng = "0";
@ApiModelProperty(value = "储能装机容量")
private String chunengMV = "0";
@ApiModelProperty(value = "风机电站数量")
private String fengdian="0";
@ApiModelProperty(value = "光伏装机容量")
private String guangfuMW = "0";
@ApiModelProperty(value = "风机装机容量")
private String fengdianMV = "0" ;
private String fengdianMV = "0" ;;
@ApiModelProperty(value = "是否已接入数据")
private Boolean jsJoin = false;
@ApiModelProperty(value = "场站名称")
......
......@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
//import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import org.elasticsearch.common.logging.ESLogMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -101,7 +102,8 @@ public class MonitoringServiceImpl {
Region region = regionList.get(i);
list = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(region.getRegionName())).collect(Collectors.toList());
List<StationCacheInfoDto> fdlist = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> gflist = list.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> gflist = list.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().contains("GFDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> cnlist = list.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("CNDZ")).collect(Collectors.toList());
if (list.size() > 0) {
regionNationWideDto.setJsJoin(true);
} else {
......@@ -109,8 +111,10 @@ public class MonitoringServiceImpl {
}
regionNationWideDto.setFengdian(String.valueOf(fdlist.size()));
regionNationWideDto.setGuangfu(String.valueOf(gflist.size()));
regionNationWideDto.setChuneng(String.valueOf(cnlist.size()));
regionNationWideDto.setGuangfuMW(String.format(CommonConstans.Twodecimalplaces, gflist.stream().mapToDouble(stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())).sum()));
regionNationWideDto.setFengdianMV(String.format(CommonConstans.Twodecimalplaces, fdlist.stream().mapToDouble(stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())).sum()));
regionNationWideDto.setChunengMV(String.format(CommonConstans.Twodecimalplaces, cnlist.stream().mapToDouble(stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())).sum()));
regionNationWideDto.setName(region.getRegionName());
regionNationWideDtoList.add(regionNationWideDto);
}
......@@ -146,13 +150,16 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"));
} else {
} else if(stationCacheInfoDto.getStationType().contains("GFDZ")){
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "WTX-801_25_WTX-801_总辐射"));
}else {
speendOrirradiate="0.00";
}
regionNationWideDto.setSpeendOrirradiate(speendOrirradiate);
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> String.valueOf(stationCoordinate1.getStationId()).equals(stationCacheInfoDto.getStationId())).collect(Collectors.toList()).get(0);
hashMap.put("lng", Double.valueOf(stationCoordinate.getLongitude()));
......@@ -1262,6 +1269,10 @@ public class MonitoringServiceImpl {
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {if(stationBasic.getStationType().contains("GFDZ")){
stationBasic.setStationType("GFZ");
stationBasic.setStationTypeName("光伏站");
}});
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> {
Map<String, String> stringStringMap = new HashMap<>();
......
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