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(
|
||||
"workflowStatus", SessionStatus.ACTV.getKey()
|
||||
)) != 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();
|
||||
for (SDf57 sdf57 : sdf) {
|
||||
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",
|
||||
stmt.getId(), asts.a__t().getRegistryCode(), asts.a__t().getId());
|
||||
} else {
|
||||
log.trace("sending gateway request for stmt.id={}", stmt.getId());
|
||||
Optional<AssetOperationListRequest> gtwReq = gatewayRequest(stmt,
|
||||
company,
|
||||
account,
|
||||
asts.a__t().getTradingClearingRegistry());
|
||||
gtwReq.ifPresent(r -> kafka.sendRequestToQueue(Consts.ASSET_OPERATION, r));
|
||||
asts.a__t().getTradingClearingRegistry(),
|
||||
existActiveCurrSession);
|
||||
gtwReq.ifPresent(r -> {
|
||||
log.trace("sending gateway request for stmt.id={}", stmt.getId());
|
||||
kafka.sendRequestToQueue(Consts.ASSET_OPERATION, r);
|
||||
});
|
||||
}
|
||||
}
|
||||
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 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())) {
|
||||
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();
|
||||
AssetOperationListRequest gatewayRequest = new AssetOperationListRequest();
|
||||
Currency currency = currencyImdg.getSingleObjectByID(stmt.getSecurityId());
|
||||
|
|
@ -839,7 +854,6 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
|||
tradingCode,
|
||||
tcrCode,
|
||||
currency != null ? currency.getCurrencyCode() : CurrencyCode.RUB.getKey());
|
||||
String specif = stmt.getComment();
|
||||
Matcher m;
|
||||
if (!TextUtil.isEmpty(specif) && (m = csBlkd.matcher(specif)).find()) {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue