From fce7a8df22ab7b5b0be0fb5151c40abbfbab6be8 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 02 七月 2026 10:49:14 +0800
Subject: [PATCH] 1.修复编译问题

---
 yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
index 71b1884..1828558 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
@@ -2,6 +2,7 @@
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.ListUtil;
+import cn.hutool.core.util.ObjUtil;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@@ -15,6 +16,7 @@
 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO;
 import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessDO;
+import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO;
 import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper;
 import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessProductMapper;
 import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
@@ -194,9 +196,15 @@
         if (saveReqVO.getCustomerId() != null) {
             customerService.validateCustomer(saveReqVO.getCustomerId());
         }
-        // 鏍¢獙鑱旂郴浜�
+        // 鏍¢獙鑱旂郴浜猴紙涓斿繀椤讳笌鍟嗘満灞炰簬鍚屼竴瀹㈡埛锛岄伩鍏嶈法瀹㈡埛鍏宠仈锛�
         if (saveReqVO.getContactId() != null) {
             contactService.validateContact(saveReqVO.getContactId());
+            if (saveReqVO.getCustomerId() != null) {
+                CrmContactDO contact = contactService.getContact(saveReqVO.getContactId());
+                if (ObjUtil.notEqual(saveReqVO.getCustomerId(), contact.getCustomerId())) {
+                    throw exception(BUSINESS_CONTACT_CUSTOMER_NOT_MATCH);
+                }
+            }
         }
         // 鏍¢獙璐熻矗浜�
         if (saveReqVO.getOwnerUserId() != null) {
@@ -378,6 +386,24 @@
     }
 
     @Override
+    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#customerId", level = CrmPermissionLevelEnum.READ)
+    public List<CrmBusinessDO> getBusinessListByCustomerId(Long customerId) {
+        return businessMapper.selectListByCustomerId(customerId);
+    }
+
+    @Override
+    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#contactId", level = CrmPermissionLevelEnum.READ)
+    public List<CrmBusinessDO> getBusinessListByContact(Long contactId) {
+        // 1. 鏌ヨ鍏宠仈鐨勫晢鏈虹紪鍙�
+        List<CrmContactBusinessDO> contactBusinessList = contactBusinessService.getContactBusinessListByContactId(contactId);
+        if (CollUtil.isEmpty(contactBusinessList)) {
+            return ListUtil.empty();
+        }
+        // 2. 鏌ヨ鍟嗘満鍒楄〃
+        return businessMapper.selectByIds(convertSet(contactBusinessList, CrmContactBusinessDO::getBusinessId));
+    }
+
+    @Override
     public PageResult<CrmBusinessDO> getBusinessPageByDate(CrmStatisticsFunnelReqVO pageVO) {
         return businessMapper.selectPage(pageVO);
     }

--
Gitblit v1.9.3