http://jira.mfd.msk:8088/browse/CLS-189 added logging
This commit is contained in:
parent
89839b7da2
commit
09a58a95ce
2 changed files with 19 additions and 0 deletions
|
|
@ -93,23 +93,28 @@ public class Clearing {
|
|||
boolean financialError = false;
|
||||
for (ExecutionDeposit execDeposit : executionDeposits) {
|
||||
if (deniedIds.contains(execDeposit.getId())) {
|
||||
log.trace("executionDeposit {} was already denied", execDeposit.getId());
|
||||
continue;
|
||||
}
|
||||
if (financialError) {
|
||||
log.trace("executionDeposit {} FinancialObligationNotSatisfied was present earlier for this company; setting DENIED status", execDeposit.getId());
|
||||
updateDenied(execDeposit);
|
||||
continue;
|
||||
}
|
||||
IValidator validator = validation.apply(category, execDeposit);
|
||||
Optional<EnumMessage> errorMsg = validator.tillFirstError();
|
||||
if (errorMsg.isPresent() && !ClearingErrorInternal.FinancialObligationNotSatisfied.equals(errorMsg.get().getSubject())) {
|
||||
log.trace("executionDeposit {} setting DENIED status: {}", execDeposit.getId(), errorMsg.get().getSubject().nameOrId());
|
||||
updateDenied(execDeposit);
|
||||
continue;
|
||||
} else if (errorMsg.isPresent()) {
|
||||
log.trace("executionDeposit {} setting DENIED status: {}", execDeposit.getId(), errorMsg.get().getSubject().nameOrId());
|
||||
financialError = true;
|
||||
updateDenied(execDeposit);
|
||||
continue;
|
||||
}
|
||||
updateAllowed(execDeposit);
|
||||
log.trace("executionDeposit {} was updated ALLOWED", execDeposit.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,6 +122,7 @@ public class Clearing {
|
|||
execDeposit.setCoverageStatus(Allowed.DENIED.getKey());
|
||||
execDeposit.setUpdated(Instant.now());
|
||||
executionDepositImdg.update(execDeposit);
|
||||
log.trace("executionDeposit {} was updated DENIED", execDeposit.getId());
|
||||
//также необходимо установить статус DEND встречной сделке контрагента этой компании, которая выбирается из executionDeposit по ключу:
|
||||
//securityId И чтобы сделка была компании категории clearingMemberCategory.clearingMemberCategory ≠ той категории, сделка которой обрабатывается в настоящий момент.
|
||||
ExecutionDeposit matchedExecDeposit = executionDepositImdg.getSingleObjectBySQL(
|
||||
|
|
@ -126,6 +132,7 @@ public class Clearing {
|
|||
matchedExecDeposit.setCoverageStatus(Allowed.DENIED.getKey());
|
||||
matchedExecDeposit.setUpdated(Instant.now());
|
||||
executionDepositImdg.update(matchedExecDeposit);
|
||||
log.trace("executionDeposit {} matching executionDeposit {} was updated DENIED", execDeposit.getId(), matchedExecDeposit.getId());
|
||||
deniedIds.add(matchedExecDeposit.getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -140,9 +147,11 @@ public class Clearing {
|
|||
log.info("running clearing for category: {}, company: {}", category, executionDeposits.get(0).getCompanyId());
|
||||
for (ExecutionDeposit execDeposit : executionDeposits) {
|
||||
if (deniedIds.contains(execDeposit.getId())) {
|
||||
log.trace("Skipping processing executionDeposit {} was denied as matching", execDeposit.getId());
|
||||
continue;
|
||||
}
|
||||
if (!Allowed.ALLOWED.getKey().equals(execDeposit.getCoverageStatus())) {
|
||||
log.trace("Skipping processing executionDeposit {} was denied", execDeposit.getId());
|
||||
continue;
|
||||
}
|
||||
//send request to kafka, wait for a reply
|
||||
|
|
@ -152,6 +161,7 @@ public class Clearing {
|
|||
request.setCompanyId(execDeposit.getCompanyId());
|
||||
request.setFirstLegAmount(execDeposit.getFirstLegAmount());
|
||||
Long sentRequestId = kafka.sendRequestToQueue(Consts.BALANCE_ACCOUNT_UPDATE, request);
|
||||
log.trace("sent request to kafka, requestId: {}", sentRequestId);
|
||||
try {
|
||||
wait(5000);
|
||||
//todo check that request Id was processed succesfully
|
||||
|
|
@ -171,6 +181,7 @@ public class Clearing {
|
|||
}
|
||||
LiabilitiesClaimsAssets liabilitiesClaimsAssets = lbltsClmsAssetsCreator.createLiabilitiesClaimsAssets(category, execDeposit);
|
||||
liabilitiesClaimsAssetsImdg.insert(liabilitiesClaimsAssets);
|
||||
log.trace("LiabilitiesClaimsAssets {} was created", liabilitiesClaimsAssets.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,4 +61,12 @@ public interface IEnumId extends Serializable {
|
|||
default boolean equalsById(Long id) {
|
||||
return id != null && getId().equals(id);
|
||||
}
|
||||
|
||||
default String nameOrId() {
|
||||
try {
|
||||
return ((Enum<?>) this).name();
|
||||
} catch (ClassCastException e) {
|
||||
return getId().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue