1.正式检测代码详情检测树代码提交
This commit is contained in:
@@ -16,6 +16,16 @@ public class TreeDataVO {
|
||||
* 检测项目名称
|
||||
*/
|
||||
private String scriptTypeName;
|
||||
|
||||
/**
|
||||
* 源下发的描述
|
||||
*/
|
||||
private String sourceDesc;
|
||||
|
||||
/**
|
||||
* 谐波次数
|
||||
*/
|
||||
private List<Integer> harmNum;
|
||||
/**
|
||||
* 测试相
|
||||
*/
|
||||
|
||||
@@ -5,10 +5,11 @@ 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.PqScriptCheckData;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
@@ -28,7 +29,6 @@ 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;
|
||||
@@ -50,6 +50,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
||||
private final PqScriptMapper scriptMapper;
|
||||
private final IDictTreeService dictTreeService;
|
||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
|
||||
/**
|
||||
* 谐波类code,取树形字典表中的code
|
||||
@@ -115,7 +116,8 @@ public class ResultServiceImpl implements IResultService {
|
||||
.eq(StrUtil.isNotBlank(param.getScriptId()), PqScriptDtls::getScriptId, param.getScriptId())
|
||||
.eq(StrUtil.isNotBlank(param.getScriptType()), PqScriptDtls::getScriptType, param.getScriptType())
|
||||
.ne(PqScriptDtls::getIndex, -1)
|
||||
.eq(PqScriptDtls::getEnable, DataStateEnum.ENABLE.getCode()));
|
||||
.eq(PqScriptDtls::getEnable, DataStateEnum.ENABLE.getCode())
|
||||
);
|
||||
List<AdBaseResult> allResultList = new ArrayList<>();
|
||||
List<Integer> indexList = new ArrayList<>();
|
||||
if (StrUtil.isNotBlank(param.getScriptType())) {
|
||||
@@ -135,34 +137,603 @@ public class ResultServiceImpl implements IResultService {
|
||||
|
||||
Map<String, DictTree> dictTreeMap = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
|
||||
Map<String, String> subName = new LinkedHashMap<>();
|
||||
subName.put("Base", "额定工作条件下的测量");
|
||||
subName.put("VOL", "电压对XX测量的影响");
|
||||
subName.put("Freq", "频率对XX测量的影响");
|
||||
subName.put("Base", "额定条件XX准确度测试");
|
||||
subName.put("VOL", "电压幅值对XX测量的影响");
|
||||
subName.put("Freq", "频率变化对XX测量的影响");
|
||||
subName.put("Harm", "谐波对XX测量的影响");
|
||||
subName.put("Single", "单影响量下XX准确度测试");
|
||||
Boolean isValueType = scriptMapper.selectScriptIsValueType(param.getScriptId());
|
||||
PqDevVO dev = pqDevService.getPqDevById(param.getDevId());
|
||||
|
||||
List<TreeDataVO> infoVOS = new ArrayList<>();
|
||||
//根据检测大项进行分组展示
|
||||
Map<Integer, Set<Integer>> finalResultMap = resultMap;
|
||||
dtlsSortMap.forEach((key, value) -> {
|
||||
DictTree dictTree = dictTreeMap.get(key);
|
||||
if (ObjectUtil.isNotNull(dictTree)) {
|
||||
List<TreeDataVO> scriptSubList = new ArrayList<>();
|
||||
|
||||
//大相检测信息
|
||||
TreeDataVO infoVO = new TreeDataVO();
|
||||
infoVO.setScriptTypeName(dictTree.getName());
|
||||
//额定条件下频率准确度测试
|
||||
LinkedHashMap<String, List<PqScriptDtls>> subTypeMap = value.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.filter(x -> "Base".equals(x.getScriptSubType()))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptSubType, LinkedHashMap::new, Collectors.toList()));
|
||||
subTypeMap.forEach((subKey, subValue) -> {
|
||||
List<TreeDataVO> scriptDlsList = new ArrayList<>();
|
||||
//根据index进行分组统计小相检测信息
|
||||
if (!"VOLTAGE".equals(dictTree.getCode())) {
|
||||
TreeDataVO subType = new TreeDataVO();
|
||||
subType.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName()));
|
||||
LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList()));
|
||||
indexMap.forEach((index, scriptDtlIndex) -> {
|
||||
List<TreeDataVO> subTypeList = new ArrayList<>();
|
||||
|
||||
indexMap.forEach((index, scriptDtlIndexList) -> {
|
||||
if (finalResultMap.containsKey(index)) {
|
||||
Set<Integer> nums = finalResultMap.get(index);
|
||||
TreeDataVO childInfo = new TreeDataVO();
|
||||
TreeDataVO dtlType = new TreeDataVO();
|
||||
dtlType.setIndex(index);
|
||||
ratedScriptTypeName(scriptDtlIndexList, isValueType, dtlType, dictTree);
|
||||
dtlType.setSourceDesc(getStringBuffer(scriptDtlIndexList, isValueType).toString());
|
||||
dtlType.setFly(conform(finalResultMap.get(index)));
|
||||
subTypeList.add(dtlType);
|
||||
}
|
||||
});
|
||||
subType.setChildren(subTypeList);
|
||||
scriptSubList.add(subType);
|
||||
} else {
|
||||
dipScriptTypeName(subValue, scriptSubList,finalResultMap, isValueType, "电压暂降测量准确度测试", 20, 85);
|
||||
dipScriptTypeName(subValue, scriptSubList,finalResultMap, isValueType, "电压暂升测量准确度测试", 110, 180);
|
||||
dipScriptTypeName(subValue, scriptSubList,finalResultMap, isValueType, "电压中断测量准确度测试", 0, 10);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
//单影响量下频率准确度测试
|
||||
LinkedHashMap<String, List<PqScriptDtls>> subSingleTypeMap = value.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.filter(x -> !"Base".equals(x.getScriptSubType()))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptSubType, LinkedHashMap::new, Collectors.toList()));
|
||||
if (CollUtil.isNotEmpty(subSingleTypeMap)) {
|
||||
TreeDataVO subType = new TreeDataVO();
|
||||
subType.setScriptTypeName(subName.get("Single").replace("XX", dictTree.getName()));
|
||||
//单影响量下频率准测量集合
|
||||
List<TreeDataVO> subSingleList = new ArrayList<>();
|
||||
subSingleTypeMap.forEach((subKey, subValue) -> {
|
||||
TreeDataVO treeDataVO = new TreeDataVO();
|
||||
treeDataVO.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName()));
|
||||
List<TreeDataVO> subTypeList = new ArrayList<>();
|
||||
|
||||
LinkedHashMap<Integer, List<PqScriptDtls>> indexMap = subValue.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList()));
|
||||
indexMap.forEach((index, scriptDtlIndexList) -> {
|
||||
if (finalResultMap.containsKey(index)) {
|
||||
TreeDataVO dtlType = new TreeDataVO();
|
||||
dtlType.setIndex(index);
|
||||
if ("Harm".equals(subKey)) {
|
||||
harmScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType);
|
||||
}
|
||||
if ("VOL".equals(subKey)) {
|
||||
volScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType);
|
||||
}
|
||||
if ("Freq".equals(subKey)) {
|
||||
freqScriptTypeName(scriptDtlIndexList, dictTree, isValueType, dtlType);
|
||||
}
|
||||
dtlType.setSourceDesc(getStringBuffer(scriptDtlIndexList, isValueType).toString());
|
||||
dtlType.setFly(conform(finalResultMap.get(index)));
|
||||
subTypeList.add(dtlType);
|
||||
}
|
||||
|
||||
});
|
||||
treeDataVO.setChildren(subTypeList);
|
||||
subSingleList.add(treeDataVO);
|
||||
});
|
||||
subType.setChildren(subSingleList);
|
||||
scriptSubList.add(subType);
|
||||
}
|
||||
infoVO.setChildren(scriptSubList);
|
||||
infoVOS.add(infoVO);
|
||||
}
|
||||
});
|
||||
return infoVOS;
|
||||
}
|
||||
|
||||
private void dipScriptTypeName(List<PqScriptDtls> subValue, List<TreeDataVO> subTypeList,Map<Integer, Set<Integer>> finalResultMap, Boolean isValueType, String name, Integer start, Integer end) {
|
||||
List<TreeDataVO> info = new ArrayList<>();
|
||||
List<PqScriptDtls> dip = subValue.stream()
|
||||
.filter(x -> "Dip".equals(x.getValueType()) && "A".equals(x.getPhase()))
|
||||
.filter(x -> x.getTransValue() >= start && x.getTransValue() <= end)
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.toList());
|
||||
TreeDataVO vo = new TreeDataVO();
|
||||
vo.setScriptTypeName(name);
|
||||
TreeDataVO dlt;
|
||||
for (PqScriptDtls dtls : dip) {
|
||||
if(finalResultMap.containsKey(dtls.getIndex())){
|
||||
dlt = new TreeDataVO();
|
||||
List<PqScriptDtls> scriptDtlIndexList = subValue.stream().filter(x -> dtls.getIndex().equals(x.getIndex())).collect(Collectors.toList());
|
||||
//特征幅值=20%Un,持续时间=1周波
|
||||
dlt.setScriptTypeName("特征幅值=" + dtls.getTransValue() + "%Un,持续时间=" + dtls.getRetainTime().intValue() + "周波");
|
||||
dlt.setIndex(dtls.getIndex());
|
||||
dlt.setSourceDesc(getStringBuffer(scriptDtlIndexList, isValueType).toString());
|
||||
dlt.setFly(conform(finalResultMap.get(dtls.getIndex())));
|
||||
info.add(dlt);
|
||||
}
|
||||
|
||||
}
|
||||
vo.setChildren(info);
|
||||
subTypeList.add(vo);
|
||||
}
|
||||
|
||||
private void ratedScriptTypeName(List<PqScriptDtls> scriptDtlIndexList, Boolean isValueType, TreeDataVO dtlType, DictTree dictTree) {
|
||||
switch (dictTree.getCode()) {
|
||||
/**
|
||||
* 频率
|
||||
*/
|
||||
case "FREQ":
|
||||
List<PqScriptDtls> f = scriptDtlIndexList.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + f.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit());
|
||||
break;
|
||||
/**
|
||||
* 电压
|
||||
*/
|
||||
case "V":
|
||||
String unit;
|
||||
if (isValueType) {
|
||||
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> v = scriptDtlIndexList.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + v.get(0).getValue().intValue() + unit);
|
||||
break;
|
||||
/**
|
||||
* 电流
|
||||
*/
|
||||
case "I":
|
||||
String unitI;
|
||||
if (isValueType) {
|
||||
unitI = ResultUnitEnum.I_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unitI = ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> I = scriptDtlIndexList.stream().filter(x -> "CUR".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + I.get(0).getValue().intValue() + unitI);
|
||||
break;
|
||||
/**
|
||||
* 谐波电压
|
||||
*/
|
||||
case "HV":
|
||||
/**
|
||||
* 谐波电流
|
||||
*/
|
||||
case "HI":
|
||||
String valueType;
|
||||
if ("HV".equals(dictTree.getCode())) {
|
||||
valueType = "Harm_V";
|
||||
} else {
|
||||
valueType = "Harm_I";
|
||||
}
|
||||
List<PqScriptDtls> hv = scriptDtlIndexList.stream().filter(x -> valueType.equals(x.getValueType())).collect(Collectors.toList());
|
||||
LinkedHashMap<Double, List<PqScriptDtls>> harmNumMap = hv.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
|
||||
if (harmNumMap.size() > 1) {
|
||||
//叠加2~50次谐波电压(含有率为GB/T)
|
||||
dtlType.setScriptTypeName("叠加" + harmNumMap.entrySet().iterator().next().getValue().get(0).getHarmNum().intValue() + "~" +
|
||||
new ArrayList<>(harmNumMap.entrySet()).get(harmNumMap.size() - 1).getValue().get(0).getHarmNum().intValue()
|
||||
+ "次" + dictTree.getName() + "(含有率为GB/T)");
|
||||
} else {
|
||||
//叠加5%的2次谐波电压
|
||||
dtlType.setScriptTypeName("叠加" + hv.get(0).getValue().intValue() + ResultUnitEnum.HV_UNIT.getUnit() + "的" + hv.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
||||
}
|
||||
break;
|
||||
/**
|
||||
* 间谐波电压
|
||||
*/
|
||||
case "HSV":
|
||||
/**
|
||||
* 间谐波电流
|
||||
*/
|
||||
case "HSI":
|
||||
//叠加1.5/5.5/7.5/49.5次间谐波,含有率为。。。
|
||||
String in;
|
||||
if ("HSV".equals(dictTree.getCode())) {
|
||||
in = "InHarm_V";
|
||||
} else {
|
||||
in = "InHarm_I";
|
||||
}
|
||||
List<PqScriptDtls> harmInNumList = scriptDtlIndexList.stream().filter(x -> in.equals(x.getValueType()) && "A".equals(x.getPhase()))
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
if (harmInNumList.size() > 1) {
|
||||
StringBuffer a = new StringBuffer();
|
||||
a.append("叠加");
|
||||
for (int i = 0; i < harmInNumList.size(); i++) {
|
||||
if (i == harmInNumList.size() - 1) {
|
||||
a.append(harmInNumList.get(i).getHarmNum());
|
||||
} else {
|
||||
a.append(harmInNumList.get(i).getHarmNum() + "/");
|
||||
}
|
||||
}
|
||||
a.append("次" + dictTree.getName());
|
||||
dtlType.setScriptTypeName(a.toString());
|
||||
} else {
|
||||
//叠加5%的2次谐波电压
|
||||
dtlType.setScriptTypeName("叠加" + harmInNumList.get(0).getValue().intValue() + ResultUnitEnum.HV_UNIT.getUnit() + "的" + harmInNumList.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
}
|
||||
|
||||
break;
|
||||
/**
|
||||
* 三相电压不平衡度
|
||||
*/
|
||||
case "IMBV":
|
||||
List<PqScriptCheckData> list = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
||||
.eq(PqScriptCheckData::getScriptId, scriptDtlIndexList.get(0).getScriptId())
|
||||
.eq(PqScriptCheckData::getIndex, scriptDtlIndexList.get(0).getIndex())
|
||||
);
|
||||
//三相负序电压不平衡度=0%
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + list.get(0).getValue() + ResultUnitEnum.IMBV_UNIT.getUnit());
|
||||
break;
|
||||
/**
|
||||
* 三相电流不平衡度
|
||||
*/
|
||||
case "IMBA":
|
||||
List<PqScriptCheckData> imba = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
||||
.eq(PqScriptCheckData::getScriptId, scriptDtlIndexList.get(0).getScriptId())
|
||||
.eq(PqScriptCheckData::getIndex, scriptDtlIndexList.get(0).getIndex())
|
||||
);
|
||||
//三相负序电流不平衡度=0%
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + imba.get(0).getValue() + ResultUnitEnum.IMBV_UNIT.getUnit());
|
||||
break;
|
||||
/**
|
||||
* 谐波有功功率
|
||||
*/
|
||||
case "HP":
|
||||
//10%的2次谐波电压,40%的2次谐波电流
|
||||
List<PqScriptDtls> hpv = scriptDtlIndexList.stream().filter(x -> "Harm_V".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hpI = scriptDtlIndexList.stream().filter(x -> "Harm_I".equals(x.getValueType())).collect(Collectors.toList());
|
||||
LinkedHashMap<Double, List<PqScriptDtls>> harmNumVMap = hpv.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
LinkedHashMap<Double, List<PqScriptDtls>> harmNumIMap = hpI.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getHarmNum))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
|
||||
StringBuffer a = new StringBuffer();
|
||||
if (harmNumVMap.size() > 1) {
|
||||
ArrayList<List<PqScriptDtls>> lists = new ArrayList<>(harmNumVMap.values());
|
||||
Map<Double, List<PqScriptDtls>> hpvMap = lists.stream().flatMap(x -> x.stream().filter(j -> "A".equals(j.getPhase()))).collect(Collectors.groupingBy(PqScriptDtls::getValue));
|
||||
hpvMap.forEach((key, value) -> {
|
||||
a.append(key.intValue() + ResultUnitEnum.HV_UNIT.getUnit() + "的");
|
||||
for (int i = 0; i < value.size(); i++) {
|
||||
if (i == value.size() - 1) {
|
||||
a.append(value.get(i).getHarmNum().intValue());
|
||||
} else {
|
||||
a.append(value.get(i).getHarmNum().intValue() + "、");
|
||||
}
|
||||
}
|
||||
a.append("次" + ResultUnitEnum.HV_UNIT.getName());
|
||||
});
|
||||
} else {
|
||||
PqScriptDtls dtls = harmNumVMap.entrySet().iterator().next().getValue().get(0);
|
||||
a.append(dtls.getValue().intValue() + ResultUnitEnum.HV_UNIT.getUnit() + "的" + dtls.getHarmNum().intValue() + ResultUnitEnum.HV_UNIT.getName());
|
||||
}
|
||||
a.append(",");
|
||||
if (harmNumIMap.size() > 1) {
|
||||
ArrayList<List<PqScriptDtls>> lists = new ArrayList<>(harmNumIMap.values());
|
||||
Map<Double, List<PqScriptDtls>> hpvMap = lists.stream().flatMap(x -> x.stream().filter(j -> "A".equals(j.getPhase()))).collect(Collectors.groupingBy(PqScriptDtls::getValue));
|
||||
hpvMap.forEach((key, value) -> {
|
||||
a.append(key.intValue() + ResultUnitEnum.HI_UNIT.getUnit() + "的");
|
||||
for (int i = 0; i < value.size(); i++) {
|
||||
if (i == value.size() - 1) {
|
||||
a.append(value.get(i).getHarmNum().intValue());
|
||||
} else {
|
||||
a.append(value.get(i).getHarmNum().intValue() + "、");
|
||||
}
|
||||
}
|
||||
a.append("次" + ResultUnitEnum.HI_UNIT.getName());
|
||||
});
|
||||
} else {
|
||||
PqScriptDtls dtls = harmNumIMap.entrySet().iterator().next().getValue().get(0);
|
||||
a.append(dtls.getValue().intValue() + ResultUnitEnum.HI_UNIT.getUnit() + "的" + dtls.getHarmNum().intValue() + "次" + ResultUnitEnum.HI_UNIT.getName());
|
||||
}
|
||||
dtlType.setScriptTypeName(a.toString());
|
||||
break;
|
||||
/**
|
||||
* 功率
|
||||
*/
|
||||
case "P":
|
||||
break;
|
||||
/**
|
||||
* 闪变
|
||||
*/
|
||||
case "F":
|
||||
//Pst=1(变动率=1.459%*1)
|
||||
List<PqScriptDtls> flicker = scriptDtlIndexList.stream().filter(x -> "Flicker".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("Pst=" + flicker.get(0).getChagFre() + "(变动率=" + flicker.get(0).getChagValue() + "%*" + flicker.get(0).getChagFre() + ")");
|
||||
break;
|
||||
/**
|
||||
* 暂态
|
||||
*/
|
||||
case "VOLTAGE":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void harmScriptTypeName(List<PqScriptDtls> dtls, DictTree dictTree, Boolean isValueType, TreeDataVO dtlType) {
|
||||
switch (dictTree.getCode()) {
|
||||
/**
|
||||
* 频率
|
||||
*/
|
||||
case "FREQ":
|
||||
List<PqScriptDtls> f = dtls.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("叠加多次谐波对" + dictTree.getName() + "=" + f.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + "的影响");
|
||||
break;
|
||||
/**
|
||||
* 电压
|
||||
*/
|
||||
case "V":
|
||||
String unit;
|
||||
if (isValueType) {
|
||||
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> v = dtls.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("叠加多次谐波对" + dictTree.getName() + "=" + v.get(0).getValue() + unit + "的影响");
|
||||
break;
|
||||
/**
|
||||
* 电流
|
||||
*/
|
||||
case "I":
|
||||
break;
|
||||
/**
|
||||
* 谐波电压
|
||||
*/
|
||||
case "HV":
|
||||
break;
|
||||
/**
|
||||
* 谐波电流
|
||||
*/
|
||||
case "HI":
|
||||
break;
|
||||
/**
|
||||
* 间谐波电压
|
||||
*/
|
||||
case "HSV":
|
||||
break;
|
||||
/**
|
||||
* 间谐波电流
|
||||
*/
|
||||
case "HSI":
|
||||
break;
|
||||
/**
|
||||
* 三相电压不平衡度
|
||||
*/
|
||||
case "IMBV":
|
||||
break;
|
||||
/**
|
||||
* 三相电流不平衡度
|
||||
*/
|
||||
case "IMBA":
|
||||
break;
|
||||
/**
|
||||
* 谐波有功功率
|
||||
*/
|
||||
case "HP":
|
||||
break;
|
||||
/**
|
||||
* 功率
|
||||
*/
|
||||
case "P":
|
||||
break;
|
||||
/**
|
||||
* 闪变
|
||||
*/
|
||||
case "F":
|
||||
break;
|
||||
/**
|
||||
* 暂态
|
||||
*/
|
||||
case "VOLTAGE":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void volScriptTypeName(List<PqScriptDtls> dtls, DictTree dictTree, Boolean isValueType, TreeDataVO dtlType) {
|
||||
switch (dictTree.getCode()) {
|
||||
/**
|
||||
* 频率
|
||||
*/
|
||||
case "FREQ":
|
||||
String unit;
|
||||
if (isValueType) {
|
||||
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> f = dtls.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> v = dtls.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName(v.get(0).getValue().intValue() + unit + "对" + dictTree.getName() + "=" + f.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + "的影响");
|
||||
break;
|
||||
/**
|
||||
* 电压
|
||||
*/
|
||||
case "V":
|
||||
|
||||
break;
|
||||
/**
|
||||
* 电流
|
||||
*/
|
||||
case "I":
|
||||
break;
|
||||
/**
|
||||
* 谐波电压
|
||||
*/
|
||||
case "HV":
|
||||
//电压有效值10%,3次谐波电压,含有率
|
||||
List<PqScriptDtls> hvv = dtls.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hv = dtls.stream().filter(x -> "Harm_V".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("电压有效值" + hvv.get(0).getValue().intValue() + ResultUnitEnum.HV_UNIT.getUnit() + "," + hv.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
||||
break;
|
||||
/**
|
||||
* 谐波电流
|
||||
*/
|
||||
case "HI":
|
||||
List<PqScriptDtls> hiv = dtls.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hi = dtls.stream().filter(x -> "Harm_I".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("电压有效值" + hiv.get(0).getValue().intValue() + ResultUnitEnum.HI_UNIT.getUnit() + "," + hi.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
||||
break;
|
||||
/**
|
||||
* 间谐波电压
|
||||
*/
|
||||
case "HSV":
|
||||
List<PqScriptDtls> hsvv = dtls.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hsv = dtls.stream().filter(x -> "InHarm_V".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("电压有效值" + hsvv.get(0).getValue().intValue() + ResultUnitEnum.HSV_UNIT.getUnit() + "," + hsv.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
break;
|
||||
/**
|
||||
* 间谐波电流
|
||||
*/
|
||||
case "HSI":
|
||||
List<PqScriptDtls> hsiv = dtls.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hsi = dtls.stream().filter(x -> "InHarm_I".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("电压有效值" + hsiv.get(0).getValue().intValue() + ResultUnitEnum.HSI_UNIT.getUnit() + "," + hsi.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
break;
|
||||
/**
|
||||
* 三相电压不平衡度
|
||||
*/
|
||||
case "IMBV":
|
||||
break;
|
||||
/**
|
||||
* 三相电流不平衡度
|
||||
*/
|
||||
case "IMBA":
|
||||
break;
|
||||
/**
|
||||
* 谐波有功功率
|
||||
*/
|
||||
case "HP":
|
||||
break;
|
||||
/**
|
||||
* 功率
|
||||
*/
|
||||
case "P":
|
||||
break;
|
||||
/**
|
||||
* 闪变
|
||||
*/
|
||||
case "F":
|
||||
break;
|
||||
/**
|
||||
* 暂态
|
||||
*/
|
||||
case "VOLTAGE":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void freqScriptTypeName(List<PqScriptDtls> dtls, DictTree dictTree, Boolean isValueType, TreeDataVO dtlType) {
|
||||
switch (dictTree.getCode()) {
|
||||
/**
|
||||
* 频率
|
||||
*/
|
||||
case "FREQ":
|
||||
break;
|
||||
/**
|
||||
* 电压
|
||||
*/
|
||||
case "V":
|
||||
String unit;
|
||||
if (isValueType) {
|
||||
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> f = dtls.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> v = dtls.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("频率=" + f.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + "," + dictTree.getName() + "=" + v.get(0).getValue() + unit);
|
||||
break;
|
||||
/**
|
||||
* 电流
|
||||
*/
|
||||
case "I":
|
||||
break;
|
||||
/**
|
||||
* 谐波电压
|
||||
*/
|
||||
case "HV":
|
||||
//基波频率为42.5Hz,2次谐波电压
|
||||
List<PqScriptDtls> hvf = dtls.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hv = dtls.stream().filter(x -> "Harm_V".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("基波频率为" + hvf.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + "," + hv.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
||||
break;
|
||||
/**
|
||||
* 谐波电流
|
||||
*/
|
||||
case "HI":
|
||||
List<PqScriptDtls> hif = dtls.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hi = dtls.stream().filter(x -> "Harm_I".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("基波频率为" + hif.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + "," + hi.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
||||
break;
|
||||
/**
|
||||
* 间谐波电压
|
||||
*/
|
||||
case "HSV":
|
||||
List<PqScriptDtls> hsvf = dtls.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hsv = dtls.stream().filter(x -> "InHarm_V".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("基波频率为" + hsvf.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + "," + hsv.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
break;
|
||||
/**
|
||||
* 间谐波电流
|
||||
*/
|
||||
case "HSI":
|
||||
List<PqScriptDtls> hsif = dtls.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> hsi = dtls.stream().filter(x -> "InHarm_I".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("基波频率为" + hsif.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + "," + hsi.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
break;
|
||||
/**
|
||||
* 三相电压不平衡度
|
||||
*/
|
||||
case "IMBV":
|
||||
break;
|
||||
/**
|
||||
* 三相电流不平衡度
|
||||
*/
|
||||
case "IMBA":
|
||||
break;
|
||||
/**
|
||||
* 谐波有功功率
|
||||
*/
|
||||
case "HP":
|
||||
break;
|
||||
/**
|
||||
* 功率
|
||||
*/
|
||||
case "P":
|
||||
break;
|
||||
/**
|
||||
* 闪变
|
||||
*/
|
||||
case "F":
|
||||
break;
|
||||
/**
|
||||
* 暂态
|
||||
*/
|
||||
case "VOLTAGE":
|
||||
//频率=42.5H在,特征幅值=60%Un,持续时间=1周波
|
||||
List<PqScriptDtls> dipf = dtls.stream().filter(x -> "Freq".equals(x.getValueType())).collect(Collectors.toList());
|
||||
List<PqScriptDtls> dip = dtls.stream().filter(x -> "Dip".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName("频率=" + dipf.get(0).getValue() + ResultUnitEnum.FREQ_UNIT.getUnit() + ",特征幅值=" + dip.get(0).getTransValue().intValue() + "%Un,持续时间=" + dip.get(0).getRetainTime().intValue() + "周波");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
@@ -172,16 +743,14 @@ 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)) {
|
||||
Float unit = 1f;
|
||||
String unit;
|
||||
if (isValueType) {
|
||||
unit = dev.getDevVolt();
|
||||
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
for (PqScriptDtls dtls : vol) {
|
||||
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()
|
||||
+ ",相角=" + dtls.getAngle() + "° ");
|
||||
buffer.append("U" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + ",相角=" + dtls.getAngle() + "° ");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -189,16 +758,14 @@ public class ResultServiceImpl implements IResultService {
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getPhase))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(cur)) {
|
||||
Float unit = 1f;
|
||||
String unit;
|
||||
if (isValueType) {
|
||||
unit = dev.getDevCurr();
|
||||
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
|
||||
} else {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
|
||||
}
|
||||
for (PqScriptDtls dtls : cur) {
|
||||
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("I" + dtls.getPhase().toLowerCase() + "=" + result.doubleValue() + ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit()
|
||||
+ ",相角=" + dtls.getAngle() + "° ");
|
||||
buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + ",相角=" + dtls.getAngle() + "° ");
|
||||
}
|
||||
}
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "Harm_V", "h", ResultUnitEnum.HV_UNIT.getUnit(), true);
|
||||
@@ -207,37 +774,13 @@ public class ResultServiceImpl implements IResultService {
|
||||
dtlsSetBuffer(scriptDtlIndex, buffer, "InHarm_I", "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());
|
||||
scriptDlsList.add(childInfo);
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(scriptDlsList)) {
|
||||
TreeDataVO sub = new TreeDataVO();
|
||||
sub.setScriptTypeName(subName.get(subKey).replace("XX", dictTree.getName()));
|
||||
sub.setChildren(scriptDlsList);
|
||||
scriptSubList.add(sub);
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(scriptSubList)) {
|
||||
//大相检测信息
|
||||
TreeDataVO infoVO = new TreeDataVO();
|
||||
infoVO.setScriptTypeName(dictTree.getName());
|
||||
infoVO.setChildren(scriptSubList);
|
||||
infoVOS.add(infoVO);
|
||||
}
|
||||
}
|
||||
});
|
||||
return infoVOS;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO resultData(ResultParam param) {
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user