“收款入账”和“账单核销”分开处理

This commit is contained in:
caojia
2026-10-28 20:13:20 +08:00
parent 00a690abe9
commit df7220d333
14 changed files with 64 additions and 669 deletions
@@ -385,6 +385,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="confirmReceipt" parameterType="com.bms.customer.customermoney.domain.CustomerReceipt">
update ctr_customer_receipt
set status = 'CONFIRMED',
allocated_amount = #{allocatedAmount},
unallocated_amount = #{unallocatedAmount},
confirmed_at = #{confirmedAt},
confirmed_by = #{confirmedBy},
version = version + 1,
@@ -395,13 +397,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="cancelReceipt">
update ctr_customer_receipt
set status = 'CANCELLED',
update_by = #{updateBy},
update_time = now()
set status = 'CANCELLED',
allocated_amount = 0.00,
unallocated_amount = ifnull(base_amount, amount),
update_by = #{updateBy},
update_time = now()
where id = #{id} and status = 'PENDING' and del_flag = '0'
</update>
<!-- 反核销联动:仅回写分配口径金额与收款类型,客户余额/额度不在此变动 -->
<!-- 兼容历史反核销联动:回写分配口径金额与收款类型,客户余额/额度不在此变动 -->
<update id="updateReceiptAllocation" parameterType="com.bms.customer.customermoney.domain.CustomerReceipt">
update ctr_customer_receipt
set allocated_amount = #{allocatedAmount},
@@ -39,32 +39,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ar_bill b on b.ar_bill_id = p.ar_bill_id
</sql>
<insert id="insertPlan" parameterType="com.bms.customer.customermoney.domain.ReceiptWriteoffPlan"
useGeneratedKeys="true" keyProperty="planId">
insert into ctr_receipt_writeoff_plan (
receipt_id, ar_bill_id, bill_no, customer_id, currency, writeoff_amount,
status, writeoff_id, remark, create_by, create_time, del_flag
) values (
#{receiptId}, #{arBillId}, #{billNo}, #{customerId}, #{currency}, #{writeoffAmount},
#{status}, #{writeoffId}, #{remark}, #{createBy}, sysdate(), '0'
)
</insert>
<select id="selectByReceiptId" resultMap="ReceiptWriteoffPlanResult">
<include refid="selectColumns"/>
where p.receipt_id = #{receiptId} and p.del_flag = '0'
order by p.plan_id asc
</select>
<update id="updateEffective">
update ctr_receipt_writeoff_plan
set status = 'EFFECTIVE',
writeoff_id = #{writeoffId},
update_by = #{updateBy},
update_time = sysdate()
where plan_id = #{planId} and status = 'PENDING' and del_flag = '0'
</update>
<update id="cancelPendingByReceiptId">
update ctr_receipt_writeoff_plan
set status = 'CANCELLED',