|
|
@ -25,51 +25,51 @@ |
|
|
|
<select id="getPaymentDetailsList" |
|
|
|
resultType="com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.AppFinUncollectedReceivablesDetailedVo"> |
|
|
|
SELECT distinct furd.sid, |
|
|
|
furd.contractNo AS contractId, |
|
|
|
furd.receivablesName AS projectName, |
|
|
|
furd.customerPhone AS mobile, |
|
|
|
furd.customerName AS `name`, |
|
|
|
furd.customerSid, |
|
|
|
furd.useOrgSid, |
|
|
|
cast((furd.`reveivableMoney` - COALESCE(df.dbalance, 0)) AS DECIMAL (10, 2) ) AS receivable, |
|
|
|
furd.contractSid, |
|
|
|
if(bv.linkNo is null or LENGTH(trim(bv.linkNo)) < 1, |
|
|
|
if(furd.payTypeKey = 2, RIGHT(bv.temporaryNo, 2), bv.temporaryNo), |
|
|
|
RIGHT(bv.linkNo, 8)) as vin, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey, |
|
|
|
0 as subscribedOf, |
|
|
|
furd.sid as receivablesSid, |
|
|
|
CURRENT_DATE() as confirmDate, |
|
|
|
furd.purchaseSystemSid |
|
|
|
furd.contractNo AS contractId, |
|
|
|
furd.receivablesName AS projectName, |
|
|
|
furd.customerPhone AS mobile, |
|
|
|
furd.customerName AS `name`, |
|
|
|
furd.customerSid, |
|
|
|
furd.useOrgSid, |
|
|
|
cast((furd.`reveivableMoney` - COALESCE(df.dbalance, 0)) AS DECIMAL (10, 2) ) AS receivable, |
|
|
|
furd.contractSid, |
|
|
|
if(bv.linkNo is null or LENGTH(trim(bv.linkNo)) < 1, |
|
|
|
if(furd.payTypeKey = 2, RIGHT(bv.temporaryNo, 2), bv.temporaryNo), |
|
|
|
RIGHT(bv.linkNo, 8)) as vin, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey, |
|
|
|
0 as subscribedOf, |
|
|
|
furd.sid as receivablesSid, |
|
|
|
CURRENT_DATE() as confirmDate, |
|
|
|
furd.purchaseSystemSid |
|
|
|
FROM fin_uncollected_receivables_detailed furd |
|
|
|
left join anrui_buscenter.bus_sales_order_vehicle bv on bv.sid = furd.busVinSid |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT d.sid, |
|
|
|
d.receivablesSid, |
|
|
|
d.`collSid`, |
|
|
|
cast((sum(d.`subscriptionMoney`) - COALESCE(SUM(f.`thisUseMoney`), 0)) AS DECIMAL (10, 2)) AS dbalance |
|
|
|
FROM fin_selected_receivables_detailed d |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` f ON f.`busSid` = d.`sid` |
|
|
|
where d.auditState = 1 |
|
|
|
or d.auditState = 3 |
|
|
|
GROUP BY d.`receivablesSid` |
|
|
|
left join anrui_buscenter.bus_sales_order_vehicle bv on bv.sid = furd.busVinSid |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT d.sid, |
|
|
|
d.receivablesSid, |
|
|
|
d.`collSid`, |
|
|
|
cast((sum(d.`subscriptionMoney`) - COALESCE(SUM(f.`thisUseMoney`), 0)) AS DECIMAL (10, 2)) AS dbalance |
|
|
|
FROM fin_selected_receivables_detailed d |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` f ON f.`busSid` = d.`sid` |
|
|
|
where d.auditState = 1 |
|
|
|
or d.auditState = 3 |
|
|
|
GROUP BY d.`receivablesSid` |
|
|
|
) df ON df.receivablesSid = furd.`sid` |
|
|
|
<where> |
|
|
|
${ew.sqlSegment} |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
and concat(IFNULL(furd.customerName |
|
|
|
, '') |
|
|
|
, ifnull(furd.contractNo |
|
|
|
, '') |
|
|
|
, ifnull(bv.linkNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
, '') |
|
|
|
, ifnull(furd.contractNo |
|
|
|
, '') |
|
|
|
, ifnull(bv.linkNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
</if> |
|
|
|
and length(furd.busVinSid) |
|
|
|
>0 |
|
|
|
>0 |
|
|
|
</where> |
|
|
|
having receivable>0 |
|
|
|
order by furd.contractNo desc |
|
|
@ -78,32 +78,32 @@ |
|
|
|
<select id="getPaymentList" |
|
|
|
resultType="com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.AppFinUncollectedReceivablesDetailedVo"> |
|
|
|
SELECT sid, |
|
|
|
contractNo AS contractId, |
|
|
|
receivablesName AS projectName, |
|
|
|
customerPhone AS mobile, |
|
|
|
customerName AS `name`, |
|
|
|
currentReceivableMoney AS receivable, |
|
|
|
contractSid, |
|
|
|
VIN AS vin, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey, |
|
|
|
furd.customerSid, |
|
|
|
furd.useOrgSid, |
|
|
|
furd.reveivableMoney |
|
|
|
contractNo AS contractId, |
|
|
|
receivablesName AS projectName, |
|
|
|
customerPhone AS mobile, |
|
|
|
customerName AS `name`, |
|
|
|
currentReceivableMoney AS receivable, |
|
|
|
contractSid, |
|
|
|
VIN AS vin, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey, |
|
|
|
furd.customerSid, |
|
|
|
furd.useOrgSid, |
|
|
|
furd.reveivableMoney |
|
|
|
FROM fin_uncollected_receivables_detailed furd |
|
|
|
<where> |
|
|
|
${ew.sqlSegment} |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
and concat(IFNULL(furd.customerName |
|
|
|
, '') |
|
|
|
, ifnull(furd.contractNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
, '') |
|
|
|
, ifnull(furd.contractNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
</if> |
|
|
|
and length(furd.busVinSid) |
|
|
|
>0 |
|
|
|
>0 |
|
|
|
</where> |
|
|
|
order by furd.contractNo desc |
|
|
|
</select> |
|
|
@ -155,7 +155,7 @@ |
|
|
|
resultType="com.yxt.anrui.fin.api.fincollectionconfirmation.app.AppBusArrearsCarryMoneyVo"> |
|
|
|
SELECT fsrd.subscriptionMoney |
|
|
|
FROM fin_selected_receivables_detailed fsrd |
|
|
|
LEFT JOIN fin_collection_confirmation fcc ON fcc.sid = fsrd.collSid |
|
|
|
LEFT JOIN fin_collection_confirmation fcc ON fcc.sid = fsrd.collSid |
|
|
|
WHERE fcc.paymentState = 1 |
|
|
|
</select> |
|
|
|
|
|
|
@ -171,7 +171,7 @@ |
|
|
|
resultType="com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedVo"> |
|
|
|
select fd.* |
|
|
|
from fin_selected_receivables_detailed fd |
|
|
|
left join fin_uncollected_receivables_detailed fud on fud.sid = fd.receivablesSid |
|
|
|
left join fin_uncollected_receivables_detailed fud on fud.sid = fd.receivablesSid |
|
|
|
where fd.contractNo = #{contractNo} |
|
|
|
and fud.busVinSid = #{busVinSid} |
|
|
|
and fd.auditState = #{state} |
|
|
@ -285,8 +285,8 @@ |
|
|
|
<select id="selectByVinSid" resultType="java.lang.String"> |
|
|
|
select cast((sum(fd.`subscriptionMoney`) - COALESCE(SUM(f.`thisUseMoney`), 0)) AS DECIMAL(10, 2)) AS dbalance |
|
|
|
from fin_selected_receivables_detailed fd |
|
|
|
left join fin_uncollected_receivables_detailed ff on ff.sid = fd.receivablesSid |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` f ON f.`busSid` = fd.`sid` |
|
|
|
left join fin_uncollected_receivables_detailed ff on ff.sid = fd.receivablesSid |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` f ON f.`busSid` = fd.`sid` |
|
|
|
where ff.busVinSid = #{busVinSid} |
|
|
|
and fd.auditState = 3 |
|
|
|
</select> |
|
|
@ -303,8 +303,7 @@ |
|
|
|
FROM fin_selected_receivables_detailed |
|
|
|
WHERE receivablesSid = #{ysSid} |
|
|
|
AND auditState = 3 |
|
|
|
ORDER BY createTime DESC |
|
|
|
LIMIT 1 |
|
|
|
ORDER BY createTime DESC LIMIT 1 |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectUnSelectList" resultType="java.lang.String"> |
|
|
@ -319,81 +318,93 @@ |
|
|
|
<select id="selectPageList" |
|
|
|
resultType="com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectReceivablesDetailedVo"> |
|
|
|
select fd.sid, |
|
|
|
fd.receivablesSid, |
|
|
|
fd.contractNo, |
|
|
|
fd.customerSid, |
|
|
|
fd.customerName, |
|
|
|
fd.customerPhone, |
|
|
|
fd.receivablesName, |
|
|
|
fd.currentReceivableMoney, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey, |
|
|
|
fd.subscriptionMoney, |
|
|
|
fd.useOrgSid, |
|
|
|
fd.subscriptionDate |
|
|
|
fd.receivablesSid, |
|
|
|
fd.contractNo, |
|
|
|
fd.customerSid, |
|
|
|
fd.customerName, |
|
|
|
fd.customerPhone, |
|
|
|
fd.receivablesName, |
|
|
|
fd.currentReceivableMoney, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey, |
|
|
|
fd.subscriptionMoney, |
|
|
|
fd.useOrgSid, |
|
|
|
fd.subscriptionDate |
|
|
|
from fin_selected_receivables_detailed fd |
|
|
|
left join fin_uncollected_receivables_detailed furd on furd.sid = fd.receivablesSid |
|
|
|
left join fin_uncollected_receivables_detailed furd on furd.sid = fd.receivablesSid |
|
|
|
<where> |
|
|
|
${ew.sqlSegment} |
|
|
|
and fd.receivablesName != '订金' |
|
|
|
and fd.auditState = 3 |
|
|
|
and fd.receivablesName != '订金' |
|
|
|
and fd.auditState = 3 |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
and concat(IFNULL(fd.customerName |
|
|
|
, '') |
|
|
|
, ifnull(fd.contractNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
, '') |
|
|
|
, ifnull(fd.contractNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="noOutVehRecPageList" |
|
|
|
resultType="com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectReceivablesDetailedWCKCLRKVo"> |
|
|
|
SELECT ferd.sid, |
|
|
|
fcc.`useOrgSid`, |
|
|
|
fcc.`staffDeptName`, |
|
|
|
fcc.staffUserSid AS staffSid, |
|
|
|
fcc.`staffName`, |
|
|
|
ferd.`contractNo`, |
|
|
|
ferd.`payType`, |
|
|
|
ferd.`customerName`, |
|
|
|
ferd.`customerPhone`, |
|
|
|
ferd.`VIN` AS vinNo, |
|
|
|
ferd.`receivablesName`, |
|
|
|
ferd.`auditDate`, |
|
|
|
ferd.`subscriptionMoney`, |
|
|
|
ferd.balance AS reveivableMoney, |
|
|
|
ferd.kxState AS state |
|
|
|
FROM fin_selected_receivables_detailed ferd |
|
|
|
LEFT JOIN fin_collection_confirmation fcc |
|
|
|
ON ferd.`collSid` = fcc.`sid` |
|
|
|
LEFT JOIN anrui_base.`base_vehicle` bv |
|
|
|
ON RIGHT(ferd.`VIN`, 8) = RIGHT(bv.`vinNo`, 8) |
|
|
|
AND fcc.`useOrgSid` = bv.`createOrgSid` |
|
|
|
SELECT |
|
|
|
ferd.sid, |
|
|
|
fcc.`useOrgSid`, |
|
|
|
fcc.`staffDeptName`, |
|
|
|
fcc.staffUserSid AS staffSid, |
|
|
|
fcc.`staffName`, |
|
|
|
ferd.`contractNo`, |
|
|
|
ferd.`payType`, |
|
|
|
ferd.`customerName`, |
|
|
|
ferd.`customerPhone`, |
|
|
|
ferd.`VIN` AS vinNo, |
|
|
|
ferd.`receivablesName`, |
|
|
|
ferd.`auditDate`, |
|
|
|
ferd.`subscriptionMoney`, |
|
|
|
( |
|
|
|
ferd.`subscriptionMoney` - COALESCE(SUM(ffc.`thisUseMoney`), 0) |
|
|
|
) AS reveivableMoney, |
|
|
|
ferd.kxState AS state |
|
|
|
FROM |
|
|
|
fin_selected_receivables_detailed ferd |
|
|
|
LEFT JOIN fin_collection_confirmation fcc |
|
|
|
ON ferd.`collSid` = fcc.`sid` |
|
|
|
LEFT JOIN anrui_base.`base_vehicle` bv |
|
|
|
ON RIGHT(ferd.`VIN`, 8) = RIGHT(bv.`vinNo`, 8) |
|
|
|
AND fcc.`useOrgSid` = bv.`createOrgSid` |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` ffc |
|
|
|
ON ffc.`busSid` = ferd.`sid` |
|
|
|
UNION |
|
|
|
SELECT ferd.sid, |
|
|
|
ffcfa.useOrgSid, |
|
|
|
ffcfa.saleDeptName AS staffDeptName, |
|
|
|
ffcfa.staffSid, |
|
|
|
ffcfa.`staffName`, |
|
|
|
ferd.`contractNo`, |
|
|
|
ferd.`payType`, |
|
|
|
ferd.`customerName`, |
|
|
|
ferd.`customerPhone`, |
|
|
|
ferd.`VIN` AS vinNo, |
|
|
|
ferd.`receivablesName`, |
|
|
|
ferd.`auditDate`, |
|
|
|
ferd.`subscriptionMoney`, |
|
|
|
ferd.balance AS reveivableMoney, |
|
|
|
ferd.kxState AS state |
|
|
|
FROM fin_selected_receivables_detailed ferd |
|
|
|
LEFT JOIN fin_funds_carried_forward_apply ffcfa |
|
|
|
ON ferd.`collSid` = ffcfa.`sid` |
|
|
|
LEFT JOIN anrui_base.`base_vehicle` bv |
|
|
|
ON RIGHT(ferd.`VIN`, 8) = RIGHT(bv.`vinNo`, 8) |
|
|
|
AND ffcfa.`useOrgSid` = bv.`createOrgSid` |
|
|
|
SELECT |
|
|
|
ferd.sid, |
|
|
|
ffcfa.useOrgSid, |
|
|
|
ffcfa.saleDeptName AS staffDeptName, |
|
|
|
ffcfa.staffSid, |
|
|
|
ffcfa.`staffName`, |
|
|
|
ferd.`contractNo`, |
|
|
|
ferd.`payType`, |
|
|
|
ferd.`customerName`, |
|
|
|
ferd.`customerPhone`, |
|
|
|
ferd.`VIN` AS vinNo, |
|
|
|
ferd.`receivablesName`, |
|
|
|
ferd.`auditDate`, |
|
|
|
ferd.`subscriptionMoney`, |
|
|
|
( |
|
|
|
ferd.`subscriptionMoney` - COALESCE(SUM(ffc.`thisUseMoney`), 0) |
|
|
|
) AS reveivableMoney, |
|
|
|
ferd.kxState AS state |
|
|
|
FROM |
|
|
|
fin_selected_receivables_detailed ferd |
|
|
|
LEFT JOIN fin_funds_carried_forward_apply ffcfa |
|
|
|
ON ferd.`collSid` = ffcfa.`sid` |
|
|
|
LEFT JOIN anrui_base.`base_vehicle` bv |
|
|
|
ON RIGHT(ferd.`VIN`, 8) = RIGHT(bv.`vinNo`, 8) |
|
|
|
AND ffcfa.`useOrgSid` = bv.`createOrgSid` |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` ffc |
|
|
|
ON ffc.`busSid` = ferd.`sid` |
|
|
|
<where> |
|
|
|
${ew.sqlSegment} |
|
|
|
</where> |
|
|
@ -417,55 +428,55 @@ |
|
|
|
<select id="selectPageLists" |
|
|
|
resultType="com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectReceivablesDetailedVo"> |
|
|
|
select distinct fd.sid, |
|
|
|
fd.receivablesSid, |
|
|
|
fd.contractNo, |
|
|
|
fd.customerSid, |
|
|
|
fd.customerName, |
|
|
|
fd.customerPhone, |
|
|
|
fd.receivablesName, |
|
|
|
fd.currentReceivableMoney, |
|
|
|
cast((furd.`reveivableMoney` - COALESCE(df.dbalance, 0)) AS DECIMAL(10, 2)) AS dbalance, |
|
|
|
if(fd.currentReceivableMoney <= 0, 0, |
|
|
|
if(cast((fd.currentReceivableMoney - fd.subscriptionMoney) AS DECIMAL(10, 2)) <= 0, 0, |
|
|
|
cast((fd.currentReceivableMoney - fd.subscriptionMoney) AS DECIMAL(10, 2)))) as reveivableMoney, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey, |
|
|
|
fd.subscriptionMoney, |
|
|
|
fd.useOrgSid, |
|
|
|
fd.subscriptionDate, |
|
|
|
if(bv.linkNo is null or LENGTH(trim(bv.linkNo)) < 1, |
|
|
|
if(furd.payTypeKey = 2, RIGHT(bv.temporaryNo, 2), bv.temporaryNo), |
|
|
|
RIGHT(bv.linkNo, 8)) as VIN, |
|
|
|
CURRENT_DATE() as confirmDate, |
|
|
|
1 as subscribedOf |
|
|
|
fd.receivablesSid, |
|
|
|
fd.contractNo, |
|
|
|
fd.customerSid, |
|
|
|
fd.customerName, |
|
|
|
fd.customerPhone, |
|
|
|
fd.receivablesName, |
|
|
|
fd.currentReceivableMoney, |
|
|
|
cast((furd.`reveivableMoney` - COALESCE(df.dbalance, 0)) AS DECIMAL(10, 2)) AS dbalance, |
|
|
|
if(fd.currentReceivableMoney <= 0, 0, |
|
|
|
if(cast((fd.currentReceivableMoney - fd.subscriptionMoney) AS DECIMAL(10, 2)) <= 0, 0, |
|
|
|
cast((fd.currentReceivableMoney - fd.subscriptionMoney) AS DECIMAL(10, 2)))) as reveivableMoney, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey, |
|
|
|
fd.subscriptionMoney, |
|
|
|
fd.useOrgSid, |
|
|
|
fd.subscriptionDate, |
|
|
|
if(bv.linkNo is null or LENGTH(trim(bv.linkNo)) < 1, |
|
|
|
if(furd.payTypeKey = 2, RIGHT(bv.temporaryNo, 2), bv.temporaryNo), |
|
|
|
RIGHT(bv.linkNo, 8)) as VIN, |
|
|
|
CURRENT_DATE() as confirmDate, |
|
|
|
1 as subscribedOf |
|
|
|
from fin_selected_receivables_detailed fd |
|
|
|
left join fin_uncollected_receivables_detailed furd on furd.sid = fd.receivablesSid |
|
|
|
left join anrui_buscenter.bus_sales_order_vehicle bv on bv.sid = furd.busVinSid |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT d.sid, |
|
|
|
d.receivablesSid, |
|
|
|
d.`collSid`, |
|
|
|
cast((sum(d.`subscriptionMoney`) - COALESCE(SUM(f.`thisUseMoney`), 0)) AS DECIMAL(10, 2)) AS dbalance |
|
|
|
FROM fin_selected_receivables_detailed d |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` f ON f.`busSid` = d.`sid` |
|
|
|
where d.auditState = 1 |
|
|
|
or d.auditState = 3 |
|
|
|
GROUP BY d.`receivablesSid` |
|
|
|
left join fin_uncollected_receivables_detailed furd on furd.sid = fd.receivablesSid |
|
|
|
left join anrui_buscenter.bus_sales_order_vehicle bv on bv.sid = furd.busVinSid |
|
|
|
LEFT JOIN ( |
|
|
|
SELECT d.sid, |
|
|
|
d.receivablesSid, |
|
|
|
d.`collSid`, |
|
|
|
cast((sum(d.`subscriptionMoney`) - COALESCE(SUM(f.`thisUseMoney`), 0)) AS DECIMAL(10, 2)) AS dbalance |
|
|
|
FROM fin_selected_receivables_detailed d |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` f ON f.`busSid` = d.`sid` |
|
|
|
where d.auditState = 1 |
|
|
|
or d.auditState = 3 |
|
|
|
GROUP BY d.`receivablesSid` |
|
|
|
) df ON df.receivablesSid = furd.`sid` |
|
|
|
<where> |
|
|
|
${ew.sqlSegment} |
|
|
|
and fd.receivablesName != '订金' |
|
|
|
and fd.auditState = 3 |
|
|
|
and fd.receivablesName != '订金' |
|
|
|
and fd.auditState = 3 |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
and concat(IFNULL(fd.customerName |
|
|
|
, '') |
|
|
|
, ifnull(fd.contractNo |
|
|
|
, '') |
|
|
|
, ifnull(bv.linkNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
, '') |
|
|
|
, ifnull(fd.contractNo |
|
|
|
, '') |
|
|
|
, ifnull(bv.linkNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
having dbalance <= 0 |
|
|
|