From 849648e82e5dec96f9f30fcc9c9bd799268b1f4c Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期四, 09 四月 2026 10:40:44 +0800
Subject: [PATCH] 新增资金流水导入
---
service/src/main/resources/mapper/cwgl/ReceivableBillManagementMapper.xml | 44 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/service/src/main/resources/mapper/cwgl/ReceivableBillManagementMapper.xml b/service/src/main/resources/mapper/cwgl/ReceivableBillManagementMapper.xml
index 284a11c..ce7eb8a 100644
--- a/service/src/main/resources/mapper/cwgl/ReceivableBillManagementMapper.xml
+++ b/service/src/main/resources/mapper/cwgl/ReceivableBillManagementMapper.xml
@@ -40,6 +40,8 @@
<result property="accountRemark" column="account_remark" />
<result property="overdueInterest" column="overdue_interest" />
<result property="status" column="status" />
+ <result property="auditStatus" column="audit_status" />
+ <result property="sourceSystemId" column="source_system_id" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@@ -82,7 +84,7 @@
</resultMap>
<sql id="selectReceivableBillManagementVo">
- select thisTab.id, thisTab.system_no, thisTab.bill_name, thisTab.customer_name, thisTab.payee, thisTab.responsible_person, thisTab.responsible_leader, thisTab.settlement_method, thisTab.business_type, thisTab.promotion_requirement, thisTab.is_internal_settlement, thisTab.internal_settlement_unit, thisTab.document_count, thisTab.total_amount, thisTab.currency, thisTab.discount_amount, thisTab.received_amount, thisTab.pending_amount, thisTab.exchange_rate, thisTab.cny_amount, thisTab.period_type, thisTab.business_start_date, thisTab.business_end_date, thisTab.billing_start_date, thisTab.billing_end_date, thisTab.bill_generate_date, thisTab.bill_send_date, thisTab.bill_due_date, thisTab.due_in_30_days, thisTab.overdue_amount, thisTab.overdue_1_to_30_days, thisTab.overdue_31_to_60_days, thisTab.overdue_61_to_90_days, thisTab.overdue_91_to_180_days, thisTab.overdue_181_to_365_days, thisTab.overdue_over_1_year, thisTab.overdue_days, thisTab.settlement_category, thisTab.settlement_period, thisTab.nc_settlement_date, thisTab.nc_settlement_amount, thisTab.account_remark, thisTab.overdue_interest, thisTab.status, thisTab.remark, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.deleted from receivable_bill_management AS thisTab
+ select thisTab.id, thisTab.system_no, thisTab.bill_name, thisTab.customer_name, thisTab.payee, thisTab.responsible_person, thisTab.responsible_leader, thisTab.settlement_method, thisTab.business_type, thisTab.promotion_requirement, thisTab.is_internal_settlement, thisTab.internal_settlement_unit, thisTab.document_count, thisTab.total_amount, thisTab.currency, thisTab.discount_amount, thisTab.received_amount, thisTab.pending_amount, thisTab.exchange_rate, thisTab.cny_amount, thisTab.period_type, thisTab.business_start_date, thisTab.business_end_date, thisTab.billing_start_date, thisTab.billing_end_date, thisTab.bill_generate_date, thisTab.bill_send_date, thisTab.bill_due_date, thisTab.due_in_30_days, thisTab.overdue_amount, thisTab.overdue_1_to_30_days, thisTab.overdue_31_to_60_days, thisTab.overdue_61_to_90_days, thisTab.overdue_91_to_180_days, thisTab.overdue_181_to_365_days, thisTab.overdue_over_1_year, thisTab.overdue_days, thisTab.settlement_category, thisTab.settlement_period, thisTab.nc_settlement_date, thisTab.nc_settlement_amount, thisTab.account_remark, thisTab.overdue_interest, thisTab.status, thisTab.audit_status, thisTab.source_system_id, thisTab.remark, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.deleted from receivable_bill_management AS thisTab
</sql>
<sql id="selectReceivableBillManagementVoCount">
select count(0) from receivable_bill_management as thisTab
@@ -199,6 +201,8 @@
<if test="accountRemark != null and accountRemark != ''">account_remark,</if>
<if test="overdueInterest != null">overdue_interest,</if>
<if test="status != null">status,</if>
+ <if test="auditStatus != null">audit_status,</if>
+ <if test="sourceSystemId != null">source_system_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@@ -241,6 +245,8 @@
<if test="accountRemark != null and accountRemark != ''">#{accountRemark},</if>
<if test="overdueInterest != null">#{overdueInterest},</if>
<if test="status != null">#{status},</if>
+ <if test="auditStatus != null">#{auditStatus},</if>
+ <if test="sourceSystemId != null">#{sourceSystemId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@@ -253,11 +259,11 @@
<insert id="insertReceivableBillManagementBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert into receivable_bill_management
<trim prefix="(" suffix=") values" suffixOverrides=",">
- system_no,bill_name,customer_name,payee,responsible_person,responsible_leader,settlement_method,business_type,promotion_requirement,is_internal_settlement,internal_settlement_unit,document_count,total_amount,currency,discount_amount,received_amount,pending_amount,exchange_rate,cny_amount,period_type,business_start_date,business_end_date,billing_start_date,billing_end_date,bill_generate_date,bill_send_date,bill_due_date,settlement_category,settlement_period,nc_settlement_date,nc_settlement_amount,account_remark,overdue_interest,status,remark,create_by,create_time,update_by,update_time,deleted,
+ system_no,bill_name,customer_name,payee,responsible_person,responsible_leader,settlement_method,business_type,promotion_requirement,is_internal_settlement,internal_settlement_unit,document_count,total_amount,currency,discount_amount,received_amount,pending_amount,exchange_rate,cny_amount,period_type,business_start_date,business_end_date,billing_start_date,billing_end_date,bill_generate_date,bill_send_date,bill_due_date,settlement_category,settlement_period,nc_settlement_date,nc_settlement_amount,account_remark,overdue_interest,status,audit_status,source_system_id,remark,create_by,create_time,update_by,update_time,deleted,
</trim>
<foreach item="item" index="index" collection="list" separator=",">
<trim prefix="(" suffix=") " suffixOverrides=",">
- #{item.systemNo},#{item.billName},#{item.customerName},#{item.payee},#{item.responsiblePerson},#{item.responsibleLeader},#{item.settlementMethod},#{item.businessType},#{item.promotionRequirement},#{item.isInternalSettlement},#{item.internalSettlementUnit},#{item.documentCount},#{item.totalAmount},#{item.currency},#{item.discountAmount},#{item.receivedAmount},#{item.pendingAmount},#{item.exchangeRate},#{item.cnyAmount},#{item.periodType},#{item.businessStartDate},#{item.businessEndDate},#{item.billingStartDate},#{item.billingEndDate},#{item.billGenerateDate},#{item.billSendDate},#{item.billDueDate},#{item.settlementCategory},#{item.settlementPeriod},#{item.ncSettlementDate},#{item.ncSettlementAmount},#{item.accountRemark},#{item.overdueInterest},#{item.status},#{item.remark},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.deleted},
+ #{item.systemNo},#{item.billName},#{item.customerName},#{item.payee},#{item.responsiblePerson},#{item.responsibleLeader},#{item.settlementMethod},#{item.businessType},#{item.promotionRequirement},#{item.isInternalSettlement},#{item.internalSettlementUnit},#{item.documentCount},#{item.totalAmount},#{item.currency},#{item.discountAmount},#{item.receivedAmount},#{item.pendingAmount},#{item.exchangeRate},#{item.cnyAmount},#{item.periodType},#{item.businessStartDate},#{item.businessEndDate},#{item.billingStartDate},#{item.billingEndDate},#{item.billGenerateDate},#{item.billSendDate},#{item.billDueDate},#{item.settlementCategory},#{item.settlementPeriod},#{item.ncSettlementDate},#{item.ncSettlementAmount},#{item.accountRemark},#{item.overdueInterest},#{item.status},#{item.auditStatus},#{item.sourceSystemId},#{item.remark},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.deleted},
</trim>
</foreach>
</insert>
@@ -300,6 +306,8 @@
<if test="accountRemark != null and accountRemark != ''">account_remark = #{accountRemark},</if>
<if test="overdueInterest != null">overdue_interest = #{overdueInterest},</if>
<if test="status != null">status = #{status},</if>
+ <if test="auditStatus != null">audit_status = #{auditStatus},</if>
+ <if test="sourceSystemId != null">source_system_id = #{sourceSystemId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
@@ -348,6 +356,8 @@
<if test="item.accountRemark != null and item.accountRemark != ''">account_remark = #{item.accountRemark},</if>
<if test="item.overdueInterest != null">overdue_interest = #{item.overdueInterest},</if>
<if test="item.status != null">status = #{item.status},</if>
+ <if test="item.auditStatus != null">audit_status = #{item.auditStatus},</if>
+ <if test="item.sourceSystemId != null">source_system_id = #{item.sourceSystemId},</if>
<if test="item.remark != null">remark = #{item.remark},</if>
<if test="item.createBy != null">create_by = #{item.createBy},</if>
<if test="item.createTime != null">create_time = #{item.createTime},</if>
@@ -388,7 +398,33 @@
<!-- 鏌ヨ搴旀敹璐﹀崟璐﹂緞鍒嗘瀽鍒楄〃 -->
<select id="selectReceivableBillAgingAnalysisList" parameterType="com.ruoyi.cwgl.domain.ReceivableBillManagement" resultMap="ReceivableBillAgingAnalysisVoResult">
- <include refid="selectReceivableBillManagementVo"/>
+ SELECT
+ thisTab.*,
+ rib_latest.latest_invoice_time as latestInvoiceTime,
+ COALESCE(rib_total.total_invoice_amount, 0) as totalInvoiceAmount,
+ CASE
+ WHEN thisTab.pending_amount > COALESCE(rib_total.total_invoice_amount, 0)
+ THEN thisTab.pending_amount - COALESCE(rib_total.total_invoice_amount, 0)
+ ELSE 0
+ END as unInvoicedAmount
+ FROM receivable_bill_management thisTab
+
+ -- 鑾峰彇鏈�鏂板紑绁ㄦ棩鏈�
+ LEFT JOIN (
+ SELECT head_id, MAX(invoice_time) as latest_invoice_time
+ FROM receivable_invoice_business
+ WHERE status = 1
+ GROUP BY head_id
+ ) rib_latest ON thisTab.id = rib_latest.head_id
+
+ -- 鑾峰彇寮�绁ㄦ�婚噾棰�
+ LEFT JOIN (
+ SELECT head_id, SUM(invoicing_amount) as total_invoice_amount
+ FROM receivable_invoice_business
+ WHERE status = 1
+ GROUP BY head_id
+ ) rib_total ON thisTab.id = rib_total.head_id
+
<where>
<if test="systemNo != null and systemNo != ''"> and thisTab.system_no = #{systemNo}</if>
<if test="customerName != null and customerName != ''"> and thisTab.customer_name like concat('%', #{customerName}, '%')</if>
--
Gitblit v1.8.0