添加波形分析
This commit is contained in:
49
.gitignore
vendored
Normal file
49
.gitignore
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
*.iml
|
||||||
|
*.idea
|
||||||
|
target/
|
||||||
|
logs/
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
*velocity.log*
|
||||||
|
|
||||||
|
# Eclipse #
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
_dockerCerts/
|
||||||
|
|
||||||
|
.factorypath
|
||||||
|
|
||||||
|
node_modules/
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
|
rebel.xml
|
||||||
|
|
||||||
|
!DmJdbcDriver18.jar
|
||||||
|
!kingbase8-8.6.0.jar
|
||||||
|
/govern.ipr
|
||||||
|
/govern.iws
|
||||||
@@ -20,6 +20,7 @@ public enum AlgorithmResponseEnum {
|
|||||||
NDID_ERROR("A00502","存在相同的ndid"),
|
NDID_ERROR("A00502","存在相同的ndid"),
|
||||||
DATA_ERROR("A00503","存在相同的数据"),
|
DATA_ERROR("A00503","存在相同的数据"),
|
||||||
LINE_DATA_ERROR ("A00504","设备下监测点数据缺失"),
|
LINE_DATA_ERROR ("A00504","设备下监测点数据缺失"),
|
||||||
|
LINE_DATA_MISS ("A00504","设备下监测点数据缺失"),
|
||||||
POSITION_ERROR ("A00504","监测点位置数据缺失"),
|
POSITION_ERROR ("A00504","监测点位置数据缺失"),
|
||||||
ENGINEERING_DATA_ERROR ("A00505","工程数据数据缺失"),
|
ENGINEERING_DATA_ERROR ("A00505","工程数据数据缺失"),
|
||||||
ELEEPDPQD_DATA_ERROR ("A00506","统计指标据数据缺失"),
|
ELEEPDPQD_DATA_ERROR ("A00506","统计指标据数据缺失"),
|
||||||
|
|||||||
@@ -74,6 +74,18 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>common-event</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>common-oss</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>user-api</artifactId>
|
<artifactId>user-api</artifactId>
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ 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.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
|
import com.njcn.csharmonic.service.CsEventPOService;
|
||||||
import com.njcn.csharmonic.service.EventService;
|
import com.njcn.csharmonic.service.EventService;
|
||||||
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
||||||
import com.njcn.influx.pojo.po.cs.EntData;
|
import com.njcn.influx.pojo.po.cs.EntData;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -33,7 +35,11 @@ import java.util.List;
|
|||||||
@Api(tags = "暂降事件")
|
@Api(tags = "暂降事件")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class EventController extends BaseController {
|
public class EventController extends BaseController {
|
||||||
|
|
||||||
private final EventService eventService;
|
private final EventService eventService;
|
||||||
|
|
||||||
|
private final CsEventPOService csEventPOService;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryEvent")
|
@PostMapping("/queryEvent")
|
||||||
@ApiOperation("暂降事件查询")
|
@ApiOperation("暂降事件查询")
|
||||||
@@ -55,6 +61,16 @@ public class EventController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,22 @@ package com.njcn.csharmonic.service;
|
|||||||
|
|
||||||
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.event.file.pojo.dto.WaveDataDTO;
|
||||||
*
|
|
||||||
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* Date: 2023/9/4 15:15【需求编号】
|
* Date: 2023/9/4 15:15【需求编号】
|
||||||
*
|
*
|
||||||
* @author clam
|
* @author clam
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
public interface CsEventPOService extends IService<CsEventPO>{
|
public interface CsEventPOService extends IService<CsEventPO> {
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 根据事件ID解析该事件波形文件
|
||||||
|
* @author hongawen
|
||||||
|
* @date 2023/9/20 14:23
|
||||||
|
* @return WaveDataDTO
|
||||||
|
*/
|
||||||
|
WaveDataDTO analyseWave(String eventId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,81 @@
|
|||||||
package com.njcn.csharmonic.service.impl;
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
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.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 lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.service.CsEventPOService;
|
import com.njcn.csharmonic.service.CsEventPOService;
|
||||||
|
|
||||||
|
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:
|
* Description:
|
||||||
* Date: 2023/9/4 15:15【需求编号】
|
* Date: 2023/9/4 15:15【需求编号】
|
||||||
*
|
*
|
||||||
* @author clam
|
* @author clam
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO> implements CsEventPOService{
|
@RequiredArgsConstructor
|
||||||
|
public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO> implements CsEventPOService {
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@@ -24,13 +24,13 @@
|
|||||||
<middle.server.url>192.168.1.13</middle.server.url>
|
<middle.server.url>192.168.1.13</middle.server.url>
|
||||||
<!--微服务模块发布地址-->
|
<!--微服务模块发布地址-->
|
||||||
<service.server.url>127.0.0.1</service.server.url>
|
<service.server.url>127.0.0.1</service.server.url>
|
||||||
<!-- <service.server.url>192.168.1.13</service.server.url>-->
|
|
||||||
<!--docker仓库地址-->
|
<!--docker仓库地址-->
|
||||||
<docker.server.url>192.168.1.13</docker.server.url>
|
<docker.server.url>192.168.1.13</docker.server.url>
|
||||||
<!--nacos的ip:port-->
|
<!--nacos的ip:port-->
|
||||||
<nacos.url>${middle.server.url}:18848</nacos.url>
|
<nacos.url>${middle.server.url}:18848</nacos.url>
|
||||||
|
<!--服务器发布内容为空-->
|
||||||
|
<nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>
|
||||||
<!-- <nacos.namespace>3eaa4bd1-bfb6-497b-aba2-47edda305427</nacos.namespace>-->
|
<!-- <nacos.namespace>3eaa4bd1-bfb6-497b-aba2-47edda305427</nacos.namespace>-->
|
||||||
<nacos.namespace>415a1c87-33aa-47bd-8e25-13cc456c87ed</nacos.namespace>
|
|
||||||
<!--sentinel:port-->
|
<!--sentinel:port-->
|
||||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||||
<!--网关地址,主要用于配置swagger中认证token-->
|
<!--网关地址,主要用于配置swagger中认证token-->
|
||||||
|
|||||||
Reference in New Issue
Block a user