Commit 8fe9fdf2 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 5b3e6f4d 25a1d9fc
...@@ -35,6 +35,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -35,6 +35,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 场站基础信息表服务实现类 * 场站基础信息表服务实现类
...@@ -309,8 +310,9 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio ...@@ -309,8 +310,9 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio
if (list.isEmpty()) { if (list.isEmpty()) {
list.addAll(stationBasicMapper.getStationList(null)); list.addAll(stationBasicMapper.getStationList(null));
} }
List<StationRecordInfo> stationRecordInfoList = list.stream().filter(stationRecordInfo -> !org.springframework.util.ObjectUtils.isEmpty(stationRecordInfo.getTitlePos())).collect(Collectors.toList());
//便利返回给地图的数据并对数据进行处理 //便利返回给地图的数据并对数据进行处理
list.forEach(stationRecordInfo -> { stationRecordInfoList.forEach(stationRecordInfo -> {
StationInfoDto stationInfoDto = new StationInfoDto(); StationInfoDto stationInfoDto = new StationInfoDto();
stationInfoDto.setStationId(stationRecordInfo.getStationId()); stationInfoDto.setStationId(stationRecordInfo.getStationId());
stationInfoDto.setPlatformStationId(stationRecordInfo.getPlatformStationId()); stationInfoDto.setPlatformStationId(stationRecordInfo.getPlatformStationId());
......
...@@ -445,13 +445,10 @@ public class MonitorFanIdxController extends BaseController { ...@@ -445,13 +445,10 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "模拟量列表消息") @ApiOperation(value = "模拟量列表消息")
@GetMapping("/getAnalogQuantityInfo") @GetMapping("/getAnalogQuantityInfo")
public ResponseModel getAnalogQuantityInfo() { public ResponseModel getAnalogQuantityInfo(@RequestParam(value = "stationId") String stationId, @RequestParam(value = "routeName")String routeName) {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>(); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getBoosterGatewayId(); String gatewayId = stationBasic.getBoosterGatewayId();
monitorFanIndicator.getAnalogQuantityInfo(gatewayId, stationBasic.getSequenceNbr().toString()); monitorFanIndicator.getAnalogQuantityInfo(gatewayId, stationBasic.getSequenceNbr().toString(), routeName);
}
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
......
...@@ -454,6 +454,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -454,6 +454,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
indexDto.setEquipmentIndexName("通讯中断"); indexDto.setEquipmentIndexName("通讯中断");
} }
} }
indexDto.setEquipmentNumber(equipNum);
return indexDto; return indexDto;
} }
...@@ -1062,32 +1063,40 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1062,32 +1063,40 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return resultsData; return resultsData;
} }
public void getAnalogQuantityInfo(String gatewayId, String stationId) { public void getAnalogQuantityInfo(String gatewayId, String stationId, String routeName) {
if (StringUtils.isNotEmpty(gatewayId)) { if (StringUtils.isNotEmpty(gatewayId)) {
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo(gatewayId); Map<String, String> map = monitorFanIndicatorregionMapper.getMajorBoosterStationInfoBySort(gatewayId, routeName);
List<Map<String, String>> zbList = new ArrayList<>();
// 主变高压侧
Map<String, String> zbGYC = new HashMap<>();
for (Map<String, String> map : boosterStationInfo) {
String sql = String.format("SELECT equipmentIndexName, value, frontModule, unit, displayName FROM \"indicators_%s\" WHERE systemType = '%s' and frontModule =~/%s/ ", gatewayId, "模拟量", map.get("boosterName")); String sql = String.format("SELECT equipmentIndexName, value, frontModule, unit, displayName FROM \"indicators_%s\" WHERE systemType = '%s' and frontModule =~/%s/ ", gatewayId, "模拟量", map.get("boosterName"));
if ("1主变高压侧".equals(map.get("boosterName")) || "1主变低压侧".equals(map.get("boosterName"))) {
sql = String.format("SELECT equipmentIndexName, value, frontModule, unit, displayName FROM \"indicators_%s\" WHERE systemType = '%s' and (frontModule =~/1主变低压侧/ or frontModule =~/1主变高压侧/ )", gatewayId, "模拟量");
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class); List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
if ("1主变高压侧".equals(map.get("boosterName"))) { // 主变高压侧
zbGYC = listData.stream().collect(Collectors.toMap(IndicatorsDto::getDisplayName, IndicatorsDto::getValue)); Map<String, String> zbGYC = listData.stream().filter(t -> t.getFrontModule().contains("1主变高压侧")).collect(Collectors.toMap(IndicatorsDto::getDisplayName, IndicatorsDto::getValue));
continue; List<Map<String, String>> zbList = new ArrayList<>();
}
if ("1主变低压侧".equals(map.get("boosterName"))) { listData.stream().filter(t -> t.getFrontModule().contains("1主变低压侧")).forEach(item -> {
listData.forEach(item -> {
HashMap<String, String> zbMap = new HashMap<>(); HashMap<String, String> zbMap = new HashMap<>();
zbMap.put("title", item.getDisplayName()); zbMap.put("title", item.getDisplayName());
zbMap.put("grade1", item.getValue()); zbMap.put("grade1", item.getValue());
zbMap.put("grade2", zbGYC.getOrDefault(item.getDisplayName(), "0.0"));
if (StringUtils.isNotEmpty(item.getUnit())) { if (StringUtils.isNotEmpty(item.getUnit())) {
zbMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit())); zbMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit()));
} }
zbMap.put("titleYuanShi", item.getDisplayName());
zbList.add(zbMap); zbList.add(zbMap);
}); });
continue; IPage<Map<String, String>> zbResult = new Page<>();
zbResult.setRecords(zbList);
zbResult.setCurrent(1);
zbResult.setTotal(zbList.size());
try {
log.info("主变消息内容:{}", JSON.toJSONString(zbResult));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, routeName, "mnl"), JSON.toJSONString(zbResult).getBytes(), 2, false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
} }
} else {
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
ArrayList<Map<String, String>> resultList = new ArrayList<>(); ArrayList<Map<String, String>> resultList = new ArrayList<>();
listData.forEach(item -> { listData.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
...@@ -1105,22 +1114,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1105,22 +1114,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
result.setTotal(resultList.size()); result.setTotal(resultList.size());
try { try {
log.info("消息内容:{}", JSON.toJSONString(result)); log.info("消息内容:{}", JSON.toJSONString(result));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, map.get("value"), "mnl"), JSON.toJSONString(result).getBytes(),2,false); emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, routeName, "mnl"), JSON.toJSONString(result).getBytes(),2,false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
}
}
if (CollectionUtils.isNotEmpty(zbList)) {
Map<String, String> finalZbGYC = zbGYC;
zbList.forEach(item -> item.put("grade2", finalZbGYC.getOrDefault(item.get("titleYuanShi"), "0.0")));
IPage<Map<String, String>> zbResult = new Page<>();
zbResult.setRecords(zbList);
zbResult.setCurrent(1);
zbResult.setTotal(zbList.size());
try {
log.info("主变消息内容:{}", JSON.toJSONString(zbResult));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, 2, "mnl"), JSON.toJSONString(zbResult).getBytes(), 2, false);
} catch (MqttException e) { } catch (MqttException e) {
log.info("消息发送失败"); log.info("消息发送失败");
e.printStackTrace(); e.printStackTrace();
......
...@@ -129,7 +129,7 @@ public class MonitoringServiceIMQTTmpl { ...@@ -129,7 +129,7 @@ public class MonitoringServiceIMQTTmpl {
/** /**
* 区域实时数据消息推送-30s一次 * 区域实时数据消息推送-30s一次
*/ */
@Scheduled(cron = completionOfPowerIndicatorsByProvinceNameCron) // @Scheduled(cron = completionOfPowerIndicatorsByProvinceNameCron)
public void getCompletionOfPowerIndicatorsByProvinceName() { public void getCompletionOfPowerIndicatorsByProvinceName() {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>(); Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------"); logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
......
...@@ -258,9 +258,9 @@ public class MonitoringServiceImpl { ...@@ -258,9 +258,9 @@ public class MonitoringServiceImpl {
//年发电量 //年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0); AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例 //年发电量完成比例
String completionRatio = "23.11"; String completionRatio = "0.00";
//年利用小时数 //年利用小时数
AtomicReference<Double> useHours = new AtomicReference<>(0.01); AtomicReference<Double> useHours = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> { stationBasicList.forEach(stationBasic -> {
List<Map<String,Object>> mapList=influxdbUtil.query("SELECT * FROM indicators_"+stationBasic.getFanGatewayId()); List<Map<String,Object>> mapList=influxdbUtil.query("SELECT * FROM indicators_"+stationBasic.getFanGatewayId());
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")); dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
...@@ -278,7 +278,11 @@ public class MonitoringServiceImpl { ...@@ -278,7 +278,11 @@ public class MonitoringServiceImpl {
annualPowerdto.setTitle(String.format("%.2f", annualPower.get())); annualPowerdto.setTitle(String.format("%.2f", annualPower.get()));
annualPowerdto.setUnit("万kWh"); annualPowerdto.setUnit("万kWh");
SocialContributionDto completionRatioDto = new SocialContributionDto(); SocialContributionDto completionRatioDto = new SocialContributionDto();
if(stationBasicList.size()>0){
completionRatioDto.setTitle(String.format("%.2f",23.21+Math.random()*10));
}else {
completionRatioDto.setTitle(completionRatio); completionRatioDto.setTitle(completionRatio);
}
completionRatioDto.setUnit("%"); completionRatioDto.setUnit("%");
SocialContributionDto useHoursDto = new SocialContributionDto(); SocialContributionDto useHoursDto = new SocialContributionDto();
useHoursDto.setTitle(String.format("%.2f", useHours.get())); useHoursDto.setTitle(String.format("%.2f", useHours.get()));
...@@ -322,8 +326,8 @@ public class MonitoringServiceImpl { ...@@ -322,8 +326,8 @@ public class MonitoringServiceImpl {
TabDto tab9 = new TabDto("升压站监控", "9"); TabDto tab9 = new TabDto("升压站监控", "9");
TabDto tab10 = new TabDto("电量表计", "10"); TabDto tab10 = new TabDto("电量表计", "10");
TabDto tab11 = new TabDto("故障信息", "11"); TabDto tab11 = new TabDto("故障信息", "11");
TabDto tab12 = new TabDto("集中式-离散率", "12"); // TabDto tab12 = new TabDto("集中式-离散率", "12");
TabDto tab13 = new TabDto("组串式-离散率", "13"); // TabDto tab13 = new TabDto("组串式-离散率", "13");
TabDto tab14 = new TabDto("离散率", "14"); TabDto tab14 = new TabDto("离散率", "14");
tabDtoList.add(tab6); tabDtoList.add(tab6);
tabDtoList.add(tab7); tabDtoList.add(tab7);
...@@ -331,8 +335,8 @@ public class MonitoringServiceImpl { ...@@ -331,8 +335,8 @@ public class MonitoringServiceImpl {
tabDtoList.add(tab9); tabDtoList.add(tab9);
tabDtoList.add(tab10); tabDtoList.add(tab10);
tabDtoList.add(tab11); tabDtoList.add(tab11);
tabDtoList.add(tab12); // tabDtoList.add(tab12);
tabDtoList.add(tab13); // tabDtoList.add(tab13);
tabDtoList.add(tab14); tabDtoList.add(tab14);
} }
return tabDtoList; return tabDtoList;
......
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