海南数据不一致问题处理

This commit is contained in:
2025-12-29 10:34:38 +08:00
parent e35bbd9b34
commit 63603dee08
2 changed files with 97 additions and 32 deletions

View File

@@ -81,33 +81,56 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
@Override @Override
public SteadyQualifyCensusVO getSteadyQualifyCensus(DeviceInfoParam.BusinessParam steadyCensusParam) { public SteadyQualifyCensusVO getSteadyQualifyCensus(DeviceInfoParam.BusinessParam steadyCensusParam) {
List<SteadyQualifyVO> steadyQualifyList = getSteadyQualifyData(steadyCensusParam);
SteadyQualifyCensusVO steadyQualifyCensusVO = new SteadyQualifyCensusVO(); SteadyQualifyCensusVO steadyQualifyCensusVO = new SteadyQualifyCensusVO();
List<String> type = new ArrayList<>(); List<String> type = new ArrayList<>();
//按照条件获取实际运行终端综合信息
List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyCensusParam).getData();
List<Double> harmonicVoltage = new ArrayList<>(), voltageOffset = new ArrayList<>(), List<Double> harmonicVoltage = new ArrayList<>(), voltageOffset = new ArrayList<>(),
VoltageUnbalance = new ArrayList<>(), interHarmonic = new ArrayList<>(), VoltageUnbalance = new ArrayList<>(), interHarmonic = new ArrayList<>(),
harmonicCurrent = new ArrayList<>(), negativeCurrent = new ArrayList<>(), harmonicCurrent = new ArrayList<>(), negativeCurrent = new ArrayList<>(),
freqOffset = new ArrayList<>(), flicker = new ArrayList<>(); freqOffset = new ArrayList<>(), flicker = new ArrayList<>();
if (!CollectionUtils.isEmpty(deviceDataList)) { if (CollUtil.isNotEmpty(steadyQualifyList)) {
for (GeneralDeviceDTO generalDeviceDTO : deviceDataList) { for (SteadyQualifyVO steadyQualifyVO : steadyQualifyList) {
List<String> lineIndexes = generalDeviceDTO.getLineIndexes(); // 还需要递归出有多少个测点
if (CollectionUtils.isEmpty(lineIndexes)) { int lineNum = seekLineNum(steadyQualifyVO);
continue; type.add(steadyQualifyVO.getName() + "\n(" + lineNum + ")");
} harmonicVoltage.add(steadyQualifyVO.getHarmonicVoltage());
type.add(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")"); voltageOffset.add(steadyQualifyVO.getVoltageOffset());
List<RStatLimitRateDPO> qualifiesRate = getQualifiesRate(lineIndexes, steadyCensusParam.getSearchBeginTime(), steadyCensusParam.getSearchEndTime()); VoltageUnbalance.add(steadyQualifyVO.getVoltageUnbalance());
SteadyQualifyVO dataMoreMonitorMoreDay = getDataMoreMonitorMoreDay(qualifiesRate); interHarmonic.add(steadyQualifyVO.getInterHarmonic());
harmonicVoltage.add(dataMoreMonitorMoreDay.getHarmonicVoltage()); harmonicCurrent.add(steadyQualifyVO.getHarmonicCurrent());
voltageOffset.add(dataMoreMonitorMoreDay.getVoltageOffset()); negativeCurrent.add(steadyQualifyVO.getNegativeCurrent());
VoltageUnbalance.add(dataMoreMonitorMoreDay.getVoltageUnbalance()); freqOffset.add(steadyQualifyVO.getFreqOffset());
interHarmonic.add(dataMoreMonitorMoreDay.getInterHarmonic()); flicker.add(steadyQualifyVO.getFlicker());
harmonicCurrent.add(dataMoreMonitorMoreDay.getHarmonicCurrent());
negativeCurrent.add(dataMoreMonitorMoreDay.getNegativeCurrent());
freqOffset.add(dataMoreMonitorMoreDay.getFreqOffset());
flicker.add(dataMoreMonitorMoreDay.getFlicker());
} }
} }
// List<String> type = new ArrayList<>();
// //按照条件获取实际运行终端综合信息
// List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyCensusParam).getData();
// List<Double> harmonicVoltage = new ArrayList<>(), voltageOffset = new ArrayList<>(),
// VoltageUnbalance = new ArrayList<>(), interHarmonic = new ArrayList<>(),
// harmonicCurrent = new ArrayList<>(), negativeCurrent = new ArrayList<>(),
// freqOffset = new ArrayList<>(), flicker = new ArrayList<>();
// if (!CollectionUtils.isEmpty(deviceDataList)) {
// for (GeneralDeviceDTO generalDeviceDTO : deviceDataList) {
// List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
// if (CollectionUtils.isEmpty(lineIndexes)) {
// continue;
// }
// type.add(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")");
// List<RStatLimitRateDPO> qualifiesRate = getQualifiesRate(lineIndexes, steadyCensusParam.getSearchBeginTime(), steadyCensusParam.getSearchEndTime());
// SteadyQualifyVO dataMoreMonitorMoreDay = getDataMoreMonitorMoreDay(qualifiesRate);
// harmonicVoltage.add(dataMoreMonitorMoreDay.getHarmonicVoltage());
// voltageOffset.add(dataMoreMonitorMoreDay.getVoltageOffset());
// VoltageUnbalance.add(dataMoreMonitorMoreDay.getVoltageUnbalance());
// interHarmonic.add(dataMoreMonitorMoreDay.getInterHarmonic());
// harmonicCurrent.add(dataMoreMonitorMoreDay.getHarmonicCurrent());
// negativeCurrent.add(dataMoreMonitorMoreDay.getNegativeCurrent());
// freqOffset.add(dataMoreMonitorMoreDay.getFreqOffset());
// flicker.add(dataMoreMonitorMoreDay.getFlicker());
// }
// }
steadyQualifyCensusVO.setHarmonicVoltage(harmonicVoltage); steadyQualifyCensusVO.setHarmonicVoltage(harmonicVoltage);
steadyQualifyCensusVO.setVoltageOffset(voltageOffset); steadyQualifyCensusVO.setVoltageOffset(voltageOffset);
steadyQualifyCensusVO.setVoltageUnbalance(VoltageUnbalance); steadyQualifyCensusVO.setVoltageUnbalance(VoltageUnbalance);
@@ -121,6 +144,25 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
return steadyQualifyCensusVO; return steadyQualifyCensusVO;
} }
/**
* 递归出有多少个测点
*
* @param steadyQualifyVO 最上层的信息
*/
private int seekLineNum(SteadyQualifyVO steadyQualifyVO) {
List<SteadyQualifyVO> children = steadyQualifyVO.getChildren();
// 如果没有子节点说明当前就是最底层节点计数1
if (children == null || children.isEmpty()) {
return 1;
}
// 如果有子节点,递归计算所有子节点的最底层节点总数
int total = 0;
for (SteadyQualifyVO child : children) {
total += seekLineNum(child);
}
return total;
}
@Override @Override
public List<SteadyQualifyVO> getEnterpriseSteadyQualify(DeviceInfoParam.BusinessParam steadyParam) { public List<SteadyQualifyVO> getEnterpriseSteadyQualify(DeviceInfoParam.BusinessParam steadyParam) {
List<SteadyQualifyVO> steadyQualifyList = new ArrayList<>(); List<SteadyQualifyVO> steadyQualifyList = new ArrayList<>();
@@ -365,7 +407,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
steadyQualifyDTO.getIharm24Overtime() + steadyQualifyDTO.getIharm24Overtime() +
steadyQualifyDTO.getIharm25Overtime()))); steadyQualifyDTO.getIharm25Overtime())));
//间谐波电压含有率 //间谐波电压含有率
steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime()*16, (steadyQualifyDTO.getInuharm1Overtime() + steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime() * 16, (steadyQualifyDTO.getInuharm1Overtime() +
steadyQualifyDTO.getInuharm2Overtime() + steadyQualifyDTO.getInuharm2Overtime() +
steadyQualifyDTO.getInuharm3Overtime() + steadyQualifyDTO.getInuharm3Overtime() +
steadyQualifyDTO.getInuharm4Overtime() + steadyQualifyDTO.getInuharm4Overtime() +
@@ -497,7 +539,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
return 3.14159; return 3.14159;
} else { } else {
if (allTime >= overTime) { if (allTime >= overTime) {
return NumberUtil.round((1 - ((double) overTime /allTime)) * 100, 2).doubleValue(); return NumberUtil.round((1 - ((double) overTime / allTime)) * 100, 2).doubleValue();
} }
return 0.0; return 0.0;
} }

View File

@@ -20,6 +20,7 @@ import com.njcn.harmonic.mapper.THDistortionMapper;
import com.njcn.harmonic.pojo.dto.PublicDTO; import com.njcn.harmonic.pojo.dto.PublicDTO;
import com.njcn.harmonic.pojo.po.RMpVThd; import com.njcn.harmonic.pojo.po.RMpVThd;
import com.njcn.harmonic.pojo.vo.RMpVThdVO; import com.njcn.harmonic.pojo.vo.RMpVThdVO;
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
import com.njcn.harmonic.pojo.vo.THDistortionCensusVO; import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
import com.njcn.harmonic.pojo.vo.THDistortionVO; import com.njcn.harmonic.pojo.vo.THDistortionVO;
import com.njcn.harmonic.service.THDistortionService; import com.njcn.harmonic.service.THDistortionService;
@@ -102,20 +103,23 @@ public class THDistortionServiceImpl implements THDistortionService {
@Override @Override
public THDistortionCensusVO getTHDistortionCensus(DeviceInfoParam.BusinessParam thDistortionCensusParam) { public THDistortionCensusVO getTHDistortionCensus(DeviceInfoParam.BusinessParam thDistortionCensusParam) {
List<THDistortionVO> thDistortionVOS = getTHDistortionData(thDistortionCensusParam, 0);
THDistortionCensusVO distortionCensusVO = new THDistortionCensusVO(); THDistortionCensusVO distortionCensusVO = new THDistortionCensusVO();
thDistortionCensusParam.setServerName(generalInfo.getMicroServiceName()); // thDistortionCensusParam.setServerName(generalInfo.getMicroServiceName());
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(thDistortionCensusParam).getData(); // List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(thDistortionCensusParam).getData();
List<String> type = new ArrayList<>(); List<String> type = new ArrayList<>();
List<Double> single = new ArrayList<>(); List<Double> single = new ArrayList<>();
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) { if (!CollectionUtils.isEmpty(thDistortionVOS)) {
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) { for (THDistortionVO thDistortionVO : thDistortionVOS) {
List<String> lineIndexes = generalDeviceDTO.getLineIndexes(); // List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
if (CollectionUtils.isEmpty(lineIndexes)) { // if (CollectionUtils.isEmpty(lineIndexes)) {
continue; // continue;
} // }
type.add(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")"); // type.add(thDistortionVO.getName() + "\n(" + seekLineNum(thDistortionVO) + ")");
List<PublicDTO> condition = getCondition(lineIndexes, thDistortionCensusParam.getSearchBeginTime(), thDistortionCensusParam.getSearchEndTime()); type.add(thDistortionVO.getName() );
single.add(roundHalfUp(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159))); // List<PublicDTO> condition = getCondition(lineIndexes, thDistortionCensusParam.getSearchBeginTime(), thDistortionCensusParam.getSearchEndTime());
single.add(thDistortionVO.getDistortion());
} }
distortionCensusVO.setType(type); distortionCensusVO.setType(type);
distortionCensusVO.setSingle(single); distortionCensusVO.setSingle(single);
@@ -123,6 +127,25 @@ public class THDistortionServiceImpl implements THDistortionService {
return distortionCensusVO; return distortionCensusVO;
} }
/**
* 递归出有多少个测点
*
* @param thDistortionVO 最上层的信息
*/
private int seekLineNum(THDistortionVO thDistortionVO) {
List<THDistortionVO> children = thDistortionVO.getChildren();
// 如果没有子节点说明当前就是最底层节点计数1
if (children == null || children.isEmpty()) {
return 1;
}
// 如果有子节点,递归计算所有子节点的最底层节点总数
int total = 0;
for (THDistortionVO child : children) {
total += seekLineNum(child);
}
return total;
}
/** /**
* @param statisticsBizBaseParam * @param statisticsBizBaseParam
* @Description: 谐波总畸变率前十列表 * @Description: 谐波总畸变率前十列表