台账识别码修改

This commit is contained in:
2025-01-06 15:13:33 +08:00
parent e4049de260
commit 11116929cc

View File

@@ -237,91 +237,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
objectListData.add(list); objectListData.add(list);
} }
;
//下面代码稳定后可删除
/* List<HarmonicHistoryData> aList = harmonicHistoryDataList.stream()
.filter(temp -> temp.getPhasicType().equalsIgnoreCase(InfluxDBTableConstant.PHASE_TYPE_A))
.collect(Collectors.toList());
List<HarmonicHistoryData> bList = harmonicHistoryDataList.stream()
.filter(temp -> temp.getPhasicType().equalsIgnoreCase(InfluxDBTableConstant.PHASE_TYPE_B))
.collect(Collectors.toList());
List<HarmonicHistoryData> cList = harmonicHistoryDataList.stream()
.filter(temp -> temp.getPhasicType().equalsIgnoreCase(InfluxDBTableConstant.PHASE_TYPE_C))
.collect(Collectors.toList());
int maxSize = Math.max(aList.size(), Math.max(bList.size(), cList.size()));
if (maxSize == aList.size()) {
time = aList.stream()
.map(temp -> PubUtils.instantToDate(temp.getTime()))
.collect(Collectors.toList());
} else if (maxSize == bList.size()) {
time = bList.stream()
.map(temp -> PubUtils.instantToDate(temp.getTime()))
.collect(Collectors.toList());
} else {
time = cList.stream()
.map(temp -> PubUtils.instantToDate(temp.getTime()))
.collect(Collectors.toList());
}
aValue = aList.stream()
.map(temp -> BigDecimal.valueOf(temp.getAValue()).setScale(4, RoundingMode.HALF_UP).floatValue())
.collect(Collectors.toList());
bValue = bList.stream()
.map(temp -> BigDecimal.valueOf(temp.getAValue()).setScale(4, RoundingMode.HALF_UP).floatValue())
.collect(Collectors.toList());
cValue = cList.stream()
.map(temp -> BigDecimal.valueOf(temp.getAValue()).setScale(4, RoundingMode.HALF_UP).floatValue())
.collect(Collectors.toList());
//组装二维数组
boolean flagA = true,flagB = true,flagC =true;
if(CollectionUtil.isEmpty(aValue)){
flagA = false;
}
if(CollectionUtil.isEmpty(bValue)){
flagB = false;
}
if(CollectionUtil.isEmpty(cValue)){
flagC = false;
}
for (int i = 0; i < time.size(); i++) {
List<Object> objects = new ArrayList<>();
//指定
objects.add(time.get(i));
if(flagA){
objects.add(aValue.get(i));
}
if(flagB) {
objects.add(bValue.get(i));
}
if(flagC) {
objects.add(cValue.get(i));
}
objectListData.add(objects);
}
Float aValueMin = CollectionUtil.isEmpty(aValue) ? null : Collections.min(aValue);
Float bValueMin = CollectionUtil.isEmpty(bValue) ? null : Collections.min(bValue);
Float cValueMin = CollectionUtil.isEmpty(cValue) ? null : Collections.min(cValue);
Float aValueMax = CollectionUtil.isEmpty(aValue) ? null : Collections.max(aValue);
Float bValueMax = CollectionUtil.isEmpty(bValue) ? null : Collections.max(bValue);
Float cValueMax = CollectionUtil.isEmpty(cValue) ? null : Collections.max(cValue);
List<Float> list = Arrays.asList(aValueMin, bValueMin, cValueMin, aValueMax, bValueMax, cValueMax);
Optional<Float> min = list.stream()
.filter(Objects::nonNull) // 过滤掉null值
.min(Float::compareTo);
if (min.isPresent()) {
historyDataResultVO.setMinValue(min.get());
}
Optional<Float> max = list.stream()
.filter(Objects::nonNull) // 过滤掉null值
.max(Float::compareTo);
if (min.isPresent()) {
historyDataResultVO.setMaxValue(max.get());
}*/
historyDataResultVO.setMaxValue(maxI); historyDataResultVO.setMaxValue(maxI);
historyDataResultVO.setMinValue(minI); historyDataResultVO.setMinValue(minI);
historyDataResultVO.setTopLimit(queryResultLimitVO.getTopLimit()); historyDataResultVO.setTopLimit(queryResultLimitVO.getTopLimit());
@@ -529,6 +445,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
targetName = "基波电压幅值"; targetName = "基波电压幅值";
sql = "SELECT time as time, v_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_v WHERE " + stringBuilder + sql = "SELECT time as time, v_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_v WHERE " + stringBuilder +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');"; " and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
unit.add(pqsDeviceUnit.getPhaseVoltage());
} else { } else {
targetName = "谐波电压含有率"; targetName = "谐波电压含有率";
sql = "SELECT time as time, v_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_v WHERE " + stringBuilder + sql = "SELECT time as time, v_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_v WHERE " + stringBuilder +
@@ -536,6 +453,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
if (number < 26) { if (number < 26) {
topLimit = PubUtils.getValueByMethod(overlimit, "getUharm", number); topLimit = PubUtils.getValueByMethod(overlimit, "getUharm", number);
} }
unit.add("%");
} }
if (ptType == 0) { if (ptType == 0) {
phasicType.add("A相"); phasicType.add("A相");
@@ -546,7 +464,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
phasicType.add("BC相"); phasicType.add("BC相");
phasicType.add("CA相"); phasicType.add("CA相");
} }
unit.add("%");
break; break;
case 41: case 41:
@@ -555,15 +473,18 @@ public class HistoryResultServiceImpl implements HistoryResultService {
targetName = "谐波电流幅值"; targetName = "谐波电流幅值";
sql = "SELECT time as time, i_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_i WHERE " + stringBuilder + sql = "SELECT time as time, i_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_i WHERE " + stringBuilder +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');"; " and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
unit.add("A");
} else { } else {
targetName = "谐波电流含有率"; targetName = "谐波电流含有率";
sql = "SELECT time as time, i_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_i WHERE " + stringBuilder + sql = "SELECT time as time, i_" + number + " as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_i WHERE " + stringBuilder +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');"; " and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
unit.add("%");
} }
phasicType.add("A相"); phasicType.add("A相");
phasicType.add("B相"); phasicType.add("B相");
phasicType.add("C相"); phasicType.add("C相");
unit.add("%");
break; break;
case 42: case 42: