微调
This commit is contained in:
@@ -737,38 +737,9 @@ public class ResultServiceImpl implements IResultService {
|
||||
private StringBuffer getStringBuffer(List<PqScriptDtls> scriptDtlIndex, Boolean isValueType) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("输入:");
|
||||
List<PqScriptDtls> freq = scriptDtlIndex.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(freq)) {
|
||||
buffer.append("频率=" + freq.get(0).getValue() + ResultUnitEnum.FREQ_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() + "° ");
|
||||
}
|
||||
}
|
||||
appendValue(scriptDtlIndex, buffer, "Freq", "频率", ResultUnitEnum.FREQ_UNIT.getUnit(), null);
|
||||
appendValue(scriptDtlIndex, buffer, "VOL", "U", isValueType ? ResultUnitEnum.V_RELATIVE_UNIT.getUnit() : ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit(), "相角=");
|
||||
appendValue(scriptDtlIndex, buffer, "CUR", "I", isValueType ? ResultUnitEnum.I_RELATIVE_UNIT.getUnit() : ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit(), "相角=");
|
||||
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, "InHarm_V", "i", ResultUnitEnum.HSV_UNIT.getUnit(), false);
|
||||
@@ -778,6 +749,23 @@ public class ResultServiceImpl implements IResultService {
|
||||
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
|
||||
public ResultVO resultData(ResultParam param) {
|
||||
StorageParam storage = new StorageParam();
|
||||
@@ -811,7 +799,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
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()
|
||||
.filter(x -> valueType.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
|
||||
@@ -822,19 +810,11 @@ public class ResultServiceImpl implements IResultService {
|
||||
} else {
|
||||
buffer.append(name + harmNum + "(");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(value)) {
|
||||
for (PqScriptDtls dtls : value) {
|
||||
buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit + " ");
|
||||
}
|
||||
buffer.append(") ");
|
||||
}
|
||||
|
||||
appendValues(buffer, value, unit);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
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()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
@@ -842,13 +822,12 @@ public class ResultServiceImpl implements IResultService {
|
||||
buffer.append(name + " ");
|
||||
for (PqScriptDtls dtls : list) {
|
||||
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 static void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name) {
|
||||
private void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name) {
|
||||
List<PqScriptDtls> list = scriptDtlIndex.stream().filter(x -> valueType.equals(x.getValueType()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
@@ -856,22 +835,28 @@ public class ResultServiceImpl implements IResultService {
|
||||
buffer.append(name + " ");
|
||||
for (PqScriptDtls dtls : list) {
|
||||
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) {
|
||||
if (numbers.size() > 2) {
|
||||
return 4;
|
||||
} else if (numbers.size() > 1) {
|
||||
if (numbers.size() > 1) {
|
||||
if (numbers.contains(4)) {
|
||||
return 4;
|
||||
} else if (numbers.contains(2)) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(numbers).get(0);
|
||||
return numbers.iterator().next();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user