新增物联设备相关算法
This commit is contained in:
@@ -62,5 +62,7 @@ public class LineCountEvaluateParam extends BaseParam implements Serializable {
|
||||
*/
|
||||
private Boolean dataType = true;
|
||||
|
||||
//0:通用 1:省级平台 2:物联
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,12 @@ public class DataFlicker {
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phasicType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
@Column(name = "fluc")
|
||||
private Double fluc=0.00;
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@ public class DataFluc {
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phasicType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
@Column(name = "fluc")
|
||||
private Double fluc=0.00;
|
||||
|
||||
|
||||
@@ -43,6 +43,12 @@ public class DataHarmphasicI {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -44,6 +44,12 @@ public class DataHarmphasicV {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -44,6 +44,12 @@ public class DataHarmpowerP {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -44,6 +44,12 @@ public class DataHarmpowerQ {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -44,6 +44,12 @@ public class DataHarmpowerS {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -43,6 +43,12 @@ public class DataHarmrateI {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -43,6 +43,12 @@ public class DataHarmrateV {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -44,6 +44,12 @@ public class DataI {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -44,6 +44,12 @@ public class DataInharmI {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -44,6 +44,12 @@ public class DataInharmV {
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -34,9 +34,18 @@ public class DataPlt {
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phasicType;
|
||||
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
@Column(name = "quality_flag",tag = true)
|
||||
private String qualityFlag="0";
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -45,6 +45,13 @@ public class DataV {
|
||||
@Column(name = "quality_flag", tag = true)
|
||||
private String qualityFlag="0";
|
||||
|
||||
@Column(name = "cl_did", tag = true)
|
||||
private String cldid;
|
||||
|
||||
@Column(name = "process", tag = true)
|
||||
private String process;
|
||||
|
||||
|
||||
//是否是异常指标数据,0否1是
|
||||
@Column(name = "abnormal_flag")
|
||||
private Integer abnormalFlag;
|
||||
|
||||
@@ -73,6 +73,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-device-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>stat-api</artifactId>
|
||||
|
||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataFlickerMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataFlickerRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataFlickerDTO;
|
||||
@@ -20,10 +24,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -41,6 +47,17 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
||||
|
||||
private final DataFlickerMapper dataFlickerMapper;
|
||||
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataFlickerDTO> dataFlickerDTOList) {
|
||||
@@ -64,7 +81,12 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
||||
@Override
|
||||
public List<DataFlickerDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataFlickerDto> result = new ArrayList<>();
|
||||
List<DataFlicker> list = getMinuteData(lineParam);
|
||||
List<DataFlicker> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam);
|
||||
} else {
|
||||
list = getMinuteData(lineParam);
|
||||
}
|
||||
list.forEach(item -> {
|
||||
DataFlickerDto dto = new DataFlickerDto();
|
||||
BeanUtils.copyProperties(item, dto);
|
||||
@@ -77,7 +99,12 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataFlicker> dataIList = getMinuteData(lineParam);
|
||||
List<DataFlicker> dataIList;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
dataIList = getWlMinuteData(lineParam);
|
||||
} else {
|
||||
dataIList = getMinuteData(lineParam);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(dataIList)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -237,4 +264,63 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
||||
quality(result, influxQueryWrapper, lineParam);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataFlicker> getWlMinuteData(LineCountEvaluateParam lineParam) {
|
||||
List<DataFlicker> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
|
||||
lineParam.getLineId().forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
|
||||
influxQueryWrapper.eq(DataFlicker::getLineId, lineId)
|
||||
.eq(DataFlicker::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataFlicker::getLineId)
|
||||
.select(DataFlicker::getPhasicType)
|
||||
.between(DataFlicker::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataFlicker::getQualityFlag, "0");
|
||||
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||
influxQueryWrapper.regular(DataFlicker::getPhasicType, lineParam.getPhasicType());
|
||||
}
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataFlicker::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataFlicker::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||
if (Objects.equals(po.getConType(),0)) {
|
||||
//相电压电压变动幅度
|
||||
influxQueryWrapper.select("Pq_Fluct","fluc");
|
||||
//相电压长时闪变
|
||||
influxQueryWrapper.select("Pq_Plt","plt");
|
||||
//相电压短时闪变
|
||||
influxQueryWrapper.select("Pq_Pst","pst");
|
||||
} else {
|
||||
//线电压电压变动幅度
|
||||
influxQueryWrapper.select("Pq_LFluct","fluc");
|
||||
//相电压长时闪变
|
||||
influxQueryWrapper.select("Pq_LPlt","plt");
|
||||
//相电压短时闪变
|
||||
influxQueryWrapper.select("Pq_LPst","pst");
|
||||
}
|
||||
result.addAll(dataFlickerMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.njcn.dataProcess.service.impl.influxdb;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataFlucMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataFlucRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataFlucDTO;
|
||||
@@ -18,10 +22,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -39,6 +45,17 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
||||
|
||||
private final DataFlucMapper dataFlucMapper;
|
||||
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataFlucDTO> dataFlucDTOList) {
|
||||
@@ -62,7 +79,12 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
||||
@Override
|
||||
public List<DataFlucDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataFlucDto> result = new ArrayList<>();
|
||||
List<DataFluc> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataFluc> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataFlucDto dto = new DataFlucDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -75,7 +97,12 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataFluc> dataIList = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataFluc> dataIList;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
dataIList = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
dataIList = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(dataIList)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -191,4 +218,53 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataFluc> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||
//todo FLUCCF电压波动频度原先oracle表存储的是0,写死的,这边暂不取值
|
||||
List<DataFluc> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineList.forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFluc.class);
|
||||
influxQueryWrapper.eq(DataFluc::getLineId, lineId)
|
||||
.eq(DataFluc::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataFluc::getLineId)
|
||||
.select(DataFluc::getPhasicType)
|
||||
.between(DataFluc::getTime, startTime, endTime)
|
||||
.eq(DataFluc::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataFluc::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataFluc::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||
if (Objects.equals(po.getConType(),0)) {
|
||||
//相电压电压变动幅度
|
||||
influxQueryWrapper.select("Pq_Fluct","fluc");
|
||||
} else {
|
||||
//线电压电压变动幅度
|
||||
influxQueryWrapper.select("Pq_LFluct","fluc");
|
||||
}
|
||||
result.addAll(dataFlucMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,15 +4,17 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataHarmRateIMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmRateIRelationMapper;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmrateI;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmrateV;
|
||||
import com.njcn.dataProcess.po.influx.DataI;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataHarmRateIDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataIDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateID;
|
||||
import com.njcn.dataProcess.service.IDataHarmRateI;
|
||||
import com.njcn.dataProcess.util.TimeUtils;
|
||||
@@ -26,6 +28,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -37,11 +40,27 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
@Resource
|
||||
private DataHarmRateIMapper dataHarmRateIMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public List<DataHarmRateIDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmRateIDto> result = new ArrayList<>();
|
||||
List<DataHarmrateI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmrateI> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataHarmRateIDto dto = new DataHarmRateIDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -54,7 +73,12 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataHarmrateI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmrateI> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -225,4 +249,47 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataHarmrateI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||
List<DataHarmrateI> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineList.forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateI.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmRI_", "i_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
influxQueryWrapper.eq(DataHarmrateI::getLineId, lineId)
|
||||
.eq(DataHarmrateI::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataHarmrateI::getLineId)
|
||||
.select(DataHarmrateI::getPhasicType)
|
||||
.select(DataHarmrateI::getValueType)
|
||||
//电流基波有效值
|
||||
.select("Pq_RmsFundI_","i_1")
|
||||
.between(DataHarmrateI::getTime, startTime, endTime)
|
||||
.eq(DataHarmrateI::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataHarmrateI::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataHarmrateI::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
result.addAll(dataHarmRateIMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
||||
import com.njcn.dataProcess.dao.imapper.DataHarmRateVMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmRateVRelationMapper;
|
||||
@@ -14,7 +18,6 @@ import com.njcn.dataProcess.po.influx.DataV;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataHarmRateVDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataVDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateVD;
|
||||
import com.njcn.dataProcess.service.IDataHarmRateV;
|
||||
import com.njcn.dataProcess.util.TimeUtils;
|
||||
@@ -25,10 +28,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -41,11 +46,27 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
|
||||
private final DataHarmRateVMapper dataHarmRateVMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmDto> result = new ArrayList<>();
|
||||
List<DataHarmrateV> list = getMinuteData(lineParam);
|
||||
List<DataHarmrateV> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam);
|
||||
} else {
|
||||
list = getMinuteData(lineParam);;
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataHarmDto dto = new DataHarmDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -77,7 +98,12 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataHarmrateV> data = getMinuteData(lineParam);
|
||||
List<DataHarmrateV> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam);
|
||||
} else {
|
||||
data = getMinuteData(lineParam);;
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -292,4 +318,56 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataHarmrateV> getWlMinuteData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmrateV> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineParam.getLineId().forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateV.class);
|
||||
influxQueryWrapper.eq(DataHarmrateV::getLineId, lineId)
|
||||
.eq(DataHarmrateV::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataHarmrateV::getLineId)
|
||||
.select(DataHarmrateV::getPhasicType)
|
||||
.select(DataHarmrateV::getValueType)
|
||||
.between(DataHarmrateV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataHarmrateV::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataHarmrateV::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataHarmrateV::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||
if (Objects.equals(po.getConType(),0)) {
|
||||
//相电压基波有效值
|
||||
influxQueryWrapper.select("Pq_RmsFundU_","v_1");
|
||||
//2-50次 相电压谐波含有率
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmU_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
} else {
|
||||
//线电压基波有效值
|
||||
influxQueryWrapper.select("Pq_RmsFundLU_","v_1");
|
||||
//2-50次 线电压谐波含有率
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmLU_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
}
|
||||
result.addAll(dataHarmRateVMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataHarmphasicIMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPhasicIRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataHarmphasicIDTO;
|
||||
@@ -21,10 +25,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -40,6 +46,17 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
||||
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
private final DataHarmphasicIMapper dataHarmphasicIMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataHarmphasicIDTO> dataHarmphasicIDTOList) {
|
||||
@@ -62,7 +79,12 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
||||
@Override
|
||||
public List<DataHarmPhasicIDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmPhasicIDto> result = new ArrayList<>();
|
||||
List<DataHarmphasicI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmphasicI> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataHarmPhasicIDto dto = new DataHarmPhasicIDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -75,7 +97,12 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataHarmphasicI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmphasicI> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -245,4 +272,48 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataHarmphasicI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap,Boolean dataType) {
|
||||
List<DataHarmphasicI> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineList.forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmphasicI.class);
|
||||
//谐波电流幅值相角
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmIAng_", "i_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
influxQueryWrapper.eq(DataHarmphasicI::getLineId, lineId)
|
||||
.eq(DataHarmphasicI::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataHarmphasicI::getLineId)
|
||||
.select(DataHarmphasicI::getPhasicType)
|
||||
.select(DataHarmphasicI::getValueType)
|
||||
//基波电流相角
|
||||
.select("Pq_FundIAng","i_1")
|
||||
.between(DataHarmphasicI::getTime, startTime, endTime)
|
||||
.eq(DataHarmphasicI::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataHarmphasicI::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataHarmphasicI::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
result.addAll(dataHarmphasicIMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,15 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataHarmphasicVMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPhasicVRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataHarmphasicVDTO;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmphasicI;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmphasicV;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
||||
@@ -22,10 +27,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -42,6 +49,17 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
|
||||
private final DataHarmphasicVMapper dataHarmphasicVMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
|
||||
@Override
|
||||
@@ -66,7 +84,12 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
||||
@Override
|
||||
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmDto> result = new ArrayList<>();
|
||||
List<DataHarmphasicV> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmphasicV> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataHarmDto dto = new DataHarmDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -79,7 +102,12 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataHarmphasicV> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmphasicV> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -249,4 +277,57 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public List<DataHarmphasicV> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||
List<DataHarmphasicV> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineList.forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmphasicV.class);
|
||||
influxQueryWrapper.eq(DataHarmphasicV::getLineId, lineId)
|
||||
.eq(DataHarmphasicV::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataHarmphasicV::getLineId)
|
||||
.select(DataHarmphasicV::getPhasicType)
|
||||
.select(DataHarmphasicV::getValueType)
|
||||
.between(DataHarmphasicV::getTime, startTime, endTime)
|
||||
.eq(DataHarmphasicV::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataHarmphasicV::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataHarmphasicV::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||
if (Objects.equals(po.getConType(),0)) {
|
||||
//相电压基波有效值相角
|
||||
influxQueryWrapper.select("Pq_FundUAng","v_1");
|
||||
//2-50次 相电压谐波相角
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmUAng_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
} else {
|
||||
//线电压基波有效值相角
|
||||
influxQueryWrapper.select("Pq_FundLUAng","v_1");
|
||||
//2-50次 线电压谐波相角
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmLUAng_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
}
|
||||
result.addAll(dataHarmphasicVMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,16 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataHarmpowerPMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerPRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataHarmpowerPDTO;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmphasicI;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmphasicV;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmpowerP;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataHarmPowerPDto;
|
||||
@@ -22,10 +28,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -42,6 +50,17 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
|
||||
private final DataHarmpowerPMapper dataHarmpowerPMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
|
||||
@Override
|
||||
@@ -65,7 +84,12 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
@Override
|
||||
public List<DataPowerPDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataPowerPDto> result = new ArrayList<>();
|
||||
List<DataHarmpowerP> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(), lineParam.getDataType());
|
||||
List<DataHarmpowerP> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataPowerPDto dto = new DataPowerPDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -78,7 +102,12 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataHarmpowerP> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(), lineParam.getDataType());
|
||||
List<DataHarmpowerP> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -255,4 +284,54 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataHarmpowerP> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||
List<DataHarmpowerP> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineList.forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerP.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmP_", "p_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
influxQueryWrapper.eq(DataHarmpowerP::getLineId, lineId)
|
||||
.eq(DataHarmpowerP::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataHarmpowerP::getLineId)
|
||||
.select(DataHarmpowerP::getPhasicType)
|
||||
.select(DataHarmpowerP::getValueType)
|
||||
//位移功率因数
|
||||
.select("Pq_DF","df")
|
||||
//视在功率因素
|
||||
.select("Pq_PF","pf")
|
||||
//总功功率
|
||||
.select("Pq_P","p")
|
||||
//基波有功功率
|
||||
.select("Pq_FundP","p_1")
|
||||
.between(DataHarmpowerP::getTime, startTime, endTime)
|
||||
.eq(DataHarmpowerP::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataHarmpowerP::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataHarmpowerP::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
result.addAll(dataHarmpowerPMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataHarmpowerQMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerQRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataHarmpowerQDTO;
|
||||
@@ -21,10 +25,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -40,6 +46,17 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
private final DataHarmpowerQMapper dataHarmpowerQMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
|
||||
@Override
|
||||
@@ -63,7 +80,12 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
@Override
|
||||
public List<DataHarmPowerQDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmPowerQDto> result = new ArrayList<>();
|
||||
List<DataHarmpowerQ> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmpowerQ> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataHarmPowerQDto dto = new DataHarmPowerQDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -76,7 +98,12 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataHarmpowerQ> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmpowerQ> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -250,4 +277,49 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataHarmpowerQ> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||
List<DataHarmpowerQ> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineList.forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerQ.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmQ_", "q_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
influxQueryWrapper.eq(DataHarmpowerQ::getLineId, lineId)
|
||||
.eq(DataHarmpowerQ::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataHarmpowerQ::getLineId)
|
||||
.select(DataHarmpowerQ::getPhasicType)
|
||||
.select(DataHarmpowerQ::getValueType)
|
||||
//总功功率
|
||||
.select("Pq_Q","q")
|
||||
//基波有功功率
|
||||
.select("Pq_FundQ","q_1")
|
||||
.between(DataHarmpowerQ::getTime, startTime, endTime)
|
||||
.eq(DataHarmpowerQ::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataHarmpowerQ::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataHarmpowerQ::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
result.addAll(dataHarmpowerQMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataHarmpowerSMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerSRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataHarmpowerSDTO;
|
||||
@@ -21,10 +25,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -40,6 +46,17 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
private final DataHarmpowerSMapper dataHarmpowerSMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
|
||||
@Override
|
||||
@@ -63,7 +80,12 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
@Override
|
||||
public List<DataHarmPowerSDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmPowerSDto> result = new ArrayList<>();
|
||||
List<DataHarmpowerS> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmpowerS> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataHarmPowerSDto dto = new DataHarmPowerSDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -76,7 +98,12 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataHarmpowerS> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataHarmpowerS> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -250,4 +277,49 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataHarmpowerS> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap,Boolean dataType) {
|
||||
List<DataHarmpowerS> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineList.forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerS.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmS_", "s_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
influxQueryWrapper.eq(DataHarmpowerS::getLineId, lineId)
|
||||
.eq(DataHarmpowerS::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataHarmpowerS::getLineId)
|
||||
.select(DataHarmpowerS::getPhasicType)
|
||||
.select(DataHarmpowerS::getValueType)
|
||||
//总功功率
|
||||
.select("Pq_S","s")
|
||||
//基波有功功率
|
||||
.select("Pq_FundS","s_1")
|
||||
.between(DataHarmpowerS::getTime, startTime, endTime)
|
||||
.eq(DataHarmpowerS::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataHarmpowerS::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataHarmpowerS::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
result.addAll(dataHarmpowerSMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,16 +4,17 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
||||
import com.njcn.dataProcess.dao.imapper.DataIMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataIRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataIDTO;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.po.influx.DataHarmrateV;
|
||||
import com.njcn.dataProcess.po.influx.DataI;
|
||||
import com.njcn.dataProcess.po.influx.DataV;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataIDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatDataID;
|
||||
import com.njcn.dataProcess.service.IDataI;
|
||||
@@ -25,10 +26,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -46,6 +49,18 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
||||
|
||||
private final DataIMapper dataIMapper;
|
||||
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataIDTO> dataIDTOList) {
|
||||
@@ -68,7 +83,12 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
||||
@Override
|
||||
public List<DataIDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataIDto> result = new ArrayList<>();
|
||||
List<DataI> list = getMinuteDataI(lineParam);
|
||||
List<DataI> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteDataI(lineParam);
|
||||
} else {
|
||||
list = getMinuteDataI(lineParam);
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataIDto dto = new DataIDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -81,7 +101,12 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataI> dataIList = getMinuteDataI(lineParam);
|
||||
List<DataI> dataIList;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
dataIList = getWlMinuteDataI(lineParam);
|
||||
} else {
|
||||
dataIList = getMinuteDataI(lineParam);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(dataIList)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -293,4 +318,64 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataI> getWlMinuteDataI(LineCountEvaluateParam lineParam) {
|
||||
List<DataI> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
|
||||
lineParam.getLineId().forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
||||
//2-50次 谐波电流有效值
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmI_", "i_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
influxQueryWrapper.eq(DataI::getLineId, lineId)
|
||||
.eq(DataI::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataI::getLineId)
|
||||
.select(DataI::getPhasicType)
|
||||
.select(DataI::getValueType)
|
||||
//电流负序
|
||||
.select("Pq_SeqNegI","i_neg")
|
||||
//电流正序
|
||||
.select("Pq_SeqPosI","i_pos")
|
||||
//电流总谐波畸变率
|
||||
.select("Pq_ThdI","i_thd")
|
||||
//电流负序不平衡度
|
||||
.select("Pq_UnbalNegI","i_unbalance")
|
||||
//电流零序
|
||||
.select("Pq_SeqZeroI","i_zero")
|
||||
//电流总有效值
|
||||
.select("Pq_RmsI","rms")
|
||||
//电流基波有效值
|
||||
.select("Pq_RmsFundI","i_1")
|
||||
.between(DataI::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataI::getQualityFlag, "0");
|
||||
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||
influxQueryWrapper.regular(DataI::getPhasicType, lineParam.getPhasicType());
|
||||
}
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataI::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataI::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
result.addAll(dataIMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataInharmIMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataInHarmIRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataInharmIDTO;
|
||||
@@ -21,10 +25,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -40,7 +46,17 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
||||
|
||||
private final DataInharmIMapper dataInharmIMapper;
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataInharmIDTO> dataInharmIDTOList) {
|
||||
@@ -63,7 +79,12 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
||||
@Override
|
||||
public List<DataInHarmIDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataInHarmIDto> result = new ArrayList<>();
|
||||
List<DataInharmI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataInharmI> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataInHarmIDto dto = new DataInHarmIDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -76,7 +97,12 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataInharmI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
List<DataInharmI> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
} else {
|
||||
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -247,4 +273,46 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataInharmI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||
List<DataInharmI> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineList.forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmI.class);
|
||||
//2-50次 间谐波电流有效值
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_InHarmIAmp_", "i_", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.eq(DataInharmI::getLineId, lineId)
|
||||
.eq(DataInharmI::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataInharmI::getLineId)
|
||||
.select(DataInharmI::getPhasicType)
|
||||
.select(DataInharmI::getValueType)
|
||||
.between(DataInharmI::getTime, startTime, endTime)
|
||||
.eq(DataInharmI::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataInharmI::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataInharmI::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
result.addAll(dataInharmIMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataInharmVMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataInHarmVRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataInharmVDTO;
|
||||
@@ -22,10 +26,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -43,7 +49,17 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
|
||||
private final DataInharmVMapper dataInharmVMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataInharmVDTO> dataInharmVDTOList) {
|
||||
@@ -66,7 +82,12 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
||||
@Override
|
||||
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataHarmDto> result = new ArrayList<>();
|
||||
List<DataInharmV> list = getMinuteData(lineParam);
|
||||
List<DataInharmV> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteData(lineParam);
|
||||
} else {
|
||||
list = getMinuteData(lineParam);
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataHarmDto dto = new DataHarmDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -79,7 +100,12 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataInharmV> data = getMinuteData(lineParam);
|
||||
List<DataInharmV> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteData(lineParam);
|
||||
} else {
|
||||
data = getMinuteData(lineParam);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -252,4 +278,54 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataInharmV> getWlMinuteData(LineCountEvaluateParam lineParam) {
|
||||
List<DataInharmV> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineParam.getLineId().forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmV.class);
|
||||
//2-50次 间谐波电流有效值
|
||||
influxQueryWrapper.eq(DataInharmV::getLineId, lineId)
|
||||
.eq(DataInharmV::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataInharmV::getLineId)
|
||||
.select(DataInharmV::getPhasicType)
|
||||
.select(DataInharmV::getValueType)
|
||||
.between(DataInharmV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataInharmV::getQualityFlag, "0");
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataInharmV::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataInharmV::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||
if (Objects.equals(po.getConType(),0)) {
|
||||
//0.5-49.5次 间谐波相电压有效值
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_InHarmURV_", "v_", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
} else {
|
||||
//0.5-49.5次 间谐波线电压有效值
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_InHarmLURV_", "v_", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
}
|
||||
result.addAll(dataInharmVMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ package com.njcn.dataProcess.service.impl.influxdb;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.dao.imapper.DataPltMapper;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataPltRelationMapper;
|
||||
import com.njcn.dataProcess.dto.DataPltDTO;
|
||||
@@ -20,10 +24,12 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -40,6 +46,17 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
|
||||
private final DataPltMapper dataPltMapper;
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataPltDTO> dataPltDTOList) {
|
||||
@@ -63,7 +80,12 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
||||
@Override
|
||||
public List<DataPltDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataPltDto> result = new ArrayList<>();
|
||||
List<DataPlt> list = getMinuteDataPlt(lineParam);
|
||||
List<DataPlt> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteDataPlt(lineParam);
|
||||
} else {
|
||||
list = getMinuteDataPlt(lineParam);
|
||||
}
|
||||
list.forEach(item->{
|
||||
DataPltDto dto = new DataPltDto();
|
||||
BeanUtils.copyProperties(item,dto);
|
||||
@@ -76,7 +98,12 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataPlt> data = getMinuteDataPlt(lineParam);
|
||||
List<DataPlt> data;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
data = getWlMinuteDataPlt(lineParam);
|
||||
} else {
|
||||
data = getMinuteDataPlt(lineParam);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -199,4 +226,56 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataPlt> getWlMinuteDataPlt(LineCountEvaluateParam lineParam) {
|
||||
List<DataPlt> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
|
||||
lineParam.getLineId().forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataPlt.class);
|
||||
influxQueryWrapper.eq(DataPlt::getLineId, lineId)
|
||||
.eq(DataPlt::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataPlt::getLineId)
|
||||
.select(DataPlt::getPhasicType)
|
||||
.select(DataPlt::getValueType)
|
||||
.between(DataPlt::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataPlt::getQualityFlag, "0");
|
||||
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||
influxQueryWrapper.regular(DataPlt::getPhasicType, lineParam.getPhasicType());
|
||||
}
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataPlt::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataPlt::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||
if (Objects.equals(po.getConType(),0)) {
|
||||
//相电压长时闪变
|
||||
influxQueryWrapper.select("Pq_Plt","plt");
|
||||
} else {
|
||||
//线电压长时闪变
|
||||
influxQueryWrapper.select("Pq_LPlt","plt");
|
||||
}
|
||||
result.addAll(dataPltMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
||||
import com.njcn.dataProcess.constant.PhaseType;
|
||||
import com.njcn.dataProcess.dao.imapper.DataVMapper;
|
||||
@@ -34,6 +38,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -46,6 +51,17 @@ import java.util.stream.Collectors;
|
||||
public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper, RStatDataVD> implements IDataV {
|
||||
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
@Resource
|
||||
private CsLineFeignClient csLineFeignClient;
|
||||
@Resource
|
||||
private EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||
put("AB", "A");
|
||||
put("BC", "B");
|
||||
put("CA", "C");
|
||||
put("M", "T");
|
||||
}};
|
||||
|
||||
@Resource
|
||||
private DataVMapper dataVMapper;
|
||||
@@ -122,14 +138,20 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
@Override
|
||||
public List<DataVDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||
List<DataVDto> result = new ArrayList<>();
|
||||
List<DataV> list = getMinuteDataV(lineParam);
|
||||
list.forEach(item -> {
|
||||
DataVDto dto = new DataVDto();
|
||||
BeanUtils.copyProperties(item, dto);
|
||||
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||
result.add(dto);
|
||||
});
|
||||
|
||||
List<DataV> list;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
list = getWlMinuteDataV(lineParam);
|
||||
} else {
|
||||
list = getMinuteDataV(lineParam);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
DataVDto dto = new DataVDto();
|
||||
BeanUtils.copyProperties(item, dto);
|
||||
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||
result.add(dto);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -205,7 +227,12 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
List<DataV> dataVList = getMinuteDataV(lineParam);
|
||||
List<DataV> dataVList;
|
||||
if (Objects.equals(lineParam.getType(), 2)) {
|
||||
dataVList = getWlMinuteDataV(lineParam);
|
||||
} else {
|
||||
dataVList = getMinuteDataV(lineParam);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(dataVList)) {
|
||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||
//以监测点分组
|
||||
@@ -403,7 +430,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
|
||||
/**
|
||||
* 按监测点集合、时间条件获取dataV分钟数据
|
||||
* timeMap参数来判断是否进行数据出来 timeMap为空则不进行数据处理
|
||||
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
|
||||
* 剔除异常数据,这里会有三种情况判断
|
||||
* 1.无异常数据,则直接返回集合;
|
||||
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
|
||||
@@ -412,7 +439,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
public List<DataV> getMinuteDataV(LineCountEvaluateParam lineParam) {
|
||||
List<DataV> result = new ArrayList<>();
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
||||
.select(DataV::getLineId)
|
||||
.select(DataV::getPhasicType)
|
||||
@@ -439,6 +466,90 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按监测点集合、时间条件获取dataV分钟数据
|
||||
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
|
||||
*/
|
||||
public List<DataV> getWlMinuteDataV(LineCountEvaluateParam lineParam) {
|
||||
List<DataV> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||
//fixme 这边查询的数据可以缓存起来,因为日表计算时可以使用
|
||||
//获取监测点信息
|
||||
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
//获取设备信息
|
||||
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||
lineParam.getLineId().forEach(lineId -> {
|
||||
String devId = lineMap.get(lineId).getDeviceId();
|
||||
CsLinePO po = lineMap.get(lineId);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.eq(DataV::getLineId, lineId)
|
||||
.eq(DataV::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||
.select(DataV::getLineId)
|
||||
.select(DataV::getPhasicType)
|
||||
.select(DataV::getValueType)
|
||||
//频率
|
||||
.select("Pq_Freq","freq")
|
||||
//频率偏差
|
||||
.select("Pq_FreqDev","freq_dev")
|
||||
//相电压有效值
|
||||
.select("Pq_RmsU","rms")
|
||||
//线电压有效值
|
||||
.select("Pq_RmsLU","rms_lvr")
|
||||
//电压负序
|
||||
.select("Pq_SeqNegU","v_neg")
|
||||
//电压正序
|
||||
.select("Pq_SeqPosU","v_pos")
|
||||
//电压零序
|
||||
.select("Pq_SeqZeroU","v_zero")
|
||||
//电压负序不平衡度
|
||||
.select("Pq_UnbalNegU","v_unbalance")
|
||||
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.eq(DataV::getQualityFlag, "0");
|
||||
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||
influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType());
|
||||
}
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
influxQueryWrapper.eq(DataV::getCldid,Integer.toString(po.getClDid()));
|
||||
} else {
|
||||
influxQueryWrapper.eq(DataV::getCldid,Integer.toString(po.getLineNo()));
|
||||
}
|
||||
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||
if (Objects.equals(po.getConType(),0)) {
|
||||
//相电压偏差
|
||||
influxQueryWrapper.select("Pq_UDev","vu_dev");
|
||||
//相电压谐波总畸变率
|
||||
influxQueryWrapper.select("Pq_ThdU","v_thd");
|
||||
//相电压基波有效值
|
||||
influxQueryWrapper.select("Pq_RmsFundU","v_1");
|
||||
//2-50次 相电压谐波有效值
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmUV_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
} else {
|
||||
//线电压偏差
|
||||
influxQueryWrapper.select("Pq_LUDev","vu_dev");
|
||||
//线电压谐波总畸变率
|
||||
influxQueryWrapper.select("Pq_ThdLU","v_thd");
|
||||
//线电压基波有效值
|
||||
influxQueryWrapper.select("Pq_RmsFundLU","v_1");
|
||||
//2-50次 线电压谐波有效值
|
||||
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmLUV_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||
}
|
||||
result.addAll(dataVMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result.forEach(item -> {
|
||||
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||
if (newType != null) {
|
||||
item.setPhasicType(newType);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void quality(List<DataV> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam lineParam) {
|
||||
List<DataV> dataList;
|
||||
List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
|
||||
Reference in New Issue
Block a user