registry update by created TCR

This commit is contained in:
ialbert 2023-10-11 18:52:51 +03:00
parent 789f18181a
commit 4006c1f233

View file

@ -170,10 +170,17 @@ public class RegistryService {
log.trace("TCR#id={} registry#id={} updated", tcr.getId(), rgs.getId());
});
if (registries.size() > 0) {
if (registries.stream().anyMatch(r -> RegistryInstrumentType.M.equalsByKey(r.getRegistryInstrumentType()))) {
log.info("assets size {} updated by TCR#id={}, will not create new assets",
registries.size(), tcr.getId());
return;
} else if (tcr.getMoneyAccountId() == null) {
log.info("assets size {} updated by TCR#id={}, TCR#moneyAccountId 'null'. will not create AM**",
registries.size(), tcr.getId());
return;
} else {
log.info("assets size {} updated by TCR#id={}, TCR#moneyAccountId {}. creating new AM**...",
registries.size(), tcr.getId(), tcr.getMoneyAccountId());
}
Account acc = accImdg.getSingleObjectByID(tcr.getMoneyAccountId());
@ -415,8 +422,14 @@ public class RegistryService {
if (moneyPredicate.isEmpty() && depoPredicate.isEmpty()) {
return Optional.empty();
}
ImdgPredicate accIdPrdct;
if (moneyPredicate.isPresent() && depoPredicate.isPresent()) {
accIdPrdct = prdBldr.or(moneyPredicate.get(), depoPredicate.get());
} else {
accIdPrdct = prdBldr.and(moneyPredicate.orElse(prdBldr.alwaysTrue()), depoPredicate.orElse(prdBldr.alwaysTrue()));
}
return Optional.ofNullable(prdBldr.and(
prdBldr.and(moneyPredicate.orElse(prdBldr.alwaysTrue()), depoPredicate.orElse(prdBldr.alwaysTrue())),
accIdPrdct,
prdBldr.equals("companyId", companyId),
prdBldr.sql("tradingClearingRegistryId == null")
));