From b5e1bceabb36fe1d1e5e88397280d12e7044c6dd Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期五, 06 十一月 2026 15:32:31 +0800
Subject: [PATCH] 完善设备采集、安全管理及采购业务

---
 yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/statistics/ErpPurchaseStatisticsServiceImpl.java |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/statistics/ErpPurchaseStatisticsServiceImpl.java b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/statistics/ErpPurchaseStatisticsServiceImpl.java
index d725153..c457532 100644
--- a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/statistics/ErpPurchaseStatisticsServiceImpl.java
+++ b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/statistics/ErpPurchaseStatisticsServiceImpl.java
@@ -6,6 +6,10 @@
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.purchase.ErpPurchasePriceRespVO;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 
 /**
  * ERP 閲囪喘缁熻 Service 瀹炵幇绫�
@@ -23,4 +27,13 @@
         return purchaseStatisticsMapper.getPurchasePrice(beginTime, endTime);
     }
 
+    @Override
+    public PageResult<ErpPurchasePriceRespVO> getPriceAnalysis(PageParam page, Long productId, LocalDateTime[] orderTime) {
+        LocalDateTime begin = orderTime != null && orderTime.length > 0 ? orderTime[0] : null;
+        LocalDateTime end = orderTime != null && orderTime.length > 1 ? orderTime[1] : null;
+        var result = purchaseStatisticsMapper.selectPriceAnalysis(new Page<>(page.getPageNo(), page.getPageSize()), productId, begin, end);
+        result.getRecords().forEach(row -> row.setPriceChangeRate(PurchasePriceMetrics.changeRate(row.getLatestPrice(), row.getPreviousPrice())));
+        return new PageResult<>(result.getRecords(), result.getTotal());
+    }
+
 }

--
Gitblit v1.9.3