1.微调正式检测-检测详情表格数据
This commit is contained in:
@@ -792,11 +792,11 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
);
|
);
|
||||||
List<Double> harmNum = list.stream().map(PqScriptCheckData::getHarmNum).collect(Collectors.toList());
|
List<Double> harmNum = list.stream().map(PqScriptCheckData::getHarmNum).collect(Collectors.toList());
|
||||||
ResultVO resultVO=new ResultVO();
|
ResultVO resultVO=new ResultVO();
|
||||||
if(CollUtil.isNotEmpty(harmNum)){
|
if(CollUtil.isEmpty(harmNum)){
|
||||||
storage.setHarmNum(harmNum);
|
|
||||||
resultVO.setRawData(adNonHarmonicService.listNonHarmData(storage));
|
resultVO.setRawData(adNonHarmonicService.listNonHarmData(storage));
|
||||||
resultVO.setResultData(adNonHarmonicService.listNonHarmResultData(storage));
|
resultVO.setResultData(adNonHarmonicService.listNonHarmResultData(storage));
|
||||||
}else{
|
}else{
|
||||||
|
storage.setHarmNum(harmNum);
|
||||||
resultVO.setRawData(adHarmonicService.listHarmData(storage));
|
resultVO.setRawData(adHarmonicService.listHarmData(storage));
|
||||||
resultVO.setResultData(adHarmonicService.listHarmResultData(storage));
|
resultVO.setResultData(adHarmonicService.listHarmResultData(storage));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,4 +41,9 @@ public class RawDataVO {
|
|||||||
* T相数据
|
* T相数据
|
||||||
*/
|
*/
|
||||||
private String dataT;
|
private String dataT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ public class RawResultDataVO {
|
|||||||
*/
|
*/
|
||||||
private DetectionData dataT;
|
private DetectionData dataT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class DetectionData {
|
public static class DetectionData {
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
for (Double i : harmNum) {
|
for (Double i : harmNum) {
|
||||||
dataVO = new RawDataVO();
|
dataVO = new RawDataVO();
|
||||||
dataVO.setHarmNum(i);
|
dataVO.setHarmNum(i);
|
||||||
|
dataVO.setUnit("%");
|
||||||
try {
|
try {
|
||||||
Field timeId = harmonicResult.getClass().getDeclaredField("timeId");
|
Field timeId = harmonicResult.getClass().getDeclaredField("timeId");
|
||||||
timeId.setAccessible(true);
|
timeId.setAccessible(true);
|
||||||
@@ -125,6 +126,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
dataVO = new RawResultDataVO();
|
dataVO = new RawResultDataVO();
|
||||||
dataVO.setHarmNum(i);
|
dataVO.setHarmNum(i);
|
||||||
dataVO.setIsData(harmonicResult.getResultFlag());
|
dataVO.setIsData(harmonicResult.getResultFlag());
|
||||||
|
dataVO.setUnit("%");
|
||||||
try {
|
try {
|
||||||
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||||
fieldA.setAccessible(true);
|
fieldA.setAccessible(true);
|
||||||
|
|||||||
@@ -65,13 +65,14 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
Map<String, List<RawDataVO>> info = new HashMap<>(2);
|
Map<String, List<RawDataVO>> info = new HashMap<>(2);
|
||||||
Map<String, List<AdNonHarmonicResult>> adTypeMap = adHarmonicResults.stream().collect(Collectors.groupingBy(AdNonHarmonicResult::getAdType));
|
Map<String, List<AdNonHarmonicResult>> adTypeMap = adHarmonicResults.stream().collect(Collectors.groupingBy(AdNonHarmonicResult::getAdType));
|
||||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet()));
|
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet()));
|
||||||
Map<String, String> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, DictTree::getName));
|
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId,Function.identity()));
|
||||||
adTypeMap.forEach((key, value) -> {
|
adTypeMap.forEach((key, value) -> {
|
||||||
if (dictTreeByName.containsKey(key)) {
|
if (dictTreeByName.containsKey(key)) {
|
||||||
String treeName = dictTreeByName.get(key);
|
DictTree dictTree = dictTreeByName.get(key);
|
||||||
List<RawDataVO> rawDataVOS = new ArrayList<>();
|
List<RawDataVO> rawDataVOS = new ArrayList<>();
|
||||||
for (AdNonHarmonicResult result : value) {
|
for (AdNonHarmonicResult result : value) {
|
||||||
RawDataVO dataVO = new RawDataVO();
|
RawDataVO dataVO = new RawDataVO();
|
||||||
|
dataVO.setUnit(unit(dictTree.getCode()));
|
||||||
dataVO.setTime(result.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
dataVO.setTime(result.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||||
dataVO.setDataA(ObjectUtil.isNotNull(result.getAValue()) ? new BigDecimal(result.getAValue()).toPlainString() : null);
|
dataVO.setDataA(ObjectUtil.isNotNull(result.getAValue()) ? new BigDecimal(result.getAValue()).toPlainString() : null);
|
||||||
dataVO.setDataB(ObjectUtil.isNotNull(result.getBValue()) ? new BigDecimal(result.getBValue()).toPlainString() : null);
|
dataVO.setDataB(ObjectUtil.isNotNull(result.getBValue()) ? new BigDecimal(result.getBValue()).toPlainString() : null);
|
||||||
@@ -79,7 +80,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
dataVO.setDataT(ObjectUtil.isNotNull(result.getTValue()) ? new BigDecimal(result.getTValue()).toPlainString() : null);
|
dataVO.setDataT(ObjectUtil.isNotNull(result.getTValue()) ? new BigDecimal(result.getTValue()).toPlainString() : null);
|
||||||
rawDataVOS.add(dataVO);
|
rawDataVOS.add(dataVO);
|
||||||
}
|
}
|
||||||
info.put(treeName, rawDataVOS);
|
info.put(dictTree.getName(), rawDataVOS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
DynamicTableNameHandler.remove();
|
DynamicTableNameHandler.remove();
|
||||||
@@ -101,12 +102,13 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream().collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity()));
|
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream().collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity()));
|
||||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet()));
|
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet()));
|
||||||
|
|
||||||
Map<String, String> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, DictTree::getName));
|
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId,Function.identity()));
|
||||||
adTypeMap.forEach((key, result) -> {
|
adTypeMap.forEach((key, result) -> {
|
||||||
if (dictTreeByName.containsKey(key)) {
|
if (dictTreeByName.containsKey(key)) {
|
||||||
String treeName = dictTreeByName.get(key);
|
DictTree treeName = dictTreeByName.get(key);
|
||||||
RawResultDataVO dataVO = new RawResultDataVO();
|
RawResultDataVO dataVO = new RawResultDataVO();
|
||||||
dataVO.setIsData(result.getResultFlag());
|
dataVO.setIsData(result.getResultFlag());
|
||||||
|
dataVO.setUnit(unit(treeName.getCode()));
|
||||||
RawResultDataVO.DetectionData a = JSON.parseObject(result.getAValue(), RawResultDataVO.DetectionData.class);
|
RawResultDataVO.DetectionData a = JSON.parseObject(result.getAValue(), RawResultDataVO.DetectionData.class);
|
||||||
RawResultDataVO.DetectionData b = JSON.parseObject(result.getBValue(), RawResultDataVO.DetectionData.class);
|
RawResultDataVO.DetectionData b = JSON.parseObject(result.getBValue(), RawResultDataVO.DetectionData.class);
|
||||||
RawResultDataVO.DetectionData c = JSON.parseObject(result.getCValue(), RawResultDataVO.DetectionData.class);
|
RawResultDataVO.DetectionData c = JSON.parseObject(result.getCValue(), RawResultDataVO.DetectionData.class);
|
||||||
@@ -122,10 +124,90 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
dataVO.setRadius(b.getRadius());
|
dataVO.setRadius(b.getRadius());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.put(treeName, dataVO);
|
info.put(treeName.getName(), dataVO);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
DynamicTableNameHandler.remove();
|
DynamicTableNameHandler.remove();
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String unit(String code){
|
||||||
|
String unit="";
|
||||||
|
switch (code) {
|
||||||
|
/**
|
||||||
|
* 频率
|
||||||
|
*/
|
||||||
|
case "FREQ":
|
||||||
|
unit="Hz";
|
||||||
|
break;
|
||||||
|
/**
|
||||||
|
* 电压
|
||||||
|
*/
|
||||||
|
case "VRMS":
|
||||||
|
unit="V";
|
||||||
|
break;
|
||||||
|
/**
|
||||||
|
* 电流
|
||||||
|
*/
|
||||||
|
case "I":
|
||||||
|
unit="A";
|
||||||
|
break;
|
||||||
|
/**
|
||||||
|
* 谐波电压
|
||||||
|
*/
|
||||||
|
case "V2-50":
|
||||||
|
/**
|
||||||
|
* 谐波电流
|
||||||
|
*/
|
||||||
|
case "I2-50":
|
||||||
|
/**
|
||||||
|
* 间谐波电压
|
||||||
|
*/
|
||||||
|
case "SV_1-49":
|
||||||
|
/**
|
||||||
|
* 间谐波电流
|
||||||
|
*/
|
||||||
|
case "SI_1-49":
|
||||||
|
/**
|
||||||
|
* 三相电压不平衡度
|
||||||
|
*/
|
||||||
|
case "V_UNBAN":
|
||||||
|
/**
|
||||||
|
* 三相电流不平衡度
|
||||||
|
*/
|
||||||
|
case "I_UNBAN":
|
||||||
|
unit="%";
|
||||||
|
break;
|
||||||
|
/**
|
||||||
|
* 谐波有功功率
|
||||||
|
*/
|
||||||
|
case "P2-50":
|
||||||
|
unit="W";
|
||||||
|
break;
|
||||||
|
/**
|
||||||
|
* 功率
|
||||||
|
*/
|
||||||
|
case "P":
|
||||||
|
unit="P";
|
||||||
|
break;
|
||||||
|
/**
|
||||||
|
* 闪变
|
||||||
|
*/
|
||||||
|
case "PST":
|
||||||
|
break;
|
||||||
|
/**
|
||||||
|
* 暂态-电压幅值
|
||||||
|
*/
|
||||||
|
case "MAG":
|
||||||
|
unit="%";
|
||||||
|
break;
|
||||||
|
/**
|
||||||
|
* 暂态-持续时间
|
||||||
|
*/
|
||||||
|
case "DUR":
|
||||||
|
unit="s";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user