1.监测点运行状态数据调整;
2.暂态事件同步
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
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 java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 暂降明细实体类
|
||||
*
|
||||
* @author yzh
|
||||
* @since 2022-10-12 18:34:55
|
||||
*/
|
||||
@Data
|
||||
@TableName("r_mp_event_detail")
|
||||
@ApiModel(value="RmpEventDetail对象")
|
||||
public class RmpEventDetailPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "暂时事件ID")
|
||||
@TableId(value = "event_id", type = IdType.ASSIGN_ID)
|
||||
private String eventId;
|
||||
|
||||
@ApiModelProperty(value = "监测点ID")
|
||||
private String measurementPointId;
|
||||
|
||||
@ApiModelProperty(value = "监测点ID(复制)")
|
||||
@TableField("measurement_point_id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(value = "统计类型")
|
||||
private String eventType;
|
||||
|
||||
@ApiModelProperty(value = "暂降原因(Event_Reason)")
|
||||
@TableField("advance_reason")
|
||||
private String advanceReason;
|
||||
|
||||
@ApiModelProperty(value = "暂降类型(Event_Type)")
|
||||
@TableField("advance_type")
|
||||
private String advanceType;
|
||||
|
||||
@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")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@ApiModelProperty(value = "格式化开始时间")
|
||||
@TableField(exist = false)
|
||||
private String formatTime;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "持续时间,单位秒")
|
||||
private Double duration;
|
||||
|
||||
@ApiModelProperty(value = "特征幅值")
|
||||
private Double featureAmplitude;
|
||||
|
||||
@ApiModelProperty(value = "相别")
|
||||
private String phase;
|
||||
|
||||
@ApiModelProperty(value = "事件描述")
|
||||
private String eventDescribe;
|
||||
|
||||
@ApiModelProperty(value = "波形路径")
|
||||
private String wavePath;
|
||||
|
||||
@ApiModelProperty(value = "暂降核实原因")
|
||||
@TableField("verify_reason")
|
||||
private String verifyReason;
|
||||
|
||||
@ApiModelProperty(value = "暂降核实原因详情")
|
||||
@TableField("verify_reason_detail")
|
||||
private String verifyReasonDetail;
|
||||
|
||||
private Double transientValue;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "用于计算数量")
|
||||
@TableField(exist = false)
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csharmonic.pojo.po.RmpEventDetailPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 暂态事件明细
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/12
|
||||
*/
|
||||
@Mapper
|
||||
@DS("sjzx")
|
||||
public interface RmpEventDetailMapper extends BaseMapper<RmpEventDetailPO> {
|
||||
|
||||
}
|
||||
@@ -21,7 +21,11 @@
|
||||
SELECT
|
||||
t1.line_id id,
|
||||
t2.NAME,
|
||||
t1.start_time timeId,
|
||||
CONCAT(
|
||||
DATE_FORMAT( t1.start_time, '%Y-%m-%d %H:%i:%s' ),
|
||||
'.',
|
||||
LPAD( FLOOR( MICROSECOND( t1.start_time ) / 1000 ), 3, '0' )
|
||||
) AS timeId,
|
||||
t1.amplitude,
|
||||
t1.persist_time
|
||||
FROM
|
||||
@@ -34,6 +38,7 @@
|
||||
#{lineId}
|
||||
</foreach>
|
||||
and t1.type = 0
|
||||
order by t1.start_time DESC
|
||||
LIMIT 60
|
||||
</select>
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.csharmonic.service.event;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csharmonic.pojo.po.RmpEventDetailPO;
|
||||
|
||||
/**
|
||||
* 暂态事件明细
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/12
|
||||
*/
|
||||
|
||||
public interface RmpEventDetailService extends IService<RmpEventDetailPO> {
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -22,18 +23,21 @@ import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csharmonic.enums.CsEventEnum;
|
||||
import com.njcn.csharmonic.enums.CsTransientEnum;
|
||||
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
||||
import com.njcn.csharmonic.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.csharmonic.param.CldEventParam;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||
import com.njcn.csharmonic.service.event.RmpEventDetailService;
|
||||
import com.njcn.event.file.component.WaveFileComponent;
|
||||
import com.njcn.event.file.component.WavePicComponent;
|
||||
import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
||||
@@ -48,8 +52,11 @@ import com.njcn.minioss.config.MinIossProperties;
|
||||
import com.njcn.minioss.util.MinIoUtils;
|
||||
import com.njcn.oss.constant.GeneralConstant;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.EleEvtFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
@@ -107,6 +114,9 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
private final MinIossProperties minIossProperties;
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
private final MinIoUtils minIoUtils;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final RmpEventDetailService rmpEventDetailService;
|
||||
private final RmpEventDetailMapper rmpEventDetailMapper;
|
||||
|
||||
@Override
|
||||
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
||||
@@ -328,7 +338,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@DSTransactional
|
||||
public void addCldEvent(CldEventParam param) {
|
||||
//校验是新增时间还是更新文件信息
|
||||
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@@ -368,6 +378,10 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
if (CollectionUtil.isNotEmpty(records)) {
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, records);
|
||||
}
|
||||
|
||||
//同步数据到 r_mp_event_detail
|
||||
insertEvent(uuid, param, time);
|
||||
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(param.getWavePath())) {
|
||||
//更新文件信息
|
||||
@@ -377,10 +391,35 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
.eq(CsEventPO::getStartTime,param.getStartTime())
|
||||
.set(CsEventPO::getWavePath,param.getWavePath())
|
||||
.update();
|
||||
|
||||
//更新文件信息
|
||||
updateEvent(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void insertEvent(String uuid, CldEventParam param, LocalDateTime time) {
|
||||
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
||||
rmpEventDetailPO.setEventId(uuid);
|
||||
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
||||
rmpEventDetailPO.setStartTime(time);
|
||||
rmpEventDetailPO.setEventType(getEventType(param.getEventType()));
|
||||
rmpEventDetailPO.setFeatureAmplitude(param.getAmplitude() * 100);
|
||||
rmpEventDetailPO.setDuration(param.getDuration());
|
||||
rmpEventDetailPO.setEventDescribe(getTag(param.getEventType()));
|
||||
rmpEventDetailPO.setPhase(param.getPhase());
|
||||
rmpEventDetailService.save(rmpEventDetailPO);
|
||||
}
|
||||
|
||||
public void updateEvent(CldEventParam param) {
|
||||
LambdaQueryWrapper<RmpEventDetailPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RmpEventDetailPO::getMeasurementPointId,param.getMonitorId()).eq(RmpEventDetailPO::getStartTime,param.getStartTime());
|
||||
RmpEventDetailPO po = rmpEventDetailMapper.selectOne(wrapper);
|
||||
po.setWavePath(param.getWavePath());
|
||||
rmpEventDetailService.updateById(po);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsEventPO> getEventByTime(List<String> lineList, String startTime, String endTime) {
|
||||
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@@ -414,7 +453,15 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
csWarnDescVOList = this.baseMapper.getEventDesc(lineIdList,60);
|
||||
// 处理下描述
|
||||
for (CsWarnDescVO csWarnDescVO : csWarnDescVOList) {
|
||||
csWarnDescVO.setEventDesc("电压暂态事件,持续时间"+csWarnDescVO.getPersistTime()+"秒,电压降至"+csWarnDescVO.getAmplitude()+"%。");
|
||||
String desc;
|
||||
if(csWarnDescVO.getAmplitude() <= 90) {
|
||||
desc = "降至";
|
||||
} else if (csWarnDescVO.getAmplitude() >= 110) {
|
||||
desc = "升至";
|
||||
} else {
|
||||
desc = "维持";
|
||||
}
|
||||
csWarnDescVO.setEventDesc("电压暂态事件,持续时间"+csWarnDescVO.getPersistTime()+"秒,电压"+desc+csWarnDescVO.getAmplitude()+"%。");
|
||||
}
|
||||
return csWarnDescVOList;
|
||||
}
|
||||
@@ -441,7 +488,27 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
public String getEventType(Integer type) {
|
||||
String tag;
|
||||
switch (type) {
|
||||
case 1:
|
||||
DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
tag = dip.getId();
|
||||
break;
|
||||
case 2:
|
||||
DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData();
|
||||
tag = rise.getId();
|
||||
break;
|
||||
case 3:
|
||||
DictData interruptions = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
||||
tag = interruptions.getId();
|
||||
break;
|
||||
default:
|
||||
tag = "Un_Know";
|
||||
break;
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.csharmonic.service.impl.event;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csharmonic.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.csharmonic.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.csharmonic.service.event.RmpEventDetailService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 暂态事件明细
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/12
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@DS("sjzx")
|
||||
public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, RmpEventDetailPO> implements RmpEventDetailService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user