From 005e11377f508e3a79b528572a386a2af43697ca Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期五, 09 一月 2026 16:24:58 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/jtwy' into jtwy

---
 src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java |   62 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
index fdd9c7c..3820823 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
@@ -416,6 +416,68 @@
     }
 
     @Override
+    public InventoryInformationDto getReportList() {
+        InventoryInformationDto inventoryInformationDto = new InventoryInformationDto();
+        IPage<ProcurementPageDto> procurementPageDtoIPage = this.listPage(new Page<>(1, -1), new ProcurementPageDto());
+        if(CollectionUtils.isEmpty(procurementPageDtoIPage.getRecords())){
+            return inventoryInformationDto;
+        }
+        // 璁$畻鎬诲簱瀛樻暟閲�
+        inventoryInformationDto.setTotalInventoryCount(procurementPageDtoIPage.getRecords().stream()
+                .map(ProcurementPageDto::getInboundNum0)
+                .reduce(BigDecimal.ZERO, BigDecimal::add)
+                .intValue());
+        // 璁$畻鎬诲簱瀛橀噾棰�-ProcurementPageDto閲屾瘡涓璞$殑inboundNum0鍊煎拰taxInclusiveUnitPrice鐨勪箻绉紝涔嬪悗鐩稿姞寰楀埌鎬诲簱瀛橀噾棰�
+        BigDecimal totalInventoryValue = procurementPageDtoIPage.getRecords().stream()
+                // 杩囨护绌哄璞★紝閬垮厤NPE
+                .filter(Objects::nonNull)
+                // 澶勭悊姣忎釜瀵硅薄鐨勭┖鍊硷細null杞负0
+                .map(dto -> {
+                    // 鍏ュ簱鏁伴噺锛歯ull 鈫� 0
+                    BigDecimal inboundNum0 = Optional.ofNullable(dto.getInboundNum0()).orElse(BigDecimal.ZERO);
+                    // 鍚◣鍗曚环锛歯ull 鈫� 0
+                    BigDecimal taxInclusiveUnitPrice = Optional.ofNullable(dto.getTaxInclusiveUnitPrice()).orElse(BigDecimal.ZERO);
+                    // 璁$畻鍗曚釜瀵硅薄鐨勫簱瀛橀噾棰濓細鏁伴噺 脳 鍚◣鍗曚环
+                    return inboundNum0.multiply(taxInclusiveUnitPrice);
+                })
+                // 鎵�鏈夊崟涓噾棰濇眰鍜岋紝鍒濆鍊间负0
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        // 璁剧疆鎬诲簱瀛橀噾棰�
+        inventoryInformationDto.setTotalInventoryValue(totalInventoryValue);
+        // 璁$畻搴撳瓨鍙樺姩鏁伴噺-ProcurementPageDto閲屾瘡涓璞$殑inboundNum鍊煎拰inboundNum0鍊肩殑宸�硷紝涔嬪悗鐩稿姞寰楀埌搴撳瓨鍙樺姩鏁伴噺
+        inventoryInformationDto.setInventoryChangeCount(procurementPageDtoIPage.getRecords().stream()
+                // 杩囨护绌哄璞★紝閬垮厤NPE
+                .filter(Objects::nonNull)
+                // 澶勭悊姣忎釜瀵硅薄鐨勭┖鍊硷細null杞负0
+                .map(dto -> {
+                    // 鍏ュ簱鏁伴噺锛歯ull 鈫� 0
+                    BigDecimal inboundNum = Optional.ofNullable(dto.getInboundNum()).orElse(BigDecimal.ZERO);
+                    // 寰呭嚭搴撴暟閲忥細null 鈫� 0
+                    BigDecimal inboundNum0 = Optional.ofNullable(dto.getInboundNum0()).orElse(BigDecimal.ZERO);
+                    // 璁$畻鍗曚釜瀵硅薄鐨勫簱瀛樺彉鍔ㄦ暟閲忥細鏁伴噺 - 寰呭嚭搴撴暟閲�
+                    return inboundNum.subtract(inboundNum0);
+                })
+                // 鎵�鏈夊崟涓彉鍔ㄦ暟閲忔眰鍜岋紝鍒濆鍊间负0
+                .reduce(BigDecimal.ZERO, BigDecimal::add)
+                .intValue());
+        // 璁$畻搴撳瓨鍙樺姩閲戦ProcurementPageDto閲屾瘡涓璞$殑taxInclusiveTotalPrice鍊肩殑鍜�
+        BigDecimal inventoryChangeValue = procurementPageDtoIPage.getRecords().stream()
+                // 杩囨护绌哄璞★紝閬垮厤NPE
+                .filter(Objects::nonNull)
+                // 澶勭悊姣忎釜瀵硅薄鐨勭┖鍊硷細null杞负0
+                .map(dto -> {
+                    // 鍚◣鎬讳环锛歯ull 鈫� 0
+                    BigDecimal taxInclusiveTotalPrice = Optional.ofNullable(dto.getTaxInclusiveTotalPrice()).orElse(BigDecimal.ZERO);
+                    // 璁$畻鍗曚釜瀵硅薄鐨勫叆搴撳簱瀛橀噾棰濓細鍚◣鎬讳环
+                    return taxInclusiveTotalPrice;
+                })
+                // 鎵�鏈夊崟涓彉鍔ㄩ噾棰濇眰鍜岋紝鍒濆鍊间负0
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        // 璁剧疆搴撳瓨鍙樺姩閲戦
+        inventoryInformationDto.setInventoryChangeValue(inventoryChangeValue.subtract(totalInventoryValue));
+        return inventoryInformationDto;
+    }
+    @Override
     public IPage<ProcurementPageDto> listPageByProduction(Page page, ProcurementPageDto procurementDto) {
         IPage<ProcurementPageDto> procurementPageDtoIPage = procurementRecordMapper.listPageByProduction(page, procurementDto);
         List<ProcurementPageDto> procurementPageDtos = procurementPageDtoIPage.getRecords();

--
Gitblit v1.9.3