From 69e0f44e279f7763fa9c9a4d105f154db39ee1d8 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期六, 23 五月 2026 11:38:02 +0800
Subject: [PATCH] feat(sales): 添加每件数量字段支持及多业务流程优化
---
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
index de86ad0..32359ec 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -29,6 +29,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
@@ -78,6 +79,7 @@
List<SalesQuotationProduct> products = salesQuotationDto.getProducts().stream().map(product -> {
SalesQuotationProduct salesQuotationProduct = new SalesQuotationProduct();
BeanUtils.copyProperties(product, salesQuotationProduct);
+ salesQuotationProduct.setSingleQuantity(normalizeSingleQuantity(salesQuotationProduct.getSingleQuantity()));
salesQuotationProduct.setSalesQuotationId(salesQuotation.getId());
return salesQuotationProduct;
}).collect(Collectors.toList());
@@ -87,7 +89,6 @@
approveProcessVO.setApproveType(6);
approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
approveProcessVO.setApproveReason(quotationNo);
- approveProcessVO.setApproveUserIds(salesQuotationDto.getApproveUserIds());
approveProcessVO.setApproveUser(loginUser.getUserId());
approveProcessVO.setApproveTime(LocalDate.now().toString());
approveProcessVO.setPrice(salesQuotationDto.getTotalAmount());
@@ -95,7 +96,7 @@
approveProcessService.addApprove(approveProcessVO);
}catch (Exception e){
log.error("SalesQuotationServiceImpl error:{}", e);
- throw new RuntimeException("瀹℃壒澶辫触");
+ throw new RuntimeException("瀹℃壒澶辫触");
}
return true;
}
@@ -118,13 +119,13 @@
List<SalesQuotationProduct> products = salesQuotationDto.getProducts().stream().map(product -> {
SalesQuotationProduct salesQuotationProduct = new SalesQuotationProduct();
BeanUtils.copyProperties(product, salesQuotationProduct);
+ salesQuotationProduct.setSingleQuantity(normalizeSingleQuantity(salesQuotationProduct.getSingleQuantity()));
salesQuotationProduct.setSalesQuotationId(salesQuotation.getId());
return salesQuotationProduct;
}).collect(Collectors.toList());
salesQuotationProductService.saveBatch(products);
// 淇敼鎶ヤ环瀹℃壒
- vo.setApproveUserIds(salesQuotationDto.getApproveUserIds());
vo.setApproveType(6);
vo.setApproveReason(salesQuotationDto.getQuotationNo());
approveProcessService.updateApproveUser(vo);
@@ -147,5 +148,12 @@
return true;
}
+ private BigDecimal normalizeSingleQuantity(BigDecimal singleQuantity) {
+ if (singleQuantity == null || singleQuantity.compareTo(BigDecimal.ZERO) <= 0) {
+ return BigDecimal.ONE;
+ }
+ return singleQuantity;
+ }
+
}
--
Gitblit v1.9.3