1.解决不可同时测试电压,电流问题
This commit is contained in:
@@ -115,45 +115,20 @@ public class DetectionServiceImpl {
|
|||||||
case I_ABSOLUTELY:
|
case I_ABSOLUTELY:
|
||||||
return isQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, code);
|
return isQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, code);
|
||||||
/**
|
/**
|
||||||
* 谐波电压
|
* 谐波
|
||||||
*/
|
*/
|
||||||
case HV:
|
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:
|
case HI:
|
||||||
|
AdHarmonicResult harmV = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, U, sourceIssue, dataRule, 2);
|
||||||
AdHarmonicResult harmI = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, 2);
|
AdHarmonicResult harmI = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, 2);
|
||||||
if (ObjectUtil.isNotNull(harmI)) {
|
return resultFlag(harmV,harmI,code);
|
||||||
detectionDataDealService.acceptAdResult(Arrays.asList(harmI), code);
|
|
||||||
return harmI.getResultFlag();
|
|
||||||
}
|
|
||||||
return 4;
|
|
||||||
/**
|
/**
|
||||||
* 间谐波电压
|
* 间谐波
|
||||||
*/
|
*/
|
||||||
case HSV:
|
case HSV:
|
||||||
AdHarmonicResult harmInV = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, U, sourceIssue, dataRule, 1);
|
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);
|
AdHarmonicResult harmInI = isHarmQualified(dev, devIdMapComm, errDtlsCheckData, I, sourceIssue, dataRule, 1);
|
||||||
if (ObjectUtil.isNotNull(harmInI)) {
|
return resultFlag(harmInV,harmInI,code);
|
||||||
detectionDataDealService.acceptAdResult(Arrays.asList(harmInI), code);
|
|
||||||
return harmInI.getResultFlag();
|
|
||||||
}
|
|
||||||
return 4;
|
|
||||||
/**
|
/**
|
||||||
* 三相电压不平衡度
|
* 三相电压不平衡度
|
||||||
*/
|
*/
|
||||||
@@ -204,7 +179,20 @@ public class DetectionServiceImpl {
|
|||||||
return isUnknownQualified(dev, devIdMapComm, errDtlsCheckData, sourceIssue, dataRule, code);
|
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,
|
public Integer isUnknownQualified(List<DevData> dev,
|
||||||
Map<String, String> devIdMapComm,
|
Map<String, String> devIdMapComm,
|
||||||
List<ErrDtlsCheckDataVO> errDtlsCheckData,
|
List<ErrDtlsCheckDataVO> errDtlsCheckData,
|
||||||
@@ -479,7 +467,6 @@ public class DetectionServiceImpl {
|
|||||||
if (I.equals(type)) {
|
if (I.equals(type)) {
|
||||||
fData = sourceIssue.getFIn();
|
fData = sourceIssue.getFIn();
|
||||||
fundCode = DetectionCodeEnum.I1.getCode();
|
fundCode = DetectionCodeEnum.I1.getCode();
|
||||||
;
|
|
||||||
if (num == 1) {
|
if (num == 1) {
|
||||||
harmCode = DetectionCodeEnum.SI_1_49.getCode();
|
harmCode = DetectionCodeEnum.SI_1_49.getCode();
|
||||||
} else {
|
} else {
|
||||||
@@ -502,11 +489,13 @@ public class DetectionServiceImpl {
|
|||||||
Integer isQualified = 4;
|
Integer isQualified = 4;
|
||||||
String valueTypeCode = "";
|
String valueTypeCode = "";
|
||||||
if (CollUtil.isNotEmpty(errDtlsCheckData)) {
|
if (CollUtil.isNotEmpty(errDtlsCheckData)) {
|
||||||
harmonicResult.setAdType(errDtlsCheckData.get(0).getValueType());
|
String finalHarmCode = harmCode;
|
||||||
isQualified = errDtlsCheckData.get(0).getIsQualified();
|
List<ErrDtlsCheckDataVO> adDtlsCheckData = errDtlsCheckData.stream().filter(x -> finalHarmCode.equals(x.getValueTypeCode())).collect(Collectors.toList());
|
||||||
valueTypeCode = errDtlsCheckData.get(0).getValueTypeCode();
|
harmonicResult.setAdType(adDtlsCheckData.get(0).getValueType());
|
||||||
if (CollUtil.isNotEmpty(errDtlsCheckData.get(0).getErrSysDtls())) {
|
isQualified = adDtlsCheckData.get(0).getIsQualified();
|
||||||
pqErrSysDtls = errDtlsCheckData.get(0).getErrSysDtls();
|
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);
|
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) {
|
private Map<String, List<RawResultDataVO>> getRadiusMap(String devNum, String key, DevReportParam devReportParam, Set<Integer> indexSet, boolean isHarm) {
|
||||||
Map<String, List<RawResultDataVO>> raiusMap = new LinkedHashMap<>();
|
Map<String, List<RawResultDataVO>> raiusMap = new LinkedHashMap<>();
|
||||||
ResultParam param = new ResultParam();
|
// ResultParam param = new ResultParam();
|
||||||
param.setScriptId(devReportParam.getScriptId());
|
// param.setScriptId(devReportParam.getScriptId());
|
||||||
param.setDevId(devReportParam.getDevId());
|
// param.setDevId(devReportParam.getDevId());
|
||||||
param.setDevNum(devNum);
|
// param.setDevNum(devNum);
|
||||||
param.setCode(devReportParam.getPlanCode());
|
// param.setCode(devReportParam.getPlanCode());
|
||||||
String[] split = key.split("_");
|
// String[] split = key.split("_");
|
||||||
param.setScriptType(split[1]);
|
// param.setScriptType(split[1]);
|
||||||
for (Integer index : indexSet) {
|
// for (Integer index : indexSet) {
|
||||||
param.setIndex(index);
|
// param.setIndex(index);
|
||||||
ResultVO resultVO = resultService.resultDataForReport(param);
|
// ResultVO resultVO = resultService.resultDataForReport(param);
|
||||||
Map<String, RawResultDataVO> resultData = resultVO.getResultData();
|
// Map<String, List<RawResultDataVO>> resultData = resultVO.getResultData();
|
||||||
if (CollectionUtil.isNotEmpty(resultData)) {
|
// if (CollectionUtil.isNotEmpty(resultData)) {
|
||||||
if (DicDataEnum.V.getCode().equals(split[0]) || DicDataEnum.I.getCode().equals(split[0])) {
|
// if (DicDataEnum.V.getCode().equals(split[0]) || DicDataEnum.I.getCode().equals(split[0])) {
|
||||||
// 排除电压相角、电压偏差、电流相角
|
// // 排除电压相角、电压偏差、电流相角
|
||||||
resultData.remove("电压相角");
|
// resultData.remove("电压相角");
|
||||||
resultData.remove("电压偏差");
|
// resultData.remove("电压偏差");
|
||||||
resultData.remove("电流相角");
|
// resultData.remove("电流相角");
|
||||||
}
|
// }
|
||||||
resultData.values().stream().findFirst().ifPresent(obj -> {
|
// resultData.values().stream().findFirst().ifPresent(obj -> {
|
||||||
String radius = obj.getRadius();
|
// String radius = obj.getRadius();
|
||||||
String unit = obj.getUnit();
|
// String unit = obj.getUnit();
|
||||||
if (StrUtil.isNotBlank(radius)) {
|
// if (StrUtil.isNotBlank(radius)) {
|
||||||
if (isHarm) {
|
// if (isHarm) {
|
||||||
raiusMap.put(index + "_" + radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
// raiusMap.put(index + "_" + radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
||||||
} else {
|
// } else {
|
||||||
raiusMap.put(radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
// raiusMap.put(radius.split("~")[1] + unit, resultData.values().stream().collect(Collectors.toList()));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return raiusMap;
|
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
|
* @param param
|
||||||
* @return
|
* @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
|
* @param param
|
||||||
* @return
|
* @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.mapper.DictTreeMapper;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
|
import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +46,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
|
|
||||||
private final AdNonHarmonicMapper adNonHarmonicMapper;
|
private final AdNonHarmonicMapper adNonHarmonicMapper;
|
||||||
private final DictTreeMapper dictTreeMapper;
|
private final DictTreeMapper dictTreeMapper;
|
||||||
|
private final IDictTreeService dictTreeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, String code) {
|
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)
|
.orderByAsc(AdHarmonicResult::getTimeId)
|
||||||
;
|
;
|
||||||
List<AdHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
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);
|
Map<String, List<RawDataVO>> info = new LinkedHashMap<>(3);
|
||||||
if (CollectionUtil.isNotEmpty(adHarmonicResults)) {
|
adMap.forEach((ad,value)->{
|
||||||
List<Double> harmNum = param.getHarmNum();
|
if (dictTreeByName.containsKey(ad)) {
|
||||||
RawDataVO dataVO;
|
DictTree dictData = dictTreeByName.get(ad);
|
||||||
List<RawDataVO> rawDataVOS;
|
List<RawDataVO> rawDataVOS = new ArrayList<>();
|
||||||
DictTree dictData = dictTreeMapper.selectById(adHarmonicResults.get(0).getAdType());
|
List<Double> harmNum = param.getHarmNum();
|
||||||
String unit;
|
RawDataVO dataVO;
|
||||||
if (DictDataEnum.I2_50.getCode().equals(dictData.getCode()) || DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())) {
|
String unit;
|
||||||
unit = "A";
|
if (DictDataEnum.I2_50.getCode().equals(dictData.getCode()) || DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())) {
|
||||||
} else if (DictDataEnum.P2_50.getCode().equals(dictData.getCode())) {
|
unit = "A";
|
||||||
unit = "W";
|
} else if (DictDataEnum.P2_50.getCode().equals(dictData.getCode())) {
|
||||||
} else {
|
unit = "W";
|
||||||
unit = "%";
|
} 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
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();
|
DynamicTableNameHandler.remove();
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, RawResultDataVO> listHarmResultData(StorageParam param) {
|
public Map<String, List<RawResultDataVO>> listHarmResultData(StorageParam param) {
|
||||||
String prefix = "ad_harmonic_result_";
|
String prefix = "ad_harmonic_result_";
|
||||||
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
||||||
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
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())
|
.eq(ObjectUtil.isNotNull(param.getScriptId()), AdHarmonicResult::getScriptId, param.getScriptId())
|
||||||
.in(ObjectUtil.isNotEmpty(param.getIndex()), AdHarmonicResult::getSort, param.getIndex())
|
.in(ObjectUtil.isNotEmpty(param.getIndex()), AdHarmonicResult::getSort, param.getIndex())
|
||||||
.orderByAsc(AdHarmonicResult::getTimeId);
|
.orderByAsc(AdHarmonicResult::getTimeId);
|
||||||
|
|
||||||
List<AdHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
List<AdHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
||||||
Map<String, RawResultDataVO> info = new LinkedHashMap<>(3);
|
LinkedHashMap<String, List<AdHarmonicResult>> adMap =
|
||||||
if (CollUtil.isNotEmpty(adHarmonicResults)) {
|
adHarmonicResults.stream().collect(Collectors.groupingBy(AdHarmonicResult::getAdType, LinkedHashMap::new, Collectors.toList()));
|
||||||
List<Double> harmNum = param.getHarmNum();
|
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adMap.keySet()));
|
||||||
RawResultDataVO dataVO;
|
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
|
||||||
DictTree dictData = dictTreeMapper.selectById(adHarmonicResults.get(0).getAdType());
|
Map<String, List<RawResultDataVO>> info = new LinkedHashMap<>(3);
|
||||||
String unit;
|
adMap.forEach((ad,value)->{
|
||||||
if (DictDataEnum.I2_50.getCode().equals(dictData.getCode()) || DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())) {
|
if (dictTreeByName.containsKey(ad)) {
|
||||||
unit = "A";
|
DictTree dictData = dictTreeByName.get(ad);
|
||||||
} else if (DictDataEnum.P2_50.getCode().equals(dictData.getCode())) {
|
List<RawResultDataVO> rawDataVOS = new ArrayList<>();
|
||||||
unit = "W";
|
List<Double> harmNum = param.getHarmNum();
|
||||||
} else {
|
RawResultDataVO dataVO;
|
||||||
unit = "%";
|
String unit;
|
||||||
}
|
if (DictDataEnum.I2_50.getCode().equals(dictData.getCode()) || DictDataEnum.SI_1_49.getCode().equals(dictData.getCode())) {
|
||||||
for (AdHarmonicResult harmonicResult : adHarmonicResults) {
|
unit = "A";
|
||||||
for (Double i : harmNum) {
|
} else if (DictDataEnum.P2_50.getCode().equals(dictData.getCode())) {
|
||||||
dataVO = new RawResultDataVO();
|
unit = "W";
|
||||||
dataVO.setHarmNum(i);
|
} else {
|
||||||
dataVO.setUnit(unit);
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
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();
|
DynamicTableNameHandler.remove();
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, RawResultDataVO> listNonHarmResultData(StorageParam param) {
|
public Map<String, List<RawResultDataVO>> listNonHarmResultData(StorageParam param) {
|
||||||
String prefix = "ad_non_harmonic_result_";
|
String prefix = "ad_non_harmonic_result_";
|
||||||
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
||||||
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
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);
|
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()
|
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream()
|
||||||
.sorted(Comparator.comparing(AdNonHarmonicResult::getResultFlag))
|
.sorted(Comparator.comparing(AdNonHarmonicResult::getResultFlag))
|
||||||
.collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity(), (a, b) -> a, LinkedHashMap::new));
|
.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());
|
dataVO.setRadius(b.getRadius());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.put(treeName.getName(), dataVO);
|
info.put(treeName.getName(), Arrays.asList(dataVO));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
DynamicTableNameHandler.remove();
|
DynamicTableNameHandler.remove();
|
||||||
|
|||||||
Reference in New Issue
Block a user