解决间谐波检测脚本问题

This commit is contained in:
wr
2025-03-10 16:49:02 +08:00
parent 67b6f822c3
commit 1c12187d93
3 changed files with 20 additions and 20 deletions

View File

@@ -676,9 +676,9 @@ public class DetectionServiceImpl {
DetectionData c;
if (DUR.equals(dur)) {
c = rangeDURComparisonList(mag.get(typeC), magErrList, fData, channelTypeCList.get(0).getDipData().getRetainTime(), dataRule);
}else {
} else {
List<Double> ampData = mag.get(typeC).stream()
.filter(x->ObjectUtil.isNotNull(x))
.filter(x -> ObjectUtil.isNotNull(x))
.map(x -> x * channelTypeCList.get(0).getFAmp() * 0.01)
.collect(Collectors.toList());
c = rangeComparisonList(ampData, magErrList, fData, channelTypeCList.get(0).getDipData().getFTransValue(), dataRule);
@@ -1003,6 +1003,7 @@ public class DetectionServiceImpl {
});
return map;
}
/**
* 处理数据是否合格
*
@@ -1219,14 +1220,15 @@ public class DetectionServiceImpl {
if (i.equals(1.0)) {
integerListMap.get(1.0).add(multiply(fund, fund));
} else {
double v = num == 1 ? num : (i - num);
if (type.equals("A")) {
integerListMap.get(i).add(multiply(harm.getList().getA().get((int) (i - num)), fund));
integerListMap.get(i).add(multiply(harm.getList().getA().get((int) v), fund));
}
if (type.equals("B")) {
integerListMap.get(i).add(multiply(harm.getList().getB().get((int) (i - num)), fund));
integerListMap.get(i).add(multiply(harm.getList().getB().get((int) v), fund));
}
if (type.equals("C")) {
integerListMap.get(i).add(multiply(harm.getList().getC().get((int) (i - num)), fund));
integerListMap.get(i).add(multiply(harm.getList().getC().get((int) v), fund));
}
}
}
@@ -1239,14 +1241,15 @@ public class DetectionServiceImpl {
integerList.add(multiply(fund, fund));
integerListMap.put(1.0, integerList);
} else {
double v = num == 1 ? num : (i - num);
if (type.equals("A")) {
integerList.add(multiply(harm.getList().getA().get((int) (i - num)), fund));
integerList.add(multiply(harm.getList().getA().get((int) v), fund));
}
if (type.equals("B")) {
integerList.add(multiply(harm.getList().getB().get((int) (i - num)), fund));
integerList.add(multiply(harm.getList().getB().get((int) v), fund));
}
if (type.equals("C")) {
integerList.add(multiply(harm.getList().getC().get((int) (i - num)), fund));
integerList.add(multiply(harm.getList().getC().get((int) v), fund));
}
integerListMap.put(i, integerList);
}

View File

@@ -99,18 +99,15 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
fieldA.setAccessible(true);
BigDecimal decimalA = new BigDecimal(fieldA.get(harmonicResult) + "");
dataVO.setDataA(decimalA.toPlainString());
dataVO.setDataA(ObjectUtil.isNotNull(fieldA.get(harmonicResult)) ? new BigDecimal(fieldA.get(harmonicResult) + "").toPlainString() : null);
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
fieldB.setAccessible(true);
BigDecimal decimalB = new BigDecimal(fieldB.get(harmonicResult) + "");
dataVO.setDataB(decimalB.toPlainString());
dataVO.setDataB(ObjectUtil.isNotNull(fieldB.get(harmonicResult)) ? new BigDecimal(fieldB.get(harmonicResult) + "").toPlainString() : null);
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
fieldC.setAccessible(true);
BigDecimal decimalC = new BigDecimal(fieldC.get(harmonicResult) + "");
dataVO.setDataC(decimalC.toPlainString());
dataVO.setDataC(ObjectUtil.isNotNull(fieldC.get(harmonicResult)) ? new BigDecimal(fieldC.get(harmonicResult) + "").toPlainString() : null);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {

View File

@@ -25,7 +25,7 @@ public class TableGenServiceImpl implements TableGenService {
StringBuilder A = new StringBuilder();
StringBuilder B = new StringBuilder();
StringBuilder C = new StringBuilder();
for (int i = 1; i <= 50; i++) {
for (int i = 1; i <= 51; i++) {
if (i == 1) {
A.append("A_Value_").append(i).append(" json NULL COMMENT 'A相基波',");
B.append("B_Value_").append(i).append(" json NULL COMMENT 'B相基波',");
@@ -74,7 +74,7 @@ public class TableGenServiceImpl implements TableGenService {
.append(",ad_non_harmonic_result_").append(code).append(",");
}
sb.deleteCharAt(sb.length() - 1);
tableGenMapper.genAdHarmonicTable("DROP TABLE IF EXISTS " + sb.toString());
tableGenMapper.genAdHarmonicTable("DROP TABLE IF EXISTS " + sb);
}