From c274ccefcc440d4bb0a9ad8a987e1036173bddbb Mon Sep 17 00:00:00 2001 From: lihongjie0209 Date: Mon, 18 Nov 2024 21:28:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=B8=8A=E6=9C=9F?= =?UTF-8?q?=E7=BB=93=E4=BD=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/WarehouseGoodsSummaryService.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/lihongjie/coal/warehouseGoodsSummary/service/WarehouseGoodsSummaryService.java b/src/main/java/cn/lihongjie/coal/warehouseGoodsSummary/service/WarehouseGoodsSummaryService.java index 3d2e0ab6..1a94176a 100644 --- a/src/main/java/cn/lihongjie/coal/warehouseGoodsSummary/service/WarehouseGoodsSummaryService.java +++ b/src/main/java/cn/lihongjie/coal/warehouseGoodsSummary/service/WarehouseGoodsSummaryService.java @@ -40,6 +40,7 @@ import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; @Service @Slf4j @@ -93,6 +94,9 @@ public class WarehouseGoodsSummaryService public Page list(CommonQuery query) { + + log.info("query: {}", query.toString()); + CommonQuery copy = new CommonQuery(); BeanUtil.copyProperties(query, copy); @@ -135,7 +139,9 @@ public class WarehouseGoodsSummaryService copy.getItems().add(new CommonQuery.QueryItem().withKey("startTime").withValue(LocalDateTimeUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"))); copy.getItems().add(new CommonQuery.QueryItem().withKey("endTime").withValue(LocalDateTimeUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"))); + copy.getItems().add(new CommonQuery.QueryItem().withKey("id").withOpt("in").withValue(dtos.getContent().stream().map(WarehouseGoodsSummaryDto::getId).collect(Collectors.joining(",")))); + em.clear(); Page prevSummary = list(copy); List> join = cn.lihongjie.coal.common.CollectionUtils.leftHashJoin( @@ -147,10 +153,10 @@ public class WarehouseGoodsSummaryService for (Tuple2 tuple2 : join) { WarehouseGoodsSummaryDto dto = tuple2._1; - WarehouseGoodsSummaryDto entity = tuple2._2; + WarehouseGoodsSummaryDto prev = tuple2._2; - dto.setPrevAmount(ObjectUtils.defaultIfNull(entity.getType0Amount(), 0.0) - ObjectUtils.defaultIfNull(entity.getType1Amount(), 0.0)); - dto.setPrevNumber(ObjectUtils.defaultIfNull(entity.getType0Number(), 0.0) - ObjectUtils.defaultIfNull(entity.getType1Number(), 0.0)); + dto.setPrevAmount(ObjectUtils.defaultIfNull(prev.getType0Amount(), 0.0) - ObjectUtils.defaultIfNull(prev.getType1Amount(), 0.0)); + dto.setPrevNumber(ObjectUtils.defaultIfNull(prev.getType0Number(), 0.0) - ObjectUtils.defaultIfNull(prev.getType1Number(), 0.0)); }