Commit 49d49c6b authored by zhangsen's avatar zhangsen

日月年电量

parent e356549e
...@@ -319,7 +319,7 @@ public class CommonServiceImpl { ...@@ -319,7 +319,7 @@ public class CommonServiceImpl {
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueF).sum(); result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
return result; return result;
} }
......
...@@ -939,69 +939,6 @@ public class MonitoringServiceImpl { ...@@ -939,69 +939,6 @@ public class MonitoringServiceImpl {
} }
} }
@Autowired
MonitoringServiceImpl monitoringServiceImpl;
/**
* 数据消息推送-30s一次
*/
@Scheduled(cron = "0/30 * * * * *")
public void getCompletionOfPowerIndicatorsByProvinceName1007() {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level", 1).eq("region_name", "江西省"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()).isNotNull("fan_gateway_id"));
int year = Calendar.getInstance().get(Calendar.YEAR);
List<Long> fdz = stationBasicList.stream().map(StationBasic::getSequenceNbr).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);
//日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例
stationBasicList.forEach(stationBasic -> {
if ("FDZ".equals(stationBasic.getStationType())) {
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);
dailyPower.updateAndGet(v -> v + monitoringServiceImpl.keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + monitoringServiceImpl.keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + monitoringServiceImpl.keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
Map<String, String> likeQuerCondtion = new HashMap<>();
likeQuerCondtion.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeQuerCondtion);
dailyPower.updateAndGet(v -> v + monitoringServiceImpl.keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量") * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
monthlyPower.updateAndGet(v -> v + monitoringServiceImpl.keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量") * CommonConstans.pvGenPoweActor));
annualPower.updateAndGet(v -> v + monitoringServiceImpl.keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor));
}
});
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, dailyPower.get()));
resultMap.put("Moon", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get()));
resultMap.put("Year", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()));
try {
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic_1007", JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------大屏日月年发电量=================== 成功!" + JSON.toJSONString(socialContributionDtoPage));
} catch (Exception exception) {
logger.error("-----------------大屏日月年发电量=================== 失败!");
}
}
public List<HashMap<String, Object>> getNationalPowerGenerationData() { public List<HashMap<String, Object>> getNationalPowerGenerationData() {
List<HashMap<String, Object>> resultHashMap = new ArrayList<>(); List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
......
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