sdf57 session autostart fix awaiting sdfs

sdf57 dmau logic only for InOutDirection.in
identificationFunds dmau.debit/am_t.credit
This commit is contained in:
ialbert 2023-09-26 13:21:47 +03:00
parent 1a0601ba56
commit 0961748a2a
4 changed files with 22 additions and 5 deletions

View file

@ -256,11 +256,15 @@ public class RegistryService {
AssetTrio asts = validator.getStored(ValidationStored.IdentificationFundsAssetTrio);
Account anltAcc = validator.getStored(Stored.AnltAccount);
BigDecimal dmauBalance = safeBD(dmau.getBalance());
BigDecimal dmauDebitBalance = safeBD(dmau.getDebit());
BigDecimal reqBalance = payload.getBalance();
BigDecimal am_tBalance = safeBD(asts.a__t().getBalance());
BigDecimal am_tCreditBalance = safeBD(asts.a__t().getCredit());
dmau.setBalance(dmauBalance.subtract(reqBalance));
dmau.setDebit(dmauDebitBalance.add(reqBalance));
asts.a__t().setBalance(am_tBalance.add(reqBalance));
asts.a__t().setCredit(am_tCreditBalance.add(reqBalance));
Instant now = Instant.now();
dmau.setUpdated(now);
asts.a__t().setUpdated(now);

View file

@ -370,7 +370,7 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
sdf57.getDbfId().toString());
asts.ifPresent(trio -> assets.process(trio.a__b(), trio.a__t(), trio.a__f(), BigDecimal.ZERO));
}
} else {
} else if (InOutDirection.in.equals(IEnumKey.getEnumByKey(InOutDirection.class, stmt.getInOutDirection()))) {
log.debug("stmt.id={} comment='{}' error: {}. Operating through DMAU registry",
stmt.getId(),
stmt.getComment(),
@ -417,6 +417,7 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
statementCred.map(stmt -> new StmtCmpAcc(stmt, companyCred, accountCred)).ifPresent(registersUpdate);
}
if (sessionIsNeededFlag.get()) {
result.setSessionWasStarted(true);
LauncherCommandRequest sessionTask = new LauncherCommandRequest();
sessionTask.setSection(Section.MKR.getKey());
sessionTask.setSessionType(SessionType.XDEP.getKey());

View file

@ -10,6 +10,7 @@ public class Result {
private Long childGenerationId;
private String fileName;
private boolean anyHasError;
private boolean sessionWasStarted = false;
public List<AccountSdfRequestPart> getAccountRequests() {
return accountRequests;
@ -42,4 +43,12 @@ public class Result {
public void setAnyHasError(boolean anyHasError) {
this.anyHasError = anyHasError;
}
public boolean isSessionWasStarted() {
return sessionWasStarted;
}
public void setSessionWasStarted(boolean sessionWasStarted) {
this.sessionWasStarted = sessionWasStarted;
}
}

View file

@ -181,12 +181,14 @@ public class StatementServiceV2 {
return;
}
//затем sdf57
processSdf57(sdf57);
boolean sessionStarted = processSdf57(sdf57);
removeFirstWithSameTableAndGroupId(sdf57);
reviser.doRevise(sdf01.getGroupId());
//теперь можем продолжить сессию с шага 1
SessionContinueEvent continueSessionBn = new SessionContinueEvent(SdfTable.SDF_01, SdfTable.SDF_57);
kafkaSender.sendRequestToQueue(Consts.CONTINUE_SESSION_BN_FIRST_PART, continueSessionBn);
if (!sessionStarted) {
SessionContinueEvent continueSessionBn = new SessionContinueEvent(SdfTable.SDF_01, SdfTable.SDF_57);
kafkaSender.sendRequestToQueue(Consts.CONTINUE_SESSION_BN_FIRST_PART, continueSessionBn);
}
log.info("pair sdf01/sdf57 processed successfully");
}
@ -242,12 +244,13 @@ public class StatementServiceV2 {
return res;
}
private void processSdf57(StatementRequest statementRequest) {
private boolean processSdf57(StatementRequest statementRequest) {
Imdg<SDf57> sdfImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_SDf57, SDf57.class);
Collection<? extends SpcexObjectBase> sdfGroup = sdfImdg.getCollectionObjectsByFieldValues(Map.of(
"generationId", statementRequest.getGroupId()));
AbstractExecutor service = sdf57Executor;
Result res = service.execute(sdfGroup, statementRequest);
return res.isSessionWasStarted();
// finishSendCommand(res, service, statementRequest);
}