diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetailNew.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetailNew.java index a88310bff..3c20a7693 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetailNew.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetailNew.java @@ -26,7 +26,7 @@ public class EventDetailNew { private String eventDescribe; @Column(name = "wave_type") - private Integer waveType; + private String waveType; @Column(name = "persist_time") private Double persistTime; diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/RmpEventDetailPO.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/RmpEventDetailPO.java index 7461b39c8..75d7e330f 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/RmpEventDetailPO.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/RmpEventDetailPO.java @@ -1,10 +1,20 @@ package com.njcn.event.pojo.po; +import cn.hutool.core.date.DateTime; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; +import org.influxdb.annotation.Column; import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.Date; /** @@ -14,57 +24,90 @@ import java.util.Date; * @since 2022-10-12 18:34:55 */ @Data +@EqualsAndHashCode(callSuper = false) +@TableName("r_mp_event_detail") +@ApiModel(value="RmpEventDetail对象", description="") public class RmpEventDetailPO implements Serializable { private static final long serialVersionUID = 1L; - /** - * 暂时事件ID - */ - @ApiModelProperty(name = "eventId",value = "暂时事件ID") + + @ApiModelProperty(value = "暂时事件ID") + @TableId(value = "event_id", type = IdType.ASSIGN_ID) private String eventId; - /** - * 监测点ID - */ - @ApiModelProperty(name = "measurementPointId",value = "监测点ID") + + @ApiModelProperty(value = "监测点ID") private String measurementPointId; - /** - * 事件类型 - */ - @ApiModelProperty(name = "eventType",value = "事件类型") + @ApiModelProperty(value = "事件类型") private String eventType; - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime",value = "开始时间") + + @ApiModelProperty(value = "暂降原因(字典表PQS_Dicdata)") + @TableField("Event_Reason") + private String eventReason; + + @ApiModelProperty(value = "事件关联分析表Guid") + private String eventassIndex; + + @ApiModelProperty(value = "dq计算持续时间 ") + private Double dqTime; + + @ApiModelProperty(value = "特征值计算更新时间(外键PQS_Relevance的Time字段)") + private LocalDateTime dealTime; + + @ApiModelProperty(value = "默认事件个数为0") + private Integer num; + + @ApiModelProperty(value = "波形文件是否从装置招到本地(0:未招,1:已招)默认值为0") + private Integer fileFlag; + + @ApiModelProperty(value = "特征值计算标志(0,未处理;1,已处理; 2,已处理,无结果;3,计算失败)默认值为0") + private Integer dealFlag; + + @ApiModelProperty(value = "处理结果第一条事件发生时间(读comtra文件获取)") + private LocalDateTime firstTime; + + @ApiModelProperty(value = "处理结果第一条事件暂降类型(字典表PQS_Dicdata)") + private String firstType; + + @ApiModelProperty(value = "处理结果第一条事件发生时间毫秒(读comtra文件获取)") + private Double firstMs; + + @ApiModelProperty(value = "暂降能量") + private Double energy; + + @ApiModelProperty(value = "暂降严重度") + private Double severity; + + @ApiModelProperty(value = "暂降源与监测位置关系 Upper:上游;Lower :下游;Unknown :未知;为空则是未计算") + private String sagsource; + + @ApiModelProperty(value = "开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS",timezone = "GMT+8") private Date startTime; - /** - * 持续时间 - */ - @ApiModelProperty(name = "duration",value = "持续时间") + + @ApiModelProperty(value = "持续时间,单位秒") private Double duration; - /** - * 特征幅值 - */ - @ApiModelProperty(name = "featureAmplitude",value = "特征幅值") + + @ApiModelProperty(value = "特征幅值") private Double featureAmplitude; - /** - * 相别 - */ - @ApiModelProperty(name = "phase",value = "相别") + + @ApiModelProperty(value = "相别") private String phase; - /** - * 事件描述 - */ - @ApiModelProperty(name = "eventDescribe",value = "事件描述") + @ApiModelProperty(value = "事件描述") private String eventDescribe; - /** - * 波形路径 - */ - @ApiModelProperty(name = "wavePath",value = "波形路径") + @ApiModelProperty(value = "波形路径") private String wavePath; + @ApiModelProperty(value = "波形名称") + @TableField("wave_path") + private String waveName; + + private String phasicType; + + private Double transientValue; + + + } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/EventDetailMapper.java b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/EventDetailMapper.java new file mode 100644 index 000000000..c3d75d57e --- /dev/null +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/EventDetailMapper.java @@ -0,0 +1,16 @@ +package com.njcn.event.mapper.majornetwork; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.event.pojo.po.RmpEventDetailPO; + +/** + *

+ * Mapper 接口 + *

+ * + * @author wr + * @since 2023-03-27 + */ +public interface EventDetailMapper extends BaseMapper { + +} diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/EventDetailMapper.xml b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/EventDetailMapper.xml new file mode 100644 index 000000000..b8f4db2b8 --- /dev/null +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/EventDetailMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java index a54cbf4b9..ae92597e3 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java @@ -1,6 +1,9 @@ package com.njcn.event.service.majornetwork; +import com.baomidou.mybatisplus.extension.service.IService; import com.njcn.event.pojo.po.EventDetail; +import com.njcn.event.pojo.po.RStatEventOrgM; +import com.njcn.event.pojo.po.RmpEventDetailPO; import java.util.List; @@ -9,7 +12,7 @@ import java.util.List; * @version 1.0.0 * @date 2022年04月07日 09:39 */ -public interface EventDetailService { +public interface EventDetailService extends IService { /** * 根据监测点id获取暂降事件 * diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaInfoServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaInfoServiceImpl.java index a046ee041..2a8243de4 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaInfoServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaInfoServiceImpl.java @@ -1,6 +1,10 @@ package com.njcn.event.service.majornetwork.Impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.njcn.device.pms.pojo.po.RStatAreaAlarmCountM; import com.njcn.device.pq.api.GeneralDeviceInfoClient; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.api.TerminalBaseClient; @@ -10,20 +14,24 @@ import com.njcn.device.pq.pojo.vo.AreaLineInfoVO; import com.njcn.device.pq.pojo.vo.TerminalBaseVO; import com.njcn.event.pojo.constant.Param; import com.njcn.event.pojo.po.EventDetailNew; +import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.vo.AreaSubLineVO; import com.njcn.event.service.majornetwork.AreaInfoService; +import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.influxdb.mapper.InfluxDBResultMapperCn; import com.njcn.influxdb.param.InfluxDBPublicParam; import com.njcn.influxdb.utils.InfluxDBCommUtils; import com.njcn.influxdb.utils.InfluxDbUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; import org.influxdb.dto.QueryResult; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -45,7 +53,7 @@ public class AreaInfoServiceImpl implements AreaInfoService { private final LineFeignClient lineFeignClient; private final TerminalBaseClient terminalBaseClient; - + private final EventDetailService eventDetailService; @Override public List getAreaLineInfo(DeviceInfoParam.BusinessParam deviceInfoParam) { @@ -55,32 +63,60 @@ public class AreaInfoServiceImpl implements AreaInfoService { if (CollectionUtil.isNotEmpty(lineIds)) { List resList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData(); + //查询监测点未处理暂态事件 - StringBuilder lineIdsStr = InfluxDBCommUtils.assToInfluxParam(lineIds); + List eventDetails = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .ge(StringUtils.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) + .le(StringUtils.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) + ); + //根据监测点分组统计数量 + Map count = eventDetails.stream().collect(Collectors.groupingBy(RmpEventDetailPO::getMeasurementPointId, Collectors.counting())); - String stringResult = "SELECT count(eventass_index) FROM " + Param.EVENT_DETAIL + Param.WHERE + "time >= '" + deviceInfoParam.getSearchBeginTime() + InfluxDBPublicParam.START_TIME + "' and " + "time <= '" + deviceInfoParam.getSearchEndTime() + InfluxDBPublicParam.END_TIME + "' and " + lineIdsStr + " and eventass_index = '' group by line_id" + InfluxDBPublicParam.TIME_ZONE; - // 结果集 - QueryResult result = influxDbUtils.query(stringResult); - if (!result.hasError()) { - List list = result.getResults().get(0).getSeries(); - - for (AreaLineInfoVO areaLineInfoVO : resList) { - boolean flag = false; - if(CollectionUtil.isNotEmpty(list)) { - for (QueryResult.Series tem : list) { - String lineId = tem.getTags().get("line_id"); - if (areaLineInfoVO.getLineId().equals(lineId)) { - areaLineInfoVO.setNoDealCount(Double.valueOf(tem.getValues().get(0).get(1).toString()).intValue()); - flag = true; - break; - } + for (AreaLineInfoVO areaLineInfoVO : resList) { + boolean flag = false; + if(CollectionUtil.isNotEmpty(count)) { + for (String s : count.keySet()) { + if (count.containsKey(areaLineInfoVO.getLineId())) { + Long aLong = count.get(s); + areaLineInfoVO.setNoDealCount(Math.toIntExact(aLong)); + flag = true; + break; } } - if (!flag) { - areaLineInfoVO.setNoDealCount(0); - } + + } + if (!flag) { + areaLineInfoVO.setNoDealCount(0); } } + + //查询监测点未处理暂态事件 +// StringBuilder lineIdsStr = InfluxDBCommUtils.assToInfluxParam(lineIds); +// +// String stringResult = "SELECT count(eventass_index) FROM " + Param.EVENT_DETAIL + Param.WHERE + "time >= '" + deviceInfoParam.getSearchBeginTime() + InfluxDBPublicParam.START_TIME + "' and " + "time <= '" + deviceInfoParam.getSearchEndTime() + InfluxDBPublicParam.END_TIME + "' and " + lineIdsStr + " and eventass_index = '' group by line_id" + InfluxDBPublicParam.TIME_ZONE; +// // 结果集 +// QueryResult result = influxDbUtils.query(stringResult); +// if (!result.hasError()) { +// List list = result.getResults().get(0).getSeries(); +// +// for (AreaLineInfoVO areaLineInfoVO : resList) { +// boolean flag = false; +// if(CollectionUtil.isNotEmpty(list)) { +// for (QueryResult.Series tem : list) { +// String lineId = tem.getTags().get("line_id"); +// if (areaLineInfoVO.getLineId().equals(lineId)) { +// areaLineInfoVO.setNoDealCount(Double.valueOf(tem.getValues().get(0).get(1).toString()).intValue()); +// flag = true; +// break; +// } +// } +// } +// if (!flag) { +// areaLineInfoVO.setNoDealCount(0); +// } +// } +// } //组装成变电站 if (CollectionUtil.isNotEmpty(resList)) { Map> map = resList.stream().collect(Collectors.groupingBy(AreaLineInfoVO::getSubId)); @@ -117,50 +153,99 @@ public class AreaInfoServiceImpl implements AreaInfoService { if (CollectionUtil.isNotEmpty(lineIds)) { List lineList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData(); - //查询监测点未处理暂态事件 - StringBuilder lineIdsStr = InfluxDBCommUtils.assToInfluxParam(lineIds); + Map lineMap = lineList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity(), (key1, kye2) -> key1)); - String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + lineIdsStr + "and eventass_index = '' order by time desc limit 100" + InfluxDBPublicParam.TIME_ZONE; - // 结果集 - QueryResult result = influxDbUtils.query(stringResult); - // 结果集映射到对象中 - InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); - resList = influxDBResultMapper.toPOJO(result, EventDetailNew.class); - //对未处理暂降事件的监测点替换成中文名称 - if (CollectionUtil.isNotEmpty(resList)) { - for (EventDetailNew eventDetail : resList) { - for (AreaLineInfoVO tem : lineList) { - if (eventDetail.getLineId().equals(tem.getLineId())) { - eventDetail.setLineName(tem.getLineName()); - eventDetail.setLng(tem.getLng()); - eventDetail.setLat(tem.getLat()); - break; - } - } + //查询监测点未处理暂态事件 + List eventDetails = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds)); + EventDetailNew eventDetailNew; + for (RmpEventDetailPO eventDetail : eventDetails) { + eventDetailNew= BeanUtil.copyProperties(eventDetail,EventDetailNew.class); + //监测点id + eventDetailNew.setLineId(eventDetail.getMeasurementPointId()); + //持续时间 + eventDetailNew.setPersistTime(eventDetail.getDuration()); + //特征幅值 + eventDetailNew.setEventValue(eventDetail.getFeatureAmplitude()); + if(lineMap.containsKey(eventDetail.getMeasurementPointId())){ + AreaLineInfoVO areaLineInfoVO = lineMap.get(eventDetail.getMeasurementPointId()); + eventDetailNew.setLineName(areaLineInfoVO.getLineName()); + eventDetailNew.setLng(areaLineInfoVO.getLng()); + eventDetailNew.setLat(areaLineInfoVO.getLat()); + resList.add(eventDetailNew); } } + + +// //查询监测点未处理暂态事件 +// StringBuilder lineIdsStr = InfluxDBCommUtils.assToInfluxParam(lineIds); +// +// String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + lineIdsStr + "and eventass_index = '' order by time desc limit 100" + InfluxDBPublicParam.TIME_ZONE; +// // 结果集 +// QueryResult result = influxDbUtils.query(stringResult); +// // 结果集映射到对象中 +// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); +// resList = influxDBResultMapper.toPOJO(result, EventDetailNew.class); +// //对未处理暂降事件的监测点替换成中文名称 +// if (CollectionUtil.isNotEmpty(resList)) { +// for (EventDetailNew eventDetail : resList) { +// for (AreaLineInfoVO tem : lineList) { +// if (eventDetail.getLineId().equals(tem.getLineId())) { +// eventDetail.setLineName(tem.getLineName()); +// eventDetail.setLng(tem.getLng()); +// eventDetail.setLat(tem.getLat()); +// break; +// } +// } +// } +// } } return resList; } @Override public List getNoDealEventsByLineId(String id) { - - String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + "line_id = '"+id+"' and eventass_index = '' order by time desc limit 100" + InfluxDBPublicParam.TIME_ZONE; - // 结果集 - QueryResult result = influxDbUtils.query(stringResult); - // 结果集映射到对象中 - InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); - List resList = influxDBResultMapper.toPOJO(result, EventDetailNew.class); - List lineList = lineFeignClient.getBaseLineAreaInfo(Stream.of(id).collect(Collectors.toList())).getData(); - if(CollectionUtil.isNotEmpty(lineList)){ - resList = resList.stream().peek(item->{ - item.setGdName(lineList.get(0).getGdName()); - item.setSubName(lineList.get(0).getSubName()); - item.setLineName(lineList.get(0).getLineName()); - }).collect(Collectors.toList()); + + List resList = new ArrayList<>(); + //查询监测点未处理暂态事件 + List eventDetails = eventDetailService.list(new LambdaQueryWrapper() + .eq(RmpEventDetailPO::getMeasurementPointId, id)); + EventDetailNew eventDetailNew; + for (RmpEventDetailPO eventDetail : eventDetails) { + eventDetailNew= BeanUtil.copyProperties(eventDetail,EventDetailNew.class); + //监测点id + eventDetailNew.setLineId(eventDetail.getMeasurementPointId()); + //持续时间 + eventDetailNew.setPersistTime(eventDetail.getDuration()); + //特征幅值 + eventDetailNew.setEventValue(eventDetail.getFeatureAmplitude()); + if(CollectionUtil.isNotEmpty(lineList)){ + resList = resList.stream().peek(item->{ + item.setGdName(lineList.get(0).getGdName()); + item.setSubName(lineList.get(0).getSubName()); + item.setLineName(lineList.get(0).getLineName()); + }).collect(Collectors.toList()); + resList.add(eventDetailNew); + } } + +// String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + "line_id = '"+id+"' and eventass_index = '' order by time desc limit 100" + InfluxDBPublicParam.TIME_ZONE; +// // 结果集 +// QueryResult result = influxDbUtils.query(stringResult); +// // 结果集映射到对象中 +// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); +// List resList = influxDBResultMapper.toPOJO(result, EventDetailNew.class); + +// List lineList = lineFeignClient.getBaseLineAreaInfo(Stream.of(id).collect(Collectors.toList())).getData(); + +// if(CollectionUtil.isNotEmpty(lineList)){ +// resList = resList.stream().peek(item->{ +// item.setGdName(lineList.get(0).getGdName()); +// item.setSubName(lineList.get(0).getSubName()); +// item.setLineName(lineList.get(0).getLineName()); +// }).collect(Collectors.toList()); +// } return resList; } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java index 66307b25b..01b834875 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java @@ -1,7 +1,9 @@ package com.njcn.event.service.majornetwork.Impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.common.config.GeneralInfo; import com.njcn.common.pojo.exception.BusinessException; @@ -16,14 +18,17 @@ import com.njcn.event.pojo.dto.wave.WaveDataDTO; import com.njcn.event.pojo.param.*; import com.njcn.event.pojo.po.EventDetail; import com.njcn.event.pojo.po.EventDetailNew; +import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.vo.*; import com.njcn.event.service.majornetwork.EventAnalysisService; import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.pojo.po.DictData; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang.StringUtils; import org.influxdb.dto.QueryResult; import org.influxdb.impl.InfluxDBResultMapper; import org.springframework.stereotype.Service; @@ -35,6 +40,7 @@ import java.text.ParseException; import java.time.LocalDate; import java.time.temporal.ChronoUnit; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -59,6 +65,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { private final DicDataFeignClient dicDataFeignClient; + @Override public Page getEventAnalyse(EventBaseParam eventBaseParam) { @@ -138,10 +145,17 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { */ @Override public List getCoords(StatisticsParam statisticsParam) { - QueryResult query = MonitorQuery(statisticsParam); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); List result = new ArrayList<>(); - List info = influxDBResultMapper.toPOJO(query, EventDetail.class); +// QueryResult query = MonitorQuery(statisticsParam); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List info = influxDBResultMapper.toPOJO(query, EventDetail.class); + + //查询监测点未处理暂态事件 + List info = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) + .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) + ); for (int i = 0; i < 10; i++) { for (int j = 0; j < 9; j++) { @@ -151,204 +165,204 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { for (int i = 0; i < info.size(); i++) { Integer index = null; CoordsVO dto = new CoordsVO(); - if (info.get(i).getEventValue() >= 0 && info.get(i).getEventValue() <= 0.1) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + if (info.get(i).getFeatureAmplitude() >= 0 && info.get(i).getFeatureAmplitude() <= 0.1) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 0; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 1; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 2; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 3; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 4; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 5; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 6; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 7; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 8; } - } else if (info.get(i).getEventValue() > 0.1 && info.get(i).getEventValue() <= 0.2) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + } else if (info.get(i).getFeatureAmplitude() > 0.1 && info.get(i).getFeatureAmplitude() <= 0.2) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 9; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 10; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 11; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 12; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 13; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 14; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 15; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 16; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 17; } - } else if (info.get(i).getEventValue() > 0.2 && info.get(i).getEventValue() <= 0.3) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + } else if (info.get(i).getFeatureAmplitude() > 0.2 && info.get(i).getFeatureAmplitude() <= 0.3) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 18; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 19; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 20; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 21; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 22; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 23; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 24; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 25; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 26; } - } else if (info.get(i).getEventValue() > 0.3 && info.get(i).getEventValue() <= 0.4) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + } else if (info.get(i).getFeatureAmplitude() > 0.3 && info.get(i).getFeatureAmplitude() <= 0.4) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 27; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 28; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 29; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 30; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 31; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 32; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 33; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 34; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 35; } - } else if (info.get(i).getEventValue() > 0.4 && info.get(i).getEventValue() <= 0.5) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + } else if (info.get(i).getFeatureAmplitude() > 0.4 && info.get(i).getFeatureAmplitude() <= 0.5) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 36; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 37; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 38; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 39; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 40; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 41; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 42; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 43; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 44; } - } else if (info.get(i).getEventValue() > 0.5 && info.get(i).getEventValue() <= 0.6) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + } else if (info.get(i).getFeatureAmplitude() > 0.5 && info.get(i).getFeatureAmplitude() <= 0.6) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 45; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 46; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 47; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 48; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 49; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 50; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 51; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 52; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 53; } - } else if (info.get(i).getEventValue() > 0.6 && info.get(i).getEventValue() <= 0.7) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + } else if (info.get(i).getFeatureAmplitude() > 0.6 && info.get(i).getFeatureAmplitude() <= 0.7) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 54; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 55; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 56; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 57; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 58; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 59; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 60; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 61; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 62; } - } else if (info.get(i).getEventValue() > 0.7 && info.get(i).getEventValue() <= 0.8) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + } else if (info.get(i).getFeatureAmplitude() > 0.7 && info.get(i).getFeatureAmplitude() <= 0.8) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 63; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 64; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 65; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 66; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 67; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 68; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 69; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 70; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 71; } - } else if (info.get(i).getEventValue() > 0.8 && info.get(i).getEventValue() <= 0.9) { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + } else if (info.get(i).getFeatureAmplitude() > 0.8 && info.get(i).getFeatureAmplitude() <= 0.9) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 72; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 73; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 74; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 75; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 76; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 77; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 78; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 79; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 80; } } else { - if (info.get(i).getPersistTime()/1000 > 0 && info.get(i).getPersistTime()/1000 <= 0.020) { + if (info.get(i).getDuration()/1000 > 0 && info.get(i).getDuration()/1000 <= 0.020) { index = 81; - } else if (info.get(i).getPersistTime()/1000 <= 0.040 && info.get(i).getPersistTime()/1000 > 0.020) { + } else if (info.get(i).getDuration()/1000 <= 0.040 && info.get(i).getDuration()/1000 > 0.020) { index = 82; - } else if (info.get(i).getPersistTime()/1000 <= 0.060 && info.get(i).getPersistTime()/1000 > 0.040) { + } else if (info.get(i).getDuration()/1000 <= 0.060 && info.get(i).getDuration()/1000 > 0.040) { index = 83; - } else if (info.get(i).getPersistTime()/1000 <= 0.080 && info.get(i).getPersistTime()/1000 > 0.060) { + } else if (info.get(i).getDuration()/1000 <= 0.080 && info.get(i).getDuration()/1000 > 0.060) { index = 84; - } else if (info.get(i).getPersistTime()/1000 <= 0.120 && info.get(i).getPersistTime()/1000 > 0.080) { + } else if (info.get(i).getDuration()/1000 <= 0.120 && info.get(i).getDuration()/1000 > 0.080) { index = 85; - } else if (info.get(i).getPersistTime()/1000 > 0.120 && info.get(i).getPersistTime()/1000 < 0.200) { + } else if (info.get(i).getDuration()/1000 > 0.120 && info.get(i).getDuration()/1000 < 0.200) { index = 86; - } else if (info.get(i).getPersistTime()/1000 >= 0.200 && info.get(i).getPersistTime()/1000 < 0.400) { + } else if (info.get(i).getDuration()/1000 >= 0.200 && info.get(i).getDuration()/1000 < 0.400) { index = 87; - } else if (info.get(i).getPersistTime()/1000 >= 0.400 && info.get(i).getPersistTime()/1000 < 0.600) { + } else if (info.get(i).getDuration()/1000 >= 0.400 && info.get(i).getDuration()/1000 < 0.600) { index = 88; - } else if (info.get(i).getPersistTime()/1000 >= 0.600 && info.get(i).getPersistTime()/1000 <= 1.200) { + } else if (info.get(i).getDuration()/1000 >= 0.600 && info.get(i).getDuration()/1000 <= 1.200) { index = 89; } } @@ -479,10 +493,17 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { @Override public List IEC411(StatisticsParam statisticsParam) { List result = new ArrayList<>(); - List info = new ArrayList<>(); - QueryResult query = MonitorQuery(statisticsParam); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - info = influxDBResultMapper.toPOJO(query, EventDetail.class); +// List info = new ArrayList<>(); +// QueryResult query = MonitorQuery(statisticsParam); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// info = influxDBResultMapper.toPOJO(query, EventDetail.class); + + //查询监测点未处理暂态事件 + List info = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) + .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) + ); int[][] arr = new int[3][6]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 6; j++) { @@ -490,8 +511,8 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { } } for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getEventValue(); - double persisttime = info.get(i).getPersistTime(); + Double eventvalue = info.get(i).getFeatureAmplitude(); + double persisttime = info.get(i).getDuration(); if (eventvalue * 100 < 1) { if (persisttime < 20 && persisttime >= 10) { arr[2][0]++; @@ -894,6 +915,8 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { */ @Override public List getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException { + //获取暂降字典信息 + DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); List list = new ArrayList<>(); //参数 StringBuilder builder1 = new StringBuilder(); @@ -918,10 +941,16 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { } else { builder2.append(startYear).append("-").append(startMonth + 1).append("-").append(startDays); } - query = MonitorQuery(new StatisticsParam(statisticsParam.getLineIndex(),builder1.toString(), builder2.toString(), statisticsParam.getFlag())); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(query, EventDetail.class); - long count = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); +// query = MonitorQuery(new StatisticsParam(statisticsParam.getLineIndex(),builder1.toString(), builder2.toString(), statisticsParam.getFlag())); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List eventDetailList = influxDBResultMapper.toPOJO(query, EventDetail.class); +// long count = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); + List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() + .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) + .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) + ); + long count = eventDetailList.stream().filter(x -> data.getId().equals(x.getEventType())).count(); if (startMonth < 10) { list.add(new TimeVO(null, null,"", "0" + startMonth.toString(), count+"", startYear.toString(), startYear.toString()+"-"+"0"+startMonth.toString())); } else { @@ -937,10 +966,16 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { builder2.delete(0, builder2.length()); builder1.append(startYear).append("-").append(startMonth).append("-").append(startDays); builder2.append(startYear).append("-").append(startMonth).append("-").append(endDays); - query = MonitorQuery(new StatisticsParam(statisticsParam.getLineIndex(),builder1.toString(), builder2.toString(), statisticsParam.getFlag())); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(query, EventDetail.class); - long count1 = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); +// query = MonitorQuery(new StatisticsParam(statisticsParam.getLineIndex(),builder1.toString(), builder2.toString(), statisticsParam.getFlag())); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List eventDetailList = influxDBResultMapper.toPOJO(query, EventDetail.class); +// long count1 = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); + List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() + .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) + .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) + ); + long count1 = eventDetailList.stream().filter(x -> data.getId().equals(x.getEventType())).count(); if (startMonth < 10) { list.add(new TimeVO(null, null,"", "0" + startMonth.toString(), count1+"", startYear.toString(), startYear.toString()+"-"+"0"+startMonth.toString())); } else { @@ -949,18 +984,27 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { return list; } else { - QueryResult monitorQuery = MonitorQuery(statisticsParam); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(monitorQuery, EventDetailNew.class); +// QueryResult monitorQuery = MonitorQuery(statisticsParam); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List eventDetailList = influxDBResultMapper.toPOJO(monitorQuery, EventDetailNew.class); +// Map> map = eventDetailList.stream().filter(x -> data.getId().equals(x.getEventType())).collect(Collectors.groupingBy(s -> s.getTimeId().substring(0, 10))); - Map> map = eventDetailList.stream().filter(x -> x.getWaveType()==1).collect(Collectors.groupingBy(s -> s.getTimeId().substring(0, 10))); + List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() + .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) + .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) + ); + + Map> map = eventDetailList.stream().filter(x -> data.getId().equals(x.getEventType())) + .collect(Collectors.groupingBy(s -> DateUtil.format(s.getStartTime(), "yyyy-MM-dd"))); Set keySet = map.keySet(); LocalDate parse1 = LocalDate.parse(startTime); LocalDate parse2 = LocalDate.parse(endTime); while (!parse1.equals(parse2.plus(1, ChronoUnit.DAYS))){ if (keySet.contains(parse1.toString())){ - List eventDetailNews = map.get(parse1.toString()); +// List eventDetailNews = map.get(parse1.toString()); + List eventDetailNews = map.get(parse1.toString()); TimeVO timeVO = new TimeVO(); timeVO.setTimes(eventDetailNews.size()+""); if (parse1.getDayOfMonth()<10){ @@ -1351,28 +1395,65 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { @Override public List getPlot(StatisticsParam statisticsParam) { List result = new ArrayList<>(); - QueryResult query = MonitorQuery(statisticsParam); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - result = influxDBResultMapper.toPOJO(query, EventDetail.class); - HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); - HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); - List reasonData = reason.getData(); - List typeData = type.getData(); - //添加detail - for (EventDetail detail : result) { - if (detail.getWaveType() == 1) { - for (DictData data : reasonData) { - if (detail.getEventReason().equals(data.getId())) { - detail.setEventReason(data.getName()); - } +// QueryResult query = MonitorQuery(statisticsParam); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// result = influxDBResultMapper.toPOJO(query, EventDetail.class); +// //添加detail +// for (EventDetail detail : result) { +// if (detail.getWaveType() == 1) { +// for (DictData data : reasonData) { +// if (detail.getEventReason().equals(data.getId())) { +// detail.setEventReason(data.getName()); +// } +// } +// for (DictData data : typeData) { +// if (detail.getEventType().equals(data.getId())) { +// detail.setEventType(data.getName()); +// } +// } +// } +// } + //查询监测点未处理暂态事件 + List eventDetails = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) + .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) + ); + + //获取字典属性 + List reasonData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_REASON.getCode()).getData(); + Map reasonMap = reasonData.stream().collect(Collectors.toMap(DictData::getId, Function.identity(), (kye1, key2) -> kye1)); + List typeData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData(); + Map typeMap = typeData.stream().collect(Collectors.toMap(DictData::getId, Function.identity(), (kye1, key2) -> kye1)); + //获取电压暂降信息 + DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); + EventDetail eventDetailNew; + for (RmpEventDetailPO eventDetail : eventDetails) { + eventDetailNew= BeanUtil.copyProperties(eventDetail,EventDetail.class); + //监测点id + eventDetailNew.setLineId(eventDetail.getMeasurementPointId()); + //持续时间 + eventDetailNew.setPersistTime(eventDetail.getDuration()); + //特征幅值 + eventDetailNew.setEventValue(eventDetail.getFeatureAmplitude()); + //波形路径 + eventDetailNew.setWaveName(eventDetail.getWavePath()); + if(data.getId().equals(eventDetail.getEventType())){ + if (reasonMap.containsKey(eventDetail.getEventReason())) { + //暂降原因 + DictData dictData = reasonMap.get(eventDetail.getEventReason()); + eventDetailNew.setEventReason(dictData.getName()); } - for (DictData data : typeData) { - if (detail.getEventType().equals(data.getId())) { - detail.setEventType(data.getName()); - } + if (typeMap.containsKey(eventDetail.getEventType())) { + //事件类型 + DictData dictData = typeMap.get(eventDetail.getEventType()); + eventDetailNew.setEventType(dictData.getName()); } } + + result.add(eventDetailNew); } + return result; } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java index 9f2a7d004..2a21afb99 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java @@ -514,7 +514,7 @@ public class ReportServiceImpl implements ReportService { ArrayList idlist = new ArrayList<>(); for (EventDetailNew eventDetail : info) { for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == 1) { + if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "1") { countMap.put(s, countMap.get(s) + 1); } } @@ -581,7 +581,7 @@ public class ReportServiceImpl implements ReportService { ArrayList idlist = new ArrayList<>(); for (EventDetailNew eventDetail : info) { for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == 2) { + if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "2") { countMap.put(s, countMap.get(s) + 1); } } @@ -648,7 +648,7 @@ public class ReportServiceImpl implements ReportService { ArrayList idlist = new ArrayList<>(); for (EventDetailNew eventDetail : info) { for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == 3) { + if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "3") { countMap.put(s, countMap.get(s) + 1); } }