From 6c0232838719873a5acb73876f943096b3ccddbd Mon Sep 17 00:00:00 2001 From: dimengzhe Date: Tue, 22 Apr 2025 10:10:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LoanRestoreReportApplyMapper.xml | 76 +++++++++++++++---- 1 file changed, 62 insertions(+), 14 deletions(-) diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrestorereportapply/LoanRestoreReportApplyMapper.xml b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrestorereportapply/LoanRestoreReportApplyMapper.xml index 3108e8b0cc..76feaebc0c 100644 --- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrestorereportapply/LoanRestoreReportApplyMapper.xml +++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrestorereportapply/LoanRestoreReportApplyMapper.xml @@ -266,13 +266,37 @@ GROUP BY saleVehSid ) lbpv_sum ON lbpv_sum.saleVehSid = ss.busVinSid LEFT JOIN ( - SELECT - lrpd.busVinSid, - SUM(lfd.fund) AS fund_sum - FROM loan_fund_day lfd - JOIN loan_repayment_plan_details lrpd ON lrpd.sid = lfd.busSid - WHERE lrpd.dueDate <= lrpd.updateTime - GROUP BY lrpd.busVinSid + SELECT + a.busVinSid, + sum( a.fund ) AS fund_sum + FROM + ( + SELECT + ( fjj.reveivableMoney - fjj.m ) AS fund, + lp.busVinSid + FROM + ( + SELECT + IFNULL(( + SELECT + SUM( subscriptionMoney ) + FROM + anrui_fin.fin_selected_receivables_detailed AS s + WHERE + s.auditState = '3' + AND s.receivablesSid = fj.sid + ), + 0 + ) AS m, + fj.* + FROM + ( SELECT j.busSid, j.sid, j.reveivableMoney FROM anrui_fin.fin_uncollected_receivables_detailed_jr AS j WHERE j.payCostTitleKey = '006' ) AS fj + ) AS fjj + LEFT JOIN loan_repayment_plan_details lp ON lp.sid = fjj.busSid + where lp.dueDate <= lp.updateTime + GROUP BY + lp.busVinSid + ) a ) lfd_sum ON lfd_sum.busVinSid = ss.busVinSid GROUP BY ss.busVinSid @@ -309,13 +333,37 @@ GROUP BY saleVehSid ) lbpv_sum ON lbpv_sum.saleVehSid = ss.busVinSid LEFT JOIN ( - SELECT - lrpd.busVinSid, - SUM(lfd.fund) AS fund_sum - FROM loan_fund_day lfd - JOIN loan_repayment_plan_details lrpd ON lrpd.sid = lfd.busSid - WHERE lrpd.dueDate <= lrpd.updateTime - GROUP BY lrpd.busVinSid + SELECT + a.busVinSid, + sum( a.fund ) AS fund_sum + FROM + ( + SELECT + ( fjj.reveivableMoney - fjj.m ) AS fund, + lp.busVinSid + FROM + ( + SELECT + IFNULL(( + SELECT + SUM( subscriptionMoney ) + FROM + anrui_fin.fin_selected_receivables_detailed AS s + WHERE + s.auditState = '3' + AND s.receivablesSid = fj.sid + ), + 0 + ) AS m, + fj.* + FROM + ( SELECT j.busSid, j.sid, j.reveivableMoney FROM anrui_fin.fin_uncollected_receivables_detailed_jr AS j WHERE j.payCostTitleKey = '006' ) AS fj + ) AS fjj + LEFT JOIN loan_repayment_plan_details lp ON lp.sid = fjj.busSid + where lp.dueDate <= lp.updateTime + GROUP BY + lp.busVinSid + ) a ) lfd_sum ON lfd_sum.busVinSid = ss.busVinSid GROUP BY ss.busVinSid