From 7591ba21194595cc8d9a1293dfdbfa945bc9948f Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期一, 17 八月 2026 16:36:54 +0800
Subject: [PATCH] Merge branch 'dev_business' of http://114.132.189.42:9002/r/mom-pro2-after into dev_business

---
 yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java
index 58b5dba..af0912e 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java
@@ -90,10 +90,24 @@
 
     @DeleteMapping("/delete")
     @Operation(summary = "鍒犻櫎閿�鍞姤浠峰崟")
-    @Parameter(name = "ids", description = "缂栧彿鏁扮粍", required = true)
+    @Parameter(name = "id", description = "鍗曚釜缂栧彿", required = false)
+    @Parameter(name = "ids", description = "缂栧彿鏁扮粍", required = false)
     @PreAuthorize("@ss.hasPermission('crm:sale-quotation:delete')")
-    public CommonResult<Boolean> deleteSaleQuotation(@RequestParam("ids") List<Long> ids) {
-        saleQuotationService.deleteSaleQuotation(ids);
+    public CommonResult<Boolean> deleteSaleQuotation(
+            @RequestParam(value = "id", required = false) Long id,
+            @RequestParam(value = "ids", required = false) List<Long> ids) {
+        // 鏀寔鍗曚釜id鎴栧涓猧ds
+        List<Long> deleteIds = new java.util.ArrayList<>();
+        if (id != null) {
+            deleteIds.add(id);
+        }
+        if (ids != null && !ids.isEmpty()) {
+            deleteIds.addAll(ids);
+        }
+        if (deleteIds.isEmpty()) {
+            throw new IllegalArgumentException("璇锋眰鍙傛暟缂哄け:id 鎴� ids");
+        }
+        saleQuotationService.deleteSaleQuotation(deleteIds);
         return success(true);
     }
 
@@ -161,9 +175,14 @@
         // 1. 鏋勫缓鐗╂枡鏄庣粏
         if (CollUtil.isNotEmpty(productList)) {
             Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(convertSet(productList, CrmSaleQuotationProductDO::getItemId));
+            java.util.Set<Long> unitIds = new java.util.HashSet<>(convertSet(productList, CrmSaleQuotationProductDO::getItemUnitId));
+            itemMap.values().forEach(item -> {
+                if (item.getUnitMeasureId2() != null) {
+                    unitIds.add(item.getUnitMeasureId2());
+                }
+            });
             Map<Long, MdmUnitMeasureRespDTO> unitMap = convertMap(
-                    mdmUnitMeasureApi.getUnitMeasureList(
-                            convertSet(productList, CrmSaleQuotationProductDO::getItemUnitId)).getCheckedData(),
+                    mdmUnitMeasureApi.getUnitMeasureList(unitIds).getCheckedData(),
                     MdmUnitMeasureRespDTO::getId);
             respVO.setItems(BeanUtils.toBean(productList, CrmSaleQuotationRespVO.Item.class, item -> {
                 MdmItemRespDTO mdmItem = itemMap.get(item.getItemId());
@@ -171,8 +190,13 @@
                     item.setItemCode(mdmItem.getCode());
                     item.setItemName(mdmItem.getName());
                     item.setItemBarCode(mdmItem.getBarCode());
+                    item.setItemSpecification(mdmItem.getSpecification());
+                    item.setItemUnitId2(mdmItem.getUnitMeasureId2());
+                    item.setItemUnitId3(mdmItem.getUnitMeasureId3());
                 }
                 MapUtils.findAndThen(unitMap, item.getItemUnitId(), unit -> item.setItemUnitName(unit.getName()));
+                MapUtils.findAndThen(unitMap, item.getItemUnitId2(), unit -> item.setItemUnitName2(unit.getName()));
+                MapUtils.findAndThen(unitMap, item.getItemUnitId3(), unit -> item.setItemUnitName3(unit.getName()));
             }));
         }
         // 2. 濉厖瀹㈡埛鍚嶇О
@@ -206,6 +230,15 @@
         Map<Long, List<CrmSaleQuotationProductDO>> productMap = convertMultiMap(productList, CrmSaleQuotationProductDO::getQuotationId);
         // 1.2 鐗╂枡淇℃伅
         Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(convertSet(productList, CrmSaleQuotationProductDO::getItemId));
+        java.util.Set<Long> unitIds = new java.util.HashSet<>(convertSet(productList, CrmSaleQuotationProductDO::getItemUnitId));
+        itemMap.values().forEach(item -> {
+            if (item.getUnitMeasureId2() != null) {
+                unitIds.add(item.getUnitMeasureId2());
+            }
+        });
+        Map<Long, MdmUnitMeasureRespDTO> unitMap = convertMap(
+                mdmUnitMeasureApi.getUnitMeasureList(unitIds).getCheckedData(),
+                MdmUnitMeasureRespDTO::getId);
         // 1.3 瀹㈡埛淇℃伅
         Map<Long, CrmCustomerDO> customerMap = customerService.getCustomerMap(
                 convertSet(pageResult.getList(), CrmSaleQuotationDO::getCustomerId));
@@ -222,8 +255,18 @@
         // 2. 寮�濮嬫嫾鎺�
         return BeanUtils.toBean(pageResult, CrmSaleQuotationRespVO.class, vo -> {
             vo.setItems(BeanUtils.toBean(productMap.get(vo.getId()), CrmSaleQuotationRespVO.Item.class,
-                    item -> MapUtils.findAndThen(itemMap, item.getItemId(), mdmItem -> item.setItemCode(mdmItem.getCode())
-                            .setItemName(mdmItem.getName()).setItemBarCode(mdmItem.getBarCode()))));
+                    item -> {
+                        MapUtils.findAndThen(itemMap, item.getItemId(), mdmItem -> item
+                                .setItemCode(mdmItem.getCode())
+                                .setItemName(mdmItem.getName())
+                                .setItemBarCode(mdmItem.getBarCode())
+                                .setItemSpecification(mdmItem.getSpecification())
+                                .setItemUnitId2(mdmItem.getUnitMeasureId2())
+                                .setItemUnitId3(mdmItem.getUnitMeasureId3()));
+                        MapUtils.findAndThen(unitMap, item.getItemUnitId(), unit -> item.setItemUnitName(unit.getName()));
+                        MapUtils.findAndThen(unitMap, item.getItemUnitId2(), unit -> item.setItemUnitName2(unit.getName()));
+                        MapUtils.findAndThen(unitMap, item.getItemUnitId3(), unit -> item.setItemUnitName3(unit.getName()));
+                    }));
             MapUtils.findAndThen(customerMap, vo.getCustomerId(), customer -> vo.setCustomerName(customer.getName()));
             MapUtils.findAndThen(userMap, vo.getOwnerUserId(), user -> vo.setOwnerUserName(user.getNickname()));
             MapUtils.findAndThen(deptMap, vo.getOwnerUserId(), dept -> vo.setOwnerUserDeptName(dept.getName()));
@@ -258,4 +301,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

--
Gitblit v1.9.3