bugfix:对账完成

This commit is contained in:
Yuan
2025-12-07 11:46:49 +08:00
parent 3f931c2e29
commit 66620d51ae
23 changed files with 664 additions and 124 deletions

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.saye.hospitalgd.mapper.FinancialReconciliation.TenpaySummaryMapper">
<select id="findTenpayBankSummary" parameterType="HashMap" resultType="HashMap">
SELECT '微信支付' AS PAY_NAME,
COUNT(1) AS CNT,
CAST(IFNULL(SUM(CAST(C_JYJE AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
FROM bankbill_history
<where>
<if test="startTime != null and startTime != ''">
AND C_JYRQ &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND C_JYRQ &lt;= #{endTime}
</if>
AND bill_table_name = '微信支付账单'
AND C_JYLX = '1'
</where>
UNION ALL
SELECT '支付宝支付' AS PAY_NAME,
0 AS CNT,
CAST(0 AS DECIMAL(19,2)) AS AMT
UNION ALL
SELECT '刷卡支付' AS PAY_NAME,
0 AS CNT,
CAST(0 AS DECIMAL(19,2)) AS AMT
UNION ALL
SELECT '退款' AS PAY_NAME,
COUNT(1) AS CNT,
CAST(IFNULL(SUM(CAST(C_JYJE AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
FROM bankbill_history
<where>
<if test="startTime != null and startTime != ''">
AND C_JYRQ &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND C_JYRQ &lt;= #{endTime}
</if>
AND bill_table_name = '微信支付账单'
AND C_JYLX = '2'
</where>
UNION ALL
SELECT '合计' AS PAY_NAME,
COUNT(1) AS CNT,
CAST(IFNULL(SUM(CAST(C_JYJE AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
FROM bankbill_history
<where>
<if test="startTime != null and startTime != ''">
AND C_JYRQ &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND C_JYRQ &lt;= #{endTime}
</if>
AND bill_table_name = '微信支付账单'
AND C_JYLX IN ('1','2')
</where>
</select>
<select id="findTenpayHisSummary" parameterType="HashMap" resultType="HashMap">
SELECT '微信支付' AS PAY_NAME,
COUNT(1) AS CNT,
CAST(IFNULL(SUM(CAST(Amount AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
FROM hisbill_history
<where>
<if test="startTime != null and startTime != ''">
AND trade_date &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND trade_date &lt;= #{endTime}
</if>
AND LOWER(HisOperCode) = 'wx'
AND TradingStatus = '1'
</where>
UNION ALL
SELECT '支付宝支付' AS PAY_NAME,
0 AS CNT,
CAST(0 AS DECIMAL(19,2)) AS AMT
UNION ALL
SELECT '刷卡支付' AS PAY_NAME,
0 AS CNT,
CAST(0 AS DECIMAL(19,2)) AS AMT
UNION ALL
SELECT '退款' AS PAY_NAME,
COUNT(1) AS CNT,
CAST(IFNULL(SUM(CAST(Amount AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
FROM hisbill_history
<where>
<if test="startTime != null and startTime != ''">
AND trade_date &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND trade_date &lt;= #{endTime}
</if>
AND LOWER(HisOperCode) = 'wx'
AND TradingStatus = '2'
</where>
UNION ALL
SELECT '合计' AS PAY_NAME,
COUNT(1) AS CNT,
CAST(IFNULL(SUM(CAST(Amount AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
FROM hisbill_history
<where>
<if test="startTime != null and startTime != ''">
AND trade_date &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND trade_date &lt;= #{endTime}
</if>
AND LOWER(HisOperCode) = 'wx'
AND TradingStatus IN ('1','2')
</where>
</select>
</mapper>