1.调整适配辽宁现场新能源场站
This commit is contained in:
@@ -64,19 +64,7 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 多数据源切换,当数据源为oracle时需要使用 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 多数据源切换,当数据源为oracle时需要使用 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>${dynamic-datasource.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
@@ -122,7 +110,6 @@
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>data-processing-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.njcn.harmonic.mapper.influxdb;
|
||||
|
||||
import com.njcn.dataProcess.po.influx.DataHarmrateI;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
public interface DataHarmRateIMapper extends InfluxDbBaseMapper<DataHarmrateI> {
|
||||
|
||||
}
|
||||
//package com.njcn.harmonic.mapper.influxdb;
|
||||
//
|
||||
//import com.njcn.dataProcess.po.influx.DataHarmrateI;
|
||||
//import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
//
|
||||
///**
|
||||
// * @author xy
|
||||
// */
|
||||
//public interface DataHarmRateIMapper extends InfluxDbBaseMapper<DataHarmrateI> {
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.njcn.harmonic.mapper.influxdb;
|
||||
|
||||
import com.njcn.dataProcess.po.influx.DataHarmrateV;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
public interface DataHarmRateVMapper extends InfluxDbBaseMapper<DataHarmrateV> {
|
||||
|
||||
}
|
||||
//package com.njcn.harmonic.mapper.influxdb;
|
||||
//
|
||||
//import com.njcn.dataProcess.po.influx.DataHarmrateV;
|
||||
//import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
//
|
||||
///**
|
||||
// * @author xy
|
||||
// */
|
||||
//public interface DataHarmRateVMapper extends InfluxDbBaseMapper<DataHarmrateV> {
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.njcn.harmonic.mapper.influxdb;
|
||||
|
||||
import com.njcn.dataProcess.po.influx.DataI;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/7 18:49
|
||||
*/
|
||||
public interface DataIMapper extends InfluxDbBaseMapper<DataI> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
//package com.njcn.harmonic.mapper.influxdb;
|
||||
//
|
||||
//import com.njcn.dataProcess.po.influx.DataI;
|
||||
//import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * @author hongawen
|
||||
// * @version 1.0
|
||||
// * @data 2024/11/7 18:49
|
||||
// */
|
||||
//public interface DataIMapper extends InfluxDbBaseMapper<DataI> {
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.njcn.harmonic.mapper.influxdb;
|
||||
|
||||
|
||||
import com.njcn.dataProcess.po.influx.DataInharmV;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-12-28
|
||||
*/
|
||||
public interface DataInharmVMapper extends InfluxDbBaseMapper<DataInharmV> {
|
||||
|
||||
}
|
||||
//package com.njcn.harmonic.mapper.influxdb;
|
||||
//
|
||||
//
|
||||
//import com.njcn.dataProcess.po.influx.DataInharmV;
|
||||
//import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
//
|
||||
///**
|
||||
// * <p>
|
||||
// * Mapper 接口
|
||||
// * </p>
|
||||
// *
|
||||
// * @author hongawen
|
||||
// * @since 2023-12-28
|
||||
// */
|
||||
//public interface DataInharmVMapper extends InfluxDbBaseMapper<DataInharmV> {
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.njcn.harmonic.mapper.influxdb;
|
||||
|
||||
|
||||
import com.njcn.dataProcess.po.influx.DataPlt;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-12-28
|
||||
*/
|
||||
public interface DataPltMapper extends InfluxDbBaseMapper<DataPlt> {
|
||||
|
||||
}
|
||||
//package com.njcn.harmonic.mapper.influxdb;
|
||||
//
|
||||
//
|
||||
//import com.njcn.dataProcess.po.influx.DataPlt;
|
||||
//import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
//
|
||||
///**
|
||||
// * <p>
|
||||
// * Mapper 接口
|
||||
// * </p>
|
||||
// *
|
||||
// * @author hongawen
|
||||
// * @since 2023-12-28
|
||||
// */
|
||||
//public interface DataPltMapper extends InfluxDbBaseMapper<DataPlt> {
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
package com.njcn.harmonic.mapper.influxdb;
|
||||
|
||||
import com.njcn.dataProcess.dto.LineDataVFiveItemDTO;
|
||||
import com.njcn.dataProcess.dto.MeasurementCountDTO;
|
||||
import com.njcn.dataProcess.po.influx.DataV;
|
||||
import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/7 18:49
|
||||
*/
|
||||
public interface DataVMapper extends InfluxDbBaseMapper<DataV> {
|
||||
|
||||
|
||||
List<LineDataVFiveItemDTO> queryDataValue(InfluxQueryWrapper dataVQueryWrapper);
|
||||
|
||||
|
||||
List<MeasurementCountDTO> getMeasurementCount(InfluxQueryWrapper influxQueryWrapper);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//package com.njcn.harmonic.mapper.influxdb;
|
||||
//
|
||||
//import com.njcn.dataProcess.dto.LineDataVFiveItemDTO;
|
||||
//import com.njcn.dataProcess.dto.MeasurementCountDTO;
|
||||
//import com.njcn.dataProcess.po.influx.DataV;
|
||||
//import com.njcn.influx.base.InfluxDbBaseMapper;
|
||||
//import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author hongawen
|
||||
// * @version 1.0
|
||||
// * @data 2024/11/7 18:49
|
||||
// */
|
||||
//public interface DataVMapper extends InfluxDbBaseMapper<DataV> {
|
||||
//
|
||||
//
|
||||
// List<LineDataVFiveItemDTO> queryDataValue(InfluxQueryWrapper dataVQueryWrapper);
|
||||
//
|
||||
//
|
||||
// List<MeasurementCountDTO> getMeasurementCount(InfluxQueryWrapper influxQueryWrapper);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.njcn.harmonic.service.influxdb.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
|
||||
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmrateV;
|
||||
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
||||
import com.njcn.harmonic.mapper.influxdb.DataHarmRateVMapper;
|
||||
import com.njcn.harmonic.service.influxdb.IDataHarmRateV;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.influx.imapper.DataHarmRateVMapper;
|
||||
import com.njcn.influx.pojo.po.DataHarmRateV;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -31,7 +32,7 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
private final DataHarmRateVMapper dataHarmRateVMapper;
|
||||
private final DataHarmRateVMapper DataHarmRateVMapper;
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
@@ -48,7 +49,7 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
|
||||
@Override
|
||||
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmDto> result = new ArrayList<>();
|
||||
List<DataHarmrateV> list = getMinuteData(lineParam);
|
||||
List<DataHarmRateV> list = getMinuteData(lineParam);
|
||||
list.forEach(item->{
|
||||
DataHarmDto dto = new DataHarmDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -68,30 +69,30 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
|
||||
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
|
||||
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
|
||||
*/
|
||||
public List<DataHarmrateV> getMinuteData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmrateV> dataList;
|
||||
List<DataHarmrateV> result = new ArrayList<>();
|
||||
List<DataHarmrateV> data = new ArrayList<>();
|
||||
public List<DataHarmRateV> getMinuteData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmRateV> dataList;
|
||||
List<DataHarmRateV> result = new ArrayList<>();
|
||||
List<DataHarmRateV> data = new ArrayList<>();
|
||||
//获取监测点、接线方式数据
|
||||
Type type = new TypeToken<Map<String, Integer>>(){}.getType();
|
||||
Map<String, Integer> map = new Gson().fromJson(
|
||||
String.valueOf(redisUtil.getObjectByKey("wlLineDetail")),
|
||||
type
|
||||
);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateV.class);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmRateV.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataHarmrateV::getLineId, lineParam.getLineId())
|
||||
.select(DataHarmrateV::getLineId)
|
||||
.select(DataHarmrateV::getPhasicType)
|
||||
.select(DataHarmrateV::getValueType)
|
||||
.select(DataHarmrateV::getQualityFlag)
|
||||
.select(DataHarmrateV::getAbnormalFlag)
|
||||
.between(DataHarmrateV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataHarmrateV::getQualityFlag,"0");
|
||||
influxQueryWrapper.regular(DataHarmRateV::getLineId, lineParam.getLineId())
|
||||
.select(DataHarmRateV::getLineId)
|
||||
.select(DataHarmRateV::getPhaseType)
|
||||
.select(DataHarmRateV::getValueType)
|
||||
.select(DataHarmRateV::getQualityFlag)
|
||||
.select(DataHarmRateV::getAbnormalFlag)
|
||||
.between(DataHarmRateV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataHarmRateV::getQualityFlag,"0");
|
||||
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
|
||||
influxQueryWrapper.regular(DataHarmrateV::getPhasicType,lineParam.getPhasicType());
|
||||
influxQueryWrapper.regular(DataHarmRateV::getPhaseType,lineParam.getPhasicType());
|
||||
}
|
||||
List<DataHarmrateV> list = dataHarmRateVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
List<DataHarmRateV> list = DataHarmRateVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
//过滤掉暂态事件影响的数据 true过滤 false不过滤
|
||||
if (lineParam.getDataType()) {
|
||||
@@ -99,14 +100,14 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
|
||||
} else {
|
||||
dataList = list;
|
||||
}
|
||||
Map<String,List<DataHarmrateV>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataHarmrateV::getLineId));
|
||||
Map<String,List<DataHarmRateV>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataHarmRateV::getLineId));
|
||||
//有异常数据
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
|
||||
lineMap.forEach((k,v)->{
|
||||
List<String> timeList = lineParam.getAbnormalTime().get(k);
|
||||
//有异常数据,当前监测点自身的异常数据
|
||||
if (CollectionUtil.isNotEmpty(timeList)) {
|
||||
List<DataHarmrateV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
|
||||
List<DataHarmRateV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
|
||||
//1.过滤掉异常数据后还有正常数据,则用正常数据计算
|
||||
if (CollectionUtil.isNotEmpty(filterList)) {
|
||||
result.addAll(filterList);
|
||||
@@ -131,14 +132,14 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
if (!Objects.isNull(map)) {
|
||||
//现根据监测点分组,然后根据接线方式排除多于数据,在修改相别
|
||||
Map<String, List<DataHarmrateV>> lineMap = result.stream().collect(Collectors.groupingBy(DataHarmrateV::getLineId));
|
||||
Map<String, List<DataHarmRateV>> lineMap = result.stream().collect(Collectors.groupingBy(DataHarmRateV::getLineId));
|
||||
lineMap.forEach((k,v)->{
|
||||
if (Objects.isNull(map.get(k))) {
|
||||
return;
|
||||
}
|
||||
Integer conType = map.get(k);
|
||||
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES;
|
||||
List<DataHarmrateV> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhasicType())).collect(Collectors.toList());
|
||||
List<DataHarmRateV> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhaseType())).collect(Collectors.toList());
|
||||
data.addAll(result2);
|
||||
});
|
||||
} else {
|
||||
@@ -146,9 +147,9 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
data.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
String newType = PHASE_MAPPING.get(item.getPhaseType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
item.setPhaseType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataI;
|
||||
import com.njcn.dataProcess.pojo.dto.DataIDto;
|
||||
import com.njcn.harmonic.mapper.influxdb.DataIMapper;
|
||||
import com.njcn.harmonic.service.influxdb.IDataI;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.influx.imapper.DataIMapper;
|
||||
import com.njcn.influx.pojo.po.DataI;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -69,7 +69,7 @@ public class InfluxdbDataIImpl implements IDataI {
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, InfluxDbSqlConstant.I, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataI::getLineId, lineParam.getLineId())
|
||||
.select(DataI::getLineId)
|
||||
.select(DataI::getPhasicType)
|
||||
.select(DataI::getPhaseType)
|
||||
.select(DataI::getValueType)
|
||||
.select(DataI::getINeg)
|
||||
.select(DataI::getIPos)
|
||||
@@ -82,7 +82,7 @@ public class InfluxdbDataIImpl implements IDataI {
|
||||
.between(DataI::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataI::getQualityFlag,"0");
|
||||
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
|
||||
influxQueryWrapper.regular(DataI::getPhasicType,lineParam.getPhasicType());
|
||||
influxQueryWrapper.regular(DataI::getPhaseType,lineParam.getPhasicType());
|
||||
}
|
||||
|
||||
List<DataI> list = dataIMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
@@ -124,9 +124,9 @@ public class InfluxdbDataIImpl implements IDataI {
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
String newType = PHASE_MAPPING.get(item.getPhaseType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
item.setPhaseType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataInharmV;
|
||||
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
||||
import com.njcn.harmonic.mapper.influxdb.DataInharmVMapper;
|
||||
import com.njcn.harmonic.service.influxdb.IDataInHarmV;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.influx.imapper.DataInHarmVMapper;
|
||||
import com.njcn.influx.pojo.po.DataInHarmV;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
|
||||
public class InfluxdbDataInharmVImpl implements IDataInHarmV {
|
||||
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
private final DataInharmVMapper dataInharmVMapper;
|
||||
private final DataInHarmVMapper DataInHarmVMapper;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
@@ -46,7 +46,7 @@ public class InfluxdbDataInharmVImpl implements IDataInHarmV {
|
||||
@Override
|
||||
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmDto> result = new ArrayList<>();
|
||||
List<DataInharmV> list = getMinuteData(lineParam);
|
||||
List<DataInHarmV> list = getMinuteData(lineParam);
|
||||
list.forEach(item->{
|
||||
DataHarmDto dto = new DataHarmDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -66,23 +66,23 @@ public class InfluxdbDataInharmVImpl implements IDataInHarmV {
|
||||
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
|
||||
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
|
||||
*/
|
||||
public List<DataInharmV> getMinuteData(LineCountEvaluateParam lineParam) {
|
||||
List<DataInharmV> dataList;
|
||||
List<DataInharmV> result = new ArrayList<>();
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmV.class);
|
||||
public List<DataInHarmV> getMinuteData(LineCountEvaluateParam lineParam) {
|
||||
List<DataInHarmV> dataList;
|
||||
List<DataInHarmV> result = new ArrayList<>();
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInHarmV.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataInharmV::getLineId, lineParam.getLineId())
|
||||
.select(DataInharmV::getLineId)
|
||||
.select(DataInharmV::getPhasicType)
|
||||
.select(DataInharmV::getValueType)
|
||||
.select(DataInharmV::getQualityFlag)
|
||||
.select(DataInharmV::getAbnormalFlag)
|
||||
.between(DataInharmV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataInharmV::getQualityFlag,"0");
|
||||
influxQueryWrapper.regular(DataInHarmV::getLineId, lineParam.getLineId())
|
||||
.select(DataInHarmV::getLineId)
|
||||
.select(DataInHarmV::getPhaseType)
|
||||
.select(DataInHarmV::getValueType)
|
||||
.select(DataInHarmV::getQualityFlag)
|
||||
.select(DataInHarmV::getAbnormalFlag)
|
||||
.between(DataInHarmV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataInHarmV::getQualityFlag,"0");
|
||||
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
|
||||
influxQueryWrapper.regular(DataInharmV::getPhasicType,lineParam.getPhasicType());
|
||||
influxQueryWrapper.regular(DataInHarmV::getPhaseType,lineParam.getPhasicType());
|
||||
}
|
||||
List<DataInharmV> list = dataInharmVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
List<DataInHarmV> list = DataInHarmVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
//过滤掉暂态事件影响的数据 true过滤 false不过滤
|
||||
if (lineParam.getDataType()) {
|
||||
@@ -90,14 +90,14 @@ public class InfluxdbDataInharmVImpl implements IDataInHarmV {
|
||||
} else {
|
||||
dataList = list;
|
||||
}
|
||||
Map<String,List<DataInharmV>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataInharmV::getLineId));
|
||||
Map<String,List<DataInHarmV>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataInHarmV::getLineId));
|
||||
//有异常数据
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
|
||||
lineMap.forEach((k,v)->{
|
||||
List<String> timeList = lineParam.getAbnormalTime().get(k);
|
||||
//有异常数据,当前监测点自身的异常数据
|
||||
if (CollectionUtil.isNotEmpty(timeList)) {
|
||||
List<DataInharmV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
|
||||
List<DataInHarmV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
|
||||
//1.过滤掉异常数据后还有正常数据,则用正常数据计算
|
||||
if (CollectionUtil.isNotEmpty(filterList)) {
|
||||
result.addAll(filterList);
|
||||
@@ -121,9 +121,9 @@ public class InfluxdbDataInharmVImpl implements IDataInHarmV {
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
String newType = PHASE_MAPPING.get(item.getPhaseType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
item.setPhaseType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataPlt;
|
||||
import com.njcn.dataProcess.po.influx.DataV;
|
||||
import com.njcn.influx.pojo.po.DataPlt;
|
||||
import com.njcn.dataProcess.pojo.dto.DataPltDto;
|
||||
import com.njcn.harmonic.mapper.influxdb.DataPltMapper;
|
||||
import com.njcn.harmonic.service.influxdb.IDataPlt;
|
||||
import com.njcn.influx.imapper.DataPltMapper;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -80,14 +80,14 @@ public class InfluxdbDataPltImpl implements IDataPlt {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataPlt.class);
|
||||
influxQueryWrapper.regular(DataPlt::getLineId, lineParam.getLineId())
|
||||
.select(DataPlt::getLineId)
|
||||
.select(DataPlt::getPhasicType)
|
||||
.select(DataPlt::getPhaseType)
|
||||
.select(DataPlt::getPlt)
|
||||
.select(DataPlt::getQualityFlag)
|
||||
.select(DataPlt::getAbnormalFlag)
|
||||
.between(DataPlt::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataPlt::getQualityFlag,"0");
|
||||
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
|
||||
influxQueryWrapper.regular(DataV::getPhasicType,lineParam.getPhasicType());
|
||||
influxQueryWrapper.regular(DataV::getPhaseType,lineParam.getPhasicType());
|
||||
}
|
||||
List<DataPlt> list = dataPltMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
@@ -136,7 +136,7 @@ public class InfluxdbDataPltImpl implements IDataPlt {
|
||||
}
|
||||
Integer conType = map.get(k);
|
||||
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES;
|
||||
List<DataPlt> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhasicType())).collect(Collectors.toList());
|
||||
List<DataPlt> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhaseType())).collect(Collectors.toList());
|
||||
data.addAll(result2);
|
||||
});
|
||||
} else {
|
||||
@@ -144,9 +144,9 @@ public class InfluxdbDataPltImpl implements IDataPlt {
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
data.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
String newType = PHASE_MAPPING.get(item.getPhaseType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
item.setPhaseType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataVDto;
|
||||
import com.njcn.harmonic.mapper.influxdb.DataVMapper;
|
||||
import com.njcn.harmonic.service.influxdb.IDataV;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.dataProcess.po.influx.DataV;
|
||||
import com.njcn.influx.imapper.DataVMapper;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -86,7 +86,7 @@ public class InfluxdbDataVImpl implements IDataV {
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
||||
.select(DataV::getLineId)
|
||||
.select(DataV::getPhasicType)
|
||||
.select(DataV::getPhaseType)
|
||||
.select(DataV::getValueType)
|
||||
.select(DataV::getFreq)
|
||||
.select(DataV::getFreqDev)
|
||||
@@ -104,7 +104,7 @@ public class InfluxdbDataVImpl implements IDataV {
|
||||
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataV::getQualityFlag, "0");
|
||||
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||
influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType());
|
||||
influxQueryWrapper.regular(DataV::getPhaseType, lineParam.getPhasicType());
|
||||
}
|
||||
quality(result, influxQueryWrapper, lineParam);
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
@@ -117,18 +117,18 @@ public class InfluxdbDataVImpl implements IDataV {
|
||||
}
|
||||
//这边需要特殊处理下,将线电压数据赋值
|
||||
Map<String, DataV> lineVoltageIndex = v.stream()
|
||||
.filter(d -> PHASE_MAPPING.containsKey(d.getPhasicType()))
|
||||
.filter(d -> PHASE_MAPPING.containsKey(d.getPhaseType()))
|
||||
.filter(d -> d.getRmsLvr() != null)
|
||||
.collect(Collectors.toMap(
|
||||
d -> buildKey(d.getTime(), d.getValueType(), d.getPhasicType()),
|
||||
d -> buildKey(d.getTime(), d.getValueType(), d.getPhaseType()),
|
||||
Function.identity(),
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
v.stream()
|
||||
.filter(d -> PHASE_VOLTAGE_TYPES.contains(d.getPhasicType()))
|
||||
.filter(d -> PHASE_VOLTAGE_TYPES.contains(d.getPhaseType()))
|
||||
.forEach(phaseData -> {
|
||||
// 根据当前相电压反查对应的线电压相别
|
||||
String targetLinePhasic = getReverseLinePhasic(phaseData.getPhasicType());
|
||||
String targetLinePhasic = getReverseLinePhasic(phaseData.getPhaseType());
|
||||
if (targetLinePhasic == null) {
|
||||
return;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class InfluxdbDataVImpl implements IDataV {
|
||||
});
|
||||
Integer conType = map.get(k);
|
||||
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES;
|
||||
List<DataV> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhasicType())).collect(Collectors.toList());
|
||||
List<DataV> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhaseType())).collect(Collectors.toList());
|
||||
data.addAll(result2);
|
||||
});
|
||||
} else {
|
||||
@@ -148,9 +148,9 @@ public class InfluxdbDataVImpl implements IDataV {
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
data.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
String newType = PHASE_MAPPING.get(item.getPhaseType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
item.setPhaseType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user