海南数据不一致问题处理
This commit is contained in:
@@ -81,33 +81,56 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
|
||||
@Override
|
||||
public SteadyQualifyCensusVO getSteadyQualifyCensus(DeviceInfoParam.BusinessParam steadyCensusParam) {
|
||||
List<SteadyQualifyVO> steadyQualifyList = getSteadyQualifyData(steadyCensusParam);
|
||||
SteadyQualifyCensusVO steadyQualifyCensusVO = new SteadyQualifyCensusVO();
|
||||
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());
|
||||
if (CollUtil.isNotEmpty(steadyQualifyList)) {
|
||||
for (SteadyQualifyVO steadyQualifyVO : steadyQualifyList) {
|
||||
// 还需要递归出有多少个测点
|
||||
int lineNum = seekLineNum(steadyQualifyVO);
|
||||
type.add(steadyQualifyVO.getName() + "\n(" + lineNum + ")");
|
||||
harmonicVoltage.add(steadyQualifyVO.getHarmonicVoltage());
|
||||
voltageOffset.add(steadyQualifyVO.getVoltageOffset());
|
||||
VoltageUnbalance.add(steadyQualifyVO.getVoltageUnbalance());
|
||||
interHarmonic.add(steadyQualifyVO.getInterHarmonic());
|
||||
harmonicCurrent.add(steadyQualifyVO.getHarmonicCurrent());
|
||||
negativeCurrent.add(steadyQualifyVO.getNegativeCurrent());
|
||||
freqOffset.add(steadyQualifyVO.getFreqOffset());
|
||||
flicker.add(steadyQualifyVO.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.setVoltageOffset(voltageOffset);
|
||||
steadyQualifyCensusVO.setVoltageUnbalance(VoltageUnbalance);
|
||||
@@ -121,6 +144,25 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
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
|
||||
public List<SteadyQualifyVO> getEnterpriseSteadyQualify(DeviceInfoParam.BusinessParam steadyParam) {
|
||||
List<SteadyQualifyVO> steadyQualifyList = new ArrayList<>();
|
||||
@@ -365,7 +407,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
steadyQualifyDTO.getIharm24Overtime() +
|
||||
steadyQualifyDTO.getIharm25Overtime())));
|
||||
//间谐波电压含有率
|
||||
steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime()*16, (steadyQualifyDTO.getInuharm1Overtime() +
|
||||
steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime() * 16, (steadyQualifyDTO.getInuharm1Overtime() +
|
||||
steadyQualifyDTO.getInuharm2Overtime() +
|
||||
steadyQualifyDTO.getInuharm3Overtime() +
|
||||
steadyQualifyDTO.getInuharm4Overtime() +
|
||||
@@ -497,7 +539,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
return 3.14159;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.njcn.harmonic.mapper.THDistortionMapper;
|
||||
import com.njcn.harmonic.pojo.dto.PublicDTO;
|
||||
import com.njcn.harmonic.pojo.po.RMpVThd;
|
||||
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.THDistortionVO;
|
||||
import com.njcn.harmonic.service.THDistortionService;
|
||||
@@ -102,20 +103,23 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
|
||||
@Override
|
||||
public THDistortionCensusVO getTHDistortionCensus(DeviceInfoParam.BusinessParam thDistortionCensusParam) {
|
||||
List<THDistortionVO> thDistortionVOS = getTHDistortionData(thDistortionCensusParam, 0);
|
||||
|
||||
THDistortionCensusVO distortionCensusVO = new THDistortionCensusVO();
|
||||
thDistortionCensusParam.setServerName(generalInfo.getMicroServiceName());
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(thDistortionCensusParam).getData();
|
||||
// thDistortionCensusParam.setServerName(generalInfo.getMicroServiceName());
|
||||
// List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(thDistortionCensusParam).getData();
|
||||
List<String> type = new ArrayList<>();
|
||||
List<Double> single = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||
if (CollectionUtils.isEmpty(lineIndexes)) {
|
||||
continue;
|
||||
}
|
||||
type.add(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")");
|
||||
List<PublicDTO> condition = getCondition(lineIndexes, thDistortionCensusParam.getSearchBeginTime(), thDistortionCensusParam.getSearchEndTime());
|
||||
single.add(roundHalfUp(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159)));
|
||||
if (!CollectionUtils.isEmpty(thDistortionVOS)) {
|
||||
for (THDistortionVO thDistortionVO : thDistortionVOS) {
|
||||
// List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||
// if (CollectionUtils.isEmpty(lineIndexes)) {
|
||||
// continue;
|
||||
// }
|
||||
// type.add(thDistortionVO.getName() + "\n(" + seekLineNum(thDistortionVO) + ")");
|
||||
type.add(thDistortionVO.getName() );
|
||||
// List<PublicDTO> condition = getCondition(lineIndexes, thDistortionCensusParam.getSearchBeginTime(), thDistortionCensusParam.getSearchEndTime());
|
||||
single.add(thDistortionVO.getDistortion());
|
||||
}
|
||||
distortionCensusVO.setType(type);
|
||||
distortionCensusVO.setSingle(single);
|
||||
@@ -123,6 +127,25 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
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
|
||||
* @Description: 谐波总畸变率前十列表
|
||||
|
||||
Reference in New Issue
Block a user