rule update

master
yixian 7 years ago
parent d47830f7f9
commit 211da4f69e

@ -53,6 +53,9 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
throw new BadRequestException("Cannot settle today's transactions"); throw new BadRequestException("Cannot settle today's transactions");
} }
JSONObject currentTask = findCurrentSettle(clientId, false); 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"); String taskId = currentTask.getString("task_id");
currentTask.put("request_time", new Date()); currentTask.put("request_time", new Date());
currentTask.put("client_id", clientId); currentTask.put("client_id", clientId);
@ -73,7 +76,7 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
if (!client.getBooleanValue("manual_settle")) { if (!client.getBooleanValue("manual_settle")) {
throw new ForbiddenException("Manual Settlement Not Enabled"); throw new ForbiddenException("Manual Settlement Not Enabled");
} }
if (client.getBooleanValue("skip_clearing")){ if (client.getBooleanValue("skip_clearing")) {
throw new ForbiddenException("Manual Settlement Not Enabled"); throw new ForbiddenException("Manual Settlement Not Enabled");
} }
JSONObject todayTask = taskManualSettleMapper.findTodayTask(clientId); JSONObject todayTask = taskManualSettleMapper.findTodayTask(clientId);
@ -83,8 +86,9 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
todayTask = new JSONObject(); todayTask = new JSONObject();
} }
List<JSONObject> settleLogs = clearingLogMapper.findByDate(new Date()); List<JSONObject> settleLogs = clearingLogMapper.findByDate(new Date());
List<JSONObject> unsettleRequests = taskManualSettleMapper.listActiveTasks(clientId);
//今天未清算则锁定 //今天未清算则锁定
todayTask.put("locked", settleLogs.isEmpty()); todayTask.put("locked", settleLogs.isEmpty() || !unsettleRequests.isEmpty());
if (includingUnsettleData) { if (includingUnsettleData) {
Date end = findSettleTo(clientId); Date end = findSettleTo(clientId);
List<JSONObject> unsettleReports = transactionMapper.listClientUnsettleDataByDate(clientId, end); List<JSONObject> unsettleReports = transactionMapper.listClientUnsettleDataByDate(clientId, end);

Loading…
Cancel
Save