1.调整适配辽宁现场新能源场站

This commit is contained in:
2026-07-01 15:14:57 +08:00
parent 687f878b5f
commit ce9b2b62d9
12 changed files with 173 additions and 185 deletions

View File

@@ -64,19 +64,7 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </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> <dependency>
<groupId>com.oracle.database.jdbc</groupId> <groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId> <artifactId>ojdbc8</artifactId>
@@ -122,7 +110,6 @@
<groupId>com.njcn.platform</groupId> <groupId>com.njcn.platform</groupId>
<artifactId>data-processing-api</artifactId> <artifactId>data-processing-api</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -1,11 +1,11 @@
package com.njcn.harmonic.mapper.influxdb; //package com.njcn.harmonic.mapper.influxdb;
//
import com.njcn.dataProcess.po.influx.DataHarmrateI; //import com.njcn.dataProcess.po.influx.DataHarmrateI;
import com.njcn.influx.base.InfluxDbBaseMapper; //import com.njcn.influx.base.InfluxDbBaseMapper;
//
/** ///**
* @author xy // * @author xy
*/ // */
public interface DataHarmRateIMapper extends InfluxDbBaseMapper<DataHarmrateI> { //public interface DataHarmRateIMapper extends InfluxDbBaseMapper<DataHarmrateI> {
//
} //}

View File

@@ -1,11 +1,11 @@
package com.njcn.harmonic.mapper.influxdb; //package com.njcn.harmonic.mapper.influxdb;
//
import com.njcn.dataProcess.po.influx.DataHarmrateV; //import com.njcn.dataProcess.po.influx.DataHarmrateV;
import com.njcn.influx.base.InfluxDbBaseMapper; //import com.njcn.influx.base.InfluxDbBaseMapper;
//
/** ///**
* @author xy // * @author xy
*/ // */
public interface DataHarmRateVMapper extends InfluxDbBaseMapper<DataHarmrateV> { //public interface DataHarmRateVMapper extends InfluxDbBaseMapper<DataHarmrateV> {
//
} //}

View File

@@ -1,16 +1,16 @@
package com.njcn.harmonic.mapper.influxdb; //package com.njcn.harmonic.mapper.influxdb;
//
import com.njcn.dataProcess.po.influx.DataI; //import com.njcn.dataProcess.po.influx.DataI;
import com.njcn.influx.base.InfluxDbBaseMapper; //import com.njcn.influx.base.InfluxDbBaseMapper;
//
//
/** ///**
* @author hongawen // * @author hongawen
* @version 1.0 // * @version 1.0
* @data 2024/11/7 18:49 // * @data 2024/11/7 18:49
*/ // */
public interface DataIMapper extends InfluxDbBaseMapper<DataI> { //public interface DataIMapper extends InfluxDbBaseMapper<DataI> {
//
//
//
} //}

View File

@@ -1,17 +1,17 @@
package com.njcn.harmonic.mapper.influxdb; //package com.njcn.harmonic.mapper.influxdb;
//
//
import com.njcn.dataProcess.po.influx.DataInharmV; //import com.njcn.dataProcess.po.influx.DataInharmV;
import com.njcn.influx.base.InfluxDbBaseMapper; //import com.njcn.influx.base.InfluxDbBaseMapper;
//
/** ///**
* <p> // * <p>
* Mapper 接口 // * Mapper 接口
* </p> // * </p>
* // *
* @author hongawen // * @author hongawen
* @since 2023-12-28 // * @since 2023-12-28
*/ // */
public interface DataInharmVMapper extends InfluxDbBaseMapper<DataInharmV> { //public interface DataInharmVMapper extends InfluxDbBaseMapper<DataInharmV> {
//
} //}

View File

@@ -1,17 +1,17 @@
package com.njcn.harmonic.mapper.influxdb; //package com.njcn.harmonic.mapper.influxdb;
//
//
import com.njcn.dataProcess.po.influx.DataPlt; //import com.njcn.dataProcess.po.influx.DataPlt;
import com.njcn.influx.base.InfluxDbBaseMapper; //import com.njcn.influx.base.InfluxDbBaseMapper;
//
/** ///**
* <p> // * <p>
* Mapper 接口 // * Mapper 接口
* </p> // * </p>
* // *
* @author hongawen // * @author hongawen
* @since 2023-12-28 // * @since 2023-12-28
*/ // */
public interface DataPltMapper extends InfluxDbBaseMapper<DataPlt> { //public interface DataPltMapper extends InfluxDbBaseMapper<DataPlt> {
//
} //}

View File

@@ -1,27 +1,27 @@
package com.njcn.harmonic.mapper.influxdb; //package com.njcn.harmonic.mapper.influxdb;
//
import com.njcn.dataProcess.dto.LineDataVFiveItemDTO; //import com.njcn.dataProcess.dto.LineDataVFiveItemDTO;
import com.njcn.dataProcess.dto.MeasurementCountDTO; //import com.njcn.dataProcess.dto.MeasurementCountDTO;
import com.njcn.dataProcess.po.influx.DataV; //import com.njcn.dataProcess.po.influx.DataV;
import com.njcn.influx.base.InfluxDbBaseMapper; //import com.njcn.influx.base.InfluxDbBaseMapper;
import com.njcn.influx.query.InfluxQueryWrapper; //import com.njcn.influx.query.InfluxQueryWrapper;
//
import java.util.List; //import java.util.List;
//
/** ///**
* @author hongawen // * @author hongawen
* @version 1.0 // * @version 1.0
* @data 2024/11/7 18:49 // * @data 2024/11/7 18:49
*/ // */
public interface DataVMapper extends InfluxDbBaseMapper<DataV> { //public interface DataVMapper extends InfluxDbBaseMapper<DataV> {
//
//
List<LineDataVFiveItemDTO> queryDataValue(InfluxQueryWrapper dataVQueryWrapper); // List<LineDataVFiveItemDTO> queryDataValue(InfluxQueryWrapper dataVQueryWrapper);
//
//
List<MeasurementCountDTO> getMeasurementCount(InfluxQueryWrapper influxQueryWrapper); // List<MeasurementCountDTO> getMeasurementCount(InfluxQueryWrapper influxQueryWrapper);
//
//
//
//
} //}

View File

@@ -1,17 +1,18 @@
package com.njcn.harmonic.service.influxdb.impl; package com.njcn.harmonic.service.influxdb.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.njcn.common.utils.HarmonicTimesUtil; import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.po.influx.DataHarmrateV;
import com.njcn.dataProcess.pojo.dto.DataHarmDto; import com.njcn.dataProcess.pojo.dto.DataHarmDto;
import com.njcn.harmonic.mapper.influxdb.DataHarmRateVMapper;
import com.njcn.harmonic.service.influxdb.IDataHarmRateV; import com.njcn.harmonic.service.influxdb.IDataHarmRateV;
import com.njcn.influx.constant.InfluxDbSqlConstant; 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.influx.query.InfluxQueryWrapper;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -31,7 +32,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV { public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()); 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
put("BC", "B"); put("BC", "B");
@@ -48,7 +49,7 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
@Override @Override
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) { public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
List<DataHarmDto> result = new ArrayList<>(); List<DataHarmDto> result = new ArrayList<>();
List<DataHarmrateV> list = getMinuteData(lineParam); List<DataHarmRateV> list = getMinuteData(lineParam);
list.forEach(item->{ list.forEach(item->{
DataHarmDto dto = new DataHarmDto(); DataHarmDto dto = new DataHarmDto();
BeanUtils.copyProperties(item,dto); BeanUtils.copyProperties(item,dto);
@@ -68,30 +69,30 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据; * 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常 * 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
*/ */
public List<DataHarmrateV> getMinuteData(LineCountEvaluateParam lineParam) { public List<DataHarmRateV> getMinuteData(LineCountEvaluateParam lineParam) {
List<DataHarmrateV> dataList; List<DataHarmRateV> dataList;
List<DataHarmrateV> result = new ArrayList<>(); List<DataHarmRateV> result = new ArrayList<>();
List<DataHarmrateV> data = new ArrayList<>(); List<DataHarmRateV> data = new ArrayList<>();
//获取监测点、接线方式数据 //获取监测点、接线方式数据
Type type = new TypeToken<Map<String, Integer>>(){}.getType(); Type type = new TypeToken<Map<String, Integer>>(){}.getType();
Map<String, Integer> map = new Gson().fromJson( Map<String, Integer> map = new Gson().fromJson(
String.valueOf(redisUtil.getObjectByKey("wlLineDetail")), String.valueOf(redisUtil.getObjectByKey("wlLineDetail")),
type 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.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
influxQueryWrapper.regular(DataHarmrateV::getLineId, lineParam.getLineId()) influxQueryWrapper.regular(DataHarmRateV::getLineId, lineParam.getLineId())
.select(DataHarmrateV::getLineId) .select(DataHarmRateV::getLineId)
.select(DataHarmrateV::getPhasicType) .select(DataHarmRateV::getPhaseType)
.select(DataHarmrateV::getValueType) .select(DataHarmRateV::getValueType)
.select(DataHarmrateV::getQualityFlag) .select(DataHarmRateV::getQualityFlag)
.select(DataHarmrateV::getAbnormalFlag) .select(DataHarmRateV::getAbnormalFlag)
.between(DataHarmrateV::getTime, lineParam.getStartTime(), lineParam.getEndTime()) .between(DataHarmRateV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataHarmrateV::getQualityFlag,"0"); .eq(DataHarmRateV::getQualityFlag,"0");
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){ 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)){ if(CollUtil.isNotEmpty(list)){
//过滤掉暂态事件影响的数据 true过滤 false不过滤 //过滤掉暂态事件影响的数据 true过滤 false不过滤
if (lineParam.getDataType()) { if (lineParam.getDataType()) {
@@ -99,14 +100,14 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
} else { } else {
dataList = list; 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())) { if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
lineMap.forEach((k,v)->{ lineMap.forEach((k,v)->{
List<String> timeList = lineParam.getAbnormalTime().get(k); List<String> timeList = lineParam.getAbnormalTime().get(k);
//有异常数据,当前监测点自身的异常数据 //有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) { 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.过滤掉异常数据后还有正常数据,则用正常数据计算 //1.过滤掉异常数据后还有正常数据,则用正常数据计算
if (CollectionUtil.isNotEmpty(filterList)) { if (CollectionUtil.isNotEmpty(filterList)) {
result.addAll(filterList); result.addAll(filterList);
@@ -131,14 +132,14 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
if (CollectionUtil.isNotEmpty(result)) { if (CollectionUtil.isNotEmpty(result)) {
if (!Objects.isNull(map)) { 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)->{ lineMap.forEach((k,v)->{
if (Objects.isNull(map.get(k))) { if (Objects.isNull(map.get(k))) {
return; return;
} }
Integer conType = map.get(k); Integer conType = map.get(k);
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES; 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); data.addAll(result2);
}); });
} else { } else {
@@ -146,9 +147,9 @@ public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
} }
if (CollectionUtil.isNotEmpty(data)) { if (CollectionUtil.isNotEmpty(data)) {
data.forEach(item -> { data.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType()); String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) { if (newType != null) {
item.setPhasicType(newType); item.setPhaseType(newType);
} }
}); });
} }

View File

@@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.utils.HarmonicTimesUtil; import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.po.influx.DataI;
import com.njcn.dataProcess.pojo.dto.DataIDto; import com.njcn.dataProcess.pojo.dto.DataIDto;
import com.njcn.harmonic.mapper.influxdb.DataIMapper;
import com.njcn.harmonic.service.influxdb.IDataI; import com.njcn.harmonic.service.influxdb.IDataI;
import com.njcn.influx.constant.InfluxDbSqlConstant; 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 com.njcn.influx.query.InfluxQueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.samePrefixAndSuffix(InfluxDbSqlConstant.I, InfluxDbSqlConstant.I, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
influxQueryWrapper.regular(DataI::getLineId, lineParam.getLineId()) influxQueryWrapper.regular(DataI::getLineId, lineParam.getLineId())
.select(DataI::getLineId) .select(DataI::getLineId)
.select(DataI::getPhasicType) .select(DataI::getPhaseType)
.select(DataI::getValueType) .select(DataI::getValueType)
.select(DataI::getINeg) .select(DataI::getINeg)
.select(DataI::getIPos) .select(DataI::getIPos)
@@ -82,7 +82,7 @@ public class InfluxdbDataIImpl implements IDataI {
.between(DataI::getTime, lineParam.getStartTime(), lineParam.getEndTime()) .between(DataI::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataI::getQualityFlag,"0"); .eq(DataI::getQualityFlag,"0");
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){ if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
influxQueryWrapper.regular(DataI::getPhasicType,lineParam.getPhasicType()); influxQueryWrapper.regular(DataI::getPhaseType,lineParam.getPhasicType());
} }
List<DataI> list = dataIMapper.selectByQueryWrapper(influxQueryWrapper); List<DataI> list = dataIMapper.selectByQueryWrapper(influxQueryWrapper);
@@ -124,9 +124,9 @@ public class InfluxdbDataIImpl implements IDataI {
} }
if (CollectionUtil.isNotEmpty(result)) { if (CollectionUtil.isNotEmpty(result)) {
result.forEach(item -> { result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType()); String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) { if (newType != null) {
item.setPhasicType(newType); item.setPhaseType(newType);
} }
}); });
} }

View File

@@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.utils.HarmonicTimesUtil; import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.po.influx.DataInharmV;
import com.njcn.dataProcess.pojo.dto.DataHarmDto; import com.njcn.dataProcess.pojo.dto.DataHarmDto;
import com.njcn.harmonic.mapper.influxdb.DataInharmVMapper;
import com.njcn.harmonic.service.influxdb.IDataInHarmV; import com.njcn.harmonic.service.influxdb.IDataInHarmV;
import com.njcn.influx.constant.InfluxDbSqlConstant; 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 com.njcn.influx.query.InfluxQueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
public class InfluxdbDataInharmVImpl implements IDataInHarmV { public class InfluxdbDataInharmVImpl implements IDataInHarmV {
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()); 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -46,7 +46,7 @@ public class InfluxdbDataInharmVImpl implements IDataInHarmV {
@Override @Override
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) { public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
List<DataHarmDto> result = new ArrayList<>(); List<DataHarmDto> result = new ArrayList<>();
List<DataInharmV> list = getMinuteData(lineParam); List<DataInHarmV> list = getMinuteData(lineParam);
list.forEach(item->{ list.forEach(item->{
DataHarmDto dto = new DataHarmDto(); DataHarmDto dto = new DataHarmDto();
BeanUtils.copyProperties(item,dto); BeanUtils.copyProperties(item,dto);
@@ -66,23 +66,23 @@ public class InfluxdbDataInharmVImpl implements IDataInHarmV {
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据; * 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常 * 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
*/ */
public List<DataInharmV> getMinuteData(LineCountEvaluateParam lineParam) { public List<DataInHarmV> getMinuteData(LineCountEvaluateParam lineParam) {
List<DataInharmV> dataList; List<DataInHarmV> dataList;
List<DataInharmV> result = new ArrayList<>(); List<DataInHarmV> result = new ArrayList<>();
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmV.class); InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInHarmV.class);
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1)); influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
influxQueryWrapper.regular(DataInharmV::getLineId, lineParam.getLineId()) influxQueryWrapper.regular(DataInHarmV::getLineId, lineParam.getLineId())
.select(DataInharmV::getLineId) .select(DataInHarmV::getLineId)
.select(DataInharmV::getPhasicType) .select(DataInHarmV::getPhaseType)
.select(DataInharmV::getValueType) .select(DataInHarmV::getValueType)
.select(DataInharmV::getQualityFlag) .select(DataInHarmV::getQualityFlag)
.select(DataInharmV::getAbnormalFlag) .select(DataInHarmV::getAbnormalFlag)
.between(DataInharmV::getTime, lineParam.getStartTime(), lineParam.getEndTime()) .between(DataInHarmV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataInharmV::getQualityFlag,"0"); .eq(DataInHarmV::getQualityFlag,"0");
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){ 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)){ if(CollUtil.isNotEmpty(list)){
//过滤掉暂态事件影响的数据 true过滤 false不过滤 //过滤掉暂态事件影响的数据 true过滤 false不过滤
if (lineParam.getDataType()) { if (lineParam.getDataType()) {
@@ -90,14 +90,14 @@ public class InfluxdbDataInharmVImpl implements IDataInHarmV {
} else { } else {
dataList = list; 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())) { if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
lineMap.forEach((k,v)->{ lineMap.forEach((k,v)->{
List<String> timeList = lineParam.getAbnormalTime().get(k); List<String> timeList = lineParam.getAbnormalTime().get(k);
//有异常数据,当前监测点自身的异常数据 //有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) { 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.过滤掉异常数据后还有正常数据,则用正常数据计算 //1.过滤掉异常数据后还有正常数据,则用正常数据计算
if (CollectionUtil.isNotEmpty(filterList)) { if (CollectionUtil.isNotEmpty(filterList)) {
result.addAll(filterList); result.addAll(filterList);
@@ -121,9 +121,9 @@ public class InfluxdbDataInharmVImpl implements IDataInHarmV {
} }
if (CollectionUtil.isNotEmpty(result)) { if (CollectionUtil.isNotEmpty(result)) {
result.forEach(item -> { result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType()); String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) { if (newType != null) {
item.setPhasicType(newType); item.setPhaseType(newType);
} }
}); });
} }

View File

@@ -5,11 +5,11 @@ import cn.hutool.core.collection.CollectionUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.po.influx.DataPlt; import com.njcn.influx.pojo.po.DataPlt;
import com.njcn.dataProcess.po.influx.DataV;
import com.njcn.dataProcess.pojo.dto.DataPltDto; import com.njcn.dataProcess.pojo.dto.DataPltDto;
import com.njcn.harmonic.mapper.influxdb.DataPltMapper;
import com.njcn.harmonic.service.influxdb.IDataPlt; 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.influx.query.InfluxQueryWrapper;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -80,14 +80,14 @@ public class InfluxdbDataPltImpl implements IDataPlt {
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataPlt.class); InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataPlt.class);
influxQueryWrapper.regular(DataPlt::getLineId, lineParam.getLineId()) influxQueryWrapper.regular(DataPlt::getLineId, lineParam.getLineId())
.select(DataPlt::getLineId) .select(DataPlt::getLineId)
.select(DataPlt::getPhasicType) .select(DataPlt::getPhaseType)
.select(DataPlt::getPlt) .select(DataPlt::getPlt)
.select(DataPlt::getQualityFlag) .select(DataPlt::getQualityFlag)
.select(DataPlt::getAbnormalFlag) .select(DataPlt::getAbnormalFlag)
.between(DataPlt::getTime, lineParam.getStartTime(), lineParam.getEndTime()) .between(DataPlt::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataPlt::getQualityFlag,"0"); .eq(DataPlt::getQualityFlag,"0");
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){ if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
influxQueryWrapper.regular(DataV::getPhasicType,lineParam.getPhasicType()); influxQueryWrapper.regular(DataV::getPhaseType,lineParam.getPhasicType());
} }
List<DataPlt> list = dataPltMapper.selectByQueryWrapper(influxQueryWrapper); List<DataPlt> list = dataPltMapper.selectByQueryWrapper(influxQueryWrapper);
if(CollUtil.isNotEmpty(list)){ if(CollUtil.isNotEmpty(list)){
@@ -136,7 +136,7 @@ public class InfluxdbDataPltImpl implements IDataPlt {
} }
Integer conType = map.get(k); Integer conType = map.get(k);
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES; 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); data.addAll(result2);
}); });
} else { } else {
@@ -144,9 +144,9 @@ public class InfluxdbDataPltImpl implements IDataPlt {
} }
if (CollectionUtil.isNotEmpty(data)) { if (CollectionUtil.isNotEmpty(data)) {
data.forEach(item -> { data.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType()); String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) { if (newType != null) {
item.setPhasicType(newType); item.setPhaseType(newType);
} }
}); });
} }

View File

@@ -7,10 +7,10 @@ import com.google.gson.reflect.TypeToken;
import com.njcn.common.utils.HarmonicTimesUtil; import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataVDto; import com.njcn.dataProcess.pojo.dto.DataVDto;
import com.njcn.harmonic.mapper.influxdb.DataVMapper;
import com.njcn.harmonic.service.influxdb.IDataV; import com.njcn.harmonic.service.influxdb.IDataV;
import com.njcn.influx.constant.InfluxDbSqlConstant; 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.influx.query.InfluxQueryWrapper;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j; 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.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId()) influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
.select(DataV::getLineId) .select(DataV::getLineId)
.select(DataV::getPhasicType) .select(DataV::getPhaseType)
.select(DataV::getValueType) .select(DataV::getValueType)
.select(DataV::getFreq) .select(DataV::getFreq)
.select(DataV::getFreqDev) .select(DataV::getFreqDev)
@@ -104,7 +104,7 @@ public class InfluxdbDataVImpl implements IDataV {
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime()) .between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataV::getQualityFlag, "0"); .eq(DataV::getQualityFlag, "0");
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) { if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType()); influxQueryWrapper.regular(DataV::getPhaseType, lineParam.getPhasicType());
} }
quality(result, influxQueryWrapper, lineParam); quality(result, influxQueryWrapper, lineParam);
if (CollectionUtil.isNotEmpty(result)) { if (CollectionUtil.isNotEmpty(result)) {
@@ -117,18 +117,18 @@ public class InfluxdbDataVImpl implements IDataV {
} }
//这边需要特殊处理下,将线电压数据赋值 //这边需要特殊处理下,将线电压数据赋值
Map<String, DataV> lineVoltageIndex = v.stream() 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) .filter(d -> d.getRmsLvr() != null)
.collect(Collectors.toMap( .collect(Collectors.toMap(
d -> buildKey(d.getTime(), d.getValueType(), d.getPhasicType()), d -> buildKey(d.getTime(), d.getValueType(), d.getPhaseType()),
Function.identity(), Function.identity(),
(existing, replacement) -> existing (existing, replacement) -> existing
)); ));
v.stream() v.stream()
.filter(d -> PHASE_VOLTAGE_TYPES.contains(d.getPhasicType())) .filter(d -> PHASE_VOLTAGE_TYPES.contains(d.getPhaseType()))
.forEach(phaseData -> { .forEach(phaseData -> {
// 根据当前相电压反查对应的线电压相别 // 根据当前相电压反查对应的线电压相别
String targetLinePhasic = getReverseLinePhasic(phaseData.getPhasicType()); String targetLinePhasic = getReverseLinePhasic(phaseData.getPhaseType());
if (targetLinePhasic == null) { if (targetLinePhasic == null) {
return; return;
} }
@@ -140,7 +140,7 @@ public class InfluxdbDataVImpl implements IDataV {
}); });
Integer conType = map.get(k); Integer conType = map.get(k);
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES; 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); data.addAll(result2);
}); });
} else { } else {
@@ -148,9 +148,9 @@ public class InfluxdbDataVImpl implements IDataV {
} }
if (CollectionUtil.isNotEmpty(data)) { if (CollectionUtil.isNotEmpty(data)) {
data.forEach(item -> { data.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType()); String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) { if (newType != null) {
item.setPhasicType(newType); item.setPhaseType(newType);
} }
}); });
} }