This commit is contained in:
wr
2025-01-06 15:27:51 +08:00
parent bb113720bc
commit b13d34dcfc
2 changed files with 37 additions and 52 deletions

View File

@@ -737,38 +737,9 @@ public class ResultServiceImpl implements IResultService {
private StringBuffer getStringBuffer(List<PqScriptDtls> scriptDtlIndex, Boolean isValueType) { private StringBuffer getStringBuffer(List<PqScriptDtls> scriptDtlIndex, Boolean isValueType) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("输入:"); buffer.append("输入:");
List<PqScriptDtls> freq = scriptDtlIndex.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList()); appendValue(scriptDtlIndex, buffer, "Freq", "频率", ResultUnitEnum.FREQ_UNIT.getUnit(), null);
if (CollUtil.isNotEmpty(freq)) { appendValue(scriptDtlIndex, buffer, "VOL", "U", isValueType ? ResultUnitEnum.V_RELATIVE_UNIT.getUnit() : ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit(), "相角=");
buffer.append("频率=" + freq.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + " "); appendValue(scriptDtlIndex, buffer, "CUR", "I", isValueType ? ResultUnitEnum.I_RELATIVE_UNIT.getUnit() : ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit(), "相角=");
}
List<PqScriptDtls> vol = scriptDtlIndex.stream().filter(x -> "VOL".equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(vol)) {
String unit;
if (isValueType) {
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
} else {
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
}
for (PqScriptDtls dtls : vol) {
buffer.append("U" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + ",相角=" + dtls.getAngle() + "° ");
}
}
List<PqScriptDtls> cur = scriptDtlIndex.stream().filter(x -> "CUR".equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(cur)) {
String unit;
if (isValueType) {
unit = ResultUnitEnum.I_RELATIVE_UNIT.getUnit();
} else {
unit = ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit();
}
for (PqScriptDtls dtls : cur) {
buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + ",相角=" + dtls.getAngle() + "° ");
}
}
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "h", ResultUnitEnum.HV_UNIT.getUnit(), true); dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "h", ResultUnitEnum.HV_UNIT.getUnit(), true);
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_I", "h", ResultUnitEnum.HI_UNIT.getUnit(), true); dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_I", "h", ResultUnitEnum.HI_UNIT.getUnit(), true);
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_V", "i", ResultUnitEnum.HSV_UNIT.getUnit(), false); dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_V", "i", ResultUnitEnum.HSV_UNIT.getUnit(), false);
@@ -778,6 +749,23 @@ public class ResultServiceImpl implements IResultService {
return buffer; return buffer;
} }
private void appendValue(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String prefix, String unit, String suffix) {
List<PqScriptDtls> values = scriptDtlIndex.stream()
.filter(x -> valueType.equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(values)) {
for (PqScriptDtls dtls : values) {
buffer.append(prefix + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit);
if (suffix != null) {
buffer.append("," + suffix + dtls.getAngle() + "° ");
} else {
buffer.append(" ");
}
}
}
}
@Override @Override
public ResultVO resultData(ResultParam param) { public ResultVO resultData(ResultParam param) {
StorageParam storage = new StorageParam(); StorageParam storage = new StorageParam();
@@ -811,7 +799,7 @@ public class ResultServiceImpl implements IResultService {
return resultVO; return resultVO;
} }
private static void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) { private void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) {
LinkedHashMap<Double, List<PqScriptDtls>> harmNumMap = scriptDtlIndex.stream() LinkedHashMap<Double, List<PqScriptDtls>> harmNumMap = scriptDtlIndex.stream()
.filter(x -> valueType.equals(x.getValueType())) .filter(x -> valueType.equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getHarmNum)) .sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
@@ -822,19 +810,11 @@ public class ResultServiceImpl implements IResultService {
} else { } else {
buffer.append(name + harmNum + "("); buffer.append(name + harmNum + "(");
} }
if (CollUtil.isNotEmpty(value)) { appendValues(buffer, value, unit);
for (PqScriptDtls dtls : value) {
buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit + " ");
}
buffer.append(") ");
}
}); });
} }
private static void dtlsSetBufferDip(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit) { private void dtlsSetBufferDip(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit) {
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType())) List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase)) .sorted(Comparator.comparing(PqScriptDtls::getPhase))
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -842,13 +822,12 @@ public class ResultServiceImpl implements IResultService {
buffer.append(name + " "); buffer.append(name + " ");
for (PqScriptDtls dtls : list) { for (PqScriptDtls dtls : list) {
buffer.append(dtls.getPhase() + "相(暂态深度=" + dtls.getTransValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() buffer.append(dtls.getPhase() + "相(暂态深度=" + dtls.getTransValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit()
+ " 暂态持续时间=" + dtls.getRetainTime().intValue() + ResultUnitEnum.VOLTAGE_MAG_UNIT.getUnit() + ") "); + ",暂态持续时间=" + dtls.getRetainTime().intValue() + ResultUnitEnum.VOLTAGE_MAG_UNIT.getUnit() + ") ");
}
} }
} }
} private void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name) {
private static void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name) {
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType())) List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType()))
.sorted(Comparator.comparing(PqScriptDtls::getPhase)) .sorted(Comparator.comparing(PqScriptDtls::getPhase))
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -856,22 +835,28 @@ public class ResultServiceImpl implements IResultService {
buffer.append(name + " "); buffer.append(name + " ");
for (PqScriptDtls dtls : list) { for (PqScriptDtls dtls : list) {
buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getChagFre() buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getChagFre()
+ "次/min 变动量=" + dtls.getChagValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") "); + "次/min,变动量=" + dtls.getChagValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") ");
}
} }
} }
private void appendValues(StringBuffer buffer, List<PqScriptDtls> values, String unit) {
if (CollUtil.isNotEmpty(values)) {
for (PqScriptDtls dtls : values) {
buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit);
}
buffer.append(") ");
}
} }
private Integer conform(Set<Integer> numbers) { private Integer conform(Set<Integer> numbers) {
if (numbers.size() > 2) { if (numbers.size() > 1) {
return 4;
} else if (numbers.size() > 1) {
if (numbers.contains(4)) { if (numbers.contains(4)) {
return 4; return 4;
} else if (numbers.contains(2)) { } else if (numbers.contains(2)) {
return 2; return 2;
} }
} }
return new ArrayList<>(numbers).get(0); return numbers.iterator().next();
} }
} }

View File

@@ -116,7 +116,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
dataVO.setDataA(a); dataVO.setDataA(a);
dataVO.setDataB(b); dataVO.setDataB(b);
dataVO.setDataC(c); dataVO.setDataC(c);
dataVO.setDataC(t); dataVO.setDataT(t);
if(ObjectUtil.isNotNull(t)){ if(ObjectUtil.isNotNull(t)){
dataVO.setRadius(t.getRadius()); dataVO.setRadius(t.getRadius());
}else{ }else{