Commit c7aa0810 authored by caotao's avatar caotao

修改发电完成率

parent 0916e647
......@@ -40,7 +40,6 @@ import java.util.stream.Collectors;
@Async
@Service
public class MonitoringServiceIMQTTmpl {
Logger logger = LoggerFactory.getLogger(MonitoringServiceIMQTTmpl.class);
//社会贡献Cron表达式
private final String totalSocialContributionCron = "0 0/1 * * * *";
//区域完成情况 Cron表达式
......@@ -55,9 +54,7 @@ public class MonitoringServiceIMQTTmpl {
private final String fanStatusListCron = "0/30 * * * * *";
//风机实时数据Cron表达式
private final String fanCurrentDataCron = "0 0/1 * * * *";
@Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix;
Logger logger = LoggerFactory.getLogger(MonitoringServiceIMQTTmpl.class);
@Autowired
StationPlanMapper stationPlanMapper;
/**
......@@ -65,7 +62,6 @@ public class MonitoringServiceIMQTTmpl {
*/
@Autowired
StationBasicMapper stationBasicMapper;
@Autowired
CommonServiceImpl commonServiceImpl;
@Autowired
......@@ -74,13 +70,14 @@ public class MonitoringServiceIMQTTmpl {
EmqKeeper emqKeeper;
@Autowired
MonitorFanIndicatorImpl monitorFanIndicator;
@Autowired
CommonServiceImpl commonService;
@Autowired
InfluxDButils influxDButils;
@Autowired
MonitoringServiceImpl monitoringServiceImpl;
@Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix;
@Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
......@@ -99,16 +96,16 @@ public class MonitoringServiceIMQTTmpl {
stationBasicList.forEach(stationBasic -> {
if ("FDZ".equals(stationBasic.getStationType())) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList( "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
totalSocialContribution.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "年发电量"));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList( "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
Map<String, String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class,shouldQueryCondtion);
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, shouldQueryCondtion);
totalSocialContribution.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor);
}
});
......@@ -124,7 +121,7 @@ public class MonitoringServiceIMQTTmpl {
/**
* 区域实时数据消息推送-30s一次
*/
// @Scheduled(cron = completionOfPowerIndicatorsByProvinceNameCron)
@Scheduled(cron = completionOfPowerIndicatorsByProvinceNameCron)
public void getCompletionOfPowerIndicatorsByProvinceName() {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
......@@ -134,8 +131,8 @@ public class MonitoringServiceIMQTTmpl {
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);
queryWrapper.eq(StationPlan::getYear, String.valueOf(year));
queryWrapper.in(StationPlan::getStationBasicId, fdz);
List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
double value = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
......@@ -153,23 +150,22 @@ public class MonitoringServiceIMQTTmpl {
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, "月发电量")));
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.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));
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));
}
});
String completionRatio = String.format("%.2f",annualPower.get() / value);
String completionRatio = String.format("%.2f", (annualPower.get() * 100) / value);
SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(String.format(CommonConstans.Fourdecimalplaces, dailyPower.get()));
dailyPowerdto.setUnit("万kWh");
......@@ -329,7 +325,6 @@ public class MonitoringServiceIMQTTmpl {
// }
// });
// }
@Scheduled(cron = fanCurrentDataCron)
public void getFanCurrentData() {
Integer current = 1;
......
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