From f548bb7ce3ec11c14e1e18e5bd91c1ec8858cf57 Mon Sep 17 00:00:00 2001 From: yixian Date: Mon, 31 May 2021 14:46:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E6=B8=85=E7=AE=97=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/impls/RetailAppServiceImp.java | 9 ++------- .../merchants/core/impls/ClientManagerImpl.java | 16 +++------------- .../core/impls/TradeLogServiceImpl.java | 17 +++-------------- .../manage/mappers/log/ClearingDetailMapper.xml | 12 +++++++----- .../mappers/payment/TransactionMapper.xml | 2 +- 5 files changed, 16 insertions(+), 40 deletions(-) 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 b0e474a75..80284ba35 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 @@ -851,14 +851,9 @@ public class RetailAppServiceImp implements RetailAppService { PageList logs = clearingDetailMapper.listClientSettlementLog(params, new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc"))); logs.forEach(log -> log.put("total_charge", log.getBigDecimal("total_charge").add(log.getBigDecimal("tax_amount")))); + logs.forEach(log -> log.put("padding", log.getBooleanValue("editable"))); JSONObject result = PageListUtils.buildPageListResult(logs); - if (appQueryBean.getPage() == 1 && !logs.isEmpty()) { - JSONObject clearingLog = clearingLogMapper.findById(logs.get(0).getIntValue("clearing_id")); - if (clearingLog.getBooleanValue("editable")) { - result.put("padding", true); - logs.get(0).put("padding", true); - } - } + result.put("padding", logs.stream().anyMatch(log -> log.getBooleanValue("editable"))); return result; } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 00d205680..3249041fa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -4119,20 +4119,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); + logs.forEach(log -> log.put("padding", log.getBooleanValue("editable"))); JSONObject result = PageListUtils.buildPageListResult(logs); - if (query.getPage() == 1) { - if (!logs.isEmpty()) { - JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clear_detail_id")); - if (clearingDetail != null) { - JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id")); - if (clearingLog.getBooleanValue("editable")) { - result.put("padding", true); - logs.get(0).put("padding", true); - logger.info("##editable{}", clearingLog.getBooleanValue("editable")); - } - } - } - } + result.put("padding", logs.stream().anyMatch(log->log.getBooleanValue("editable"))); + logger.info("##editable{}", result.getBooleanValue("padding")); return result; } 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 25761287b..0ec3dff0f 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 @@ -1425,21 +1425,10 @@ public class TradeLogServiceImpl implements TradeLogService { } PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); + logs.forEach(log -> log.put("padding", log.getBooleanValue("editable"))); result.putAll(PageListUtils.buildPageListResult(logs)); - if (query.getPage() == 1) { - if (!logs.isEmpty()) { - JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clear_detail_id")); - if (clearingDetail != null) { - JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id")); - - if (clearingLog.getBooleanValue("editable")) { - result.put("padding", true); - logs.get(0).put("padding", true); - logger.info("##editable{}", clearingLog.getBooleanValue("editable")); - } - } - } - } + result.put("padding", logs.stream().anyMatch(log -> log.getBooleanValue("editable"))); + logger.info("##editable{}", result.getBooleanValue("padding")); return result; } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml index 8444788cb..31ff6d0d7 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml @@ -91,11 +91,13 @@