|
|
|
@ -119,6 +119,43 @@
|
|
|
|
|
a.expiry_time < #{expiry_date}
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getAllClientRateExpiryMerchants" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT
|
|
|
|
|
c.client_moniker,
|
|
|
|
|
c.client_id
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
LEFT JOIN sys_client_rates r
|
|
|
|
|
ON r.client_id = c.client_id
|
|
|
|
|
WHERE c.skip_clearing = 0
|
|
|
|
|
AND (c.approve_result = 1
|
|
|
|
|
OR (c.approve_result = 2
|
|
|
|
|
AND (c.source = 1
|
|
|
|
|
OR c.source = 2)))
|
|
|
|
|
AND c.is_valid = 1
|
|
|
|
|
AND (r.expiry_time = (SELECT
|
|
|
|
|
MAX(expiry_time)
|
|
|
|
|
FROM sys_client_rates r3
|
|
|
|
|
WHERE r3.client_id = c.client_id
|
|
|
|
|
AND r3.rate_name = r.rate_name)
|
|
|
|
|
AND r.expiry_time <= CURRENT_DATE()
|
|
|
|
|
OR r.client_rate_id IS NULL
|
|
|
|
|
)
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
<insert id="postponeMerchantRateByClientId" parameterType="int">
|
|
|
|
|
INSERT sys_client_rates (manager_id, client_id, rate_name, rate_value, transaction_fee, active_time, expiry_time, create_time, update_time, manager_name, clean_days, remark)
|
|
|
|
|
SELECT CONCAT('System-', CURRENT_DATE()),r.client_id,r.rate_name,r.rate_value,r.transaction_fee,DATE_ADD(r.expiry_time, INTERVAL 1 day),DATE_ADD(r.expiry_time, INTERVAL 1 year),NOW(), NOW(),
|
|
|
|
|
CONCAT('System-', CURRENT_DATE()),r.clean_days,'费率自动延期一年'
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
LEFT JOIN sys_client_rates r ON r.client_id = c.client_id
|
|
|
|
|
WHERE c.client_id = #{clientId} AND c.skip_clearing = 0 AND (c.approve_result = 1 OR (c.approve_result = 2 AND (c.source = 1 OR c.source = 2)))
|
|
|
|
|
AND c.is_valid = 1 AND (r.expiry_time = (SELECT MAX(expiry_time)FROM sys_client_rates r3
|
|
|
|
|
WHERE r3.client_id = c.client_id
|
|
|
|
|
AND r3.rate_name = r.rate_name)
|
|
|
|
|
AND CURRENT_DATE() >= r.expiry_time
|
|
|
|
|
OR r.client_rate_id IS NULL)
|
|
|
|
|
</insert>
|
|
|
|
|
<select id="latestConfig" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT * FROM
|
|
|
|
|
sys_client_rates
|
|
|
|
|