From 8d350f76d9b8ca447f8eef680745cea2b3ec61d8 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期四, 25 六月 2026 09:09:17 +0800
Subject: [PATCH] fix: 报价、审核、采购台账、供应商往来、销售台账、客户往来小数点保留6位小数

---
 src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 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 1ec6a8d..e847384 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -13,6 +13,8 @@
 import com.ruoyi.approve.bean.vo.ApproveProcessVO;
 import com.ruoyi.basic.mapper.CustomerMapper;
 import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.common.enums.IsDeleteEnum;
+import com.ruoyi.common.utils.AmountUtils;
 import com.ruoyi.common.utils.OrderUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
@@ -51,16 +53,37 @@
             return salesQuotationDtoIPage;
         }
         salesQuotationDtoIPage.getRecords().forEach(record -> {
+            record.setTotalAmount(AmountUtils.scaleAmount(record.getTotalAmount()));
             List<SalesQuotationProduct> products = salesQuotationProductMapper.selectBySalesQuotationId(record.getId());
+            if (!CollectionUtils.isEmpty(products)) {
+                products.forEach(product -> {
+                    product.setUnitPrice(AmountUtils.scaleAmount(product.getUnitPrice()));
+                    product.setAmount(AmountUtils.scaleAmount(product.getAmount()));
+                });
+            }
             record.setProducts(products);
         });
         return salesQuotationDtoIPage;
     }
 
+    private void normalizeAmounts(SalesQuotationDto salesQuotationDto) {
+        salesQuotationDto.setTotalAmount(AmountUtils.scaleAmount(salesQuotationDto.getTotalAmount()));
+        if (CollectionUtils.isEmpty(salesQuotationDto.getProducts())) {
+            return;
+        }
+        salesQuotationDto.getProducts().forEach(product -> {
+            product.setUnitPrice(AmountUtils.scaleAmount(product.getUnitPrice()));
+            product.setAmount(AmountUtils.scaleAmount(product.getAmount()));
+        });
+    }
+
     @Override
     public boolean add(SalesQuotationDto salesQuotationDto) {
+        normalizeAmounts(salesQuotationDto);
         LoginUser loginUser = SecurityUtils.getLoginUser();
         SalesQuotation salesQuotation = new SalesQuotation();
+        BeanUtils.copyProperties(salesQuotationDto, salesQuotation);
+        salesQuotation.setId(null);
         Customer customer = customerMapper.selectById(Long.valueOf(salesQuotationDto.getCustomerId()));
         if (ObjectUtils.isNotEmpty(customer))  {
             salesQuotation.setCustomer(customer.getCustomerName());
@@ -98,6 +121,7 @@
     }
     @Override
     public boolean edit(SalesQuotationDto salesQuotationDto) {
+        normalizeAmounts(salesQuotationDto);
         SalesQuotation salesQuotation = new SalesQuotation();
         BeanUtils.copyProperties(salesQuotationDto, salesQuotation);
         ApproveGetAndUpdateVo vo = new ApproveGetAndUpdateVo();
@@ -136,6 +160,7 @@
         // 鍒犻櫎鎶ヤ环瀹℃壒
         ApproveProcess one = approveProcessService.getOne(new LambdaQueryWrapper<ApproveProcess>()
                 .eq(ApproveProcess::getApproveType, 6)
+                .eq(ApproveProcess::getApproveDelete, IsDeleteEnum.NOT_DELETED)
                 .eq(ApproveProcess::getApproveReason, salesQuotation.getQuotationNo()));
         if(one != null){
             approveProcessService.delByIds(Collections.singletonList(one.getId()));

--
Gitblit v1.9.3