UNIT финальный шаг coverageStatus

This commit is contained in:
ialbert 2024-06-18 19:13:28 +03:00
parent ccef5a7590
commit 10f1e2a7b9

View file

@ -2,7 +2,9 @@ package ru.spcex.clearing.session.stage.impl;
import java.time.Instant;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@ -33,6 +35,7 @@ import ru.spcex.clearing.session.stage.ISessionStage;
import ru.spcex.clearing.session.stage.StageResult;
import ru.spcex.clearing.session.stage.Task;
import ru.spcex.clearing.session.stage.task.FinishingSessionPayload;
import ru.spcex.platform.classes.base.interfaces.ExecutionType;
import ru.spcex.platform.enumeration.CoverageStatus;
import ru.spcex.platform.enumeration.RegistryDesignation;
import ru.spcex.platform.enumeration.RegistryStatus;
@ -146,7 +149,7 @@ public class FinishingSession implements ISessionStage {
int allowed = 0;
int notAllowed = 0;
SessionType sessionType = getEnumByKey(SessionType.class, session.getSessionType());
if (IEnumKey.contains(sessionType, SessionType.FINL, SessionType.MEDM)) {
if (IEnumKey.contains(sessionType, SessionType.FINL, SessionType.MEDM, SessionType.UNIT)) {
Collection<ExecutionDeposit> executions = findExecutionDepositBySessionId(sessionId);
log.trace("loaded {} ExecutionDeposits for sessionId {}", executions.size(), sessionId);
for (ExecutionDeposit execution : executions) {
@ -171,7 +174,8 @@ public class FinishingSession implements ISessionStage {
allowed,
notAllowed,
executions.size() - (allowed + notAllowed));
} else if (IEnumKey.contains(sessionType, SessionType.CURR, SessionType.TRDT, SessionType.IPOB, SessionType.IPO0, SessionType.IPOT)) {
}
if (IEnumKey.contains(sessionType, SessionType.CURR, SessionType.TRDT, SessionType.IPOB, SessionType.IPO0, SessionType.IPOT, SessionType.UNIT)) {
Collection<? extends ExecutionCommon> executions = findExecutionFondBySessionId(sessionId, sessionType);
log.trace("loaded {} Executions for sessionId {}", executions.size(), sessionId);
for (ExecutionCommon execution : executions) {
@ -188,7 +192,7 @@ public class FinishingSession implements ISessionStage {
}
execution.setCoverageStatus(toStatus.getKey());
execution.setUpdated(Instant.now());
if (sessionType.equals(SessionType.CURR)) {
if (execution.type().equals(ExecutionType.ExecutionCurrency)) {
executionCurrencyImdg.update((ExecutionCurrency) execution);
} else {
executionFondImdg.update((ExecutionFond) execution);
@ -310,12 +314,25 @@ public class FinishingSession implements ISessionStage {
}
protected Collection<? extends ExecutionCommon> findExecutionFondBySessionId(Long sessionId, SessionType sessionType) {
if (sessionType.equals(SessionType.UNIT)) {
List<ExecutionCommon> res = new ArrayList<>();
res.addAll(findExecutionFondBySessionId(sessionId, executionCurrencyImdg));
res.addAll(findExecutionFondBySessionId(sessionId, executionFondImdg));
return res;
} else {
Imdg<? extends ExecutionCommon> excImdg;
if (sessionType.equals(SessionType.CURR)) {
excImdg = executionCurrencyImdg;
} else {
excImdg = executionFondImdg;
}
return findExecutionFondBySessionId(sessionId, excImdg);
}
}
protected Collection<? extends ExecutionCommon> findExecutionFondBySessionId(
Long sessionId,
Imdg<? extends ExecutionCommon> excImdg) {
ImdgPredicateBuilder pb = excImdg.predicateBuilder();
ImdgPredicate prdct = pb.or(
pb.equals("sessionId", sessionId),