PaymentInstructionOutboundService + search for anlt by contract

sdf57 session continue event fix
This commit is contained in:
ialbert 2023-09-26 19:13:24 +03:00
parent b9b3013b2d
commit f467b1062b
3 changed files with 16 additions and 3 deletions

View file

@ -89,7 +89,15 @@ public class AnltSearcher {
if (tcrIndex == -1) {
return null;
}
comment = comment.substring(tcrIndex + 3);
if (comment.length() < (tcrIndex + 4)) {
return null;
}
int spaceAfterTCR = comment.indexOf(" ", tcrIndex + 4);
if (spaceAfterTCR == -1) {
comment = comment.substring(tcrIndex + 4);
} else {
comment = comment.substring(tcrIndex + 4, spaceAfterTCR);
}
return comment.replaceAll("\\s+", "");
}

View file

@ -125,7 +125,7 @@ public class PaymentInstructionOutboundService {
log.debug("all checks passed, accCred.id={}, accDeb.id={}, addressee.id={}, sender.id={}, amount: {}",
accCred.getId(), accDeb.getId(), addressee.getId(), sender.getId(), amount);
String purpose = tcr != null ? "Вывод средств по ТКР " + tcr.getCode() + "." : "Вывод средств.";
String purpose = tcr != null ? "Вывод средств по ТКР " + tcr.getCode() + " ." : "Вывод средств.";
if (payload.getPaymentPurpose() != null) {
purpose += " " + payload.getPaymentPurpose();
if (!(purpose.endsWith(".") || purpose.endsWith("!") || purpose.endsWith("?") || purpose.endsWith(";"))) {

View file

@ -3,6 +3,7 @@ package ru.spcex.clearing.statement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.misc.Session;
import ru.clearing.classes.statics.data.sdf.*;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
@ -19,6 +20,7 @@ import ru.spcex.platform.classes.base.SpcexObjectBase;
import ru.spcex.platform.enumeration.ObjectType;
import ru.spcex.platform.enumeration.Priority;
import ru.spcex.platform.enumeration.SdfTable;
import ru.spcex.platform.enumeration.WorkflowStatus;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.utils.text.TextUtil;
@ -42,6 +44,7 @@ public class StatementServiceV2 {
private final Sdf57Executor sdf57Executor;
private final Sdf04Executor sdf04Executor;
private final Sdf13Executor sdf13Executor;
private final Imdg<Session> sessionImdg;
private final Reviser reviser;
private final SdfGroupManager grpMng;
@ -63,6 +66,7 @@ public class StatementServiceV2 {
this.sdf57Executor = sdf57Executor;
this.sdf04Executor = sdf04Executor;
this.sdf13Executor = sdf13Executor;
this.sessionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Session, Session.class);
this.reviser = reviser;
this.grpMng = grpMng;
}
@ -185,7 +189,8 @@ public class StatementServiceV2 {
removeFirstWithSameTableAndGroupId(sdf57);
reviser.doRevise(sdf01.getGroupId());
//теперь можем продолжить сессию с шага 1
if (!sessionStarted) {
if (!sessionStarted
|| sessionImdg.getFirstObjectBySQL("workflowStatus = '%s'".formatted(WorkflowStatus.Active.getKey())) != null) {
SessionContinueEvent continueSessionBn = new SessionContinueEvent(SdfTable.SDF_01, SdfTable.SDF_57);
kafkaSender.sendRequestToQueue(Consts.CONTINUE_SESSION_BN_FIRST_PART, continueSessionBn);
}