http://jira.mfd.msk:8088/browse/CLS-445
This commit is contained in:
parent
9518c7130a
commit
c92dc63fa8
5 changed files with 15 additions and 5 deletions
|
|
@ -33,7 +33,7 @@ public class RegistryManager {
|
|||
this.rgsImdg = rgsImdg;
|
||||
}
|
||||
|
||||
public Optional<Registry> searchDmx(Registry rgs) {
|
||||
public Optional<Registry> searchDmxByCounterParty(Registry rgs) {
|
||||
if (TextUtil.isEmpty(rgs.getContract())) return Optional.empty();
|
||||
String sqlCondition = String.format("(%s) and companyId = %d and contract = '%s'",
|
||||
RegistryCodeSqlBuilder.getInstance(DM_X).build(),
|
||||
|
|
@ -43,6 +43,16 @@ public class RegistryManager {
|
|||
return Optional.ofNullable(dmx);
|
||||
}
|
||||
|
||||
public Optional<Registry> searchDmxByCompanyId(Registry rgs) {
|
||||
if (TextUtil.isEmpty(rgs.getContract())) return Optional.empty();
|
||||
String sqlCondition = String.format("(%s) and companyId = %d and contract = '%s'",
|
||||
RegistryCodeSqlBuilder.getInstance(DM_X).build(),
|
||||
rgs.getCompanyId(),
|
||||
rgs.getContract());
|
||||
Registry dmx = rgsImdg.getFirstObjectBySQL(sqlCondition);
|
||||
return Optional.ofNullable(dmx);
|
||||
}
|
||||
|
||||
public Optional<Registry> searchDmtInfo(Registry rgs) {
|
||||
if (TextUtil.isEmpty(rgs.getContract())) return Optional.empty();
|
||||
String sqlCondition = String.format("(%s) and accountType='%s' and companyId = %d and counterPartyId = %d and contract = '%s'",
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public enum ReturnDepositValidationRule implements IValidationRule<ImdgValidatio
|
|||
Registry rgs = context.getStoredObject(Stored.PresentById);
|
||||
Imdg<Registry> rgsImdg = context.obtainMap(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
RegistryManager rgsMng = new RegistryManager(rgsImdg);
|
||||
Optional<Registry> dmx = rgsMng.searchDmx(rgs);
|
||||
Optional<Registry> dmx = rgsMng.searchDmxByCompanyId(rgs);
|
||||
if (dmx.isPresent() && RegistryStatus.OK.equalsByKey(dmx.get().getRegistryStatus()) ) {
|
||||
return of(ClearingError.ObligationsAlreadyCalculated);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class FormingPaymentInstructionDepositReturn implements ISessionStage {
|
|||
}
|
||||
Registry lm_t = lmtO.get(); //obligation by money
|
||||
Registry cm_t = cmtO.get();
|
||||
Optional<Registry> dmx = rgsMng.searchDmx(lm_t);
|
||||
Optional<Registry> dmx = rgsMng.searchDmxByCounterParty(lm_t);
|
||||
if (dmx.isPresent()) {
|
||||
log.debug("LM*T#id={}, DM*X#id={} found, no action needed for group {}, skipping liability",
|
||||
lm_t.getId(), dmx.get().getId(), lm_t.getGroupId());
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public class FormingPaymentInstructionReturnMkr implements ISessionStage {
|
|||
}
|
||||
Registry lm_t = lmtO.get(); //obligation by money
|
||||
Registry cm_t = cmtO.get();
|
||||
Optional<Registry> dmx = rgsMng.searchDmx(lm_t);
|
||||
Optional<Registry> dmx = rgsMng.searchDmxByCounterParty(lm_t);
|
||||
if (dmx.isPresent()) {
|
||||
log.debug("LM*T#id={}, DM*X#id={} found, no action needed for group {}, skipping liability",
|
||||
lm_t.getId(), dmx.get().getId(), lm_t.getGroupId());
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class InspectionObligationsDepositReturn implements ISessionStage {
|
|||
}
|
||||
|
||||
//вторая часть сделки - возврат депозита
|
||||
Optional<Registry> dmx = rgsMng.searchDmx(omtRgs);
|
||||
Optional<Registry> dmx = rgsMng.searchDmxByCounterParty(omtRgs);
|
||||
if (dmx.isPresent()) {
|
||||
BigDecimal dmxBalance = safeBD(dmx.get().getBalance());
|
||||
log.debug("OM*T.id={} -> DM*X.id={}, dmxBalance={}, omtBalance={}",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue