1.解决不可同时测试电压,电流问题
This commit is contained in:
@@ -115,45 +115,20 @@ public class DetectionServiceImpl {
|
||||
case I_ABSOLUTELY:
|
||||
return isQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, code);
|
||||
/**
|
||||
* 谐波电压
|
||||
* 谐波
|
||||
*/
|
||||
case HV:
|
||||
AdHarmonicResult harmV = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, U, sourceIssue, dataRule, 2);
|
||||
if (ObjectUtil.isNotNull(harmV)) {
|
||||
detectionDataDealService.acceptAdResult(Arrays.asList(harmV), code);
|
||||
return harmV.getResultFlag();
|
||||
}
|
||||
return 4;
|
||||
/**
|
||||
* 谐波电流
|
||||
*/
|
||||
case HI:
|
||||
AdHarmonicResult harmV = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, U, sourceIssue, dataRule, 2);
|
||||
AdHarmonicResult harmI = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, 2);
|
||||
if (ObjectUtil.isNotNull(harmI)) {
|
||||
detectionDataDealService.acceptAdResult(Arrays.asList(harmI), code);
|
||||
return harmI.getResultFlag();
|
||||
}
|
||||
return 4;
|
||||
return resultFlag(harmV,harmI,code);
|
||||
/**
|
||||
* 间谐波电压
|
||||
* 间谐波
|
||||
*/
|
||||
case HSV:
|
||||
AdHarmonicResult harmInV = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, U, sourceIssue, dataRule, 1);
|
||||
if (ObjectUtil.isNotNull(harmInV)) {
|
||||
detectionDataDealService.acceptAdResult(Arrays.asList(harmInV), code);
|
||||
return harmInV.getResultFlag();
|
||||
}
|
||||
return 4;
|
||||
/**
|
||||
* 间谐波电流
|
||||
*/
|
||||
case HSI:
|
||||
AdHarmonicResult harmInI = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, 1);
|
||||
if (ObjectUtil.isNotNull(harmInI)) {
|
||||
detectionDataDealService.acceptAdResult(Arrays.asList(harmInI), code);
|
||||
return harmInI.getResultFlag();
|
||||
}
|
||||
return 4;
|
||||
return resultFlag(harmInV,harmInI,code);
|
||||
/**
|
||||
* 三相电压不平衡度
|
||||
*/
|
||||
@@ -204,7 +179,20 @@ public class DetectionServiceImpl {
|
||||
return isUnknownQualified(dev, devIdMapComm, errDtlsCheckData, sourceIssue, dataRule, code);
|
||||
}
|
||||
}
|
||||
|
||||
public Integer resultFlag(AdHarmonicResult v,AdHarmonicResult i,String code){
|
||||
List<AdHarmonicResult> info=new ArrayList<>();
|
||||
if (ObjectUtil.isNotNull(v)) {
|
||||
info.add(v);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(i)) {
|
||||
info.add(i);
|
||||
}
|
||||
if(CollUtil.isNotEmpty(info)){
|
||||
detectionDataDealService.acceptAdResult(info, code);
|
||||
return getInteger(info.stream().map(x->x.getResultFlag()).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
public Integer isUnknownQualified(List<DevData> dev,
|
||||
Map<String, String> devIdMapComm,
|
||||
List<ErrDtlsCheckDataVO> errDtlsCheckData,
|
||||
@@ -479,7 +467,6 @@ public class DetectionServiceImpl {
|
||||
if (I.equals(type)) {
|
||||
fData = sourceIssue.getFIn();
|
||||
fundCode = DetectionCodeEnum.I1.getCode();
|
||||
;
|
||||
if (num == 1) {
|
||||
harmCode = DetectionCodeEnum.SI_1_49.getCode();
|
||||
} else {
|
||||
@@ -502,11 +489,13 @@ public class DetectionServiceImpl {
|
||||
Integer isQualified = 4;
|
||||
String valueTypeCode = "";
|
||||
if (CollUtil.isNotEmpty(errDtlsCheckData)) {
|
||||
harmonicResult.setAdType(errDtlsCheckData.get(0).getValueType());
|
||||
isQualified = errDtlsCheckData.get(0).getIsQualified();
|
||||
valueTypeCode = errDtlsCheckData.get(0).getValueTypeCode();
|
||||
if (CollUtil.isNotEmpty(errDtlsCheckData.get(0).getErrSysDtls())) {
|
||||
pqErrSysDtls = errDtlsCheckData.get(0).getErrSysDtls();
|
||||
String finalHarmCode = harmCode;
|
||||
List<ErrDtlsCheckDataVO> adDtlsCheckData = errDtlsCheckData.stream().filter(x -> finalHarmCode.equals(x.getValueTypeCode())).collect(Collectors.toList());
|
||||
harmonicResult.setAdType(adDtlsCheckData.get(0).getValueType());
|
||||
isQualified = adDtlsCheckData.get(0).getIsQualified();
|
||||
valueTypeCode = adDtlsCheckData.get(0).getValueTypeCode();
|
||||
if (CollUtil.isNotEmpty(adDtlsCheckData.get(0).getErrSysDtls())) {
|
||||
pqErrSysDtls = adDtlsCheckData.get(0).getErrSysDtls();
|
||||
}
|
||||
}
|
||||
List<DetectionData> integerBooleanA = harmRangeComparison(isQualified, valueTypeCode, pqErrSysDtls, type, TYPE_A, sourceIssue, dataRule, devMap.get(TYPE_A), fData, num);
|
||||
|
||||
@@ -1392,37 +1392,37 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
*/
|
||||
private Map<String, List<RawResultDataVO>> getRadiusMap(String devNum, String key, DevReportParam devReportParam, Set<Integer> indexSet, boolean isHarm) {
|
||||
Map<String, List<RawResultDataVO>> raiusMap = new LinkedHashMap<>();
|
||||
ResultParam param = new ResultParam();
|
||||
param.setScriptId(devReportParam.getScriptId());
|
||||
param.setDevId(devReportParam.getDevId());
|
||||
param.setDevNum(devNum);
|
||||
param.setCode(devReportParam.getPlanCode());
|
||||
String[] split = key.split("_");
|
||||
param.setScriptType(split[1]);
|
||||
for (Integer index : indexSet) {
|
||||
param.setIndex(index);
|
||||
ResultVO resultVO = resultService.resultDataForReport(param);
|
||||
Map<String, RawResultDataVO> resultData = resultVO.getResultData();
|
||||
if (CollectionUtil.isNotEmpty(resultData)) {
|
||||
if (DicDataEnum.V.getCode().equals(split[0]) || DicDataEnum.I.getCode().equals(split[0])) {
|
||||
// 排除电压相角、电压偏差、电流相角
|
||||
resultData.remove("电压相角");
|
||||
resultData.remove("电压偏差");
|
||||
resultData.remove("电流相角");
|
||||
}
|
||||
resultData.values().stream().findFirst().ifPresent(obj -> {
|
||||
String radius = obj.getRadius();
|
||||
String unit = obj.getUnit();
|
||||
if (StrUtil.isNotBlank(radius)) {
|
||||
if (isHarm) {
|
||||
raiusMap.put(index + "_" + radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
||||
} else {
|
||||
raiusMap.put(radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// ResultParam param = new ResultParam();
|
||||
// param.setScriptId(devReportParam.getScriptId());
|
||||
// param.setDevId(devReportParam.getDevId());
|
||||
// param.setDevNum(devNum);
|
||||
// param.setCode(devReportParam.getPlanCode());
|
||||
// String[] split = key.split("_");
|
||||
// param.setScriptType(split[1]);
|
||||
// for (Integer index : indexSet) {
|
||||
// param.setIndex(index);
|
||||
// ResultVO resultVO = resultService.resultDataForReport(param);
|
||||
// Map<String, List<RawResultDataVO>> resultData = resultVO.getResultData();
|
||||
// if (CollectionUtil.isNotEmpty(resultData)) {
|
||||
// if (DicDataEnum.V.getCode().equals(split[0]) || DicDataEnum.I.getCode().equals(split[0])) {
|
||||
// // 排除电压相角、电压偏差、电流相角
|
||||
// resultData.remove("电压相角");
|
||||
// resultData.remove("电压偏差");
|
||||
// resultData.remove("电流相角");
|
||||
// }
|
||||
// resultData.values().stream().findFirst().ifPresent(obj -> {
|
||||
// String radius = obj.getRadius();
|
||||
// String unit = obj.getUnit();
|
||||
// if (StrUtil.isNotBlank(radius)) {
|
||||
// if (isHarm) {
|
||||
// raiusMap.put(index + "_" + radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
||||
// } else {
|
||||
// raiusMap.put(radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
return raiusMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ResultVO {
|
||||
/**
|
||||
* 结果数据
|
||||
*/
|
||||
private Map<String, RawResultDataVO> resultData;
|
||||
private Map<String, List<RawResultDataVO>> resultData;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, RawResultDataVO> listHarmResultData(StorageParam param);
|
||||
Map<String, List<RawResultDataVO>> listHarmResultData(StorageParam param);
|
||||
|
||||
/**
|
||||
* 获取索引
|
||||
|
||||
@@ -39,7 +39,7 @@ public interface AdNonHarmonicService extends IService<AdNonHarmonicResult> {
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, RawResultDataVO> listNonHarmResultData(StorageParam param);
|
||||
Map<String, List<RawResultDataVO>> listNonHarmResultData(StorageParam param);
|
||||
|
||||
/**
|
||||
* 根据参数查询指定非谐波结果
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.njcn.gather.storage.service.AdHarmonicService;
|
||||
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
|
||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -32,6 +33,7 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -44,6 +46,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
||||
|
||||
private final AdNonHarmonicMapper adNonHarmonicMapper;
|
||||
private final DictTreeMapper dictTreeMapper;
|
||||
private final IDictTreeService dictTreeService;
|
||||
|
||||
@Override
|
||||
public List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, String code) {
|
||||
@@ -73,65 +76,64 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
||||
.orderByAsc(AdHarmonicResult::getTimeId)
|
||||
;
|
||||
List<AdHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
||||
LinkedHashMap<String, List<AdHarmonicResult>> adMap =
|
||||
adHarmonicResults.stream().collect(Collectors.groupingBy(AdHarmonicResult::getAdType, LinkedHashMap::new, Collectors.toList()));
|
||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adMap.keySet()));
|
||||
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
|
||||
Map<String, List<RawDataVO>> info = new LinkedHashMap<>(3);
|
||||
if (CollectionUtil.isNotEmpty(adHarmonicResults)) {
|
||||
List<Double> harmNum = param.getHarmNum();
|
||||
RawDataVO dataVO;
|
||||
List<RawDataVO> rawDataVOS;
|
||||
DictTree dictData = dictTreeMapper.selectById(adHarmonicResults.get(0).getAdType());
|
||||
String unit;
|
||||
if (DictDataEnum.I2_50.getCode().equals(dictData.getCode()) || DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())) {
|
||||
unit = "A";
|
||||
} else if (DictDataEnum.P2_50.getCode().equals(dictData.getCode())) {
|
||||
unit = "W";
|
||||
} else {
|
||||
unit = "%";
|
||||
}
|
||||
for (AdHarmonicResult harmonicResult : adHarmonicResults) {
|
||||
for (Double i : harmNum) {
|
||||
dataVO = new RawDataVO();
|
||||
dataVO.setHarmNum(i);
|
||||
dataVO.setUnit(unit);
|
||||
try {
|
||||
Field timeId = harmonicResult.getClass().getDeclaredField("timeId");
|
||||
timeId.setAccessible(true);
|
||||
LocalDateTime localDateTime = (LocalDateTime) timeId.get(harmonicResult);
|
||||
dataVO.setTime(localDateTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||
|
||||
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldA.setAccessible(true);
|
||||
dataVO.setDataA(StrUtil.isNotBlank(fieldA.get(harmonicResult) + "") ? new BigDecimal(fieldA.get(harmonicResult) + "").toPlainString() : null);
|
||||
|
||||
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldB.setAccessible(true);
|
||||
dataVO.setDataB(StrUtil.isNotBlank(fieldB.get(harmonicResult) + "") ? new BigDecimal(fieldB.get(harmonicResult) + "").toPlainString() : null);
|
||||
|
||||
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldC.setAccessible(true);
|
||||
dataVO.setDataC(StrUtil.isNotBlank(fieldC.get(harmonicResult) + "") ? new BigDecimal(fieldC.get(harmonicResult) + "").toPlainString() : null);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (info.containsKey(String.valueOf(i))) {
|
||||
info.get(String.valueOf(i)).add(dataVO);
|
||||
} else {
|
||||
rawDataVOS = new ArrayList<>();
|
||||
rawDataVOS.add(dataVO);
|
||||
info.put(String.valueOf(i), rawDataVOS);
|
||||
}
|
||||
|
||||
adMap.forEach((ad,value)->{
|
||||
if (dictTreeByName.containsKey(ad)) {
|
||||
DictTree dictData = dictTreeByName.get(ad);
|
||||
List<RawDataVO> rawDataVOS = new ArrayList<>();
|
||||
List<Double> harmNum = param.getHarmNum();
|
||||
RawDataVO dataVO;
|
||||
String unit;
|
||||
if (DictDataEnum.I2_50.getCode().equals(dictData.getCode()) || DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())) {
|
||||
unit = "A";
|
||||
} else if (DictDataEnum.P2_50.getCode().equals(dictData.getCode())) {
|
||||
unit = "W";
|
||||
} else {
|
||||
unit = "%";
|
||||
}
|
||||
}
|
||||
}
|
||||
for (AdHarmonicResult harmonicResult : adHarmonicResults) {
|
||||
for (Double i : harmNum) {
|
||||
dataVO = new RawDataVO();
|
||||
dataVO.setHarmNum(i);
|
||||
dataVO.setUnit(unit);
|
||||
try {
|
||||
Field timeId = harmonicResult.getClass().getDeclaredField("timeId");
|
||||
timeId.setAccessible(true);
|
||||
LocalDateTime localDateTime = (LocalDateTime) timeId.get(harmonicResult);
|
||||
dataVO.setTime(localDateTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||
|
||||
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldA.setAccessible(true);
|
||||
dataVO.setDataA(StrUtil.isNotBlank(fieldA.get(harmonicResult) + "") ? new BigDecimal(fieldA.get(harmonicResult) + "").toPlainString() : null);
|
||||
|
||||
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldB.setAccessible(true);
|
||||
dataVO.setDataB(StrUtil.isNotBlank(fieldB.get(harmonicResult) + "") ? new BigDecimal(fieldB.get(harmonicResult) + "").toPlainString() : null);
|
||||
|
||||
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldC.setAccessible(true);
|
||||
dataVO.setDataC(StrUtil.isNotBlank(fieldC.get(harmonicResult) + "") ? new BigDecimal(fieldC.get(harmonicResult) + "").toPlainString() : null);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
rawDataVOS.add(dataVO);
|
||||
}
|
||||
}
|
||||
info.put(dictData.getName(), rawDataVOS);
|
||||
}
|
||||
});
|
||||
DynamicTableNameHandler.remove();
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, RawResultDataVO> listHarmResultData(StorageParam param) {
|
||||
public Map<String, List<RawResultDataVO>> listHarmResultData(StorageParam param) {
|
||||
String prefix = "ad_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
||||
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||
@@ -139,55 +141,61 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
||||
.eq(ObjectUtil.isNotNull(param.getScriptId()), AdHarmonicResult::getScriptId, param.getScriptId())
|
||||
.in(ObjectUtil.isNotEmpty(param.getIndex()), AdHarmonicResult::getSort, param.getIndex())
|
||||
.orderByAsc(AdHarmonicResult::getTimeId);
|
||||
|
||||
List<AdHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
||||
Map<String, RawResultDataVO> info = new LinkedHashMap<>(3);
|
||||
if (CollUtil.isNotEmpty(adHarmonicResults)) {
|
||||
List<Double> harmNum = param.getHarmNum();
|
||||
RawResultDataVO dataVO;
|
||||
DictTree dictData = dictTreeMapper.selectById(adHarmonicResults.get(0).getAdType());
|
||||
String unit;
|
||||
if (DictDataEnum.I2_50.getCode().equals(dictData.getCode()) || DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())) {
|
||||
unit = "A";
|
||||
} else if (DictDataEnum.P2_50.getCode().equals(dictData.getCode())) {
|
||||
unit = "W";
|
||||
} else {
|
||||
unit = "%";
|
||||
}
|
||||
for (AdHarmonicResult harmonicResult : adHarmonicResults) {
|
||||
for (Double i : harmNum) {
|
||||
dataVO = new RawResultDataVO();
|
||||
dataVO.setHarmNum(i);
|
||||
dataVO.setUnit(unit);
|
||||
try {
|
||||
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldA.setAccessible(true);
|
||||
RawResultDataVO.DetectionData a = JSON.parseObject(fieldA.get(harmonicResult) + "", RawResultDataVO.DetectionData.class);
|
||||
dataVO.setDataA(a);
|
||||
|
||||
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldB.setAccessible(true);
|
||||
RawResultDataVO.DetectionData b = JSON.parseObject(fieldB.get(harmonicResult) + "", RawResultDataVO.DetectionData.class);
|
||||
dataVO.setDataB(b);
|
||||
|
||||
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldC.setAccessible(true);
|
||||
RawResultDataVO.DetectionData c = JSON.parseObject(fieldC.get(harmonicResult) + "", RawResultDataVO.DetectionData.class);
|
||||
dataVO.setDataC(c);
|
||||
if (ObjectUtil.isNotNull(a)) {
|
||||
dataVO.setRadius(a.getRadius());
|
||||
}
|
||||
dataVO.setIsData(setResultFlag(Arrays.asList(a, b, c)));
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
info.put(String.valueOf(i), dataVO);
|
||||
LinkedHashMap<String, List<AdHarmonicResult>> adMap =
|
||||
adHarmonicResults.stream().collect(Collectors.groupingBy(AdHarmonicResult::getAdType, LinkedHashMap::new, Collectors.toList()));
|
||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adMap.keySet()));
|
||||
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
|
||||
Map<String, List<RawResultDataVO>> info = new LinkedHashMap<>(3);
|
||||
adMap.forEach((ad,value)->{
|
||||
if (dictTreeByName.containsKey(ad)) {
|
||||
DictTree dictData = dictTreeByName.get(ad);
|
||||
List<RawResultDataVO> rawDataVOS = new ArrayList<>();
|
||||
List<Double> harmNum = param.getHarmNum();
|
||||
RawResultDataVO dataVO;
|
||||
String unit;
|
||||
if (DictDataEnum.I2_50.getCode().equals(dictData.getCode()) || DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())) {
|
||||
unit = "A";
|
||||
} else if (DictDataEnum.P2_50.getCode().equals(dictData.getCode())) {
|
||||
unit = "W";
|
||||
} else {
|
||||
unit = "%";
|
||||
}
|
||||
}
|
||||
}
|
||||
for (AdHarmonicResult harmonicResult : value) {
|
||||
for (Double i : harmNum) {
|
||||
dataVO = new RawResultDataVO();
|
||||
dataVO.setHarmNum(i);
|
||||
dataVO.setUnit(unit);
|
||||
try {
|
||||
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldA.setAccessible(true);
|
||||
RawResultDataVO.DetectionData a = JSON.parseObject(fieldA.get(harmonicResult) + "", RawResultDataVO.DetectionData.class);
|
||||
dataVO.setDataA(a);
|
||||
|
||||
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldB.setAccessible(true);
|
||||
RawResultDataVO.DetectionData b = JSON.parseObject(fieldB.get(harmonicResult) + "", RawResultDataVO.DetectionData.class);
|
||||
dataVO.setDataB(b);
|
||||
|
||||
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
||||
fieldC.setAccessible(true);
|
||||
RawResultDataVO.DetectionData c = JSON.parseObject(fieldC.get(harmonicResult) + "", RawResultDataVO.DetectionData.class);
|
||||
dataVO.setDataC(c);
|
||||
if (ObjectUtil.isNotNull(a)) {
|
||||
dataVO.setRadius(a.getRadius());
|
||||
}
|
||||
dataVO.setIsData(setResultFlag(Arrays.asList(a, b, c)));
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
rawDataVOS.add(dataVO);
|
||||
}
|
||||
}
|
||||
info.put(dictData.getName(), rawDataVOS);
|
||||
}
|
||||
});
|
||||
DynamicTableNameHandler.remove();
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, RawResultDataVO> listNonHarmResultData(StorageParam param) {
|
||||
public Map<String, List<RawResultDataVO>> listNonHarmResultData(StorageParam param) {
|
||||
String prefix = "ad_non_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
||||
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||
@@ -102,7 +102,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
||||
|
||||
List<AdNonHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
||||
|
||||
Map<String, RawResultDataVO> info = new LinkedHashMap<>(2);
|
||||
Map<String, List<RawResultDataVO>> info = new LinkedHashMap<>(2);
|
||||
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(AdNonHarmonicResult::getResultFlag))
|
||||
.collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity(), (a, b) -> a, LinkedHashMap::new));
|
||||
@@ -129,7 +129,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
||||
dataVO.setRadius(b.getRadius());
|
||||
}
|
||||
}
|
||||
info.put(treeName.getName(), dataVO);
|
||||
info.put(treeName.getName(), Arrays.asList(dataVO));
|
||||
}
|
||||
});
|
||||
DynamicTableNameHandler.remove();
|
||||
|
||||
Reference in New Issue
Block a user