From b94831f6bc2ecafb7159b09d4622226410a1c31a Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期一, 19 一月 2026 18:03:14 +0800
Subject: [PATCH] yys 1.客户模块修改 2.销售报价修改 3.回款登记修改

---
 src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java |   44 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 37 insertions(+), 7 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 104a712..058513a 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -4,9 +4,15 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
+import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
+import com.ruoyi.approve.vo.ApproveGetAndUpdateVo;
+import com.ruoyi.approve.vo.ApproveProcessVO;
+import com.ruoyi.common.utils.OrderUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.framework.security.LoginUser;
 import com.ruoyi.sales.dto.SalesQuotationDto;
 import com.ruoyi.sales.mapper.SalesQuotationMapper;
 import com.ruoyi.sales.mapper.SalesQuotationProductMapper;
@@ -15,10 +21,12 @@
 import com.ruoyi.sales.service.SalesQuotationProductService;
 import com.ruoyi.sales.service.SalesQuotationService;
 import org.springframework.beans.factory.annotation.Autowired;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -48,18 +56,17 @@
     public boolean add(SalesQuotationDto salesQuotationDto) {
         SalesQuotation salesQuotation = new SalesQuotation();
         BeanUtils.copyProperties(salesQuotationDto, salesQuotation);
-        String quotationNo = salesQuotation.getQuotationNo();
+        String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT");
+        salesQuotation.setQuotationNo(quotationNo);
+        salesQuotation.setStatus("寰呭鎵�");
         salesQuotationMapper.insert(salesQuotation);
-//        if(salesQuotationMapper.insert(salesQuotation)!=1){
-//            return false;
-//        }
         if(CollectionUtils.isEmpty(salesQuotationDto.getProducts())){
             return true;
         }
         List<SalesQuotationProduct> products = salesQuotationDto.getProducts().stream().map(product -> {
             SalesQuotationProduct salesQuotationProduct = new SalesQuotationProduct();
             BeanUtils.copyProperties(product, salesQuotationProduct);
-            salesQuotationProduct.setSalesQuotationId(salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>().eq(SalesQuotation::getQuotationNo, quotationNo)).getId());
+            salesQuotationProduct.setSalesQuotationId(salesQuotation.getId());
             return salesQuotationProduct;
         }).collect(Collectors.toList());
         salesQuotationProductService.saveBatch(products);
@@ -69,6 +76,11 @@
     public boolean edit(SalesQuotationDto salesQuotationDto) {
         SalesQuotation salesQuotation = new SalesQuotation();
         BeanUtils.copyProperties(salesQuotationDto, salesQuotation);
+        ApproveGetAndUpdateVo vo = new ApproveGetAndUpdateVo();
+        if("鎷掔粷".equals(salesQuotationDto.getStatus())){
+            vo.setApproveStatus(0);
+            salesQuotation.setStatus("寰呭鎵�");
+        }
         if(salesQuotationMapper.updateById(salesQuotation)!=1){
             return false;
         }
@@ -85,6 +97,24 @@
         salesQuotationProductService.saveBatch(products);
         return true;
     }
+
+    @Override
+    public BigDecimal detail(String type, String productName, String specification) {
+        SalesQuotationProduct salesQuotationProduct = salesQuotationProductMapper.selectOne(new LambdaQueryWrapper<SalesQuotationProduct>()
+                .eq(SalesQuotationProduct::getProduct, productName)
+                .eq(SalesQuotationProduct::getSpecification, specification)
+                .last("limit 1"));
+        if(salesQuotationProduct==null) return null;
+        switch (type){
+            case "涓�鎵瑰晢":
+                return salesQuotationProduct.getUnitPrice();
+            case "缁堢鍟�":
+                return salesQuotationProduct.getUnitPriceTwo();
+            default:
+                return salesQuotationProduct.getUnitPriceThree();
+        }
+    }
+
     @Override
     public boolean delete(Long id) {
         salesQuotationMapper.deleteById(id);

--
Gitblit v1.9.3