From d086ecc4ce42fca3d80e29bab1f203df13831113 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期六, 28 三月 2026 11:07:26 +0800
Subject: [PATCH] fix: 编辑/新增销售台账产品信息数据展示缺失
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 87be01e..871597a 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.pojo.CustomerRegions;
+import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.basic.service.ICustomerRegionsService;
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.enums.SaleEnum;
@@ -197,6 +198,20 @@
productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId());
productWrapper.eq(SalesLedgerProduct::getType, 1);
List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper);
+ Map<Long, ProductModel> productModelMap = Collections.emptyMap();
+ if (CollectionUtils.isNotEmpty(products)) {
+ List<Long> productModelIds = products.stream()
+ .map(SalesLedgerProduct::getProductModelId)
+ .filter(Objects::nonNull)
+ .distinct()
+ .collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(productModelIds)) {
+ List<ProductModel> productModels = productModelMapper.selectBatchIds(productModelIds);
+ if (CollectionUtils.isNotEmpty(productModels)) {
+ productModelMap = productModels.stream().collect(Collectors.toMap(ProductModel::getId, Function.identity()));
+ }
+ }
+ }
for (SalesLedgerProduct product : products) {
product.setOriginalNoInvoiceNum(product.getNoInvoiceNum());
// 鎻愪緵涓存椂鏈紑绁ㄦ暟锛屾湭寮�绁ㄩ噾棰濅緵鍓嶆璁$畻
@@ -229,6 +244,20 @@
processList.forEach(p -> p.setQuantity(processQuantityMap.get(p.getId())));
product.setSalesProductProcessList(processList);
}
+ ProductModel productModel = productModelMap.get(product.getProductModelId());
+ if (productModel != null) {
+ product.setThickness(productModel.getThickness());
+ }
+ if (product.getWidth() != null && product.getHeight() != null) {
+ BigDecimal pieceArea = product.getWidth().multiply(product.getHeight()).divide(new BigDecimal(1000000), 2, RoundingMode.HALF_UP);
+ if (product.getActualPieceArea() == null) {
+ product.setActualPieceArea(pieceArea);
+ }
+ BigDecimal quantity = product.getQuantity() == null ? BigDecimal.ZERO : product.getQuantity();
+ if (product.getActualTotalArea() == null) {
+ product.setActualTotalArea(pieceArea.multiply(quantity).setScale(2, RoundingMode.HALF_UP));
+ }
+ }
}
// 3.鏌ヨ涓婁紶鏂囦欢
--
Gitblit v1.9.3