From 662a09bf1632ff3e2780e3621023c3e97512a546 Mon Sep 17 00:00:00 2001 From: luojiaquan <1583622118@qq.com> Date: Tue, 15 Sep 2026 18:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E8=AE=B0=E6=94=B6=E6=AC=BE=E9=99=84?= =?UTF-8?q?=E4=BB=B6bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customerinfo/domain/BmsCustomerAttachment.java | 13 +++++++++++-- .../customerinfo/mapper/BmsCustomerMapper.java | 8 ++++++++ .../service/impl/BmsCustomerServiceImpl.java | 6 ++++-- .../service/impl/CustomerMoneyServiceImpl.java | 5 +++-- .../mapper/customer/BmsCustomerMapper.xml | 14 +++++++++++++- .../customerinfo/customeredit/index.vue | 6 +++--- .../customerinfo/customermoney/index.vue | 11 ++++++++--- 7 files changed, 50 insertions(+), 13 deletions(-) diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/domain/BmsCustomerAttachment.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/domain/BmsCustomerAttachment.java index e92dfe1e..85824455 100644 --- a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/domain/BmsCustomerAttachment.java +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/domain/BmsCustomerAttachment.java @@ -19,12 +19,21 @@ public class BmsCustomerAttachment extends BaseEntity { private static final long serialVersionUID = 1L; + /** 业务模块:客户档案附件 */ + public static final String BIZ_TYPE_CUSTOMER = "customer"; + + /** 业务模块:客户收款水单 */ + public static final String BIZ_TYPE_CUSTOMER_RECEIPT = "customer_receipt"; + /** 附件ID */ private Long attachmentId; /** 所属客户ID */ private Long customerId; + /** 业务模块(customer客户档案附件 / customer_receipt客户收款水单),为空按客户档案处理 */ + private String bizType; + /** 文件原始名称 */ @Excel(name = "文件名称") private String fileName; @@ -43,11 +52,11 @@ public class BmsCustomerAttachment extends BaseEntity @Excel(name = "文件扩展名") private String fileExtension; - /** 附件类型(0附件资料 1客户Logo 2合同文件 3其他) */ + /** 附件类型(文件分类:0附件资料 1客户Logo 2合同文件 3其他) */ @Excel(name = "附件类型", readConverterExp = "0=附件资料,1=客户Logo,2=合同文件,3=其他") private String attachmentType; - /** 关联业务ID(如收款单ID,attachment_type=3 时使用) */ + /** 关联业务ID(业务模块内的单据ID,如收款单ID) */ private Long bizId; /** 是否Logo(0否 1是) */ diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/mapper/BmsCustomerMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/mapper/BmsCustomerMapper.java index c9165731..9815bfd0 100644 --- a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/mapper/BmsCustomerMapper.java +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/mapper/BmsCustomerMapper.java @@ -95,6 +95,14 @@ public interface BmsCustomerMapper */ public int deleteBmsCustomerAttachmentByCustomerId(Long customerId); + /** + * 按客户ID删除客户档案模块的附件(保留收款水单等其他业务模块附件) + * + * @param customerId 客户主键 + * @return 结果 + */ + public int deleteBmsCustomerProfileAttachmentByCustomerId(Long customerId); + /** * 批量删除客户附件 * diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/service/impl/BmsCustomerServiceImpl.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/service/impl/BmsCustomerServiceImpl.java index c6456d50..5bf4ebdc 100644 --- a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/service/impl/BmsCustomerServiceImpl.java +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customerinfo/service/impl/BmsCustomerServiceImpl.java @@ -41,6 +41,7 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService { BmsCustomerAttachment query = new BmsCustomerAttachment(); query.setCustomerId(customerId); + query.setBizType(BmsCustomerAttachment.BIZ_TYPE_CUSTOMER); bmsCustomer.setAttachmentList(bmsCustomerMapper.selectBmsCustomerAttachmentList(query)); BmsCustomerCompany companyQuery = new BmsCustomerCompany(); companyQuery.setCustomerId(customerId); @@ -84,6 +85,7 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService for (BmsCustomerAttachment item : attachmentList) { item.setCustomerId(customerId); + item.setBizType(BmsCustomerAttachment.BIZ_TYPE_CUSTOMER); if (item.getDelFlag() == null) { item.setDelFlag("0"); @@ -241,8 +243,8 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService SysUser user = SecurityUtils.getLoginUser().getUser(); bmsCustomer.setUpdateTime(DateUtils.getNowDate()); bmsCustomer.setUpdateBy(user.getUserName()); - // 先逻辑删除原有附件,再按新列表重建(简化全量替换) - bmsCustomerMapper.deleteBmsCustomerAttachmentByCustomerId(bmsCustomer.getCustomerId()); + // 仅重建客户档案模块的附件,收款水单等其他业务模块的附件保留不动 + bmsCustomerMapper.deleteBmsCustomerProfileAttachmentByCustomerId(bmsCustomer.getCustomerId()); if (bmsCustomer.getAttachmentList() != null) { for (BmsCustomerAttachment item : bmsCustomer.getAttachmentList()) diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/service/impl/CustomerMoneyServiceImpl.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/service/impl/CustomerMoneyServiceImpl.java index f461a19c..3889c536 100644 --- a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/service/impl/CustomerMoneyServiceImpl.java +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/service/impl/CustomerMoneyServiceImpl.java @@ -68,6 +68,7 @@ public class CustomerMoneyServiceImpl implements ICustomerMoneyService if (receipt != null) { BmsCustomerAttachment query = new BmsCustomerAttachment(); + query.setBizType(BmsCustomerAttachment.BIZ_TYPE_CUSTOMER_RECEIPT); query.setBizId(id); receipt.setAttachmentList(bmsCustomerMapper.selectBmsCustomerAttachmentList(query)); } @@ -134,7 +135,7 @@ public class CustomerMoneyServiceImpl implements ICustomerMoneyService receipt.setVersion(0); customerMoneyMapper.insertReceipt(receipt); - // 收款附件:复用客户附件表,类型挂"其他(3)",biz_id 关联收款单 + // 收款附件:复用客户附件表,业务模块挂 customer_receipt,biz_id 关联收款单 saveReceiptAttachments(receipt); return 1; } @@ -274,7 +275,7 @@ public class CustomerMoneyServiceImpl implements ICustomerMoneyService attachment.setAttachmentId(null); attachment.setCustomerId(receipt.getCustomerId()); attachment.setBizId(receipt.getId()); - attachment.setAttachmentType("3"); + attachment.setBizType(BmsCustomerAttachment.BIZ_TYPE_CUSTOMER_RECEIPT); if (!StringUtils.hasText(attachment.getIsLogo())) { attachment.setIsLogo("0"); diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/customer/BmsCustomerMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/customer/BmsCustomerMapper.xml index 619d2f71..f5009886 100644 --- a/bms-back/ruoyi-system/src/main/resources/mapper/customer/BmsCustomerMapper.xml +++ b/bms-back/ruoyi-system/src/main/resources/mapper/customer/BmsCustomerMapper.xml @@ -92,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -110,13 +111,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select attachment_id, customer_id, file_name, file_path, file_size, file_type, file_extension, attachment_type, biz_id, is_logo, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from bms_customer_attachment + select attachment_id, customer_id, biz_type, file_name, file_path, file_size, file_type, file_extension, attachment_type, biz_id, is_logo, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from bms_customer_attachment