|
|
@ -24,31 +24,44 @@ |
|
|
|
<!--手机端—查询可使用款项明细列表--> |
|
|
|
<select id="getPaymentDetailsList" |
|
|
|
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, |
|
|
|
<!--currentReceivableMoney AS confirmMoney,--> |
|
|
|
VIN AS vin, |
|
|
|
furd.busVinSid, |
|
|
|
furd.payType, |
|
|
|
furd.payTypeKey |
|
|
|
SELECT distinct furd.sid, |
|
|
|
furd.contractNo AS contractId, |
|
|
|
furd.receivablesName AS projectName, |
|
|
|
furd.customerPhone AS mobile, |
|
|
|
furd.customerName AS `name`, |
|
|
|
(furd.reveivableMoney - COALESCE(SUM(df.dbalance), 0)) 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 |
|
|
|
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.`collSid`, (d.`subscriptionMoney` - COALESCE(SUM(f.`thisUseMoney`), 0)) AS dbalance |
|
|
|
FROM fin_selected_receivables_detailed d |
|
|
|
LEFT JOIN `fin_funds_carried_forward_veh` f ON f.`busSid` = d.`sid` |
|
|
|
GROUP BY d.`sid` |
|
|
|
) df ON df.collSid = furd.`sid` |
|
|
|
<where> |
|
|
|
${ew.sqlSegment} |
|
|
|
<if test="name != null and name != ''"> |
|
|
|
and concat(IFNULL(furd.customerName |
|
|
|
, '') |
|
|
|
, ifnull(furd.contractNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
, '') |
|
|
|
, ifnull(furd.contractNo |
|
|
|
, '') |
|
|
|
, ifnull(bv.linkNo |
|
|
|
, '')) LIKE concat('%' |
|
|
|
, #{name} |
|
|
|
, '%') |
|
|
|
</if> |
|
|
|
and length(furd.busVinSid) |
|
|
|
>0 |
|
|
|
>0 |
|
|
|
</where> |
|
|
|
order by furd.contractNo desc |
|
|
|
</select> |
|
|
@ -56,32 +69,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> |
|
|
@ -124,7 +137,7 @@ |
|
|
|
payTypeKey, |
|
|
|
customerSid, |
|
|
|
useOrgSid, |
|
|
|
subscribedOf |
|
|
|
subscribedOf |
|
|
|
FROM fin_selected_receivables_detailed |
|
|
|
WHERE collSid = #{collectionBillSid} |
|
|
|
</select> |
|
|
@ -133,7 +146,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> |
|
|
|
|
|
|
@ -149,7 +162,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} |
|
|
@ -263,7 +276,7 @@ |
|
|
|
<select id="selectByVinSid" resultType="java.lang.String"> |
|
|
|
select sum(fd.balance) |
|
|
|
from fin_selected_receivables_detailed fd |
|
|
|
left join fin_uncollected_receivables_detailed ff on ff.sid = fd.receivablesSid |
|
|
|
left join fin_uncollected_receivables_detailed ff on ff.sid = fd.receivablesSid |
|
|
|
where ff.busVinSid = #{busVinSid} |
|
|
|
and fd.auditState = 3 |
|
|
|
</select> |
|
|
@ -280,7 +293,8 @@ |
|
|
|
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"> |
|
|
@ -295,58 +309,58 @@ |
|
|
|
<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 |
|
|
|
${ew.sqlSegment} |
|
|
|
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.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` |
|
|
|
<where> |
|
|
|
${ew.sqlSegment} |
|
|
|
</where> |
|
|
@ -354,6 +368,9 @@ |
|
|
|
|
|
|
|
<select id="selectBalanceByReceivedSid" |
|
|
|
resultType="java.lang.String"> |
|
|
|
select ifnull(sum(balance),0) from fin_selected_receivables_detailed where receivablesSid = #{receivablesSid} and (auditState =1 or auditState = 3) |
|
|
|
select ifnull(sum(balance), 0) |
|
|
|
from fin_selected_receivables_detailed |
|
|
|
where receivablesSid = #{receivablesSid} |
|
|
|
and (auditState = 1 or auditState = 3) |
|
|
|
</select> |
|
|
|
</mapper> |