don't send asset to gateway if active session exists and comment contains 'ПО ИТОГУ КЛИРИНГА'
This commit is contained in:
parent
1bd41b8f50
commit
94715bdd34
1 changed files with 19 additions and 5 deletions
|
|
@ -193,6 +193,11 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
boolean sessionIsPresent = sessionImdg.getFirstObjectByFieldValues(Map.of(
|
boolean sessionIsPresent = sessionImdg.getFirstObjectByFieldValues(Map.of(
|
||||||
"workflowStatus", SessionStatus.ACTV.getKey()
|
"workflowStatus", SessionStatus.ACTV.getKey()
|
||||||
)) != null;
|
)) != null;
|
||||||
|
boolean existActiveCurrSession = sessionImdg.getFirstObjectByFieldValues(
|
||||||
|
Map.of(
|
||||||
|
"workflowStatus", SessionStatus.ACTV.getKey(),
|
||||||
|
"sessionType", SessionType.CURR.getKey()
|
||||||
|
)) != null;
|
||||||
sdf = sdf.stream().sorted(Comparator.comparing(SpcexObjectBase::getId)).toList();
|
sdf = sdf.stream().sorted(Comparator.comparing(SpcexObjectBase::getId)).toList();
|
||||||
for (SDf57 sdf57 : sdf) {
|
for (SDf57 sdf57 : sdf) {
|
||||||
IValidator validator = sDf57Validator.apply(sdf57);
|
IValidator validator = sDf57Validator.apply(sdf57);
|
||||||
|
|
@ -396,12 +401,15 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
log.trace("stmt.id={} {}.id={} TCR is empty, skipping gateway request",
|
log.trace("stmt.id={} {}.id={} TCR is empty, skipping gateway request",
|
||||||
stmt.getId(), asts.a__t().getRegistryCode(), asts.a__t().getId());
|
stmt.getId(), asts.a__t().getRegistryCode(), asts.a__t().getId());
|
||||||
} else {
|
} else {
|
||||||
log.trace("sending gateway request for stmt.id={}", stmt.getId());
|
|
||||||
Optional<AssetOperationListRequest> gtwReq = gatewayRequest(stmt,
|
Optional<AssetOperationListRequest> gtwReq = gatewayRequest(stmt,
|
||||||
company,
|
company,
|
||||||
account,
|
account,
|
||||||
asts.a__t().getTradingClearingRegistry());
|
asts.a__t().getTradingClearingRegistry(),
|
||||||
gtwReq.ifPresent(r -> kafka.sendRequestToQueue(Consts.ASSET_OPERATION, r));
|
existActiveCurrSession);
|
||||||
|
gtwReq.ifPresent(r -> {
|
||||||
|
log.trace("sending gateway request for stmt.id={}", stmt.getId());
|
||||||
|
kafka.sendRequestToQueue(Consts.ASSET_OPERATION, r);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Optional.of(asts);
|
return Optional.of(asts);
|
||||||
|
|
@ -826,11 +834,18 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern csBlkd = Pattern.compile(SpecifFlag.CS_BLKD.getKey() + "_(\\d+).*");
|
private static final Pattern csBlkd = Pattern.compile(SpecifFlag.CS_BLKD.getKey() + "_(\\d+).*");
|
||||||
|
private static final String COMMENT_FOR_SKIPPING_SEND_ASSETS_CURR_SESSION = "ПО ИТОГУ КЛИРИНГА";
|
||||||
|
|
||||||
private Optional<AssetOperationListRequest> gatewayRequest(Statement stmt, Company company, Account account, String tcrCode) {
|
private Optional<AssetOperationListRequest> gatewayRequest(Statement stmt, Company company, Account account,
|
||||||
|
String tcrCode, boolean existActiveCurrSession) {
|
||||||
if (AccountType.Anlt.equalsByKey(account.getAccountType())) {
|
if (AccountType.Anlt.equalsByKey(account.getAccountType())) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
String specif = stmt.getComment();
|
||||||
|
if (existActiveCurrSession && !TextUtil.isEmpty(specif) &&
|
||||||
|
specif.toUpperCase().contains(COMMENT_FOR_SKIPPING_SEND_ASSETS_CURR_SESSION)) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
String tradingCode = company.getTradingCode();
|
String tradingCode = company.getTradingCode();
|
||||||
AssetOperationListRequest gatewayRequest = new AssetOperationListRequest();
|
AssetOperationListRequest gatewayRequest = new AssetOperationListRequest();
|
||||||
Currency currency = currencyImdg.getSingleObjectByID(stmt.getSecurityId());
|
Currency currency = currencyImdg.getSingleObjectByID(stmt.getSecurityId());
|
||||||
|
|
@ -839,7 +854,6 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
tradingCode,
|
tradingCode,
|
||||||
tcrCode,
|
tcrCode,
|
||||||
currency != null ? currency.getCurrencyCode() : CurrencyCode.RUB.getKey());
|
currency != null ? currency.getCurrencyCode() : CurrencyCode.RUB.getKey());
|
||||||
String specif = stmt.getComment();
|
|
||||||
Matcher m;
|
Matcher m;
|
||||||
if (!TextUtil.isEmpty(specif) && (m = csBlkd.matcher(specif)).find()) {
|
if (!TextUtil.isEmpty(specif) && (m = csBlkd.matcher(specif)).find()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue