添加治理波形图后台绘制功能
This commit is contained in:
@@ -58,6 +58,20 @@ public class CsEventPO extends BaseEntity {
|
|||||||
@TableField(value = "wave_path")
|
@TableField(value = "wave_path")
|
||||||
private String wavePath;
|
private String wavePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 瞬时波形图,存在多张的情况
|
||||||
|
*/
|
||||||
|
@TableField(value = "instant_pics")
|
||||||
|
private String instantPics;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RMS波形图,存在多张的情况
|
||||||
|
*/
|
||||||
|
@TableField(value = "rms_pics")
|
||||||
|
private String rmsPics;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件类型(0:暂态事件1:稳态事件 2:设备事
|
* 事件类型(0:暂态事件1:稳态事件 2:设备事
|
||||||
* 件)
|
* 件)
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2023年09月20日 15:57
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CsEventVO extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点id
|
||||||
|
*/
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置id
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件类型
|
||||||
|
*/
|
||||||
|
private String tag;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 瞬时波形图,存在多张的情况
|
||||||
|
*/
|
||||||
|
private String instantPics;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RMS波形图,存在多张的情况
|
||||||
|
*/
|
||||||
|
private String rmsPics;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件类型(0:暂态事件1:稳态事件 2:设备事
|
||||||
|
* 件)
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑子设备id
|
||||||
|
* 电能质量设备是监测点、治理设备是各个模块
|
||||||
|
*/
|
||||||
|
private Integer clDid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件等级(1:Ⅰ级 2:Ⅱ级 3:Ⅲ级)
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.csharmonic.service.CsEventPOService;
|
import com.njcn.csharmonic.service.CsEventPOService;
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
@@ -51,10 +52,20 @@ public class EventController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "eventId", value = "暂态事件索引", required = true)
|
@ApiImplicitParam(name = "eventId", value = "暂态事件索引", required = true)
|
||||||
public HttpResult<WaveDataDTO> analyseWave(String eventId) {
|
public HttpResult<WaveDataDTO> analyseWave(String eventId) {
|
||||||
String methodDescribe = getMethodDescribe("analyseWave");
|
String methodDescribe = getMethodDescribe("analyseWave");
|
||||||
WaveDataDTO wave = csEventPOService.analyseWave(eventId);
|
WaveDataDTO wave = csEventPOService.analyseWave(eventId,1);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getWavePics")
|
||||||
|
@ApiOperation("获取事件波形图")
|
||||||
|
@ApiImplicitParam(name = "eventId", value = "暂态事件索引", required = true)
|
||||||
|
public HttpResult<CsEventVO> getWavePics(String eventId) {
|
||||||
|
String methodDescribe = getMethodDescribe("getWavePics");
|
||||||
|
CsEventVO eventVO = csEventPOService.getWavePics(eventId,2);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventVO, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.csharmonic.service;
|
|||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
|
|
||||||
@@ -27,6 +28,15 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
|||||||
* @date 2023/9/20 14:23
|
* @date 2023/9/20 14:23
|
||||||
* @return WaveDataDTO
|
* @return WaveDataDTO
|
||||||
*/
|
*/
|
||||||
WaveDataDTO analyseWave(String eventId);
|
WaveDataDTO analyseWave(String eventId, int i);
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 获取事件波形图信息
|
||||||
|
* @author hongawen
|
||||||
|
* @date 2023/9/20 15:59
|
||||||
|
* @return CsEventVO
|
||||||
|
*/
|
||||||
|
CsEventVO getWavePics(String eventId, int i);
|
||||||
|
|
||||||
List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam);
|
List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,27 @@
|
|||||||
package com.njcn.csharmonic.service.impl;
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
|
||||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||||
import com.njcn.event.file.component.WaveFileComponent;
|
import com.njcn.event.file.component.WaveFileComponent;
|
||||||
|
import com.njcn.event.file.component.WavePicComponent;
|
||||||
|
import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||||
|
import com.njcn.event.file.utils.WaveUtil;
|
||||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||||
import com.njcn.influx.service.EvtDataService;
|
import com.njcn.influx.service.EvtDataService;
|
||||||
import com.njcn.oss.constant.GeneralConstant;
|
import com.njcn.oss.constant.GeneralConstant;
|
||||||
import com.njcn.oss.constant.OssPath;
|
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.system.api.EleEvtFeignClient;
|
import com.njcn.system.api.EleEvtFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
@@ -38,9 +41,7 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -57,7 +58,9 @@ import java.util.stream.Stream;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO> implements CsEventPOService{
|
public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO> implements CsEventPOService{
|
||||||
|
|
||||||
private final EvtDataService evtDataService;
|
private final EvtDataService evtDataService;
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
private final WaveFileComponent waveFileComponent;
|
private final WaveFileComponent waveFileComponent;
|
||||||
@@ -67,9 +70,13 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||||
|
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
|
||||||
private final CsEventUserPOService csEventUserPOService;
|
private final CsEventUserPOService csEventUserPOService;
|
||||||
|
|
||||||
private final EleEvtFeignClient eleEvtFeignClient;
|
private final EleEvtFeignClient eleEvtFeignClient;
|
||||||
|
|
||||||
|
private final WavePicComponent wavePicComponent;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
||||||
|
|
||||||
@@ -104,8 +111,17 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return WaveDataDTO
|
||||||
|
* @date 2023/9/21 15:59
|
||||||
|
* param iType == 0 高级算法的要求,采样率只能是32-128
|
||||||
|
* iType == 1 普通展示,采样率按照cfg里面最小的(大于32)
|
||||||
|
* iType == 2 App抽点要求,采样率抽点成32
|
||||||
|
* iType == 3 高级算法原始波形(大于32)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public WaveDataDTO analyseWave(String eventId) {
|
public WaveDataDTO analyseWave(String eventId, int iType) {
|
||||||
WaveDataDTO waveDataDTO;
|
WaveDataDTO waveDataDTO;
|
||||||
//获取暂降事件
|
//获取暂降事件
|
||||||
CsEventPO eventDetail = this.baseMapper.selectById(eventId);
|
CsEventPO eventDetail = this.baseMapper.selectById(eventId);
|
||||||
@@ -122,7 +138,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, iType);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
|
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
|
||||||
}
|
}
|
||||||
@@ -134,6 +150,29 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
waveDataDTO.setPtType(csLinePOList.get(0).getConType());
|
waveDataDTO.setPtType(csLinePOList.get(0).getConType());
|
||||||
waveDataDTO.setPt(csLinePOList.get(0).getPtRatio());
|
waveDataDTO.setPt(csLinePOList.get(0).getPtRatio());
|
||||||
waveDataDTO.setCt(csLinePOList.get(0).getCtRatio());
|
waveDataDTO.setCt(csLinePOList.get(0).getCtRatio());
|
||||||
|
waveDataDTO.setMonitorName(csLinePOList.get(0).getName());
|
||||||
return waveDataDTO;
|
return waveDataDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsEventVO getWavePics(String eventId, int iType) {
|
||||||
|
CsEventPO eventDetail = this.baseMapper.selectById(eventId);
|
||||||
|
if (StrUtil.isBlank(eventDetail.getInstantPics())) {
|
||||||
|
//获取波形数据。然后绘图
|
||||||
|
WaveDataDTO waveDataDTO = this.analyseWave(eventId, iType);
|
||||||
|
//数据筛选,如果是双路电压的话,会存在2个波形数据
|
||||||
|
List<WaveDataDetail> waveDataDetails = WaveUtil.filterWaveData(waveDataDTO);
|
||||||
|
String instantPath = wavePicComponent.generateImageShun(waveDataDTO, waveDataDetails);
|
||||||
|
eventDetail.setInstantPics(instantPath);
|
||||||
|
if (StrUtil.isBlank(eventDetail.getRmsPics())) {
|
||||||
|
String rmsPath = wavePicComponent.generateImageRms(waveDataDTO, waveDataDetails);
|
||||||
|
eventDetail.setRmsPics(rmsPath);
|
||||||
|
}
|
||||||
|
this.updateById(eventDetail);
|
||||||
|
}
|
||||||
|
CsEventVO csEventVO = new CsEventVO();
|
||||||
|
BeanUtil.copyProperties(eventDetail,csEventVO);
|
||||||
|
return csEventVO;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user