From 501aead9955b65d956f746f0ec2a480d87b4caf5 Mon Sep 17 00:00:00 2001
From: zhang_nuo <zhang_12370@163.com>
Date: 星期二, 15 九月 2026 01:23:17 +0800
Subject: [PATCH] fix(sales): 修正发货率统计逻辑
---
src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
index 77faa01..63d77e6 100644
--- a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
@@ -6,10 +6,12 @@
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
+import com.ruoyi.purchase.vo.PurchaseReportVo;
import com.ruoyi.sales.dto.SalesLedgerDto;
import com.ruoyi.sales.dto.SalesTrendDto;
import com.ruoyi.sales.dto.StatisticsTableDto;
import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.vo.SalesLedgerVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@@ -52,7 +54,7 @@
* @param salesLedgerDto
* @return
*/
- IPage<SalesLedger> selectSalesLedgerListPage(Page page, @Param("salesLedgerDto") SalesLedgerDto salesLedgerDto);
+ IPage<SalesLedgerVo> selectSalesLedgerListPage(Page page, @Param("salesLedgerDto") SalesLedgerDto salesLedgerDto);
/**
* 鎸夋湀浠界粺璁¤鍗曟暟銆侀攢鍞锛堟敮鎸佷骇鍝佸ぇ绫汇�佸鎴峰悕绉扮瓫閫夛級
@@ -64,11 +66,13 @@
"DATE_FORMAT(sl.entry_date, '%Y-%m') AS month, " +
"COUNT(DISTINCT sl.id) AS order_count, " + // 鎬昏鍗曟暟
"SUM(slp.tax_inclusive_total_price) AS sales_amount, " + // 閿�鍞
- // 鍙戣揣鐜� = 鍙戣揣璁㈠崟鏁� * 100 / 鎬昏鍗曟暟锛堜繚鐣�2浣嶅皬鏁帮紝閬垮厤闄�0鎶ラ敊锛�
+ "SUM(IFNULL(slp.quantity, 0)) AS product_quantity, " + // 浜у搧閿�鍞暟閲�
+ // 鍙戣揣鐜� = 鏈夊彂璐ц褰曠殑璁㈠崟鏁� / 鎬昏鍗曟暟 * 100锛堜繚鐣�2浣嶅皬鏁帮紝閬垮厤闄�0鎶ラ敊锛�
"ROUND(IF(COUNT(DISTINCT sl.id) = 0, 0, " +
- "SUM(CASE WHEN slp.approve_status = 2 THEN 1 ELSE 0 END) / COUNT(DISTINCT sl.id) * 100), 2) AS ship_rate " +
+ "COUNT(DISTINCT CASE WHEN si.id IS NOT NULL THEN sl.id END) / COUNT(DISTINCT sl.id) * 100), 2) AS ship_rate " +
"FROM sales_ledger sl " +
"LEFT JOIN sales_ledger_product slp ON sl.id = slp.sales_ledger_id " +
+ "LEFT JOIN shipping_info si ON sl.id = si.sales_ledger_id " +
"WHERE sl.entry_date >= DATE_FORMAT(#{statisticsTableDto.entryDateStart}, '%Y-%m-01') " +
"AND sl.entry_date <= LAST_DAY(#{statisticsTableDto.entryDateEnd}) " +
// 浜у搧澶х被绛涢��
@@ -83,4 +87,9 @@
"ORDER BY month" +
"</script>")
List<SalesTrendDto> statisticsTable(@Param("statisticsTableDto")StatisticsTableDto statisticsTableDto);
+
+ IPage<SalesLedgerDto> listSalesLedgerAndShipped(Page page, @Param("ew") SalesLedgerDto salesLedgerDto);
+
+ IPage<PurchaseReportVo> selectPurchaseReportVoPage(Page page, @Param("customerName") String customerName);
+
}
--
Gitblit v1.9.3