fix(finance): include billed sources in trip financial attribution

This commit is contained in:
2026-10-05 12:35:38 +08:00
parent f13d340620
commit adaac7aca4
3 changed files with 33 additions and 4 deletions
@@ -28,7 +28,7 @@ public class TripFinanceQueryService {
SELECT f.id,f.customer_id,f.business_no,f.source_no,f.fee_item_name,f.source_fee_version,f.currency_code,f.amount,f.status
FROM fin_fee_source f WHERE f.source_system='LASTLEG' AND f.business_type='DELIVERY_ORDER'
AND f.source_type='OVERSEAS_DELIVERY_FEE' AND f.direction='RECEIVABLE'
AND f.review_status='APPROVED' AND f.status IN ('AVAILABLE','SETTLED')
AND f.review_status='APPROVED' AND f.status IN ('AVAILABLE','BILLED','SETTLED')
AND NOT EXISTS (SELECT 1 FROM fin_fee_source newer WHERE newer.source_system=f.source_system
AND newer.source_type=f.source_type AND newer.source_fee_id=f.source_fee_id
AND newer.source_fee_version>f.source_fee_version)