From 211da4f69e98d0d88fe8b23f535f69d82a88d050 Mon Sep 17 00:00:00 2001 From: yixian Date: Thu, 22 Mar 2018 23:20:43 +0800 Subject: [PATCH] rule update --- .../settlement/core/impls/ManualSettleSupportImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java b/src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java index 5506d4736..9f89c83db 100644 --- a/src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java @@ -53,6 +53,9 @@ public class ManualSettleSupportImpl implements ManualSettleSupport { throw new BadRequestException("Cannot settle today's transactions"); } JSONObject currentTask = findCurrentSettle(clientId, false); + if (currentTask.getBooleanValue("locked")) { + throw new BadRequestException("You cannot do this at the moment"); + } String taskId = currentTask.getString("task_id"); currentTask.put("request_time", new Date()); currentTask.put("client_id", clientId); @@ -73,7 +76,7 @@ public class ManualSettleSupportImpl implements ManualSettleSupport { if (!client.getBooleanValue("manual_settle")) { throw new ForbiddenException("Manual Settlement Not Enabled"); } - if (client.getBooleanValue("skip_clearing")){ + if (client.getBooleanValue("skip_clearing")) { throw new ForbiddenException("Manual Settlement Not Enabled"); } JSONObject todayTask = taskManualSettleMapper.findTodayTask(clientId); @@ -83,8 +86,9 @@ public class ManualSettleSupportImpl implements ManualSettleSupport { todayTask = new JSONObject(); } List settleLogs = clearingLogMapper.findByDate(new Date()); + List unsettleRequests = taskManualSettleMapper.listActiveTasks(clientId); //今天未清算则锁定 - todayTask.put("locked", settleLogs.isEmpty()); + todayTask.put("locked", settleLogs.isEmpty() || !unsettleRequests.isEmpty()); if (includingUnsettleData) { Date end = findSettleTo(clientId); List unsettleReports = transactionMapper.listClientUnsettleDataByDate(clientId, end);