项目集成华为obs查看波形文件
This commit is contained in:
@@ -36,4 +36,13 @@ public class GeneralInfo {
|
|||||||
@Value("${business.tempPath}")
|
@Value("${business.tempPath}")
|
||||||
private String businessTempPath;
|
private String businessTempPath;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 文件存储方式
|
||||||
|
* 1:本地磁盘
|
||||||
|
* 2:华为obs
|
||||||
|
* 3: minioss
|
||||||
|
*/
|
||||||
|
@Value("${business.file.storage}")
|
||||||
|
private int businessFileStorage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.njcn.common.pojo.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2023年03月06日 11:07
|
||||||
|
*/
|
||||||
|
public interface GeneralConstant {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 文件存储的3种方式
|
||||||
|
*/
|
||||||
|
Integer LOCAL_DISK = 1;
|
||||||
|
Integer HUAWEI_OBS = 2;
|
||||||
|
Integer MINIO_OSS = 3;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 波形文件的3种后缀
|
||||||
|
*/
|
||||||
|
String CFG =".CFG";
|
||||||
|
String DAT =".DAT";
|
||||||
|
String HDR =".HDR";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.njcn.common.pojo.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2023年03月03日 16:29
|
||||||
|
*/
|
||||||
|
public interface OssPath {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 波形文件
|
||||||
|
*/
|
||||||
|
String WAVE_DIR="comtrade/";
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 稳态报表
|
||||||
|
*/
|
||||||
|
String HARMONIC_EXCEL_REPORT="harmonic/excel/report";
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 稳态报表模板
|
||||||
|
*/
|
||||||
|
String HARMONIC_EXCEL_TEMPLATE="harmonic/excel/template";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -91,6 +91,7 @@ public enum CommonResponseEnum {
|
|||||||
ID_NOT_EXIST("A0100", "id不存在"),
|
ID_NOT_EXIST("A0100", "id不存在"),
|
||||||
|
|
||||||
TIME_ERROR("A0101","时间格式有误"),
|
TIME_ERROR("A0101","时间格式有误"),
|
||||||
|
CLOSE_RESOURCE_ERROR("A0102","关闭资源有误"),
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.njcn.device.pms.controller.majornetwork;
|
|
||||||
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.device.pms.service.majornetwork.TransientPmsService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 暂态事件列表(PMS暂用)
|
|
||||||
* @author hongawen
|
|
||||||
* @since 2022-10-14
|
|
||||||
*/
|
|
||||||
@Validated
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/pms/transientStasticData")
|
|
||||||
@Api(tags = "暂态事件列表(PMS暂用)")
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class TransientStasticDataController extends BaseController {
|
|
||||||
|
|
||||||
private final TransientPmsService transientPmsService;
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
@PostMapping("/getTransientAnalyseWavePms")
|
|
||||||
@ApiOperation("暂态事件波形分析")
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "timeId", value = "暂态时刻", required = true),
|
|
||||||
@ApiImplicitParam(name = "lineId", value = "暂态监测点Id", required = true),
|
|
||||||
@ApiImplicitParam(name = "lineType", value = "暂态监测点类型(1主网 2配网)", required = true)
|
|
||||||
})
|
|
||||||
public HttpResult<WaveDataDTO> getTransientAnalyseWavePms(@RequestParam("timeId") String timeId, @RequestParam("lineId") String lineId, @RequestParam("lineType") Integer lineType){
|
|
||||||
String methodDescribe = getMethodDescribe("getTransientAnalyseWavePms");
|
|
||||||
WaveDataDTO wave = transientPmsService.getTransientAnalyseWavePms(timeId, lineId,lineType);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.njcn.device.pms.service.majornetwork;
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TransientPmsService
|
|
||||||
*
|
|
||||||
* @author qijian
|
|
||||||
* @version 1.0.0
|
|
||||||
* @createTime 2022/12/14 - 15:09
|
|
||||||
*/
|
|
||||||
public interface TransientPmsService {
|
|
||||||
/**
|
|
||||||
* 功能描述: 暂态事件波形分析
|
|
||||||
* @param timeId
|
|
||||||
* @param lineId
|
|
||||||
* @param lineType
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
WaveDataDTO getTransientAnalyseWavePms(String timeId, String lineId, Integer lineType);
|
|
||||||
}
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
package com.njcn.device.pms.service.majornetwork.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.njcn.common.config.GeneralInfo;
|
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.common.utils.PubUtils;
|
|
||||||
import com.njcn.common.utils.wave.AnalyWave;
|
|
||||||
import com.njcn.device.pms.api.DistributionMonitorClient;
|
|
||||||
import com.njcn.device.pms.api.MonitorClient;
|
|
||||||
import com.njcn.device.pms.mapper.majornetwork.DistributionMonitorMapper;
|
|
||||||
import com.njcn.device.pms.mapper.majornetwork.MonitorMapper;
|
|
||||||
import com.njcn.device.pms.mapper.majornetwork.TerminalMapper;
|
|
||||||
import com.njcn.device.pms.pojo.po.DistributionMonitor;
|
|
||||||
import com.njcn.device.pms.pojo.po.Monitor;
|
|
||||||
import com.njcn.device.pms.pojo.po.PmsTerminal;
|
|
||||||
import com.njcn.device.pms.service.majornetwork.EventDetailPmsService;
|
|
||||||
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
|
||||||
import com.njcn.device.pms.service.majornetwork.TransientPmsService;
|
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
|
||||||
import com.njcn.device.pq.enums.DeviceResponseEnum;
|
|
||||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
|
||||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
|
||||||
import com.njcn.event.enums.EventResponseEnum;
|
|
||||||
import com.njcn.event.pojo.param.TransientParam;
|
|
||||||
import com.njcn.event.pojo.param.WaveFileParam;
|
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
|
||||||
import com.njcn.event.pojo.po.EventDetailNew;
|
|
||||||
import com.njcn.event.pojo.vo.TransientVO;
|
|
||||||
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
|
||||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
|
||||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
|
||||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
|
||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
|
||||||
import com.njcn.system.pojo.po.DictData;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.influxdb.dto.QueryResult;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: chenchao
|
|
||||||
* @date: 2022/03/29 14:37
|
|
||||||
* @Description: <描述>
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class TransientPmsServiceImpl implements TransientPmsService {
|
|
||||||
|
|
||||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
|
||||||
|
|
||||||
private final EventDetailPmsService eventDetailPmsService;
|
|
||||||
|
|
||||||
private final GeneralInfo generalInfo;
|
|
||||||
|
|
||||||
private final DistributionMonitorMapper distributionMonitorMapper;
|
|
||||||
|
|
||||||
private final MonitorMapper monitorMapper;
|
|
||||||
|
|
||||||
private final TerminalMapper terminalMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public WaveDataDTO getTransientAnalyseWavePms(String timeId, String lineId,Integer lineType) {
|
|
||||||
//初始化
|
|
||||||
WaveDataDTO waveDataDTO;
|
|
||||||
PmsTerminal pmsTerminal;
|
|
||||||
DictData dictData;
|
|
||||||
String ip = null;
|
|
||||||
String ptTypeName = null;
|
|
||||||
Float pt1 = null;
|
|
||||||
Float pt2 = null;
|
|
||||||
Float ct1 = null;
|
|
||||||
Float ct2 = null;
|
|
||||||
|
|
||||||
//根据监测点id获取信息(1主网 2配网)
|
|
||||||
if (lineType == 1){
|
|
||||||
Monitor monitor = monitorMapper.selectById(lineId);
|
|
||||||
//获取ip
|
|
||||||
pmsTerminal = terminalMapper.selectById(monitor.getTerminalId());
|
|
||||||
ip = pmsTerminal.getIp();
|
|
||||||
//获取接线方式
|
|
||||||
dictData = dicDataFeignClient.getDicDataById(monitor.getTerminalWiringMethod()).getData();
|
|
||||||
ptTypeName = dictData.getName();
|
|
||||||
//获取pt、ct
|
|
||||||
pt1 = monitor.getPt1();
|
|
||||||
pt2 = monitor.getPt1();
|
|
||||||
ct1 = monitor.getCt1();
|
|
||||||
ct2 = monitor.getCt2();
|
|
||||||
}else{
|
|
||||||
DistributionMonitor distributionMonitor = distributionMonitorMapper.selectById(lineId);
|
|
||||||
//获取ip
|
|
||||||
pmsTerminal = terminalMapper.selectById(distributionMonitor.getTerminalId());
|
|
||||||
ip = pmsTerminal.getIp();
|
|
||||||
//获取接线方式
|
|
||||||
dictData = dicDataFeignClient.getDicDataById(distributionMonitor.getTerminalWiringMethod()).getData();
|
|
||||||
ptTypeName = dictData.getName();
|
|
||||||
//获取pt、ct
|
|
||||||
pt1 = distributionMonitor.getPt1();
|
|
||||||
pt2 = distributionMonitor.getPt1();
|
|
||||||
ct1 = distributionMonitor.getCt1();
|
|
||||||
ct2 = distributionMonitor.getCt2();
|
|
||||||
}
|
|
||||||
|
|
||||||
EventDetail eventDetailByTime = eventDetailPmsService.getEventDetailByTime(lineId, timeId);
|
|
||||||
String waveName = eventDetailByTime.getWaveName();
|
|
||||||
|
|
||||||
AnalyWave analyWave = new AnalyWave();
|
|
||||||
WaveDataDTO comtrade = analyWave.getComtrade(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".CFG", 1);
|
|
||||||
if (Objects.isNull(comtrade.getComtradeCfgDTO())) {
|
|
||||||
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
|
||||||
}
|
|
||||||
waveDataDTO = analyWave.getValidData(comtrade);
|
|
||||||
waveDataDTO.setPtType(PubUtils.ptTypeName(ptTypeName));
|
|
||||||
waveDataDTO.setPt((double) (pt1 / pt2));
|
|
||||||
waveDataDTO.setCt((double) (ct1 / ct2));
|
|
||||||
return waveDataDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -17,6 +17,9 @@ public enum EventResponseEnum {
|
|||||||
EVENT_COMMON_ERROR("A00650","暂降模块异常"),
|
EVENT_COMMON_ERROR("A00650","暂降模块异常"),
|
||||||
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
|
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
|
||||||
ANALYSEWAVE_NOT_FOUND("A00652","波形文件找不到"),
|
ANALYSEWAVE_NOT_FOUND("A00652","波形文件找不到"),
|
||||||
|
WAVE_DATA_INVALID("A00654","波形文件数据缺失"),
|
||||||
|
DAT_DATA_ERROR("A00653","dat文件数据读取失败"),
|
||||||
|
RMS_DATA_ERROR("A00653","rms数据读取失败"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -41,6 +40,11 @@ public class ComtradeCfgDTO implements Serializable {
|
|||||||
// 最终采样率,计算的时候只用一个采样率
|
// 最终采样率,计算的时候只用一个采样率
|
||||||
private Long finalSampleRate;
|
private Long finalSampleRate;
|
||||||
// 整个波形大小
|
// 整个波形大小
|
||||||
private Long nAllWaveNum = 0l;
|
private Long nAllWaveNum = 0L;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 赋值编码格式(二进制)
|
||||||
|
*/
|
||||||
|
private String strBinType;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yxb
|
* @author yxb
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.njcn.event.pojo.po;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version 1.0.0
|
|
||||||
* @author: chenchao
|
|
||||||
* @date: 2022/06/28 19:41
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Component
|
|
||||||
public class WavePath {
|
|
||||||
|
|
||||||
|
|
||||||
@Value("${business.wavePath}")
|
|
||||||
private String wavePath;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -72,6 +72,18 @@
|
|||||||
<artifactId>pq-device-api</artifactId>
|
<artifactId>pq-device-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>huawei-obs-springboot-starter</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okio</groupId>
|
||||||
|
<artifactId>okio</artifactId>
|
||||||
|
<version>2.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.njcn.event.controller.majornetwork;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
@@ -202,24 +201,6 @@ public class MonitorPointController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*监测点事件波形分析
|
|
||||||
* @author zbj
|
|
||||||
* @date 2022/7/27
|
|
||||||
*/
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
@PostMapping("/getMonitorEventAnalyseWave")
|
|
||||||
@ApiOperation("监测点事件波形分析")
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "timeId", value = "时间Id", required = true),
|
|
||||||
@ApiImplicitParam(name = "lineId", value = "监测点Id", required = true)
|
|
||||||
})
|
|
||||||
public HttpResult<WaveDataDTO> getMonitorEventAnalyseWave(@RequestParam("timeId") String timeId, @RequestParam("lineId") String lineId){
|
|
||||||
String methodDescribe = getMethodDescribe("getMonitorEventAnalyseWave");
|
|
||||||
WaveDataDTO wave = eventAnalysisService.getMonitorEventAnalyseWave(timeId, lineId);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*监测点事件波形下载
|
*监测点事件波形下载
|
||||||
* @author zbj
|
* @author zbj
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package com.njcn.event.controller.majornetwork;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
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.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.TransientParam;
|
import com.njcn.event.pojo.param.TransientParam;
|
||||||
import com.njcn.event.pojo.param.WaveFileParam;
|
import com.njcn.event.pojo.param.WaveFileParam;
|
||||||
import com.njcn.event.pojo.po.EventDetailNew;
|
import com.njcn.event.pojo.po.EventDetailNew;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.event.service.majornetwork;
|
package com.njcn.event.service.majornetwork;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.*;
|
import com.njcn.event.pojo.param.*;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
import com.njcn.event.pojo.vo.*;
|
import com.njcn.event.pojo.vo.*;
|
||||||
@@ -82,12 +82,7 @@ public interface EventAnalysisService {
|
|||||||
*/
|
*/
|
||||||
Page<WaveTypeVO> getMonitorEventAnalyseQuery(EventBaseParam eventBaseParam);
|
Page<WaveTypeVO> getMonitorEventAnalyseQuery(EventBaseParam eventBaseParam);
|
||||||
|
|
||||||
/**
|
|
||||||
*监测点事件波形分析
|
|
||||||
* @author zbj
|
|
||||||
* @date 2022/7/27
|
|
||||||
*/
|
|
||||||
WaveDataDTO getMonitorEventAnalyseWave(String timeId, String lineId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*监测点事件波形下载
|
*监测点事件波形下载
|
||||||
|
|||||||
@@ -4,16 +4,15 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.common.utils.wave.AnalyWave;
|
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.event.enums.EventResponseEnum;
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.event.pojo.constant.Param;
|
import com.njcn.event.pojo.constant.Param;
|
||||||
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.*;
|
import com.njcn.event.pojo.param.*;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
import com.njcn.event.pojo.po.EventDetailNew;
|
import com.njcn.event.pojo.po.EventDetailNew;
|
||||||
@@ -1627,55 +1626,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 监测点事件波形分析
|
|
||||||
*
|
|
||||||
* @author zbj
|
|
||||||
* @date 2022/7/27
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public WaveDataDTO getMonitorEventAnalyseWave(String timeId, String lineId) {
|
|
||||||
WaveDataDTO waveDataDTO = new WaveDataDTO();
|
|
||||||
//根据监测点id获取监测点详情
|
|
||||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
|
||||||
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId, timeId);
|
|
||||||
|
|
||||||
//暂时没有进行拼接
|
|
||||||
String ip = lineDetailData.getIp();
|
|
||||||
String waveName = eventDetailByTime.getWaveName();
|
|
||||||
/* if(StrUtil.isBlank(waveName)){
|
|
||||||
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
AnalyWave analyWave = new AnalyWave();
|
|
||||||
|
|
||||||
|
|
||||||
/*WaveDataDTO comtrade = analyWave.getComtrade(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".CFG", 1);
|
|
||||||
if (Objects.isNull(comtrade.getComtradeCfgDTO())) {
|
|
||||||
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
//测试用的本地路径
|
|
||||||
WaveDataDTO comtrade = analyWave.getComtrade("C:\\Users\\CDF\\Desktop\\00-B7-8D-00-E7-15\\1_20220204_125513_383.cfg", 1);
|
|
||||||
|
|
||||||
|
|
||||||
waveDataDTO = analyWave.getValidData(comtrade);
|
|
||||||
|
|
||||||
|
|
||||||
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
|
|
||||||
double pt1 = Double.parseDouble(lineDetailData.getPt().split("/")[0]);
|
|
||||||
double pt2 = Double.parseDouble(lineDetailData.getPt().split("/")[1]);
|
|
||||||
double ct1 = Double.parseDouble(lineDetailData.getCt().split("/")[0]);
|
|
||||||
double ct2 = Double.parseDouble(lineDetailData.getCt().split("/")[1]);
|
|
||||||
|
|
||||||
waveDataDTO.setPt(pt1 / pt2);
|
|
||||||
waveDataDTO.setCt(ct1 / ct2);
|
|
||||||
|
|
||||||
|
|
||||||
return waveDataDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
import com.njcn.common.pojo.constant.GeneralConstant;
|
||||||
|
import com.njcn.common.pojo.constant.OssPath;
|
||||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.common.utils.wave.AnalyWave;
|
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||||
@@ -17,6 +17,7 @@ import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
|||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.event.enums.EventResponseEnum;
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.event.mapper.majornetwork.TransientMapper;
|
import com.njcn.event.mapper.majornetwork.TransientMapper;
|
||||||
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.TransientParam;
|
import com.njcn.event.pojo.param.TransientParam;
|
||||||
import com.njcn.event.pojo.param.WaveFileParam;
|
import com.njcn.event.pojo.param.WaveFileParam;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
@@ -24,6 +25,8 @@ import com.njcn.event.pojo.po.EventDetailNew;
|
|||||||
import com.njcn.event.pojo.vo.TransientVO;
|
import com.njcn.event.pojo.vo.TransientVO;
|
||||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||||
import com.njcn.event.service.majornetwork.TransientService;
|
import com.njcn.event.service.majornetwork.TransientService;
|
||||||
|
import com.njcn.event.utils.WaveUtil;
|
||||||
|
import com.njcn.huawei.obs.util.OBSUtil;
|
||||||
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
||||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
||||||
@@ -75,6 +78,11 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
|
|
||||||
private final InfluxDbUtils influxDbUtils;
|
private final InfluxDbUtils influxDbUtils;
|
||||||
|
|
||||||
|
private final OBSUtil obsUtil;
|
||||||
|
|
||||||
|
private final WaveUtil waveUtil;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<TransientVO> getTransientData(TransientParam transientParam) {
|
public Page<TransientVO> getTransientData(TransientParam transientParam) {
|
||||||
Page<TransientVO> page = new Page<>();
|
Page<TransientVO> page = new Page<>();
|
||||||
@@ -168,23 +176,47 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
@Override
|
@Override
|
||||||
public WaveDataDTO getTransientAnalyseWave(String timeId, String lineId) {
|
public WaveDataDTO getTransientAnalyseWave(String timeId, String lineId) {
|
||||||
WaveDataDTO waveDataDTO;
|
WaveDataDTO waveDataDTO;
|
||||||
|
//原始数据
|
||||||
|
WaveDataDTO originalData;
|
||||||
//根据监测点id获取监测点详情
|
//根据监测点id获取监测点详情
|
||||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
||||||
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId, timeId);
|
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId, timeId);
|
||||||
String ip = lineDetailData.getIp();
|
String ip = lineDetailData.getIp();
|
||||||
String waveName = eventDetailByTime.getWaveName();
|
String waveName = eventDetailByTime.getWaveName();
|
||||||
AnalyWave analyWave = new AnalyWave();
|
String cfgPath, datPath;
|
||||||
// 从本地读取该事件的波形
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||||
WaveDataDTO comtrade = analyWave.getComtrade(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".CFG", 1);
|
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
|
||||||
if (Objects.isNull(comtrade.getComtradeCfgDTO())) {
|
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
|
||||||
|
InputStream cfgStream = waveUtil.getFileInputStreamByFilePath(cfgPath);
|
||||||
|
InputStream datStream = waveUtil.getFileInputStreamByFilePath(datPath);
|
||||||
|
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||||
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
waveDataDTO = analyWave.getValidData(comtrade);
|
originalData = waveUtil.getComtrade(cfgStream, datStream, 1);
|
||||||
|
// } else if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
|
} else {
|
||||||
|
ip = "192.168.1.190";
|
||||||
|
waveName = "PQMonitor_PQM1_002438_20210508_092859_938";
|
||||||
|
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
||||||
|
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
||||||
|
try (
|
||||||
|
InputStream cfgStream = obsUtil.fileDownload(cfgPath);
|
||||||
|
InputStream datStream = obsUtil.fileDownload(datPath)
|
||||||
|
) {
|
||||||
|
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||||
|
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
originalData = waveUtil.getComtrade(cfgStream, datStream, 1);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new BusinessException(EventResponseEnum.WAVE_DATA_INVALID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
waveDataDTO = waveUtil.getValidData(originalData);
|
||||||
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
|
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
|
||||||
double pt1 = Double.parseDouble(lineDetailData.getPt().split("/")[0]);
|
double pt1 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[0]);
|
||||||
double pt2 = Double.parseDouble(lineDetailData.getPt().split("/")[1]);
|
double pt2 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[1]);
|
||||||
double ct1 = Double.parseDouble(lineDetailData.getCt().split("/")[0]);
|
double ct1 = Double.parseDouble(lineDetailData.getCt().split(StrUtil.SLASH)[0]);
|
||||||
double ct2 = Double.parseDouble(lineDetailData.getCt().split("/")[1]);
|
double ct2 = Double.parseDouble(lineDetailData.getCt().split(StrUtil.SLASH)[1]);
|
||||||
waveDataDTO.setPt(pt1 / pt2);
|
waveDataDTO.setPt(pt1 / pt2);
|
||||||
waveDataDTO.setCt(ct1 / ct2);
|
waveDataDTO.setCt(ct1 / ct2);
|
||||||
return waveDataDTO;
|
return waveDataDTO;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.event.service.majornetwork;
|
package com.njcn.event.service.majornetwork;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.TransientParam;
|
import com.njcn.event.pojo.param.TransientParam;
|
||||||
import com.njcn.event.pojo.param.WaveFileParam;
|
import com.njcn.event.pojo.param.WaveFileParam;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.njcn.event.utils;
|
||||||
|
|
||||||
|
public class BitConverter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte数组转换为无符号short整数
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param off 开始位置
|
||||||
|
* @return short整数
|
||||||
|
*/
|
||||||
|
public static short byte2ToUnsignedShort(byte[] bytes, int off) {
|
||||||
|
int low = bytes[off]& 0xFF;
|
||||||
|
int high = bytes[off + 1]& 0xFF;
|
||||||
|
return (short)(((high & 0x00FF) << 8) | (0x00FF & low));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字节转换为浮点
|
||||||
|
*
|
||||||
|
* @param b 字节(至少4个字节)
|
||||||
|
* @param index 开始位置
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static float byte4float(byte[] b, int index) {
|
||||||
|
/* b=new byte[4];
|
||||||
|
b[0]=-16;
|
||||||
|
b[1]=-1;
|
||||||
|
b[2]=117;
|
||||||
|
b[3]=66;*/
|
||||||
|
|
||||||
|
int l;
|
||||||
|
l = b[index + 0];
|
||||||
|
l &= 0xff;
|
||||||
|
l |= ((long) b[index + 1] << 8);
|
||||||
|
l &= 0xffff;
|
||||||
|
l |= ((long) b[index + 2] << 16);
|
||||||
|
l &= 0xffffff;
|
||||||
|
l |= ((long) b[index + 3] << 24);
|
||||||
|
return Float.intBitsToFloat(l);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* byte数组转换为int32整数
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param off 开始位置
|
||||||
|
* @return int整数
|
||||||
|
*/
|
||||||
|
public static int byte4ToInt(byte[] bytes, int off) {
|
||||||
|
int b0 = bytes[off] & 0xFF;
|
||||||
|
int b1 = bytes[off + 1] & 0xFF;
|
||||||
|
int b2 = bytes[off + 2] & 0xFF;
|
||||||
|
int b3 = bytes[off + 3] & 0xFF;
|
||||||
|
return (b3 << 24) | (b2 << 16) | (b1 << 8) | b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte数组转换为int16整数
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param off 开始位置
|
||||||
|
* @return int整数
|
||||||
|
*/
|
||||||
|
public static int byte2ToInt(byte[] bytes, int off) {
|
||||||
|
int b0 = bytes[off] & 0xFF;
|
||||||
|
int b1 = bytes[off + 1] & 0xFF;
|
||||||
|
return (b1 << 8) | b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte数组转换为int16整数
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param off 开始位置
|
||||||
|
* @return int整数
|
||||||
|
*/
|
||||||
|
public static long byte4ToLong(byte[] bytes, int off) {
|
||||||
|
long b0 = bytes[off] & 0xFF;
|
||||||
|
long b1 = bytes[off + 1] & 0xFF;
|
||||||
|
long b2 = bytes[off + 2] & 0xFF;
|
||||||
|
long b3 = bytes[off + 3] & 0xFF;
|
||||||
|
|
||||||
|
return (b3 << 24) | (b2 << 16) | (b1 << 8) | b0;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -44,3 +44,4 @@ mybatis-plus:
|
|||||||
type-aliases-package: com.njcn.event.pojo
|
type-aliases-package: com.njcn.event.pojo
|
||||||
mqtt:
|
mqtt:
|
||||||
client-id: @artifactId@${random.value}
|
client-id: @artifactId@${random.value}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
package com.njcn.event;
|
package com.njcn.event;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.OssPath;
|
||||||
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.event.pojo.PqsEventDetail;
|
import com.njcn.event.pojo.PqsEventDetail;
|
||||||
import com.njcn.event.pojo.PqsOnlinerateAggregate;
|
import com.njcn.event.pojo.PqsOnlinerateAggregate;
|
||||||
import com.njcn.event.pojo.PqsEventDetailCount;
|
import com.njcn.event.pojo.PqsEventDetailCount;
|
||||||
|
import com.njcn.event.pojo.dto.wave.EigenvalueDTO;
|
||||||
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
|
import com.njcn.event.utils.WaveUtil;
|
||||||
|
import com.njcn.huawei.obs.util.OBSUtil;
|
||||||
import com.njcn.influxdb.config.InfluxDbConfig;
|
import com.njcn.influxdb.config.InfluxDbConfig;
|
||||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||||
import org.influxdb.dto.QueryResult;
|
import org.influxdb.dto.QueryResult;
|
||||||
@@ -20,8 +26,14 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
import static com.njcn.influxdb.param.InfluxDBPublicParam.PQS_EVENT_DETAIL;
|
import static com.njcn.influxdb.param.InfluxDBPublicParam.PQS_EVENT_DETAIL;
|
||||||
@@ -40,6 +52,12 @@ public class EventBootApplicationTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private InfluxDbUtils influxDbUtils;
|
private InfluxDbUtils influxDbUtils;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WaveUtil waveUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OBSUtil obsUtil;
|
||||||
|
|
||||||
// TODO https://github.com/influxdata/influxdb-java/blob/master/QUERY_BUILDER.md
|
// TODO https://github.com/influxdata/influxdb-java/blob/master/QUERY_BUILDER.md
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -120,4 +138,28 @@ public class EventBootApplicationTest {
|
|||||||
andNested.close();
|
andNested.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHuaweiOBS() throws FileNotFoundException {
|
||||||
|
|
||||||
|
String cfgPath = OssPath.WAVE_DIR+"192.168.1.190/PQMonitor_PQM1_002438_20210508_092859_938.CFG";
|
||||||
|
String datPath = OssPath.WAVE_DIR+"192.168.1.190/PQMonitor_PQM1_002438_20210508_092859_938.DAT";
|
||||||
|
|
||||||
|
InputStream cfgStream =obsUtil.fileDownload(cfgPath);
|
||||||
|
InputStream datStream =obsUtil.fileDownload(datPath);
|
||||||
|
|
||||||
|
if(Objects.isNull(cfgStream) || Objects.isNull(datStream)){
|
||||||
|
throw new FileNotFoundException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取瞬时波形 //获取原始波形值
|
||||||
|
WaveDataDTO waveDataDTO = waveUtil.getComtrade(cfgStream,datStream, 1);
|
||||||
|
|
||||||
|
// 获取RMS波形
|
||||||
|
WaveDataDTO waveDataDTO1 = waveUtil.getValidData(waveDataDTO);
|
||||||
|
|
||||||
|
// 获取特征值
|
||||||
|
List<EigenvalueDTO> lstEigenvalueDTO = waveUtil.getEigenvalue(waveDataDTO, true);
|
||||||
|
System.out.println(1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,13 @@
|
|||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--华为obs工具包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>huawei-obs-springboot-starter</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class Test1 extends BaseJunitTest{
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMethod(){
|
public void testMethod(){
|
||||||
InfluxDbUtils influxDBUtil = new InfluxDbUtils(influxDbConfig.getUserName(), influxDbConfig.getPassword(), influxDbConfig.getInfluxDBUrl(), influxDbConfig.getDatabase(), "");
|
InfluxDbUtils influxDBUtil = new InfluxDbUtils(influxDbConfig.getUser(), influxDbConfig.getPassword(), influxDbConfig.getUrl(), influxDbConfig.getDatabase(), "");
|
||||||
SelectQueryImpl selectQuery = select().from(influxDbConfig.getDatabase(),"data_flicker").where(eq("fluc",0)).limit(1).tz("Asia/Shanghai");
|
SelectQueryImpl selectQuery = select().from(influxDbConfig.getDatabase(),"data_flicker").where(eq("fluc",0)).limit(1).tz("Asia/Shanghai");
|
||||||
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
||||||
QueryResult queryResult = influxDBUtil.query(selectQuery.getCommand());
|
QueryResult queryResult = influxDBUtil.query(selectQuery.getCommand());
|
||||||
|
|||||||
Reference in New Issue
Block a user