Commit 5ba6c06d authored by caotao's avatar caotao

运行监盘-上下数据不同步问题修改处理

parent 556ddc02
......@@ -45,131 +45,137 @@ public class MonitoringMapController extends BaseController {
@Autowired
MonitoringServiceImpl monitoringServiceImpl;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取监盘全国-安全生产天数")
@GetMapping("/getSecDays")
public ResponseModel<HashMap<String,String>> getSecDays(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
public ResponseModel<HashMap<String, String>> getSecDays(@RequestParam(value = "provinceName", required = false) String provinceName, @RequestParam(value = "type", required = false) String type) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSecDays(secStartDate));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取监盘全国地图数据")
@GetMapping("/nationwide")
public ResponseModel<List<RegionNationWideDto>> getNationWideInfo(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName,type));
public ResponseModel<List<RegionNationWideDto>> getNationWideInfo(@RequestParam(value = "provinceName", required = false) String provinceName, @RequestParam(value = "type", required = false) String type) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName, type));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取监盘全国地图-发电量数据")
@GetMapping("/getNationalPowerGenerationData")
public ResponseModel<List<HashMap<String,Object>>> getNationalPowerGenerationData() {
public ResponseModel<List<HashMap<String, Object>>> getNationalPowerGenerationData() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationalPowerGenerationData());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取监盘全国地图-获取功率曲线下拉框数据")
@GetMapping("/getSelectDataForNational")
public ResponseModel<List<HashMap<String,Object>>> getSelectDataForNational() {
public ResponseModel<List<HashMap<String, Object>>> getSelectDataForNational() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSelectDataForNational());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取区域电量指标完成情况")
@GetMapping("/getCompletionOfPowerIndicatorsByProvinceName")
public ResponseModel<ResultsData> getCompletionOfPowerIndicatorsByProvinceName(@RequestParam(required = true) int current, @RequestParam(required = true) int size, @RequestParam(required = true) String provinceName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getCompletionOfPowerIndicatorsByProvinceName(current,size,provinceName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据场站id动态获取tab页签")
@GetMapping("/getTabsByStationBasicId")
public ResponseModel<List<TabDto>> getTabsByStationBasicId(@RequestParam(required = true) String stationBasicId) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getTabsByStationBasicId(stationBasicId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页地图-全国")
@GetMapping("/getAreaInfo")
public ResponseModel<List<MapAreaInfoDto>> getAreaInfo() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页地图-片区")
@GetMapping("/getStaitonListInfoByAreaName")
public ResponseModel<List<HomeMapStationInfoDto>> getStaitonListInfoByAreaName(@RequestParam(required = true)String areaName) {
public ResponseModel<List<HomeMapStationInfoDto>> getStaitonListInfoByAreaName(@RequestParam(required = true) String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getStaitonListInfoByAreaName(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-场站分类信息")
@GetMapping("/getStaionCategoryInfo")
public ResponseModel<List<Map<String,String>>> getStaionCategoryInfo(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getStaionCategoryInfo(areaName));
public ResponseModel<List<Map<String, String>>> getStaionCategoryInfo(@RequestParam(required = false) String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getStaionCategoryInfo(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-装机容量")
@GetMapping("/getInstallCapityByAreaName")
public ResponseModel<HashMap<String,String>> getInstallCapityByAreaName(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getInstallCapityByAreaName(areaName));
public ResponseModel<HashMap<String, String>> getInstallCapityByAreaName(@RequestParam(required = false) String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getInstallCapityByAreaName(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-有功功率")
@GetMapping("/getActivePowerByAreaName")
public ResponseModel<HashMap<String,String>> getActivePowerByAreaName(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getActivePowerByAreaName(areaName));
public ResponseModel<HashMap<String, String>> getActivePowerByAreaName(@RequestParam(required = false) String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getActivePowerByAreaName(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-社会贡献")
@GetMapping("/getSocialContributionDtoList")
public ResponseModel<Page<SocialContributionDto>> getSocialContributionDtoList(@RequestParam(required = false)String areaName, @RequestParam(required = false)String station) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSocialContributionDtoList(areaName,station));
public ResponseModel<Page<SocialContributionDto>> getSocialContributionDtoList(@RequestParam(required = false) String areaName, @RequestParam(required = false) String station) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSocialContributionDtoList(areaName, station));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-发电量趋势")
@GetMapping("/getPowerGenerationTrendsOfMonth")
public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfMonth(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfMonth(areaName));
public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfMonth(@RequestParam(required = false) String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfMonth(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-发电量详情")
@GetMapping("/getDetailsOnPowergeneration")
public ResponseModel<Page<HashMap<String,String>>> getDetailsOnPowergeneration(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getDetailsOnPowergeneration(areaName));
public ResponseModel<Page<HashMap<String, String>>> getDetailsOnPowergeneration(@RequestParam(required = false) String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getDetailsOnPowergeneration(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-发电量趋势完成率")
@GetMapping("/getPowerGenerationTrendsOfCompletionRate")
public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfCompletionRate(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionRate(areaName));
public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfCompletionRate(@RequestParam(required = false) String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionRate(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-发电top5")
@GetMapping("/getPowerGenerationTrendsOfCompletionTopFive")
public ResponseModel<Page<HashMap<String,String>>> getPowerGenerationTrendsOfCompletionTopFive(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopFive(areaName));
public ResponseModel<Page<HashMap<String, String>>> getPowerGenerationTrendsOfCompletionTopFive(@RequestParam(required = false) String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopFive(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "监盘首页-发电小时排名top3")
@GetMapping("/getPowerGenerationTrendsOfCompletionTopThree")
public ResponseModel<Page<HashMap<String, String>>> getPowerGenerationTrendsOfCompletionTopThree(@RequestParam(required = false)String areaName,@RequestParam(required = false,defaultValue = "0")String tabValue) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopThree(tabValue,areaName));
public ResponseModel<Page<HashMap<String, String>>> getPowerGenerationTrendsOfCompletionTopThree(@RequestParam(required = false) String areaName, @RequestParam(required = false, defaultValue = "0") String tabValue) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopThree(tabValue, areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "运行监盘-获取全国数据")
@GetMapping("/getTotalData")
public void getTotalData() {
monitoringServiceImpl.getTotalData();
monitoringServiceImpl.getTotalData();
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "运行监盘-功率曲线")
@GetMapping("/getTheStationPowerCurve")
public ResponseModel<HashMap<String, Object>> getTheStationPowerCurve(@RequestParam(required = false)String stationId,@RequestParam(required = false)String date) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getTheStationPowerCurve(stationId,date));
public ResponseModel<HashMap<String, Object>> getTheStationPowerCurve(@RequestParam(required = false) String stationId, @RequestParam(required = false) String date) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getTheStationPowerCurve(stationId, date));
}
}
......@@ -20,6 +20,7 @@ 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.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
......@@ -169,7 +170,7 @@ public class MonitoringServiceImpl {
return regionNationWideDtoList;
}
// @Scheduled(cron = "0/60 * * * * ? ")
public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) {
List<ColModel> colModels = new ArrayList<>();
......@@ -190,6 +191,11 @@ public class MonitoringServiceImpl {
colModels.add(colModelAnnualPower);
List<StationCacheInfoDto> stationCacheInfoDtoList = commonServiceImpl.getListStationCacheInfoDto();
List<StationCacheInfoDto> stationCacheInfoDtos = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(provinceName)).collect(Collectors.toList());
if(ObjectUtils.isEmpty(stationCacheInfoDtos)){
DataGridMock dataGridMock = new DataGridMock(current, 0, false, 1, null);
ResultsData resultsData = new ResultsData(dataGridMock, colModels);
return resultsData;
}
//日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
......@@ -199,12 +205,14 @@ public class MonitoringServiceImpl {
//年发电量完成比例
String completionRatio = "0.00";
//年利用小时数
List<StationPlan> fdzPlans = new ArrayList<>();
int year = Calendar.getInstance().get(Calendar.YEAR);
List<String> fdz = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
LambdaQueryWrapper<StationPlan> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StationPlan::getYear, String.valueOf(year));
queryWrapper.in(StationPlan::getStationBasicId, fdz);
List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
fdzPlans = stationPlanMapper.selectList(queryWrapper);
double value = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
AtomicReference<Double> useHours = new AtomicReference<>(0.0);
......@@ -298,18 +306,20 @@ public class MonitoringServiceImpl {
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
socialContributionDtoPage.setCurrent(1);
Integer allsize = completionOfPowerIndicatorsDtoList.size();
DataGridMock dataGridMock = new DataGridMock(current, allsize, false, allsize / size + 1, completionOfPowerIndicatorsDtoList);
ResultsData resultsData = new ResultsData(dataGridMock, colModels);
try {
emqKeeper.getMqttClient().publish("completion_of_powerindicator_topic", JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_list_topic", JSON.toJSON(resultsData).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_topic", JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送区域实时生产数据消息=================== 成功!" + JSON.toJSONString(socialContributionDtoPage));
} catch (Exception exception) {
logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
}
Integer allsize = completionOfPowerIndicatorsDtoList.size();
DataGridMock dataGridMock = new DataGridMock(current, allsize, false, allsize / size + 1, completionOfPowerIndicatorsDtoList);
ResultsData resultsData = new ResultsData(dataGridMock, colModels);
return resultsData;
}
public void getCompletionOfPowerIndicatorsByCurrentData(List<StationCacheInfoDto> stationBasicList, String provinceName) {
String provinceNameTopic = "";
if (provinceName.contains("黑龙江") || provinceName.contains("内蒙古")) {
......@@ -320,7 +330,7 @@ public class MonitoringServiceImpl {
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("title", provinceNameTopic + "区域");
try {
emqKeeper.getMqttClient().publish("proviceName_topic", JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_proviceName_topic", JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
logger.info("----------------------------------推送省份名称消息成功败--------------------------------");
} catch (Exception e) {
logger.info("----------------------------------推送省份名称消息失败--------------------------------");
......@@ -529,7 +539,6 @@ public class MonitoringServiceImpl {
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("有功功率"));
......@@ -547,7 +556,7 @@ public class MonitoringServiceImpl {
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion2, null, ESEquipments.class);
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()));
......@@ -882,15 +891,14 @@ public class MonitoringServiceImpl {
Map<String, String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, shouldQueryCondtion);
// total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay;
if(finalIndicator.equals("日发电量")){
// total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay;
if (finalIndicator.equals("日发电量")) {
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay;
}else{
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator) * CommonConstans.pvGenPoweActor ;
} else {
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator) * CommonConstans.pvGenPoweActor;
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
......@@ -1310,13 +1318,13 @@ public class MonitoringServiceImpl {
}
stationBasicListAll.forEach(stationBasic -> {
if(stationBasic.getStationType().equals("FDZ")){
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有功功率一次值"));
}else {
} 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);
......
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