Merge remote-tracking branch 'origin/master'
# Conflicts: # cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/EventController.java # cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/CsEventPOService.java # cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/CsEventPOServiceImpl.java
This commit is contained in:
@@ -8,6 +8,9 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
||||
import com.njcn.influx.pojo.po.cs.EntData;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -31,7 +34,7 @@ import java.util.List;
|
||||
@Api(tags = "暂降事件")
|
||||
@AllArgsConstructor
|
||||
public class EventController extends BaseController {
|
||||
private final CsEventPOService eventService;
|
||||
private final CsEventPOService csEventPOService;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@@ -40,10 +43,20 @@ public class EventController extends BaseController {
|
||||
@ApiImplicitParam(name = "csEventUserQueryParam", value = "暂降事件查询参数", required = true)
|
||||
public HttpResult<List<EventDetailVO>> queryEventList(@RequestBody CsEventUserQueryParam csEventUserQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryEventList");
|
||||
List<EventDetailVO> list = eventService.queryEventList(csEventUserQueryParam);
|
||||
List<EventDetailVO> list = csEventPOService.queryEventList(csEventUserQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/analyseWave")
|
||||
@ApiOperation("暂态事件波形分析")
|
||||
@ApiImplicitParam(name = "eventId", value = "暂态事件索引", required = true)
|
||||
public HttpResult<WaveDataDTO> analyseWave(String eventId) {
|
||||
String methodDescribe = getMethodDescribe("analyseWave");
|
||||
WaveDataDTO wave = csEventPOService.analyseWave(eventId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/9/4 15:15【需求编号】
|
||||
*
|
||||
@@ -17,5 +20,12 @@ import java.util.List;
|
||||
*/
|
||||
public interface CsEventPOService extends IService<CsEventPO>{
|
||||
|
||||
/***
|
||||
* 根据事件ID解析该事件波形文件
|
||||
* @author hongawen
|
||||
* @date 2023/9/20 14:23
|
||||
* @return WaveDataDTO
|
||||
*/
|
||||
WaveDataDTO analyseWave(String eventId);
|
||||
List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.EleEvtFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.event.file.component.WaveFileComponent;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||
import com.njcn.oss.constant.GeneralConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
||||
@@ -24,6 +25,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -32,6 +41,7 @@ import java.util.Optional;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO> implements CsEventPOService{
|
||||
@@ -76,4 +86,42 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
|
||||
return list;
|
||||
}
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final WaveFileComponent waveFileComponent;
|
||||
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
@Override
|
||||
public WaveDataDTO analyseWave(String eventId) {
|
||||
WaveDataDTO waveDataDTO;
|
||||
//获取暂降事件
|
||||
CsEventPO eventDetail = this.baseMapper.selectById(eventId);
|
||||
String waveName = eventDetail.getWavePath();
|
||||
if(StrUtil.isBlank(waveName)){
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
String cfgPath = waveName.concat(GeneralConstant.CFG), datPath = waveName.concat(GeneralConstant.DAT);
|
||||
System.out.println("波形路径-------------------" + cfgPath);
|
||||
try (
|
||||
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
|
||||
InputStream datStream = fileStorageUtil.getFileStream(datPath)
|
||||
) {
|
||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getValidData(waveDataDTO);
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(Stream.of(eventDetail.getLineId()).collect(Collectors.toList())).getData();
|
||||
if(CollectionUtil.isEmpty(csLinePOList)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_MISS);
|
||||
}
|
||||
waveDataDTO.setPtType(csLinePOList.get(0).getConType());
|
||||
waveDataDTO.setPt(csLinePOList.get(0).getPtRatio());
|
||||
waveDataDTO.setCt(csLinePOList.get(0).getCtRatio() );
|
||||
return waveDataDTO;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user