Commit a313256c authored by wujiang's avatar wujiang

提交修改

parent 2379e2c7
......@@ -89,7 +89,7 @@ public class AmosJxiopAnalyseApplication {
return;
}
// 订阅固化周期性数据成功的消息
emqKeeper.subscript("sync_esdata_to_tdengine_notice1", 1, syncESDataToTdengineMqttListener);
emqKeeper.subscript("sync_esdata_to_tdengine_notice", 1, syncESDataToTdengineMqttListener);
// 订阅业务固化同步数据成功消息
//emqKeeper.subscript("sync_iotdata_to_tdengine_notice", 1, syncDasSuccessMqttListener);
}
......
......@@ -70,7 +70,7 @@ public class Constants {
*/
public static final String JXIOP_DICT_CERTIFICATES = "jxIop:dict:certificates";
public static final String BASE_URL = "http://iiet-jepcc.powerchina.cn:8088/screen_api";
//public static final String BASE_URL = "http://iiet-jepcc.powerchina.cn:8088/screen_api";
public static final String REQUEST_GET="GET";
public static final String REQUEST_POST="POST";
public static final String get_province_item_url="method=scene_screen.data_interface.get_province_item";
......
......@@ -5,7 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Map;
public interface EnergyAccessService {
Page<Map<String, Object>> getInstalledCapacity(String current, String pageSize, String code, String sourceStationId, String tp) throws Exception;
Page<Map<String, Object>> getInstalledCapacity(String current, String pageSize, String code, String sourceStationId, String tp) throws Exception;
Page<Map<String, Object>> getQuotaCompleteInfo(String current, String pageSize, String code, String sourceStationId, String tp);
}
......@@ -6,12 +6,13 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.util.Constants;
import com.yeejoin.amos.boot.module.jxiop.api.util.HttpRequestUtil;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.EnergyAccessMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.EnergyAccessService;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.EnergyAccessMapper;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -32,6 +33,9 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
private final Logger logger = LoggerFactory.getLogger(EnergyAccessServiceImpl.class);
@Value("${budun.baseurl:http://iiet-jepcc.powerchina.cn:8088/screen_api}")
private String budunBaseURL;
@Override
public Page<Map<String, Object>> getInstalledCapacity(String current, String pageSize, String code, String sourceStationId, String tp) {
......@@ -45,7 +49,7 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
logger.info("获取并网容量接口查询本地返回结果:{}", returnList.toString());
} else {
//改为部盾接口
StringBuilder requestUrl = new StringBuilder(Constants.BASE_URL).append("?").append(Constants.get_station_actual_installed_capacity);
StringBuilder requestUrl = new StringBuilder(budunBaseURL).append("?").append(Constants.get_station_actual_installed_capacity);
if (StringUtils.isNotEmpty(code)) {
requestUrl.append("&code=").append(code);
}
......@@ -102,7 +106,7 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
@Override
public Page<Map<String, Object>> getQuotaCompleteInfo(String current, String pageSize, String code, String sourceStationId, String tp) {
//改为部盾接口
StringBuilder requestUrl = new StringBuilder(Constants.BASE_URL).append("?").append(Constants.get_quota_complate_info);
StringBuilder requestUrl = new StringBuilder(budunBaseURL).append("?").append(Constants.get_quota_complate_info);
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
......
......@@ -30,6 +30,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.metrics.ParsedAvg;
import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
......@@ -95,6 +96,9 @@ public class LargeScreenImpl {
private final String YFD = "月发电量";
private final String NFD = "年发电量";
@Value("${budun.baseurl:http://iiet-jepcc.powerchina.cn:8088/screen_api}")
private String budunBaseURL;
/**
* 全国
*/
......@@ -144,7 +148,7 @@ public class LargeScreenImpl {
// }
// 改为部盾接口
String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info;
String requestUrl = budunBaseURL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate yesterday = currentDate.minusDays(1);
......@@ -474,7 +478,7 @@ public class LargeScreenImpl {
// mapdta.put("NJHWC", ybfbn);
// 改为部盾接口
String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info;
String requestUrl = budunBaseURL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate yesterday = currentDate.minusDays(1);
......
......@@ -84,6 +84,8 @@ public class MonitoringServiceImpl {
@Autowired
private HttpRequestUtil httpRequestUtil;
@Value("${budun.baseurl:http://iiet-jepcc.powerchina.cn:8088/screen_api}")
private String budunBaseURL;
/**
* 根据场站编号获取该场站的装机容量
*
......@@ -1107,7 +1109,7 @@ public class MonitoringServiceImpl {
//改为部盾接口
String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info;
String requestUrl = budunBaseURL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate yesterday = currentDate.minusDays(1);
......
......@@ -84,3 +84,4 @@ year.power.generation.cron=0 0/1 * * * ?
large.cron=0 0/5 * * * ?
forecast.url=http://10.20.1.29:8095/offline/time-series/decomposition
budun.baseurl=http://iiet-jepcc.powerchina.cn:8088/screen_api
\ No newline at end of file
......@@ -674,11 +674,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
if ("FDZ".equals(stationBasic.getStationType())) {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()));
Double value = groupMap.get(indicatorData.getCreatedTime());
if (Objects.isNull(value)){
value= 0.0;
if (Objects.isNull(value)) {
value = 0.0;
}
valueList.add(
String.format(CommonConstans.Twodecimalplaces,value));
valueList.add(String.format(CommonConstans.Twodecimalplaces, value));
} else {
values.add(String.format(CommonConstans.Twodecimalplaces,
indicatorData.getValueF() * CommonConstans.kwToMv));
......@@ -834,6 +833,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public void schedAddAlarmEventData(String gatewayId, String stationId, String stationName, long currentsort) {
Map<String, List<String>> queryCondtion = new HashMap<>();
if (gatewayId == null) {
return;
}
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList("光字牌"));
queryCondtion.put(CommonConstans.QueryStringValueKeyword, Arrays.asList("false"));
......@@ -841,7 +843,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
ESEquipments.class);
List<AlarmEvent> newAlarmEvents = new ArrayList<>();
List<String> alarmsNames = new ArrayList<>();
if (indicatorsDtoList == null) {
return;
}
for (ESEquipments esEquipments : indicatorsDtoList) {
AlarmEvent alarmEvent = new AlarmEvent();
alarmEvent.setEventDesc(esEquipments.getEquipmentIndexName());
......@@ -1198,8 +1202,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public void getListByFJ(String gatewayId, String werks, String stationId) {
if(werks==null||StringUtils.isEmpty(werks))
{
if (werks == null || StringUtils.isEmpty(werks)) {
return;
}
HashMap<String, String> fanstatutsHashMap = new HashMap<>();
......@@ -1209,8 +1212,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> listDataAll = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
if(listDataAll==null||listDataAll.isEmpty())
{
if (listDataAll == null || listDataAll.isEmpty()) {
return;
}
Map<String, Object> listDataWindSpeed = listDataAll.stream()
......@@ -1224,20 +1226,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// List<Map<String, Object>> dataMaps = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
// .getStationInfoMapByStationWerks(werks, tpriDmpDatabook.getDataid().toString());
List<Map<String, Object>> dataMapss = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
.getStationInfoMapByStationWerksNew(werks, tpriDmpDatabook.getDataid().toString());
Map<String, List<Map<String, Object>>> dataResult = dataMapss.stream().collect(Collectors.groupingBy(map -> (String) map.get("name")));
Map<String, List<Map<String, Object>>> dataResult = dataMapss.stream()
.collect(Collectors.groupingBy(map -> (String) map.get("name")));
List<Map<String, Object>> dataMaps = new ArrayList<>();
dataResult.keySet().forEach(m->{
String equipNum = dataResult.get(m).stream()
.map(map ->map.get("equipNum").toString().replace(m+"#",""))
.reduce((a, b) -> a + "," + b)
.orElse("");
dataResult.keySet().forEach(m -> {
String equipNum = dataResult.get(m).stream().map(map -> map.get("equipNum").toString().replace(m + "#", ""))
.reduce((a, b) -> a + "," + b).orElse("");
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("name",m.replace("#",""));
hashMap.put("equipNum",equipNum);
hashMap.put("name", m.replace("#", ""));
hashMap.put("equipNum", equipNum);
dataMaps.add(hashMap);
});
......@@ -2141,6 +2141,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public void getEquipSwitchStatus(StationBasic stationBasic) {
String gatewayId = stationBasic.getFanGatewayId();
if (gatewayId == null) {
return;
}
Long stationId = stationBasic.getSequenceNbr();
Map<String, List<String>> queryConditon = new HashMap<>();
queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
......@@ -2329,6 +2332,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public void getListByNbq(String gatewayId, String werks, String stationId) {
if (gatewayId == null) {
return;
}
HashMap<String, String> equipStatesMap = getPvNBQStationBy(gatewayId);
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
Map<String, List<String>> queryConditon = new HashMap<>();
......@@ -2376,24 +2382,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// .getStationInfoMapByStationGFWerks(werks, "集电线");
List<Map<String, Object>> dataMapss = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper
.getStationInfoMapByStationGFWerksNew(werks,"集电线");
.getStationInfoMapByStationGFWerksNew(werks, "集电线");
Map<String, List<Map<String, Object>>> dataResult = dataMapss.stream().collect(Collectors.groupingBy(map -> (String) map.get("name")));
Map<String, List<Map<String, Object>>> dataResult = dataMapss.stream()
.collect(Collectors.groupingBy(map -> (String) map.get("name")));
List<Map<String, Object>> dataMaps = new ArrayList<>();
dataResult.keySet().forEach(m->{
String equipNum = dataResult.get(m).stream()
.map(map ->map.get("equipNum").toString().replace(m,""))
.reduce((a, b) -> a + "," + b)
.orElse("");
dataResult.keySet().forEach(m -> {
String equipNum = dataResult.get(m).stream().map(map -> map.get("equipNum").toString().replace(m, ""))
.reduce((a, b) -> a + "," + b).orElse("");
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("name",m.replace("#",""));
hashMap.put("equipNum",equipNum);
hashMap.put("name", m.replace("#", ""));
hashMap.put("equipNum", equipNum);
dataMaps.add(hashMap);
});
int i = 0;
// 逆变器需要根据所属集电线分类组装 下面循环是将同一子阵下的不同逆变器组装为消息数据
for (Map<String, Object> dataMap : dataMaps) {
......@@ -2793,6 +2795,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public HashMap<String, String> getPvNBQStationBy(String gatewayId) {
HashMap<String, String> result = new HashMap<>();
if (gatewayId == null) {
return result;
}
Map<String, List<String>> queryCondition = new HashMap<>();
queryCondition.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("运行"));
queryCondition.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
......
......@@ -16,11 +16,14 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.MonitorService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.optional.qual.Present;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -45,6 +48,9 @@ public class MonitorServiceImpl implements MonitorService {
private final StationCoordinateMapper stationCoordinateMapper;
private final MapRegionMapper mapRegionMapper;
private final HttpRequestUtil httpRequestUtil;
@Value("${budun.baseurl:http://iiet-jepcc.powerchina.cn:8088/screen_api}")
private String budunBaseURL;
@Override
public void getTotalData() {
......@@ -121,11 +127,11 @@ public class MonitorServiceImpl implements MonitorService {
Double useHoursOfAnnualGF = 0.00;
// 获取全国数据
String nationalUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url;
String nationalUrl = budunBaseURL + "?" + Constants.get_province_item_url;
// 获取风电
String nationalFanUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&type=fan";
String nationalFanUrl = budunBaseURL + "?" + Constants.get_province_item_url + "&type=fan";
// 获取光伏
String nationalPVUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&type=pv";
String nationalPVUrl = budunBaseURL + "?" + Constants.get_province_item_url + "&type=pv";
List<BuDunGenDto> nationalGendto = httpRequestUtil.getResPonse(nationalUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> fanGendto = httpRequestUtil.getResPonse(nationalFanUrl, Constants.REQUEST_GET, "",
......@@ -286,7 +292,7 @@ public class MonitorServiceImpl implements MonitorService {
}
}
String requestUrl = Constants.BASE_URL + "?" + Constants.get_province_station_item + "&provinceName"
String requestUrl = budunBaseURL + "?" + Constants.get_province_station_item + "&provinceName"
+ provinceName;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl,
Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
......@@ -450,7 +456,7 @@ public class MonitorServiceImpl implements MonitorService {
AtomicReference<Double> fdzannualPower = new AtomicReference<>(0.0);
AtomicReference<Double> gfzannualPower = new AtomicReference<>(0.0);
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
String requestUrl = Constants.BASE_URL + "?" + Constants.get_province_station_item + "&provinceName="
String requestUrl = budunBaseURL + "?" + Constants.get_province_station_item + "&provinceName="
+ provinceName;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl,
Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
......@@ -489,7 +495,7 @@ public class MonitorServiceImpl implements MonitorService {
completionOfPowerIndicatorsDtoList.add(completionOfPowerIndicatorsDto);
});
}
String provincelUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&provinceName="
String provincelUrl = budunBaseURL + "?" + Constants.get_province_item_url + "&provinceName="
+ provinceName;
List<BuDunGenDto> provinceDtos = httpRequestUtil.getResPonse(provincelUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunGenDto.class);
......@@ -615,7 +621,7 @@ public class MonitorServiceImpl implements MonitorService {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 99);
List<HashMap<String, String>> hashMapList = new ArrayList<>();
List<StationCacheInfoDto> stationCacheInfoDtoList = new ArrayList<>();
String requestUrl = Constants.BASE_URL + "?" + Constants.get_area_item_url;
String requestUrl = budunBaseURL + "?" + Constants.get_area_item_url;
if (!ObjectUtils.isEmpty(areaName)) {
if (!areaName.contains(Constants.areaChinese)) {
areaName = areaName + Constants.areaChinese;
......@@ -660,7 +666,7 @@ public class MonitorServiceImpl implements MonitorService {
public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
String requestUrl = Constants.BASE_URL + "?" + Constants.get_area_item_url;
String requestUrl = budunBaseURL + "?" + Constants.get_area_item_url;
if (!ObjectUtils.isEmpty(stationId)) {
stationBasicListAll.add(stationBasicMapper.selectById(stationId));
} else if (!ObjectUtils.isEmpty(areaName)) {
......@@ -716,7 +722,7 @@ public class MonitorServiceImpl implements MonitorService {
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
List<HashMap<String, String>> mapList = new ArrayList<>();
String requestUrl = Constants.BASE_URL + "?" + Constants.get_month_top_url + "&topValue=5";
String requestUrl = budunBaseURL + "?" + Constants.get_month_top_url + "&topValue=5";
if (!ObjectUtils.isEmpty(areaName)) {
if (!areaName.contains(Constants.areaChinese)) {
areaName = areaName + Constants.areaChinese;
......@@ -782,7 +788,7 @@ public class MonitorServiceImpl implements MonitorService {
List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> fdzList = new ArrayList<>();
List<StationBasic> gfdzlist = new ArrayList<>();
String requestUrl = Constants.BASE_URL + "?" + Constants.get_hours_num_top + "&topValue=3&tabValue=" + tabValue;
String requestUrl = budunBaseURL + "?" + Constants.get_hours_num_top + "&topValue=3&tabValue=" + tabValue;
if (!ObjectUtils.isEmpty(areaName)) {
if (!areaName.contains(Constants.areaChinese)) {
areaName = areaName + Constants.areaChinese;
......
......@@ -31,6 +31,8 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
@Service
public class MonitoringServiceImpl {
Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class);
......
......@@ -2,7 +2,7 @@ spring.application.name=AMOS-JXIOP-MONITOR-CT
server.servlet.context-path=/jxiop-monitor
server.port=33200
server.uri-encoding=UTF-8
spring.profiles.active=dev1
spring.profiles.active=dev2
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
#logging.config=classpath:logback-${spring.profiles.active}.xml
......@@ -94,4 +94,6 @@ spring.elasticsearch.rest.read-timeout=30000
amos.system.user.user-name=cz
amos.system.user.password=a1234567
amos.system.user.product=AMOS_STUDIO_WEB
amos.system.user.app-key=AMOS_STUDIO
\ No newline at end of file
amos.system.user.app-key=AMOS_STUDIO
budun.baseurl=http://iiet-jepcc.powerchina.cn:8088/screen_api
\ No newline at end of file
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