ialbert 2025-02-19 15:49:20 +03:00
parent 02c7669d9f
commit 47bcf7acc8
3 changed files with 43 additions and 0 deletions

View file

@ -258,6 +258,26 @@ public class RegistryService {
Stream.of(assets.a__t(), assets.a__b(), assets.a__f())
.forEach(a -> {
RegistryTradingParams rgsCde = RegistryTradingParams.of(
a.getRegistryDesignation(),
a.getRegistryInstrumentType(),
a.getRegistryCapacity(),
a.getRegistryUnit());
Collection<Registry> assetFound = this.assets.searchByParamsWithoutStatusCondition(
a.getAccount(),
a.getSecuritySymbol(),
a.getCompanyId(),
rgsCde
);
if (!assetFound.isEmpty()) {
String idsFound = assetFound
.stream()
.map(Registry::getId)
.map(Object::toString)
.collect(Collectors.joining(";", "[", "]"));
log.debug("TCR#id={} account#id={} company#id={}: {} asset already present: (#id={}), skipping;",
tcr.getId(), acc.getId(), cmp.getId(), a.getRegistryCode(), idsFound);
}
a.setRegistryStatus(RegistryStatus.PROC.getKey());
registryImdg.insert(a);
});

View file

@ -135,6 +135,20 @@ public class AssetTBFProcessing {
return rgsImdg.getCollectionObjectsByPredicate(d__iPrdct);
}
public Collection<Registry> searchByParamsWithoutStatusCondition(String account,
String securitySymbol,
Long companyId,
RegistryTradingParams params) {
ImdgPredicateBuilder pb = rgsImdg.predicateBuilder();
ImdgPredicate d__iPrdct = pb.and(
pb.equals("account", account),
pb.equals("securitySymbol", securitySymbol),
pb.equals("companyId", companyId),
pb.sql(RegistryCodeSqlBuilder.getInstance(params).build())
);
return rgsImdg.getCollectionObjectsByPredicate(d__iPrdct);
}
public void processByAm_b(Registry am_b, BigDecimal sum) {
Optional<Registry> am_f = rgsMng.findRegByUnit(am_b.getCompanyId(),
am_b.getAccountId(),

View file

@ -16,6 +16,15 @@ public record RegistryTradingParams(RegistryDesignation registryDesignation,
return isEqualDesignation && isEqualInstrumentType && isEqualCapacity && isEqualUnit;
}
public static RegistryTradingParams of(String dsgn, String insType, String cap, String unit) {
return new RegistryTradingParams(
IEnumKey.getEnumByKey(RegistryDesignation.class, dsgn),
IEnumKey.getEnumByKey(RegistryInstrumentType.class, insType),
IEnumKey.getEnumByKey(RegistryCapacity.class, cap),
IEnumKey.getEnumByKey(RegistryUnit.class, unit)
);
}
public RegistryTradingParams dsgn(RegistryDesignation registryDesignation) {
return new RegistryTradingParams(registryDesignation,
registryInstrumentType,