From 2aec27bb802cdc3b3270cd9eb9cfe0cfb6b067ef Mon Sep 17 00:00:00 2001 From: lihongjie0209 Date: Tue, 7 Nov 2023 20:25:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E7=A9=BA=E8=A1=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CoalWashingDailyAnalysisEntity.java | 96 +++++++++++++++++++ .../CoalWashingDailyAnalysisItemVo.java | 50 ++++++++-- 2 files changed, 136 insertions(+), 10 deletions(-) diff --git a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/entity/CoalWashingDailyAnalysisEntity.java b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/entity/CoalWashingDailyAnalysisEntity.java index 0df7df71..16bed71e 100644 --- a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/entity/CoalWashingDailyAnalysisEntity.java +++ b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/entity/CoalWashingDailyAnalysisEntity.java @@ -181,5 +181,101 @@ public class CoalWashingDailyAnalysisEntity extends OrgCommonEntity { item.setFddAvgP2(null); } } + + for (int i = 0; i < inputItems.size(); i++) { + + CoalWashingDailyAnalysisItemVo item = inputItems.get(i); + item.setSysDdAvgP1(0.0); + + int nullCount = 0; + for (int j = 0; j <= i; j++) { + if (inputItems.get(j).getSysDdp1() == null) { + nullCount++; + } else { + + item.setSysDdAvgP1( + ObjectUtils.defaultIfNull(inputItems.get(j).getSysDdp1(), 0.0) + + item.getFddAvgP1()); + } + } + if (i - nullCount + 1 > 0) { + + item.setSysDdAvgP1(item.getFddAvgP1() / (double) (i - nullCount + 1)); + } else { + item.setSysDdAvgP1(null); + } + } + + for (int i = 0; i < inputItems.size(); i++) { + + CoalWashingDailyAnalysisItemVo item = inputItems.get(i); + item.setSysDdAvgP2(0.0); + + int nullCount = 0; + for (int j = 0; j <= i; j++) { + if (inputItems.get(j).getSysDdp2() == null) { + nullCount++; + } else { + + item.setSysDdAvgP2( + ObjectUtils.defaultIfNull(inputItems.get(j).getSysDdp2(), 0.0) + + item.getFddAvgP2()); + } + } + if (i - nullCount + 1 > 0) { + + item.setSysDdAvgP2(item.getFddAvgP2() / (double) (i - nullCount + 1)); + } else { + item.setSysDdAvgP2(null); + } + } + + for (int i = 0; i < inputItems.size(); i++) { + + CoalWashingDailyAnalysisItemVo item = inputItems.get(i); + item.setDdAvgP1(0.0); + + int nullCount = 0; + for (int j = 0; j <= i; j++) { + if (inputItems.get(j).getDdp1() == null) { + nullCount++; + } else { + + item.setDdAvgP1( + ObjectUtils.defaultIfNull(inputItems.get(j).getDdp1(), 0.0) + + item.getFddAvgP1()); + } + } + if (i - nullCount + 1 > 0) { + + item.setDdAvgP1(item.getFddAvgP1() / (double) (i - nullCount + 1)); + } else { + item.setDdAvgP1(null); + } + } + + for (int i = 0; i < inputItems.size(); i++) { + + CoalWashingDailyAnalysisItemVo item = inputItems.get(i); + item.setDdAvgP2(0.0); + + int nullCount = 0; + for (int j = 0; j <= i; j++) { + if (inputItems.get(j).getDdp2() == null) { + nullCount++; + } else { + + item.setDdAvgP2( + ObjectUtils.defaultIfNull(inputItems.get(j).getDdp2(), 0.0) + + item.getFddAvgP2()); + } + } + if (i - nullCount + 1 > 0) { + + item.setDdAvgP2(item.getFddAvgP2() / (double) (i - nullCount + 1)); + } else { + item.setDdAvgP2(null); + } + } } } diff --git a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/entity/CoalWashingDailyAnalysisItemVo.java b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/entity/CoalWashingDailyAnalysisItemVo.java index ed59f4d1..c90c2aea 100644 --- a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/entity/CoalWashingDailyAnalysisItemVo.java +++ b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/entity/CoalWashingDailyAnalysisItemVo.java @@ -138,6 +138,21 @@ public class CoalWashingDailyAnalysisItemVo { @Comment("用户输入 大堆 备用") private Double ddp5; + @Comment("大堆化验平均 灰") + private Double ddAvgP1; + + @Comment("大堆化验平均 硫") + private Double ddAvgP2; + + @Comment("大堆化验平均 挥发") + private Double ddAvgP3; + + @Comment("大堆化验平均 粘结") + private Double ddAvgP4; + + @Comment("大堆化验平均 备用") + private Double ddAvgP5; + @Comment("用户输入 翻大堆 灰") private Double fddp1; @@ -183,6 +198,21 @@ public class CoalWashingDailyAnalysisItemVo { @Comment("系统计算 大堆 备用") private Double sysDdp5; + @Comment("系统计算 平均大堆 灰") + private Double sysDdAvgP1; + + @Comment("系统计算 平均大堆 硫") + private Double sysDdAvgP2; + + @Comment("系统计算 平均大堆 挥发") + private Double sysDdAvgP3; + + @Comment("系统计算 平均大堆 粘结") + private Double sysDdAvgP4; + + @Comment("系统计算 平均大堆 备用") + private Double sysDdAvgP5; + @Comment("用户输入与系统计算的平均值 大堆 灰") private Double avgDdp1; @@ -425,15 +455,15 @@ public class CoalWashingDailyAnalysisItemVo { public boolean isAllEmpty() { - return (c0p0 != null && c0p1 == null && c0p2 == null) - && (c1p0 != null && c1p1 == null && c1p2 == null) - && (c2p0 != null && c2p1 == null && c2p2 == null) - && (c3p0 != null && c3p1 == null && c3p2 == null) - && (c4p0 != null && c4p1 == null && c4p2 == null) - && (c5p0 != null && c5p1 == null && c5p2 == null) - && (c6p0 != null && c6p1 == null && c6p2 == null) - && (c7p0 != null && c7p1 == null && c7p2 == null) - && (c8p0 != null && c8p1 == null && c8p2 == null) - && (c9p0 != null && c9p1 == null && c9p2 == null); + return (c0p1 == null && c0p2 == null) + && (c1p1 == null && c1p2 == null) + && (c2p1 == null && c2p2 == null) + && (c3p1 == null && c3p2 == null) + && (c4p1 == null && c4p2 == null) + && (c5p1 == null && c5p2 == null) + && (c6p1 == null && c6p2 == null) + && (c7p1 == null && c7p2 == null) + && (c8p1 == null && c8p2 == null) + && (c9p1 == null && c9p2 == null); } }