过滤空行数据

This commit is contained in:
2023-11-07 20:08:50 +08:00
parent bd656bece6
commit a9b7d9b944
2 changed files with 24 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/** */
@Entity
@@ -88,8 +89,17 @@ public class CoalWashingDailyAnalysisEntity extends OrgCommonEntity {
if (CollectionUtils.isEmpty(inputItems)) {
return;
}
this.inputItems =
inputItems.stream()
.filter(CoalWashingDailyAnalysisItemVo::isAllEmpty)
.collect(Collectors.toList());
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) {

View File

@@ -422,4 +422,18 @@ public class CoalWashingDailyAnalysisItemVo {
if (ddp4 != null && sysDdp4 != null) avgDdp4 = (ddp4 + sysDdp4) / 2.0;
if (ddp5 != null && sysDdp5 != null) avgDdp5 = (ddp5 + sysDdp5) / 2.0;
}
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);
}
}