正式检测检测项进度,小相详情展示

This commit is contained in:
wr
2025-01-13 23:42:16 +08:00
parent f9c8c812ee
commit 93973b6c6f
5 changed files with 17 additions and 86 deletions

View File

@@ -318,6 +318,7 @@ public class SocketSourceResponseService {
//告诉前端当前项开始了 //告诉前端当前项开始了
WebSocketVO<List<DevLineTestResult>> webSocketVO = new WebSocketVO<>(); WebSocketVO<List<DevLineTestResult>> webSocketVO = new WebSocketVO<>();
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1]+stepBegin); webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1]+stepBegin);
webSocketVO.setDesc(SocketManager.getSourceList().get(0).getDesc());
List<DevLineTestResult> devListRes = new ArrayList<>(); List<DevLineTestResult> devListRes = new ArrayList<>();
devList.forEach(item->{ devList.forEach(item->{
DevLineTestResult devLineTestResult = new DevLineTestResult(); DevLineTestResult devLineTestResult = new DevLineTestResult();

View File

@@ -19,6 +19,8 @@ public class WebSocketVO<T> {
private Integer code; private Integer code;
private String desc;
private T data; private T data;
} }

View File

@@ -11,6 +11,7 @@ import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
import com.njcn.gather.device.script.pojo.po.PqScriptDtls; import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
import com.njcn.gather.device.script.service.IPqScriptCheckDataService; import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
import com.njcn.gather.device.script.service.IPqScriptDtlsService; import com.njcn.gather.device.script.service.IPqScriptDtlsService;
import com.njcn.gather.device.script.util.ScriptDtlsDesc;
import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.pojo.po.AdPlan;
import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.plan.service.IAdPlanService;
import com.njcn.gather.result.pojo.enums.ResultUnitEnum; import com.njcn.gather.result.pojo.enums.ResultUnitEnum;
@@ -174,7 +175,7 @@ public class ResultServiceImpl implements IResultService {
dtlType.setIndex(index); dtlType.setIndex(index);
dtlType.setScriptType(scriptDtlIndexList.get(0).getScriptType()); dtlType.setScriptType(scriptDtlIndexList.get(0).getScriptType());
ratedScriptTypeName(scriptDtlIndexList, isValueType, dtlType, dictTree); ratedScriptTypeName(scriptDtlIndexList, isValueType, dtlType, dictTree);
dtlType.setSourceDesc(getStringBuffer(scriptDtlIndexList, isValueType).toString()); dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString());
dtlType.setFly(conform(finalResultMap.get(index))); dtlType.setFly(conform(finalResultMap.get(index)));
subTypeList.add(dtlType); subTypeList.add(dtlType);
} }
@@ -223,7 +224,7 @@ public class ResultServiceImpl implements IResultService {
if ("Freq".equals(subKey)) { if ("Freq".equals(subKey)) {
freqScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType); freqScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType);
} }
dtlType.setSourceDesc(getStringBuffer(scriptDtlIndexList, isValueType).toString()); dtlType.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString());
dtlType.setFly(conform(finalResultMap.get(index))); dtlType.setFly(conform(finalResultMap.get(index)));
subTypeList.add(dtlType); subTypeList.add(dtlType);
} }
@@ -266,7 +267,7 @@ public class ResultServiceImpl implements IResultService {
dlt.setScriptTypeName("特征幅值=" + dtls.getTransValue() + "%Un持续时间=" + dtls.getRetainTime().intValue() + "周波"); dlt.setScriptTypeName("特征幅值=" + dtls.getTransValue() + "%Un持续时间=" + dtls.getRetainTime().intValue() + "周波");
dlt.setIndex(dtls.getIndex()); dlt.setIndex(dtls.getIndex());
dlt.setScriptType(scriptDtlIndexList.get(0).getScriptType()); dlt.setScriptType(scriptDtlIndexList.get(0).getScriptType());
dlt.setSourceDesc(getStringBuffer(scriptDtlIndexList, isValueType).toString()); dlt.setSourceDesc(ScriptDtlsDesc.getStringBuffer(scriptDtlIndexList, isValueType).toString());
dlt.setFly(conform(finalResultMap.get(dtls.getIndex()))); dlt.setFly(conform(finalResultMap.get(dtls.getIndex())));
info.add(dlt); info.add(dlt);
} }
@@ -745,37 +746,6 @@ public class ResultServiceImpl implements IResultService {
} }
private StringBuffer getStringBuffer(List<PqScriptDtls> scriptDtlIndex, Boolean isValueType) {
StringBuffer buffer = new StringBuffer();
buffer.append("输入:");
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);
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_I", "i", ResultUnitEnum.HSI_UNIT.getUnit(), false);
dtlsSetBufferDip(scriptDtlIndex, buffer, "Dip", "暂态", ResultUnitEnum.HSI_UNIT.getUnit());
dtlsSetBufferFlicker(scriptDtlIndex, buffer, "Flicker", "闪变");
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) {
@@ -810,56 +780,6 @@ public class ResultServiceImpl implements IResultService {
return resultVO; return resultVO;
} }
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))
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
harmNumMap.forEach((harmNum, value) -> {
if (fly) {
buffer.append(name + String.format("%.0f", harmNum) + "(");
} else {
buffer.append(name + harmNum + "(");
}
appendValues(buffer, value, 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());
if (CollUtil.isNotEmpty(list)) {
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() + ") ");
}
}
}
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());
if (CollUtil.isNotEmpty(list)) {
buffer.append(name + " ");
for (PqScriptDtls dtls : list) {
buffer.append(dtls.getPhase() + "相(变动频度=" + dtls.getChagFre()
+ "次/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() > 1) { if (numbers.size() > 1) {
if (numbers.contains(4)) { if (numbers.contains(4)) {

View File

@@ -44,6 +44,11 @@ public class SourceIssue {
@JSONField(serialize = false) @JSONField(serialize = false)
private List<String> devValueTypeList; private List<String> devValueTypeList;
@JSONField(serialize = false)
private String desc;
/** /**
* 检测类型 * 检测类型
*/ */

View File

@@ -20,6 +20,7 @@ import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
import com.njcn.gather.device.script.pojo.po.SourceIssue; import com.njcn.gather.device.script.pojo.po.SourceIssue;
import com.njcn.gather.device.script.service.IPqScriptCheckDataService; import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
import com.njcn.gather.device.script.service.IPqScriptDtlsService; import com.njcn.gather.device.script.service.IPqScriptDtlsService;
import com.njcn.gather.device.script.util.ScriptDtlsDesc;
import com.njcn.gather.system.dictionary.pojo.po.DictTree; import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -125,6 +126,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
Double volt = voltSet.stream().collect(Collectors.toList()).stream().findFirst().get(); Double volt = voltSet.stream().collect(Collectors.toList()).stream().findFirst().get();
Double curr = currSet.stream().collect(Collectors.toList()).stream().findFirst().get(); Double curr = currSet.stream().collect(Collectors.toList()).stream().findFirst().get();
List<PqScriptDtls> pqScriptDtls = this.pqScriptDtls(param.getScriptId(), param.getIsPhaseSequence(), volt, curr,param.getIndexList()); List<PqScriptDtls> pqScriptDtls = this.pqScriptDtls(param.getScriptId(), param.getIsPhaseSequence(), volt, curr,param.getIndexList());
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(param.getScriptId());
if (CollUtil.isNotEmpty(pqScriptDtls)) { if (CollUtil.isNotEmpty(pqScriptDtls)) {
/** /**
* 1.获取全部检测点脚本 * 1.获取全部检测点脚本
@@ -157,6 +159,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
checkDataParam.setIndex(freqDtls.getIndex()); checkDataParam.setIndex(freqDtls.getIndex());
checkDataParam.setIsValueTypeName(true); checkDataParam.setIsValueTypeName(true);
issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam)); issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam));
issue.setDesc(ScriptDtlsDesc.getStringBuffer(value,isValueType).toString());
issue.setScriptId(freqDtls.getScriptId()); issue.setScriptId(freqDtls.getScriptId());
issue.setFUn(volt); issue.setFUn(volt);
issue.setFIn(curr); issue.setFIn(curr);
@@ -220,8 +223,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
.selectAs(DictTree::getCode, PqScriptDtls::getScriptCode) .selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType) .leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
// .eq(PqScriptDtls::getIndex, 1) // .eq(PqScriptDtls::getIndex, 1)
// .le(PqScriptDtls::getIndex, 8) // .le(PqScriptDtls::getIndex, 30)
// .in(PqScriptDtls::getIndex, Arrays.asList(30,101,105)) // .in(PqScriptDtls::getIndex, Arrays.asList(1,7))
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode()); .eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
if (isPhaseSequence.equals(CommonEnum.PHASE_TEST.getValue())) { if (isPhaseSequence.equals(CommonEnum.PHASE_TEST.getValue())) {