生成账单费用合并;

This commit is contained in:
王奎兴
2026-03-16 18:29:33 +08:00
parent 0d61ae880b
commit 9dafdfc051
27 changed files with 254 additions and 47 deletions
@@ -8,70 +8,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryList" parameterType="com.mhd.bms.domain.billManage.repository.todo.BillManageDO" resultType="com.mhd.bms.domain.billManage.repository.po.BillManagePO">
select
*
from bill_manage
where del_flag = 1
a.*,b.SETTLEMENT_ENTITY_ID as settlementEntityId
from bill_manage a LEFT JOIN SETTLEMENT_CUSTOMERS b on a.SETTLEMENT_CUSTOMERS_ID = b.SETTLEMENT_CUSTOMERS_ID
where a.del_flag = 1
<include refid="common_where"/>
ORDER BY create_time DESC
ORDER BY a.create_time DESC
</select>
<sql id="common_where">
<if test="billManageDO.createTimeStart != null and billManageDO.createTimeStart != ''">
AND date_format(create_time,'%Y-%m-%d') <![CDATA[>=]]> #{billManageDO.createTimeStart}
AND date_format(a.create_time,'%Y-%m-%d') <![CDATA[>=]]> #{billManageDO.createTimeStart}
</if>
<if test="billManageDO.createTimeEnd != null and billManageDO.createTimeEnd != ''">
AND date_format(create_time,'%Y-%m-%d') <![CDATA[<=]]> #{billManageDO.createTimeEnd}
AND date_format(a.create_time,'%Y-%m-%d') <![CDATA[<=]]> #{billManageDO.createTimeEnd}
</if>
<if test="billManageDO.createByName != null and billManageDO.createByName != ''">
AND create_by_name like concat('%', #{billManageDO.createByName}, '%')
AND a.create_by_name like concat('%', #{billManageDO.createByName}, '%')
</if>
<if test="billManageDO.organizationId != null">
AND organization_id = #{billManageDO.organizationId}
AND a.organization_id = #{billManageDO.organizationId}
</if>
<if test="billManageDO.topOrganizationId != null and billManageDO.topOrganizationId != ''">
AND top_organization_id = #{billManageDO.topOrganizationId}
AND a.top_organization_id = #{billManageDO.topOrganizationId}
</if>
<if test="billManageDO.updateTimeStart != null and billManageDO.updateTimeStart != ''">
AND date_format(update_time,'%Y-%m-%d') <![CDATA[>=]]> #{billManageDO.updateTimeStart}
AND date_format(a.update_time,'%Y-%m-%d') <![CDATA[>=]]> #{billManageDO.updateTimeStart}
</if>
<if test="billManageDO.updateTimeEnd != null and billManageDO.updateTimeEnd != ''">
AND date_format(update_time,'%Y-%m-%d') <![CDATA[<=]]> #{billManageDO.updateTimeEnd}
AND date_format(a.update_time,'%Y-%m-%d') <![CDATA[<=]]> #{billManageDO.updateTimeEnd}
</if>
<if test="billManageDO.updateByName != null and billManageDO.updateByName != ''">
AND update_by_name like concat('%', #{billManageDO.updateByName}, '%')
AND a.update_by_name like concat('%', #{billManageDO.updateByName}, '%')
</if>
<if test="billManageDO.billNumber != null and billManageDO.billNumber != ''">
AND bill_number like concat('%', #{billManageDO.billNumber}, '%')
AND a.bill_number like concat('%', #{billManageDO.billNumber}, '%')
</if>
<if test="billManageDO.belongModule != null and billManageDO.belongModule != ''">
AND belong_module like concat('%', #{billManageDO.belongModule}, '%')
AND a.belong_module like concat('%', #{billManageDO.belongModule}, '%')
</if>
<if test="billManageDO.settlementEntity != null and billManageDO.settlementEntity != ''">
AND settlement_entity like concat('%', #{billManageDO.settlementEntity}, '%')
AND a.settlement_entity like concat('%', #{billManageDO.settlementEntity}, '%')
</if>
<if test="billManageDO.billState != null">
AND bill_state = #{billManageDO.billState}
AND a.bill_state = #{billManageDO.billState}
</if>
<if test="billManageDO.isInvoice != null">
AND IS_INVOICE = #{billManageDO.isInvoice}
AND a.IS_INVOICE = #{billManageDO.isInvoice}
</if>
<if test="billManageDO.reconciliationStatus != null">
AND reconciliation_status = #{billManageDO.reconciliationStatus}
AND a.reconciliation_status = #{billManageDO.reconciliationStatus}
</if>
<if test="billManageDO.billType != null">
AND bill_type = #{billManageDO.billType}
AND a.bill_type = #{billManageDO.billType}
</if>
<if test="billManageDO.queryParam != null and billManageDO.queryParam == 1">
AND bill_state <![CDATA[<]]> 5
AND a.bill_state <![CDATA[<]]> 5
</if>
<if test="billManageDO.queryParam != null and billManageDO.queryParam == 2">
AND bill_state = 5
AND a.bill_state = 5
</if>
<if test="billManageDO.queryParam != null and billManageDO.queryParam == 3">
AND bill_state = 6
AND a.bill_state = 6
</if>
<if test="billManageDO.billManageIdSet != null and billManageDO.billManageIdSet.size() > 0">
and bill_manage_id in
and a.bill_manage_id in
<foreach item="id" collection="billManageDO.billManageIdSet" open="(" separator="," close=")">
#{id}
</foreach>
@@ -112,4 +112,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and interface_type = #{interfaceType} limit 1
</select>
<select id="getCustomerUserDept" parameterType="java.lang.String" resultType="java.lang.String">
SELECT DEPARTMENT_ID FROM NGWL_TEST_USER."USER" where DEL_FLAG = '1' and user_id = #{userId} limit 1
</select>
<select id="getDeptValue" parameterType="java.lang.String" resultType="java.lang.String">
SELECT dict_value FROM NGWL_TEST_SYSTEM."SYS_DICT_DATA" where status = '0' and dict_type = 'department' and dict_code = #{dictCode} limit 1
</select>
<select id="getDeptName" parameterType="java.lang.String" resultType="java.lang.String">
SELECT dict_label FROM NGWL_TEST_SYSTEM."SYS_DICT_DATA" where status = '0' and dict_type = 'department' and dict_code = #{dictCode} limit 1
</select>
</mapper>
@@ -78,16 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getDetailsByManageId" resultType="com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO" parameterType="java.lang.Long">
SELECT
a.*,
b.billing_amount AS billingAmount,
b.billing_total_amount,
b.billing_discount_amount
a.BILLING_AMOUNT AS billingAmount
FROM
billing_statement a
LEFT JOIN bill_detail b ON a.billing_statement_id = b.billing_statement_id
LEFT JOIN bill_manage c ON b.bill_manage_id = c.bill_manage_id
WHERE
a.del_flag = 1
AND c.bill_manage_id = #{billManageId}
AND a.bill_manage_id = #{billManageId}
GROUP BY
a.billing_statement_id
</select>
@@ -263,4 +259,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</sql>
</mapper>
</mapper>
@@ -5,7 +5,7 @@
select
<include refid="field_where"></include>
FROM
bms_invoice_list a
bms_invoice_list a left join BILL_MANAGE b on a.apply_number = b.apply_number
where a.is_delete = 0
<include refid="common_where"></include>
@@ -22,6 +22,17 @@
where a.id = #{id} and a.is_delete = 0
group by a.id
</select>
<select id="getByApplyNumber" parameterType="java.lang.String" resultType="com.mhd.bms.domain.bmsInvoiceList.repository.vo.BmsInvoiceListDetailsVO">
select
<include refid="field_where2"></include>
from
bms_invoice_list a
LEFT JOIN bms_invoice_info b
ON a.invoice_title = b.invoice_title
where a.apply_number = #{applyNumber} and a.is_delete = 0
group by a.id
</select>
<sql id="common_where">
<if test="bmsInvoiceListQueryDTO.id !=null and bmsInvoiceListQueryDTO.id != ''"> and a.id = #{bmsInvoiceListQueryDTO.id} </if>
<if test="bmsInvoiceListQueryDTO.id!=null and bmsInvoiceListQueryDTO.id!=''"> and instr(a.id ,#{bmsInvoiceListQueryDTO.id}) > 0 </if>
@@ -124,6 +135,9 @@
a.invoice_code,
a.tracking_number,
a.apply_number,
a.company_name as companyName,
b.bill_number as billNumber,
b.bill_manage_id as billManageId,
a.SETTLEMENT_CURRENCY as settlementCurrency,
a.organization_id AS organizationId,
a.organization_name AS organizationName,
@@ -82,6 +82,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.payment_method_code,
b.payment_method,
b.payment_card_id,
c.main_name as mainName,
c.phone,
c.bank_deposi as bankDeposi,
b.payment_card,
b.transaction_flow,
b.receipt_number,
@@ -95,8 +98,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
receipt_detail a
LEFT JOIN receipt_manage b ON a.receipt_manage_id = b.receipt_manage_id
left join PAYMENT_WALLET c on b.payment_card_id = c.PAYMENT_WALLET_ID
WHERE
a.bill_manage_id = #{billManageId}
</select>
</mapper>
</mapper>