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