1.修改pqbug
2.添加统计类型下监测点数量
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.event.influxdb;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.EventDetailCount;
|
||||
import com.njcn.influxdb.config.InfluxDbConfig;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
@@ -137,7 +138,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
* @param eventDetailList influxdb数据
|
||||
* @return 个数
|
||||
*/
|
||||
public static Function<List<String>, Long> countLineIndexes(List<EventDetail> eventDetailList) {
|
||||
public static Function<List<String>, Long> countLineIndexes(List<RmpEventDetailPO> eventDetailList) {
|
||||
return lineIndexes -> eventDetailList.stream().filter(t -> lineIndexes.contains(t.getLineId())).count();
|
||||
}
|
||||
|
||||
@@ -146,7 +147,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
*
|
||||
* @return 个数
|
||||
*/
|
||||
public static Function<List<EventDetail>, Long> countEventassIndexIsNoEmpty() {
|
||||
public static Function<List<RmpEventDetailPO>, Long> countEventassIndexIsNoEmpty() {
|
||||
return eventDetails -> eventDetails.stream().filter(t -> StringUtils.isNotEmpty(t.getEventassIndex())).count();
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
* @param eventDetailList influxdb数据
|
||||
* @return 数据
|
||||
*/
|
||||
public static BiFunction<DateTime, DateTime, List<EventDetail>> getBetweenTimeEventDetailList(List<EventDetail> eventDetailList) {
|
||||
public static BiFunction<DateTime, DateTime, List<RmpEventDetailPO>> getBetweenTimeEventDetailList(List<RmpEventDetailPO> eventDetailList) {
|
||||
ZoneId zone = ZoneId.systemDefault();
|
||||
return (beginTime, endTime) -> eventDetailList.stream().filter(eventDetail -> {
|
||||
Instant timeId = eventDetail.getStartTime().atZone(zone).toInstant();
|
||||
|
||||
@@ -118,6 +118,9 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
@Override
|
||||
public VoltageToleranceCurveVO getVoltageToleranceCurve(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
// 获取指定部门下的监测点集合
|
||||
if(CollUtil.isEmpty(deviceInfoParam.getScale())&&(CollUtil.isEmpty(deviceInfoParam.getLoadType()))){
|
||||
return VoltageToleranceCurveVO.empty();
|
||||
}
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
return VoltageToleranceCurveVO.empty();
|
||||
|
||||
@@ -187,7 +187,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
);
|
||||
List<EventHeatDeatilVO> eventdetailList = BeanUtil.copyToList(info, EventHeatDeatilVO.class);
|
||||
if (eventdetailList.size() > 0) {
|
||||
List<String> lineIds = eventdetailList.stream().map(EventHeatDeatilVO::getLineId).collect(Collectors.toList());
|
||||
List<String> lineIds = eventdetailList.stream().map(EventHeatDeatilVO::getLineId).distinct().collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaAnalysisVOList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
|
||||
/* for (EventHeatDeatilVO eventHeat : eventdetailList) {
|
||||
|
||||
@@ -66,7 +66,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
@Override
|
||||
public AreaStatisticalVO getAreaCalculation(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
//获取录波字典信息
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.RECORDING_WAVE.getCode()).getData();
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
|
||||
// 获取指定部门下的监测点集合
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
@@ -81,23 +81,22 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
||||
//todo 是否缺少录波
|
||||
.ne(RmpEventDetailPO::getEventType, data.getId())
|
||||
.eq(RmpEventDetailPO::getEventType, data.getId())
|
||||
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
|
||||
.le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
|
||||
);
|
||||
List<EventDetail> eventDetailList = BeanUtil.copyToList(info,EventDetail.class);
|
||||
if (CollUtil.isEmpty(eventDetailList)) {
|
||||
if (CollUtil.isEmpty(info)) {
|
||||
return AreaStatisticalVO.empty();
|
||||
}
|
||||
|
||||
AreaStatisticsVO areaStatisticsVO = statisticsAreaInfo(generalDeviceDTOList, eventDetailList);
|
||||
AreaStatisticsVO areaStatisticsVO = statisticsAreaInfo(generalDeviceDTOList, info);
|
||||
|
||||
MonthlyStatisticsVO monthCalculationVOS = statisticsMonthInfo(deviceInfoParam, eventDetailList);
|
||||
MonthlyStatisticsVO monthCalculationVOS = statisticsMonthInfo(deviceInfoParam, info);
|
||||
|
||||
|
||||
deviceInfoParam.getStatisticalType().setCode(StatisticsEnum.VOLTAGE_LEVEL.getCode());
|
||||
List<GeneralDeviceDTO> voltageLevelList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
VoltageStatisticsVO voltageStatisticsVO = statisticalVoltageLevelInfo(voltageLevelList, eventDetailList);
|
||||
VoltageStatisticsVO voltageStatisticsVO = statisticalVoltageLevelInfo(voltageLevelList, info);
|
||||
|
||||
return AreaStatisticalVO.buildVO(areaStatisticsVO, voltageStatisticsVO, monthCalculationVOS);
|
||||
}
|
||||
@@ -109,7 +108,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
* @param eventDetailList influxdb数据
|
||||
* @return 统计月份信息
|
||||
*/
|
||||
private MonthlyStatisticsVO statisticsMonthInfo(DeviceInfoParam.BusinessParam deviceInfoParam, List<EventDetail> eventDetailList) {
|
||||
private MonthlyStatisticsVO statisticsMonthInfo(DeviceInfoParam.BusinessParam deviceInfoParam, List<RmpEventDetailPO> eventDetailList) {
|
||||
List<DateTime> timeLimit = calculateTheTimePeriodRange(deviceInfoParam);
|
||||
List<DateTime> monthStartAndEnd = new ArrayList<>();
|
||||
if(deviceInfoParam.getTimeFlag()==0){
|
||||
@@ -127,7 +126,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
DateTime beginMon = monthStartAndEnd.get(i);
|
||||
DateTime endMon = monthStartAndEnd.get(i + 1);
|
||||
|
||||
List<EventDetail> eventDetails = getBetweenTimeEventDetailList(eventDetailList).apply(beginMon, endMon);
|
||||
List<RmpEventDetailPO> eventDetails = getBetweenTimeEventDetailList(eventDetailList).apply(beginMon, endMon);
|
||||
|
||||
// 时间段内总记录数
|
||||
Long count = (long) eventDetails.size();
|
||||
@@ -161,7 +160,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
* @param eventDetailList influxdb数据
|
||||
* @return 统计电压等级信息
|
||||
*/
|
||||
private VoltageStatisticsVO statisticalVoltageLevelInfo(List<GeneralDeviceDTO> generalDeviceDTOList, List<EventDetail> eventDetailList) {
|
||||
private VoltageStatisticsVO statisticalVoltageLevelInfo(List<GeneralDeviceDTO> generalDeviceDTOList, List<RmpEventDetailPO> eventDetailList) {
|
||||
List<VoltageLevelCalculationVO> voltageLevelCalculation = generalDeviceDTOList.parallelStream().map(t -> {
|
||||
VoltageLevelCalculationVO voltageLevelCalculationVO = new VoltageLevelCalculationVO();
|
||||
voltageLevelCalculationVO.setVoltageLevel(t.getName());
|
||||
@@ -184,7 +183,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
* @param eventDetailList influxdb数据
|
||||
* @return 统计区域信息
|
||||
*/
|
||||
private AreaStatisticsVO statisticsAreaInfo(List<GeneralDeviceDTO> generalDeviceDTOList, List<EventDetail> eventDetailList) {
|
||||
private AreaStatisticsVO statisticsAreaInfo(List<GeneralDeviceDTO> generalDeviceDTOList, List<RmpEventDetailPO> eventDetailList) {
|
||||
List<AreaCalculationVO> areaCalculation = generalDeviceDTOList.parallelStream().map(t -> {
|
||||
AreaCalculationVO calculationVO = new AreaCalculationVO();
|
||||
calculationVO.setAreaName(t.getName());
|
||||
|
||||
Reference in New Issue
Block a user