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;
|
boolean financialError = false;
|
||||||
for (ExecutionDeposit execDeposit : executionDeposits) {
|
for (ExecutionDeposit execDeposit : executionDeposits) {
|
||||||
if (deniedIds.contains(execDeposit.getId())) {
|
if (deniedIds.contains(execDeposit.getId())) {
|
||||||
|
log.trace("executionDeposit {} was already denied", execDeposit.getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (financialError) {
|
if (financialError) {
|
||||||
|
log.trace("executionDeposit {} FinancialObligationNotSatisfied was present earlier for this company; setting DENIED status", execDeposit.getId());
|
||||||
updateDenied(execDeposit);
|
updateDenied(execDeposit);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
IValidator validator = validation.apply(category, execDeposit);
|
IValidator validator = validation.apply(category, execDeposit);
|
||||||
Optional<EnumMessage> errorMsg = validator.tillFirstError();
|
Optional<EnumMessage> errorMsg = validator.tillFirstError();
|
||||||
if (errorMsg.isPresent() && !ClearingErrorInternal.FinancialObligationNotSatisfied.equals(errorMsg.get().getSubject())) {
|
if (errorMsg.isPresent() && !ClearingErrorInternal.FinancialObligationNotSatisfied.equals(errorMsg.get().getSubject())) {
|
||||||
|
log.trace("executionDeposit {} setting DENIED status: {}", execDeposit.getId(), errorMsg.get().getSubject().nameOrId());
|
||||||
updateDenied(execDeposit);
|
updateDenied(execDeposit);
|
||||||
continue;
|
continue;
|
||||||
} else if (errorMsg.isPresent()) {
|
} else if (errorMsg.isPresent()) {
|
||||||
|
log.trace("executionDeposit {} setting DENIED status: {}", execDeposit.getId(), errorMsg.get().getSubject().nameOrId());
|
||||||
financialError = true;
|
financialError = true;
|
||||||
updateDenied(execDeposit);
|
updateDenied(execDeposit);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
updateAllowed(execDeposit);
|
updateAllowed(execDeposit);
|
||||||
|
log.trace("executionDeposit {} was updated ALLOWED", execDeposit.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,6 +122,7 @@ public class Clearing {
|
||||||
execDeposit.setCoverageStatus(Allowed.DENIED.getKey());
|
execDeposit.setCoverageStatus(Allowed.DENIED.getKey());
|
||||||
execDeposit.setUpdated(Instant.now());
|
execDeposit.setUpdated(Instant.now());
|
||||||
executionDepositImdg.update(execDeposit);
|
executionDepositImdg.update(execDeposit);
|
||||||
|
log.trace("executionDeposit {} was updated DENIED", execDeposit.getId());
|
||||||
//также необходимо установить статус DEND встречной сделке контрагента этой компании, которая выбирается из executionDeposit по ключу:
|
//также необходимо установить статус DEND встречной сделке контрагента этой компании, которая выбирается из executionDeposit по ключу:
|
||||||
//securityId И чтобы сделка была компании категории clearingMemberCategory.clearingMemberCategory ≠ той категории, сделка которой обрабатывается в настоящий момент.
|
//securityId И чтобы сделка была компании категории clearingMemberCategory.clearingMemberCategory ≠ той категории, сделка которой обрабатывается в настоящий момент.
|
||||||
ExecutionDeposit matchedExecDeposit = executionDepositImdg.getSingleObjectBySQL(
|
ExecutionDeposit matchedExecDeposit = executionDepositImdg.getSingleObjectBySQL(
|
||||||
|
|
@ -126,6 +132,7 @@ public class Clearing {
|
||||||
matchedExecDeposit.setCoverageStatus(Allowed.DENIED.getKey());
|
matchedExecDeposit.setCoverageStatus(Allowed.DENIED.getKey());
|
||||||
matchedExecDeposit.setUpdated(Instant.now());
|
matchedExecDeposit.setUpdated(Instant.now());
|
||||||
executionDepositImdg.update(matchedExecDeposit);
|
executionDepositImdg.update(matchedExecDeposit);
|
||||||
|
log.trace("executionDeposit {} matching executionDeposit {} was updated DENIED", execDeposit.getId(), matchedExecDeposit.getId());
|
||||||
deniedIds.add(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());
|
log.info("running clearing for category: {}, company: {}", category, executionDeposits.get(0).getCompanyId());
|
||||||
for (ExecutionDeposit execDeposit : executionDeposits) {
|
for (ExecutionDeposit execDeposit : executionDeposits) {
|
||||||
if (deniedIds.contains(execDeposit.getId())) {
|
if (deniedIds.contains(execDeposit.getId())) {
|
||||||
|
log.trace("Skipping processing executionDeposit {} was denied as matching", execDeposit.getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!Allowed.ALLOWED.getKey().equals(execDeposit.getCoverageStatus())) {
|
if (!Allowed.ALLOWED.getKey().equals(execDeposit.getCoverageStatus())) {
|
||||||
|
log.trace("Skipping processing executionDeposit {} was denied", execDeposit.getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//send request to kafka, wait for a reply
|
//send request to kafka, wait for a reply
|
||||||
|
|
@ -152,6 +161,7 @@ public class Clearing {
|
||||||
request.setCompanyId(execDeposit.getCompanyId());
|
request.setCompanyId(execDeposit.getCompanyId());
|
||||||
request.setFirstLegAmount(execDeposit.getFirstLegAmount());
|
request.setFirstLegAmount(execDeposit.getFirstLegAmount());
|
||||||
Long sentRequestId = kafka.sendRequestToQueue(Consts.BALANCE_ACCOUNT_UPDATE, request);
|
Long sentRequestId = kafka.sendRequestToQueue(Consts.BALANCE_ACCOUNT_UPDATE, request);
|
||||||
|
log.trace("sent request to kafka, requestId: {}", sentRequestId);
|
||||||
try {
|
try {
|
||||||
wait(5000);
|
wait(5000);
|
||||||
//todo check that request Id was processed succesfully
|
//todo check that request Id was processed succesfully
|
||||||
|
|
@ -171,6 +181,7 @@ public class Clearing {
|
||||||
}
|
}
|
||||||
LiabilitiesClaimsAssets liabilitiesClaimsAssets = lbltsClmsAssetsCreator.createLiabilitiesClaimsAssets(category, execDeposit);
|
LiabilitiesClaimsAssets liabilitiesClaimsAssets = lbltsClmsAssetsCreator.createLiabilitiesClaimsAssets(category, execDeposit);
|
||||||
liabilitiesClaimsAssetsImdg.insert(liabilitiesClaimsAssets);
|
liabilitiesClaimsAssetsImdg.insert(liabilitiesClaimsAssets);
|
||||||
|
log.trace("LiabilitiesClaimsAssets {} was created", liabilitiesClaimsAssets.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,4 +61,12 @@ public interface IEnumId extends Serializable {
|
||||||
default boolean equalsById(Long id) {
|
default boolean equalsById(Long id) {
|
||||||
return id != null && getId().equals(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