From b4938a834592bd3b125a36181257d0a51c985986 Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Wed, 17 May 2023 20:16:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9A=82=E6=80=81=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/njcn/device/pq/pojo/vo/EventVO.java | 6 +++ .../pq/service/impl/LineServiceImpl.java | 39 ++++++++++++++++--- .../com/njcn/event/pojo/po/EventDetail.java | 3 ++ .../pojo/vo/VoltageToleranceCurveVO.java | 3 ++ .../mapping/LargeScreenMapper.xml | 2 +- .../Impl/AreaAnalysisServiceImpl.java | 1 + .../Impl/EventAnalysisServiceImpl.java | 3 ++ 7 files changed, 50 insertions(+), 7 deletions(-) diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/EventVO.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/EventVO.java index 35a1771bb..b9d18bfad 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/EventVO.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/EventVO.java @@ -50,4 +50,10 @@ public class EventVO implements Serializable { */ @ApiModelProperty("持续时间") private String duration; + + /** + * 暂态事件id + */ + @ApiModelProperty("暂态事件id") + private String eventId; } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java index 4cf45e2b3..5ba959e87 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java @@ -1,6 +1,7 @@ package com.njcn.device.pq.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; @@ -172,16 +173,30 @@ public class LineServiceImpl extends ServiceImpl implements Li List updateTime = new ArrayList<>(); List comType = new ArrayList<>(); //开始时间 - if(!communicateList.get(0).getUpdateTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())){ + Boolean beginFly =false; + if(CollUtil.isNotEmpty(communicateList)){ + 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(); Long time = instant.toEpochMilli(); String timeText = df.format(time); updateTime.add(timeText); - if(communicateList.get(0).getType()==0){ - comType.add(1); + if(CollUtil.isNotEmpty(communicateList)){ + if(communicateList.get(0).getType()==0){ + comType.add(1); + }else{ + comType.add(0); + } }else{ - comType.add(0); + comType.add(1); } + } for (Communicate communicate : communicateList) { //转化时间 @@ -197,11 +212,23 @@ public class LineServiceImpl extends ServiceImpl implements Li String format = times.format(date); Instant endTime = DateUtil.parse(searchEndTime + " " + format).toInstant(); - if(!communicateList.get(communicateList.size()-1).getUpdateTime().equals(endTime)){ + Boolean endFly =false; + if(CollUtil.isNotEmpty(communicateList)){ + if(!communicateList.get(communicateList.size()-1).getUpdateTime().equals(endTime)){ + endFly =true; + } + }else{ + endFly =true; + } + if(endFly){ Long time = endTime.toEpochMilli(); String timeText = df.format(time); updateTime.add(timeText); - comType.add(communicateList.get(communicateList.size()-1).getType()); + if(CollUtil.isNotEmpty(communicateList)){ + comType.add(communicateList.get(communicateList.size()-1).getType()); + }else{ + comType.add(1); + } } communicateVOList.setUpdateTime(updateTime); communicateVOList.setType(comType); diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetail.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetail.java index 0c536c5c7..b5b434c83 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetail.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetail.java @@ -26,6 +26,9 @@ import java.util.concurrent.TimeUnit; //@TableName("r_mp_event_detail") public class EventDetail { + @ApiModelProperty(name = "eventId",value ="暂态事件id") + private String eventId; + @Column(name = "line_id") private String lineId; diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/vo/VoltageToleranceCurveVO.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/vo/VoltageToleranceCurveVO.java index 51fb0d8ff..c25918527 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/vo/VoltageToleranceCurveVO.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/vo/VoltageToleranceCurveVO.java @@ -57,6 +57,9 @@ public class VoltageToleranceCurveVO implements Serializable { @ApiModelProperty(name = "lineId", value = "LineId") private String lineId; + @ApiModelProperty(name = "lineId",value ="暂态事件id") + private String eventId; + @ApiModelProperty(name = "persistTime", value = "持续时间(ms)") private Double persistTime; diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/LargeScreenMapper.xml b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/LargeScreenMapper.xml index 9f9c113b9..fdb970a5e 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/LargeScreenMapper.xml +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/LargeScreenMapper.xml @@ -347,7 +347,7 @@