1.监测点运行状态数据调整;

2.暂态事件同步
This commit is contained in:
xy
2026-01-16 14:57:44 +08:00
parent 0ac51648f4
commit 4497699178
10 changed files with 311 additions and 41 deletions

View File

@@ -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> {
}

View File

@@ -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>

View File

@@ -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> {
}

View File

@@ -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;
}
/**

View File

@@ -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 {
}