diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbeoverdueveh/LoanBeOverdueVehMapper.xml b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbeoverdueveh/LoanBeOverdueVehMapper.xml index 71f0cd4f26..1e165a6800 100644 --- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbeoverdueveh/LoanBeOverdueVehMapper.xml +++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbeoverdueveh/LoanBeOverdueVehMapper.xml @@ -102,13 +102,36 @@ ) lbpv_sum ON lbpv_sum.saleVehSid = a1.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 + 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 = a1.busVinSid ${ew.sqlSegment}