|
|
|
@ -1649,20 +1649,27 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
|
|
|
|
|
if (!log.getBooleanValue("editable")) {
|
|
|
|
|
throw new ForbiddenException("Settlement log has been sent and unable to edit");
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(clearingId);
|
|
|
|
|
List<JSONObject> detailsWithDistributedSurcharge = details.stream().filter(detail -> detail.getBigDecimal("distributed_surcharge").compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
|
|
|
|
|
if (!detailsWithDistributedSurcharge.isEmpty()) {
|
|
|
|
|
for (JSONObject detail : detailsWithDistributedSurcharge) {
|
|
|
|
|
releaseDistributedSurcharge(detail);
|
|
|
|
|
if (!locker.lock("settle_task", 3600_000)) {
|
|
|
|
|
throw new ServerErrorException("Settle Task Running!");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(clearingId);
|
|
|
|
|
List<JSONObject> detailsWithDistributedSurcharge = details.stream().filter(detail -> detail.getBigDecimal("distributed_surcharge").compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
|
|
|
|
|
if (!detailsWithDistributedSurcharge.isEmpty()) {
|
|
|
|
|
for (JSONObject detail : detailsWithDistributedSurcharge) {
|
|
|
|
|
releaseDistributedSurcharge(detail);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
transactionMapper.deleteSettlementTransaction(clearingId);
|
|
|
|
|
transactionMapper.removeSettleRemark(clearingId);
|
|
|
|
|
preSettleTaskMapper.resetClearStatus(clearingId);
|
|
|
|
|
clearingDetailAnalysisMapper.clearAnalysis(clearingId);
|
|
|
|
|
taskManualSettleMapper.rollbackExecutedTask(clearingId);
|
|
|
|
|
clearingDetailMapper.deleteSettleLogs(clearingId);
|
|
|
|
|
clearingLogMapper.deleteSettleLogs(clearingId);
|
|
|
|
|
}finally {
|
|
|
|
|
locker.unlock("settle_task");
|
|
|
|
|
}
|
|
|
|
|
transactionMapper.deleteSettlementTransaction(clearingId);
|
|
|
|
|
transactionMapper.removeSettleRemark(clearingId);
|
|
|
|
|
preSettleTaskMapper.resetClearStatus(clearingId);
|
|
|
|
|
clearingDetailAnalysisMapper.clearAnalysis(clearingId);
|
|
|
|
|
taskManualSettleMapper.rollbackExecutedTask(clearingId);
|
|
|
|
|
clearingDetailMapper.deleteSettleLogs(clearingId);
|
|
|
|
|
clearingLogMapper.deleteSettleLogs(clearingId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|