添加暂态事件id

This commit is contained in:
wr
2023-05-17 20:16:59 +08:00
parent c7b6d4022c
commit b4938a8345
7 changed files with 50 additions and 7 deletions

View File

@@ -50,4 +50,10 @@ public class EventVO implements Serializable {
*/ */
@ApiModelProperty("持续时间") @ApiModelProperty("持续时间")
private String duration; private String duration;
/**
* 暂态事件id
*/
@ApiModelProperty("暂态事件id")
private String eventId;
} }

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pq.service.impl; package com.njcn.device.pq.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
@@ -172,16 +173,30 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
List<String> updateTime = new ArrayList<>(); List<String> updateTime = new ArrayList<>();
List<Integer> comType = new ArrayList<>(); List<Integer> comType = new ArrayList<>();
//开始时间 //开始时间
Boolean beginFly =false;
if(CollUtil.isNotEmpty(communicateList)){
if(!communicateList.get(0).getUpdateTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())){ if(!communicateList.get(0).getUpdateTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())){
beginFly =true;
}
}else{
beginFly =true;
}
if(beginFly){
Instant instant = DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant(); Instant instant = DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant();
Long time = instant.toEpochMilli(); Long time = instant.toEpochMilli();
String timeText = df.format(time); String timeText = df.format(time);
updateTime.add(timeText); updateTime.add(timeText);
if(CollUtil.isNotEmpty(communicateList)){
if(communicateList.get(0).getType()==0){ if(communicateList.get(0).getType()==0){
comType.add(1); comType.add(1);
}else{ }else{
comType.add(0); comType.add(0);
} }
}else{
comType.add(1);
}
} }
for (Communicate communicate : communicateList) { for (Communicate communicate : communicateList) {
//转化时间 //转化时间
@@ -197,11 +212,23 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
String format = times.format(date); String format = times.format(date);
Instant endTime = DateUtil.parse(searchEndTime + " " + format).toInstant(); Instant endTime = DateUtil.parse(searchEndTime + " " + format).toInstant();
Boolean endFly =false;
if(CollUtil.isNotEmpty(communicateList)){
if(!communicateList.get(communicateList.size()-1).getUpdateTime().equals(endTime)){ if(!communicateList.get(communicateList.size()-1).getUpdateTime().equals(endTime)){
endFly =true;
}
}else{
endFly =true;
}
if(endFly){
Long time = endTime.toEpochMilli(); Long time = endTime.toEpochMilli();
String timeText = df.format(time); String timeText = df.format(time);
updateTime.add(timeText); updateTime.add(timeText);
if(CollUtil.isNotEmpty(communicateList)){
comType.add(communicateList.get(communicateList.size()-1).getType()); comType.add(communicateList.get(communicateList.size()-1).getType());
}else{
comType.add(1);
}
} }
communicateVOList.setUpdateTime(updateTime); communicateVOList.setUpdateTime(updateTime);
communicateVOList.setType(comType); communicateVOList.setType(comType);

View File

@@ -26,6 +26,9 @@ import java.util.concurrent.TimeUnit;
//@TableName("r_mp_event_detail") //@TableName("r_mp_event_detail")
public class EventDetail { public class EventDetail {
@ApiModelProperty(name = "eventId",value ="暂态事件id")
private String eventId;
@Column(name = "line_id") @Column(name = "line_id")
private String lineId; private String lineId;

View File

@@ -57,6 +57,9 @@ public class VoltageToleranceCurveVO implements Serializable {
@ApiModelProperty(name = "lineId", value = "LineId") @ApiModelProperty(name = "lineId", value = "LineId")
private String lineId; private String lineId;
@ApiModelProperty(name = "lineId",value ="暂态事件id")
private String eventId;
@ApiModelProperty(name = "persistTime", value = "持续时间ms") @ApiModelProperty(name = "persistTime", value = "持续时间ms")
private Double persistTime; private Double persistTime;

View File

@@ -347,7 +347,7 @@
<select id="eventLists" resultType="com.njcn.device.pq.pojo.vo.EventVO"> <select id="eventLists" resultType="com.njcn.device.pq.pojo.vo.EventVO">
SELECT SELECT
ed.start_time "time",pl.`Name` "name",ed.advance_reason reason,ed.advance_type "type",ed.feature_amplitude amplitude,ed.duration ed.event_id as eventId, ed.start_time "time",pl.`Name` "name",ed.advance_reason reason,ed.advance_type "type",ed.feature_amplitude amplitude,ed.duration
from r_mp_event_detail ed from r_mp_event_detail ed
left join pq_line pl on pl.id = ed.measurement_point_id left join pq_line pl on pl.id = ed.measurement_point_id
<where> <where>

View File

@@ -158,6 +158,7 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
VoltageToleranceCurveDataList voltageToleranceCurve = new VoltageToleranceCurveDataList(); VoltageToleranceCurveDataList voltageToleranceCurve = new VoltageToleranceCurveDataList();
voltageToleranceCurve.setLineId(dto.getLineId()); voltageToleranceCurve.setLineId(dto.getLineId());
voltageToleranceCurve.setEventId(dto.getEventId());
voltageToleranceCurve.setPersistTime(dto.getDuration()); voltageToleranceCurve.setPersistTime(dto.getDuration());
voltageToleranceCurve.setEventValue(dto.getFeatureAmplitude()); voltageToleranceCurve.setEventValue(dto.getFeatureAmplitude());
voltageToleranceCurve.setTime(dto.getStartTime()); voltageToleranceCurve.setTime(dto.getStartTime());

View File

@@ -1478,6 +1478,8 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
eventDetailNew = BeanUtil.copyProperties(eventDetail, EventDetail.class); eventDetailNew = BeanUtil.copyProperties(eventDetail, EventDetail.class);
//监测点id //监测点id
eventDetailNew.setLineId(eventDetail.getMeasurementPointId()); eventDetailNew.setLineId(eventDetail.getMeasurementPointId());
//监测点id
eventDetailNew.setEventId(eventDetail.getEventId());
//持续时间 //持续时间
eventDetailNew.setDuration(eventDetail.getDuration()); eventDetailNew.setDuration(eventDetail.getDuration());
//特征幅值 //特征幅值
@@ -1519,6 +1521,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
VoltageToleranceCurveVO.VoltageToleranceCurveDataList voltageToleranceCurve = new VoltageToleranceCurveVO.VoltageToleranceCurveDataList(); VoltageToleranceCurveVO.VoltageToleranceCurveDataList voltageToleranceCurve = new VoltageToleranceCurveVO.VoltageToleranceCurveDataList();
voltageToleranceCurve.setLineId(dto.getLineId()); voltageToleranceCurve.setLineId(dto.getLineId());
voltageToleranceCurve.setEventId(dto.getEventId());
voltageToleranceCurve.setPersistTime(dto.getDuration()); voltageToleranceCurve.setPersistTime(dto.getDuration());
voltageToleranceCurve.setEventValue(dto.getFeatureAmplitude()*100); voltageToleranceCurve.setEventValue(dto.getFeatureAmplitude()*100);
voltageToleranceCurve.setTime(dto.getStartTime()); voltageToleranceCurve.setTime(dto.getStartTime());