bugfix:对账对平

This commit is contained in:
Yuan
2025-12-10 19:07:51 +08:00
parent 66620d51ae
commit f084043a4b
6 changed files with 176 additions and 145 deletions

View File

@@ -73,7 +73,7 @@
and C_ZFFS = #{c_zffs}
</if>
<if test="likeFiled!=null and likeFiled!=''">
and C_YSDDH like concat('%',concat(#{likeFiled},'%'))
and C_SHDDH like concat('%',concat(#{likeFiled},'%'))
</if>
and C_SHDDH in (
select C_SHDDH
@@ -280,7 +280,7 @@
and C_ZFFS = #{c_zffs}
</if>
<if test="likeFiled!=null and likeFiled!=''">
and C_YSDDH like concat('%',concat(#{likeFiled},'%'))
and C_SHDDH like concat('%',concat(#{likeFiled},'%'))
</if>
</where>
</select>

View File

@@ -41,6 +41,7 @@
from bankbill_history
where C_JYRQ = #{trade_date}
and (is_inpatient is null or is_inpatient = '0') <!-- 排除住院订单(终端号10091548和10091549) -->
and (bill_table_name is null or bill_table_name != '微信医保账单') <!-- 排除微信医保账单 -->
</select>
<insert id="saveOriginalData" parameterType="java.util.List">
insert into bankbills_original (

View File

@@ -14,7 +14,7 @@
<if test="endTime != null and endTime != ''">
AND C_JYRQ &lt;= #{endTime}
</if>
AND bill_table_name = '微信支付账单'
AND bill_table_name in ('微信支付账单','微信医保账单')
AND C_JYLX = '1'
</where>
UNION ALL
@@ -37,7 +37,7 @@
<if test="endTime != null and endTime != ''">
AND C_JYRQ &lt;= #{endTime}
</if>
AND bill_table_name = '微信支付账单'
AND bill_table_name in ('微信支付账单','微信医保账单')
AND C_JYLX = '2'
</where>
UNION ALL
@@ -52,7 +52,7 @@
<if test="endTime != null and endTime != ''">
AND C_JYRQ &lt;= #{endTime}
</if>
AND bill_table_name = '微信支付账单'
AND bill_table_name in ('微信支付账单','微信医保账单')
AND C_JYLX IN ('1','2')
</where>
</select>

View File

@@ -82,6 +82,7 @@
and b.C_JYRQ &lt;= #{endTime}
and a.PayMethod != '2' -- 排除不参与对账的记录
and (b.is_inpatient is null or b.is_inpatient = '0') -- 排除住院订单
and (b.bill_table_name is null or b.bill_table_name != '微信医保账单') -- 排除微信医保账单
<if test="prepayment_code != null and prepayment_code != ''">
and a.PayType != #{prepayment_code}
</if>
@@ -139,7 +140,7 @@
</if>
) a
inner join
(select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0')) b -- 排除住院订单
(select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0') and (bill_table_name is null or bill_table_name != '微信医保账单')) b -- 排除住院订单与微信医保账单
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) = ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
</insert>
@@ -185,7 +186,7 @@
</if>
) a
left join
(select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0')) b -- 排除住院订单
(select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0') and (bill_table_name is null or bill_table_name != '微信医保账单')) b -- 排除住院订单与微信医保账单
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) = ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
where b.C_SHDDH is null
</insert>
@@ -236,11 +237,13 @@
select * from bankbill_history
where C_JYRQ = #{trade_date}
and (is_inpatient is null or is_inpatient = '0')
and (bill_table_name is null or bill_table_name != '微信医保账单')
and C_SHDDH in (
select C_SHDDH
from bankbill_history
where C_JYRQ = #{trade_date}
and (is_inpatient is null or is_inpatient = '0')
and (bill_table_name is null or bill_table_name != '微信医保账单')
group by C_SHDDH
having ROUND(SUM(CAST(C_JYJE AS DECIMAL(18,2))), 2) != 0
)