From bee96a1d36c86068cd5a7eb69f4e3294a8123b04 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期五, 03 七月 2026 18:02:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_business' into dev_business
---
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java | 45 ++++++++++++++++++++++++---------------------
1 files changed, 24 insertions(+), 21 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 e1f2713..2bad9a7 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
@@ -13,6 +13,8 @@
import cn.iocoder.yudao.module.crm.controller.admin.quotation.vo.CrmSaleQuotationSaveReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.quotation.CrmSaleQuotationDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.quotation.CrmSaleQuotationProductDO;
+import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
+import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
import cn.iocoder.yudao.module.crm.service.quotation.CrmSaleQuotationService;
import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi;
import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO;
@@ -38,8 +40,10 @@
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "绠$悊鍚庡彴 - CRM 閿�鍞姤浠峰崟")
@@ -59,6 +63,8 @@
private MdmItemApi mdmItemApi;
@Resource
private MdmUnitMeasureApi mdmUnitMeasureApi;
+ @Resource
+ private CrmCustomerService customerService;
@PostMapping("/create")
@Operation(summary = "鍒涘缓閿�鍞姤浠峰崟")
@@ -133,22 +139,6 @@
ExcelUtils.write(response, "閿�鍞姤浠峰崟.xls", "鏁版嵁", CrmSaleQuotationRespVO.class, list);
}
- @PutMapping("/submit")
- @Operation(summary = "鎻愪氦閿�鍞姤浠峰鎵�")
- @PreAuthorize("@ss.hasPermission('crm:sale-quotation:submit')")
- public CommonResult<Boolean> submitSaleQuotation(@RequestParam("id") Long id,
- @RequestParam("processDefinitionKey") String processDefinitionKey) {
- saleQuotationService.submitSaleQuotation(id, processDefinitionKey, getLoginUserId());
- return success(true);
- }
-
- @GetMapping("/approve-process-list")
- @Operation(summary = "鑾峰彇閿�鍞姤浠峰鎵规祦绋嬪垪琛�")
- @PreAuthorize("@ss.hasPermission('crm:sale-quotation:query')")
- public CommonResult<List<Map<String, Object>>> getSaleQuotationApproveProcessList() {
- return success(saleQuotationService.getSaleQuotationApproveProcessDefinitionList());
- }
-
@PostMapping("/convert-contract")
@Operation(summary = "杞负鍚堝悓")
@Parameter(name = "id", description = "鎶ヤ环鍗曠紪鍙�", required = true)
@@ -164,8 +154,10 @@
// 1. 鏋勫缓鐗╂枡鏄庣粏
if (CollUtil.isNotEmpty(productList)) {
Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(convertSet(productList, CrmSaleQuotationProductDO::getItemId));
- Map<Long, MdmUnitMeasureRespDTO> unitMap = mdmUnitMeasureApi.getUnitMeasureMap(
- convertSet(productList, CrmSaleQuotationProductDO::getItemUnitId));
+ Map<Long, MdmUnitMeasureRespDTO> unitMap = convertMap(
+ mdmUnitMeasureApi.getUnitMeasureList(
+ convertSet(productList, CrmSaleQuotationProductDO::getItemUnitId)).getCheckedData(),
+ MdmUnitMeasureRespDTO::getId);
respVO.setItems(BeanUtils.toBean(productList, CrmSaleQuotationRespVO.Item.class, item -> {
MdmItemRespDTO mdmItem = itemMap.get(item.getItemId());
if (mdmItem != null) {
@@ -176,7 +168,14 @@
MapUtils.findAndThen(unitMap, item.getItemUnitId(), unit -> item.setItemUnitName(unit.getName()));
}));
}
- // 2. 濉厖鍏宠仈淇℃伅
+ // 2. 濉厖瀹㈡埛鍚嶇О
+ if (saleQuotation.getCustomerId() != null) {
+ CrmCustomerDO customer = customerService.getCustomer(saleQuotation.getCustomerId());
+ if (customer != null) {
+ respVO.setCustomerName(customer.getName());
+ }
+ }
+ // 3. 濉厖鍏宠仈淇℃伅
fillSaleQuotationRelatedFields(respVO);
return respVO;
}
@@ -191,10 +190,13 @@
Map<Long, List<CrmSaleQuotationProductDO>> productMap = convertMultiMap(productList, CrmSaleQuotationProductDO::getQuotationId);
// 1.2 鐗╂枡淇℃伅
Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(convertSet(productList, CrmSaleQuotationProductDO::getItemId));
- // 1.3 鐢ㄦ埛淇℃伅
+ // 1.3 瀹㈡埛淇℃伅
+ Map<Long, CrmCustomerDO> customerMap = customerService.getCustomerMap(
+ convertSet(pageResult.getList(), CrmSaleQuotationDO::getCustomerId));
+ // 1.4 鐢ㄦ埛淇℃伅
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), CrmSaleQuotationDO::getOwnerUserId));
- // 1.4 閮ㄩ棬淇℃伅
+ // 1.5 閮ㄩ棬淇℃伅
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
convertSet(pageResult.getList(), CrmSaleQuotationDO::getOwnerUserId));
@@ -203,6 +205,7 @@
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()))));
+ 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()));
});
--
Gitblit v1.9.3