登记收款附件bug修改

This commit is contained in:
luojiaquan
2026-09-15 18:06:40 +08:00
parent 73e425b12f
commit 662a09bf16
7 changed files with 50 additions and 13 deletions
@@ -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是) */
@@ -95,6 +95,14 @@ public interface BmsCustomerMapper
*/
public int deleteBmsCustomerAttachmentByCustomerId(Long customerId);
/**
* 按客户ID删除客户档案模块的附件(保留收款水单等其他业务模块附件)
*
* @param customerId 客户主键
* @return 结果
*/
public int deleteBmsCustomerProfileAttachmentByCustomerId(Long customerId);
/**
* 批量删除客户附件
*
@@ -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())
@@ -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");
@@ -92,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.ruoyi.customer.customerinfo.domain.BmsCustomerAttachment" id="BmsCustomerAttachmentResult">
<result property="attachmentId" column="attachment_id" />
<result property="customerId" column="customer_id" />
<result property="bizType" column="biz_type" />
<result property="fileName" column="file_name" />
<result property="filePath" column="file_path" />
<result property="fileSize" column="file_size" />
@@ -110,13 +111,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBmsCustomerAttachmentVo">
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
</sql>
<select id="selectBmsCustomerAttachmentList" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerAttachment" resultMap="BmsCustomerAttachmentResult">
<include refid="selectBmsCustomerAttachmentVo"/>
<where>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="bizType != null and bizType != ''"> and ifnull(nullif(biz_type, ''), 'customer') = #{bizType}</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="attachmentType != null and attachmentType != ''"> and attachment_type = #{attachmentType}</if>
<if test="bizId != null"> and biz_id = #{bizId}</if>
@@ -130,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into bms_customer_attachment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="bizType != null">biz_type,</if>
<if test="fileName != null">file_name,</if>
<if test="filePath != null">file_path,</if>
<if test="fileSize != null">file_size,</if>
@@ -146,6 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
<if test="bizType != null">#{bizType},</if>
<if test="fileName != null">#{fileName},</if>
<if test="filePath != null">#{filePath},</if>
<if test="fileSize != null">#{fileSize},</if>
@@ -166,6 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update bms_customer_attachment
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="fileName != null">file_name = #{fileName},</if>
<if test="filePath != null">file_path = #{filePath},</if>
<if test="fileSize != null">file_size = #{fileSize},</if>
@@ -186,6 +191,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update bms_customer_attachment set del_flag = '2' where customer_id = #{customerId}
</delete>
<!-- 仅逻辑删除客户档案模块的附件,保留收款水单等其他业务模块的附件 -->
<update id="deleteBmsCustomerProfileAttachmentByCustomerId" parameterType="Long">
update bms_customer_attachment set del_flag = '2'
where customer_id = #{customerId}
and (biz_type = 'customer' or biz_type is null or biz_type = '')
</update>
<delete id="deleteBmsCustomerAttachmentByAttachmentIds" parameterType="String">
update bms_customer_attachment set del_flag = '2' where attachment_id in
<foreach item="attachmentId" collection="attachmentIds" open="(" separator="," close=")">