This commit is contained in:
2023-11-07 20:58:51 +08:00
parent 1d12ebfe18
commit 8f8fe39b73

View File

@@ -100,8 +100,6 @@ public class CoalWashingDailyAnalysisEntity extends OrgCommonEntity {
inputItems.sort(
Comparator.comparing(x -> ObjectUtils.defaultIfNull(x.getTime(), LocalTime.MIN)));
for (int i = 0; i < inputItems.size(); i++) {
CoalWashingDailyAnalysisItemVo coalWashingDailyAnalysisItemVo = inputItems.get(i);
if (StringUtils.equals(type, "2") && i == inputItems.size() - 1) {
@@ -115,7 +113,8 @@ public class CoalWashingDailyAnalysisEntity extends OrgCommonEntity {
Double prevNumber = ObjectUtils.defaultIfNull(initTotalNumber, 0.0);
// 总的权重
Double totalWeight = 0.0;
Double totalWeight1 = 0.0;
Double totalWeight2 = 0.0;
// 大堆平均之和
Double avgSum1 = 0.0;
Double avgSum2 = 0.0;
@@ -126,12 +125,20 @@ public class CoalWashingDailyAnalysisEntity extends OrgCommonEntity {
inputItem.getTotalNumber() == null
? 1
: Double.max(1, inputItem.getTotalNumber() - prevNumber);
totalWeight += currWeight;
avgSum1 += ObjectUtils.defaultIfNull(inputItem.getAvgDdp1(), 0.0) * currWeight;
avgSum2 += ObjectUtils.defaultIfNull(inputItem.getAvgDdp2(), 0.0) * currWeight;
inputItem.setRollingAvgDdp1(avgSum1 / totalWeight);
inputItem.setRollingAvgDdp2(avgSum2 / totalWeight);
if (inputItem.getAvgDdp1() != null) {
totalWeight1 += currWeight;
avgSum1 += ObjectUtils.defaultIfNull(inputItem.getAvgDdp1(), 0.0) * currWeight;
inputItem.setRollingAvgDdp1(avgSum1 / totalWeight1);
}
if (inputItem.getAvgDdp2() != null) {
totalWeight2 += currWeight;
avgSum2 += ObjectUtils.defaultIfNull(inputItem.getAvgDdp2(), 0.0) * currWeight;
inputItem.setRollingAvgDdp2(avgSum2 / totalWeight2);
}
}
for (int i = 0; i < inputItems.size(); i++) {