From 317c0053ddb123512f997ef5ada5e30dec60830a Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期一, 03 八月 2026 14:21:54 +0800
Subject: [PATCH] 删除合同的时候同步更新报价的状态
---
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/CrmSaleQuotationServiceImpl.java | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/CrmSaleQuotationServiceImpl.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/CrmSaleQuotationServiceImpl.java
index 99dda59..2c00fd7 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/CrmSaleQuotationServiceImpl.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/CrmSaleQuotationServiceImpl.java
@@ -23,8 +23,10 @@
import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi;
import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService;
import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO;
+import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi;
import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -70,6 +72,8 @@
@Resource
private CrmPermissionService permissionService;
@Resource
+ private StorageAttachmentApi storageAttachmentApi;
+ @Resource
private CrmContractService contractService;
@Override
@@ -100,6 +104,8 @@
.setBizType(CrmBizTypeEnum.CRM_SALE_QUOTATION.getType())
.setBizId(saleQuotation.getId())
.setLevel(CrmPermissionLevelEnum.OWNER.getLevel()));
+ storageAttachmentApi.bindAttachments("file", "crm_sale_quotation",
+ saleQuotation.getId(), createReqVO.getBlobIds());
return saleQuotation.getId();
}
@@ -123,6 +129,7 @@
saleQuotationMapper.updateById(updateObj);
// 2.2 鏇存柊鎶ヤ环鏄庣粏
updateQuotationProductList(updateReqVO.getId(), quotationProducts);
+ storageAttachmentApi.updateAttachments("file", "crm_sale_quotation", updateReqVO.getId(), updateReqVO.getBlobIds());
}
@Override
@@ -141,6 +148,8 @@
// 2. 閬嶅巻鍒犻櫎
saleQuotations.forEach(saleQuotation -> {
+ // 2.0 鍒犻櫎闄勪欢鍏宠仈
+ storageAttachmentApi.deleteAttachmentsByRecord("crm_sale_quotation", saleQuotation.getId());
// 2.1 鍒犻櫎鎶ヤ环鍗�
saleQuotationMapper.deleteById(saleQuotation.getId());
// 2.2 鍒犻櫎鎶ヤ环鏄庣粏
@@ -310,4 +319,14 @@
return contractId;
}
+ @Override
+ public CrmSaleQuotationDO getByContractId(Long id) {
+ return saleQuotationMapper.selectOne(new LambdaQueryWrapper<CrmSaleQuotationDO>().eq(CrmSaleQuotationDO::getContractId,id));
+ }
+
+ @Override
+ public void clearContractReference(Long quotationId) {
+ saleQuotationMapper.clearContractReference(quotationId);
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.3