|
|
|
@ -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<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) {
|
|
|
|
|
Date end = findSettleTo(clientId);
|
|
|
|
|
List<JSONObject> unsettleReports = transactionMapper.listClientUnsettleDataByDate(clientId, end);
|
|
|
|
|