diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 37e28566a..cb718e7e6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -1046,7 +1046,17 @@ public class RetailAppServiceImp implements RetailAppService { devId = device.getString("dev_id"); } Date to = DateUtils.addDays(date, 1); - List transactions = transactionMapper.listDailyTransactions(date, to, devId, device.getIntValue("client_id")); + String [] param_client_ids = null; + if(StringUtils.isEmpty(app_client_ids)) { + JSONArray client_ids = clientManager.getAllClientIds(device.getIntValue("client_id")); + if (client_ids.size() > 1) { + param_client_ids = new String[client_ids.size()]; + client_ids.toArray(param_client_ids); + } + }else { + param_client_ids = app_client_ids.split(","); + } + List transactions = transactionMapper.listDailyTransactions(date, to, devId, device.getIntValue("client_id"),param_client_ids); if (transactions.isEmpty()) { throw new BadRequestException("No Transactions in date " + dateStr + " at " + timezone); } @@ -1066,16 +1076,7 @@ public class RetailAppServiceImp implements RetailAppService { } JSONObject res = new JSONObject(); res.put("transactions", transactions); - String [] param_client_ids = null; - if(StringUtils.isEmpty(app_client_ids)) { - JSONArray client_ids = clientManager.getAllClientIds(device.getIntValue("client_id")); - if (client_ids.size() > 1) { - param_client_ids = new String[client_ids.size()]; - client_ids.toArray(param_client_ids); - } - }else { - param_client_ids = app_client_ids.split(","); - } + JSONObject analysis = transactionMapper.analysisRetailDailyReport(date, to, devId, device.getIntValue("client_id"),param_client_ids); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java index b7d43de47..9b4110532 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java @@ -106,7 +106,7 @@ public interface TransactionMapper { @AdvanceSelect(addonWhereClause = "transaction_type='Credit'") int countOrders(@Param("client_id") int client_id); - List listDailyTransactions(@Param("from") Date from, @Param("to") Date to, @Param("dev_id") String devId, @Param("client_id") int clientId); + List listDailyTransactions(@Param("from") Date from, @Param("to") Date to, @Param("dev_id") String devId, @Param("client_id") int clientId,@Param("client_ids")String [] client_ids); JSONObject analysisRetailDailyReport(@Param("from") Date from, @Param("to") Date to, @Param("dev_id") String devId, @Param("client_id") int clientId,@Param("client_ids")String [] client_ids); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index 56983a97d..a2d1d9285 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -659,9 +659,17 @@ LEFT JOIN pmt_orders o on o.order_id=t.order_id LEFT JOIN pmt_refunds r on r.refund_id=t.refund_id WHERE t.transaction_time>=#{from} and t.transaction_time<#{to} and t.channel!='Settlement' - and t.client_id=#{client_id} ]]> and t.device_id=#{dev_id} + + AND t.client_id IN + + #{client_id} + + + + and t.client_id=#{client_id} + order by t.transaction_time asc