1.调整源下发参数单位信息
This commit is contained in:
@@ -27,4 +27,6 @@ public interface IResultService {
|
||||
* @Date: 2024/12/31 15:14
|
||||
*/
|
||||
List<DetectionInfoVO> treeData(ResultParam param);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
@@ -26,6 +27,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -138,7 +140,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
subName.put("Freq", "频率对XX测量的影响");
|
||||
subName.put("Harm", "谐波对XX测量的影响");
|
||||
Boolean isValueType = scriptMapper.selectScriptIsValueType(param.getScriptId());
|
||||
|
||||
PqDevVO dev = pqDevService.getPqDevById(param.getDevId());
|
||||
|
||||
List<DetectionInfoVO> infoVOS = new ArrayList<>();
|
||||
Map<Integer, Set<Integer>> finalResultMap = resultMap;
|
||||
@@ -170,14 +172,15 @@ public class ResultServiceImpl implements IResultService {
|
||||
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;
|
||||
Float unit = 1f;
|
||||
if (isValueType) {
|
||||
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
unit = dev.getDevVolt();
|
||||
}
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
buffer.append("U" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + " ");
|
||||
BigDecimal volValue = new BigDecimal(dtls.getValue());
|
||||
BigDecimal result = volValue.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)
|
||||
.multiply(new BigDecimal(unit.toString()));
|
||||
buffer.append("U" + dtls.getPhase().toLowerCase() + "=" + result.doubleValue() + ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit() + " ");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -185,22 +188,20 @@ public class ResultServiceImpl implements IResultService {
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(cur)) {
|
||||
String unit;
|
||||
Float unit = 1f;
|
||||
if (isValueType) {
|
||||
unit = ResultUnitEnum.I_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit();
|
||||
unit = dev.getDevCurr();
|
||||
}
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + " ");
|
||||
buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue()*0.01*unit + ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit() + " ");
|
||||
}
|
||||
}
|
||||
dtlsSetBuffer(scriptDtlIndex, vol, buffer, "Harm_V", "次谐波电压幅值", ResultUnitEnum.HV_UNIT.getUnit(), true);
|
||||
dtlsSetBuffer(scriptDtlIndex, vol, buffer, "Harm_I", "次谐波电流幅值", ResultUnitEnum.HI_UNIT.getUnit(), true);
|
||||
dtlsSetBuffer(scriptDtlIndex, vol, buffer, "InHarm_V", "次间谐波电压幅值", ResultUnitEnum.HSV_UNIT.getUnit(), false);
|
||||
dtlsSetBuffer(scriptDtlIndex, vol, buffer, "InHarm_I", "次间谐波电流幅值", ResultUnitEnum.HSI_UNIT.getUnit(), false);
|
||||
dtlsSetBufferDip(scriptDtlIndex, vol, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit());
|
||||
dtlsSetBufferFlicker(scriptDtlIndex, vol, buffer, "Flicker", "闪变");
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "次谐波电压幅值", ResultUnitEnum.HV_UNIT.getUnit(), true);
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_I", "次谐波电流幅值", ResultUnitEnum.HI_UNIT.getUnit(), true);
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_V", "次间谐波电压幅值", ResultUnitEnum.HSV_UNIT.getUnit(), false);
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_I", "次间谐波电流幅值", ResultUnitEnum.HSI_UNIT.getUnit(), false);
|
||||
dtlsSetBufferDip(scriptDtlIndex, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit());
|
||||
dtlsSetBufferFlicker(scriptDtlIndex, buffer, "Flicker", "闪变");
|
||||
childInfo.setIndex(index);
|
||||
childInfo.setFly(conform(nums));
|
||||
childInfo.setScriptTypeName(buffer.toString());
|
||||
@@ -226,7 +227,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
return infoVOS;
|
||||
}
|
||||
|
||||
private static void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, List<PqScriptDtls> vol, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) {
|
||||
private static 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::getIndex))
|
||||
@@ -242,7 +243,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
for (PqScriptDtls dtls : list) {
|
||||
buffer.append(dtls.getPhase() + "相=" + dtls.getValue() + unit + " ");
|
||||
}
|
||||
buffer.append(") ");
|
||||
@@ -253,13 +254,13 @@ public class ResultServiceImpl implements IResultService {
|
||||
|
||||
}
|
||||
|
||||
private static void dtlsSetBufferDip(List<PqScriptDtls> scriptDtlIndex, List<PqScriptDtls> vol, StringBuffer buffer, String valueType, String name, String unit) {
|
||||
private static 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());
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
buffer.append(name + " ");
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
for (PqScriptDtls dtls : list) {
|
||||
buffer.append(dtls.getPhase() + "相(暂态深度=" + dtls.getTransValue() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit()
|
||||
+ " 暂态持续时间=" + dtls.getRetainTime() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") ");
|
||||
}
|
||||
@@ -267,14 +268,13 @@ public class ResultServiceImpl implements IResultService {
|
||||
|
||||
}
|
||||
|
||||
private static void dtlsSetBufferFlicker(List<PqScriptDtls> scriptDtlIndex, List<PqScriptDtls> vol, 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()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
buffer.append(name + " ");
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
for (PqScriptDtls dtls : list) {
|
||||
buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getTransValue()
|
||||
+ "次/min 变动量=" + dtls.getRetainTime() + ResultUnitEnum.VOLTAGE_DUR_UNIT.getUnit() + ") ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user