etreschenkov 2023-05-29 18:33:28 +03:00
parent 0390f3d20e
commit 3bf9d651cd

View file

@ -71,6 +71,11 @@ public class InspectionObligations implements ISessionStage {
null, null,
RegistryUnit.T); RegistryUnit.T);
RegistryTradingParams registryTradingParamsTST = new RegistryTradingParams(RegistryDesignation.T,
RegistryInstrumentType.S,
null,
RegistryUnit.T);
RegistryTradingParams registryTradingParamsTMT = new RegistryTradingParams(RegistryDesignation.T, RegistryTradingParams registryTradingParamsTMT = new RegistryTradingParams(RegistryDesignation.T,
RegistryInstrumentType.M, RegistryInstrumentType.M,
null, null,
@ -78,7 +83,7 @@ public class InspectionObligations implements ISessionStage {
String sqlCondition = String.format("%s and registryStatus = '%s'", String sqlCondition = String.format("%s and registryStatus = '%s'",
RegistryCodeSqlBuilder.getInstance(registryTradingParamsOST, registryTradingParamsTMT, registryTradingParamsOMT).build(), RegistryCodeSqlBuilder.getInstance(registryTradingParamsOST, registryTradingParamsTMT, registryTradingParamsOMT, registryTradingParamsTST).build(),
RegistryStatus.POOL.getKey()); RegistryStatus.POOL.getKey());
Collection<Registry> obligations = registryImdg.getCollectionObjectsBySQL(sqlCondition); Collection<Registry> obligations = registryImdg.getCollectionObjectsBySQL(sqlCondition);
@ -92,10 +97,6 @@ public class InspectionObligations implements ISessionStage {
log.debug("Skip insecurity groupId: {}", currentRegistry.getGroupId()); log.debug("Skip insecurity groupId: {}", currentRegistry.getGroupId());
continue; continue;
} }
if (IEnumKey.getEnumByKey(RegistryDesignation.class, currentRegistry.getRegistryDesignation()) == RegistryDesignation.O) {
log.debug("Its t registry, skip");
continue;
}
RegistryTradingParams counterRegistryTradingParams = null; RegistryTradingParams counterRegistryTradingParams = null;
if (IEnumKey.getEnumByKey(RegistryDesignation.class, currentRegistry.getRegistryDesignation()) == RegistryDesignation.O if (IEnumKey.getEnumByKey(RegistryDesignation.class, currentRegistry.getRegistryDesignation()) == RegistryDesignation.O
@ -112,15 +113,23 @@ public class InspectionObligations implements ISessionStage {
RegistryUnit.F); RegistryUnit.F);
} }
if (counterRegistryTradingParams == null) {
continue;
}
String sqlCounterRegistryCondition = String.format("%s and " + String sqlCounterRegistryCondition = String.format("%s and " +
"tradingClearingRegistryId = '%s' and " + "tradingClearingRegistryId = '%s' and " +
"companyId = '%s' and ", "companyId = '%s'",
RegistryCodeSqlBuilder.getInstance(counterRegistryTradingParams).build(), RegistryCodeSqlBuilder.getInstance(counterRegistryTradingParams).build(),
currentRegistry.getTradingClearingRegistryId(), currentRegistry.getTradingClearingRegistryId(),
currentRegistry.getCompanyId()); currentRegistry.getCompanyId());
Registry counterRegistry = registryImdg.getSingleObjectBySQL(sqlCounterRegistryCondition); Registry counterRegistry = registryImdg.getSingleObjectBySQL(sqlCounterRegistryCondition);
if (counterRegistry == null) {
log.warn("Not found registry by params: {}", sqlCounterRegistryCondition);
continue;
}
if (currentRegistry.getBalance().compareTo(counterRegistry.getBalance()) > 0) { if (currentRegistry.getBalance().compareTo(counterRegistry.getBalance()) > 0) {
log.warn("{}", msgResolver.resolve(new EnumMessage(ClearingError.InsecurityObligation, currentRegistry.getCompanyId()))); log.warn("groupId: {}: {}", currentRegistry.getGroupId(),
msgResolver.resolve(new EnumMessage(ClearingError.InsecurityObligation, currentRegistry.getCompanyId())));
currentRegistry.setRegistryStatus("UNCV"); currentRegistry.setRegistryStatus("UNCV");
alreadyUpdatedToUncover.add(currentRegistry.getId()); alreadyUpdatedToUncover.add(currentRegistry.getId());
insecurityGroups.add(currentRegistry.getGroupId()); insecurityGroups.add(currentRegistry.getGroupId());