From a2d9cdb739e5c6b448010aa8c7a9e199d840a8c6 Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Thu, 6 Jan 2022 16:59:56 +0800 Subject: [PATCH] =?UTF-8?q?Incremental=20=E5=88=97=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/mappers/payment/OrderMapper.java | 2 + .../core/impls/TradeLogServiceImpl.java | 7 + .../manage/mappers/payment/OrderMapper.xml | 216 +++++++++++++++++- 3 files changed, 214 insertions(+), 11 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java index 90d33bf7f..de3a5fee2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java @@ -32,6 +32,8 @@ public interface OrderMapper { PageList listIncrementalOrders(JSONObject params, PageBounds pagination); + PageList listIncrementalOrdersNew(JSONObject params, PageBounds pagination); + List listOrdersNoPage(JSONObject params); PageList listOrdersByClients(JSONObject params, PageBounds pagination); diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index ae51cf0cb..79fa5cc5f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -33,6 +33,7 @@ import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils; import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; @@ -211,6 +212,12 @@ public class TradeLogServiceImpl implements TradeLogService { add(query.getGatewayChild()); }}); } + JSONArray clientIds = clientManager.getAllClientIds(client.getIntValue("client_id")); + logger.info("====>clientIds:{}",clientIds.size()); + if (clientIds.size() > 1) { + String[] arr = new String[clientIds.size()]; + params.put("client_ids", clientIds.toArray(arr)); + } PageList logs = orderMapper.listIncrementalOrdersByClients(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc"))); if (timezone != null) { diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml index 0dc653a3a..3b8b093d4 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml @@ -38,6 +38,41 @@ t.tax_amount, t.surcharge_rate + + SELECT + o.order_id, + o.client_id, + o.total_amount, + o.display_amount, + o.customer_payment_amount, + o.coupon_payment_amount, + o.currency, + o.create_time, + o.confirm_time, + o.status, + o.order_description, + o.order_detail, + o.client_order_id, + o.gateway, + o.channel, + o.pay_type, + o.pre_authorization, + o.refund_amount refund_fee, + o.customer_id, + o.source, + sum(t.clearing_amount) clearing_amount, + t.refund_id, + t.transaction_time, + t.transaction_type, + t.transaction_id, + t.exchange_rate, + t.clearing_status, + t.settle_amount, + t.incremental_surcharge, + t.total_surcharge, + t.tax_amount, + t.surcharge_rate + SELECT o.order_id order_id, @@ -107,6 +142,73 @@ t.settle_amount, t.transaction_time + + SELECT + o.order_id order_id, + format(o.total_amount * 100, 0) total_fee, + format(o.customer_payment_amount * 100, 0) real_fee, + o.currency, + o.channel, + o.create_time, + o.confirm_time pay_time, + o.pre_authorization, + o.source, + o.pay_type, + CASE o.status + WHEN 0 + THEN 'SUBMITTING' + WHEN 1 + THEN 'SUBMIT_FAIL' + WHEN 2 + THEN 'WAITING_PAYMENT' + WHEN 3 + THEN 'CLOSED' + WHEN 4 + THEN 'PAYMENT_FAIL' + WHEN 5 + THEN 'SUCCESS' + WHEN 6 + THEN 'PARTIAL_REFUND' + WHEN 7 + THEN 'FULL_REFUND' + END AS `status`, + o.order_description order_body, + o.client_order_id partner_order_id, + 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 'In-APP H5' + 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, + format(o.refund_amount * 100, 0) refund_fee, + t.clearing_status, + t.settle_amount, + t.transaction_time + + - + ,ifnull(i.incremental_rate,0.00) as rate_value FROM pmt_orders o - INNER JOIN sys_clients p ON p.client_id=o.client_id and p.is_valid=1 - - AND p.client_id IN - - #{client_id} - - - - and (p.client_id=#{client_id} or p.parent_client_id=#{client_id}) - + LEFT JOIN pmt_transactions t on t.order_id=o.order_id and t.refund_id is null and t.transaction_type='Credit' + LEFT JOIN pmt_incremental_detail i on i.transaction_id = t.transaction_id + and o.create_time >= #{from} and o.create_time < #{to} @@ -583,6 +768,15 @@ AND o.source = #{source} + + AND o.client_id IN + + #{client_id} + + + + and o.client_id=#{client_id} + GROUP BY o.order_id