fix 商户端transaction查询记录

master
luoyang 5 years ago
parent 8f1553163e
commit 7457684dc5

@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.4.2</version> <version>1.4.3</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.8.0</jib-maven-plugin.version> <jib-maven-plugin.version>1.8.0</jib-maven-plugin.version>

@ -23,7 +23,6 @@ public interface TransactionMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject transaction); void save(JSONObject transaction);
@CountRef(".countTransFlowPage")
PageList<JSONObject> listTransFlowPage(JSONObject params, PageBounds pagination); PageList<JSONObject> listTransFlowPage(JSONObject params, PageBounds pagination);
int countTransFlowPage(JSONObject params); int countTransFlowPage(JSONObject params);

@ -536,7 +536,8 @@ public class TradeLogServiceImpl implements TradeLogService {
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id")); JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id"));
params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch")); params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
List<JSONObject> logs = transactionMapper.listTransFlow(params); List<JSONObject> logs = transactionMapper.listTransFlowPage(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("transaction_time.desc")));
TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time"); TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time");
Paginator paginator = new Paginator(query.getPage(), query.getLimit(), logs.size()); Paginator paginator = new Paginator(query.getPage(), query.getLimit(), logs.size());
List<JSONObject> pagedLogsList = logs.stream() List<JSONObject> pagedLogsList = logs.stream()

@ -21,44 +21,119 @@
and t.channel = 'Settlement' and t.channel = 'Settlement'
</delete> </delete>
<select id="listTransFlowPage" resultType="com.alibaba.fastjson.JSONObject"> <select id="listTransFlowPage" resultType="com.alibaba.fastjson.JSONObject">
SELECT t.*,if(t.refund_id is not null,'refund',if(t.transaction_type='Debit' AND SELECT t.*,
t.system_generate=0,'clearing','payment')) trans_type, o.status,o.source,
if(t.transaction_type='Debit' AND t.refund_id is NULL AND c.client_moniker,
t.system_generate=0,if(locate('MERCHANT',t.system_transaction_id)>0,'Transfer to Merchant','Merchant Service c.short_name,
Fee'),t.order_id) order_id2, o.dev_id order_dev_id,
if(t.transaction_type='Debit' AND t.refund_id is NULL AND t.system_generate=0,'-',t.clearing_status) ifnull(o.client_order_id,'--') client_order_id,
clear_status, if(t.channel='Settlement','clearing',
o.order_detail,o.display_amount,o.currency if(t.transaction_type='Credit','payment','refund')) trans_type,
if(t.channel='Settlement',
if(locate('MERCHANT',t.system_transaction_id)>0, 'Transfer to Merchant','Merchant Service Fee'),
if(t.system_generate=0,t.order_id,t.remark)) order_id2,
if(t.channel='Settlement','-',CASE t.clearing_status
WHEN 0 THEN 'ReadyToClear'
WHEN 1 THEN 'Cleared'
WHEN 2 THEN 'Preauthorised'
END) clear_status,
o.order_detail,o.display_amount,o.currency,o.pre_authorization,
CASE o.gateway
WHEN 0
THEN 'Retail In-Store'
WHEN 1
THEN 'Retail In-Store'
WHEN 2
THEN 'QR Code'
WHEN 3
THEN 'Online API'
WHEN 4
THEN 'WeChat HTML5'
WHEN 5
THEN 'Retail API'
WHEN 6
THEN 'Retail API'
WHEN 7
THEN 'QR Code'
WHEN 8
THEN 'Mobile H5'
WHEN 9
THEN 'Third Party Gateway'
WHEN 10
THEN 'APP'
WHEN 12
THEN 'MICROAPP'
WHEN 13
THEN 'Native QR Code'
WHEN 14
THEN 'Share Link'
END AS gateway,
CASE o.channel
WHEN 'Alipay' THEN ra.login_id
WHEN 'AlipayOnline' THEN ra.login_email
END login_id
FROM pmt_transactions t FROM pmt_transactions t
LEFT JOIN pmt_orders o ON o.order_id=t.order_id LEFT JOIN pmt_orders o ON o.order_id=t.order_id
left join sys_customer_relation_alipay ra on ra.alipay_uid = o.customer_id
LEFT JOIN sys_clients c on c.client_id = t.client_id
<where> <where>
<if test="client_ids!=null"> <if test="search_text!=null">
<bind name="name_pattern" value="'%'+search_text+'%'"/>
<if test="text_type=='all'">
and (o.order_detail like #{name_pattern}
or t.system_transaction_id like #{name_pattern}
or o.channel = #{search_text}
or t.order_id like #{name_pattern}
or o.client_order_id like #{name_pattern})
</if>
<if test="text_type=='sys_trans_id'">
and t.system_transaction_id =#{search_text}
</if>
<if test="text_type=='channel'">
and o.channel = #{search_text}
</if>
<if test="text_type=='remark'">
and o.order_detail like #{name_pattern}
</if>
<if test="text_type=='order_id'">
and t.order_id = #{search_text}
</if>
<if test="text_type=='client_order_id'">
and o.client_order_id = #{search_text}
</if>
</if>
<if test="!hide_sub_mch and client_ids!=null">
AND t.client_id IN AND t.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id"> <foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id} #{client_id}
</foreach> </foreach>
</if> </if>
<if test="client_ids==null"> <if test="!hide_sub_mch and client_ids==null">
and t.client_id=#{client_id} and c.client_id=#{client_id}
</if>
<if test="hide_sub_mch">
and (c.client_id=#{client_id} or c.parent_client_id=#{client_id})
</if> </if>
<if test="from!=null">and t.transaction_time &gt;= #{from}</if> <if test="from!=null">and t.transaction_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if> <if test="to!=null">and t.transaction_time &lt; #{to}</if>
<if test="transaction_type!=null">and t.transaction_type=#{transaction_type}</if> <if test="transaction_type!=null">and t.transaction_type=#{transaction_type}</if>
<if test="date!=null">and date(t.transaction_time)=date(#{date})</if> <if test="date!=null">and date(t.transaction_time)=date(#{date})</if>
<if test="clearing_status!=null">and t.clearing_status=#{clearing_status}</if> <if test="clearing_status!=null">and t.clearing_status=#{clearing_status}</if>
<if test="dev_id!=null">
and o.dev_id = #{dev_id}
</if>
<if test="trans_type==1">and t.transaction_type = 'Credit'</if> <if test="trans_type==1">and t.transaction_type = 'Credit'</if>
<if test="trans_type==2">and t.refund_id is NOT NULL</if> <if test="trans_type==2">and t.refund_id is NOT NULL</if>
<if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if> <if test="trans_type==3">and t.transaction_type='Debit' and t.refund_id is NULL</if>
<if test="dev_id!=null">
and binary o.dev_id = #{dev_id}
</if>
<if test="channel!=null"> <if test="channel!=null">
and and
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan} <foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}
</foreach> </foreach>
</if> </if>
</where> </where>
order by t.transaction_time desc
</select> </select>
<select id="countTransFlowPage" resultType="int"> <select id="countTransFlowPage" resultType="int">
SELECT count(1) SELECT count(1)
FROM pmt_transactions t FROM pmt_transactions t

Loading…
Cancel
Save