From c2053d7017625f270577bc0f6c523d04f52db6ea Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 24 七月 2026 14:20:29 +0800
Subject: [PATCH] refactor(crm): 重构文件上传功能,替换原有的fileUrls字段为统一的StorageAttachmentApi
---
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
index 31c62d3..69d88ca 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
@@ -18,6 +18,7 @@
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmFollowUpCreateReqBO;
import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService;
+import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@@ -60,6 +61,8 @@
@Resource
@Lazy
private CrmCustomerService customerService;
+ @Resource
+ private StorageAttachmentApi storageAttachmentApi;
@Override
@CrmPermission(bizTypeValue = "#createReqVO.bizType", bizId = "#createReqVO.bizId", level = CrmPermissionLevelEnum.WRITE)
@@ -67,6 +70,8 @@
// 1. 鍒涘缓鏇磋繘璁板綍
CrmFollowUpRecordDO record = BeanUtils.toBean(createReqVO, CrmFollowUpRecordDO.class);
crmFollowUpRecordMapper.insert(record);
+ storageAttachmentApi.bindAttachments("file", "crm_follow_up_record",
+ record.getId(), createReqVO.getBlobIds());
// 2. 鏇存柊 bizId 瀵瑰簲鐨勮褰�
if (ObjUtil.equal(CrmBizTypeEnum.CRM_CUSTOMER.getType(), record.getBizType())) { // 鏇存柊瀹㈡埛璺熻繘淇℃伅
@@ -113,12 +118,18 @@
throw exception(FOLLOW_UP_RECORD_DELETE_DENIED);
}
+ // 鍒犻櫎闄勪欢
+ storageAttachmentApi.deleteAttachmentsByRecord("crm_follow_up_record", id);
// 鍒犻櫎
crmFollowUpRecordMapper.deleteById(id);
}
@Override
public void deleteFollowUpRecordByBiz(Integer bizType, Long bizId) {
+ List<CrmFollowUpRecordDO> records = crmFollowUpRecordMapper.selectListByBiz(bizType, List.of(bizId));
+ for (CrmFollowUpRecordDO record : records) {
+ storageAttachmentApi.deleteAttachmentsByRecord("crm_follow_up_record", record.getId());
+ }
crmFollowUpRecordMapper.deleteByBiz(bizType, bizId);
}
--
Gitblit v1.9.3