группировка registry с учетом market и groupId для шага 4 активной сессии
This commit is contained in:
parent
86917e91fd
commit
f78d4394c3
1 changed files with 11 additions and 6 deletions
|
|
@ -18,12 +18,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionCommon;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionCurrency;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionDeposit;
|
||||
import ru.clearing.classes.statics.data.execution.ExecutionFond;
|
||||
import ru.clearing.classes.statics.data.misc.Session;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.component.GroupRgsKey;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.session.stage.ISessionStage;
|
||||
|
|
@ -129,17 +131,17 @@ public class InclusionObligations implements ISessionStage {
|
|||
}
|
||||
log.info("Inclusion to pool with predicate: {}", registryPredicate.toString());
|
||||
Collection<Registry> obligations = registryImdg.getCollectionObjectsByPredicate(registryPredicate);
|
||||
Map<Long, List<Registry>> registryByGroupId = obligations.stream()
|
||||
Map<GroupRgsKey, List<Registry>> registryByGroupId = obligations.stream()
|
||||
.filter(registry -> registry.getSettlementDate().isEqual(LocalDate.now()))
|
||||
.collect(Collectors.groupingBy(Registry::getGroupId));
|
||||
.collect(Collectors.groupingBy(registry -> new GroupRgsKey(registry.getGroupId(), registry.getMarket())));
|
||||
|
||||
Optional<SessionType> ssnType = obtainSessionType(sessionId);
|
||||
Map<Long, Registry> rgsToUpdate = new HashMap<>();
|
||||
List<ExecutionCommon> execsToUpdate = new ArrayList<>();
|
||||
boolean loadExecs = !IEnumKey.contains(sessionType,
|
||||
SessionType.TRDT, SessionType.CURR, SessionType.UNIT, SessionType.IPOT);
|
||||
for (Map.Entry<Long, List<Registry>> entrySet : registryByGroupId.entrySet()) {
|
||||
log.debug("Processing set of registry with groupId: {}", entrySet.getKey());
|
||||
for (Map.Entry<GroupRgsKey, List<Registry>> entrySet : registryByGroupId.entrySet()) {
|
||||
log.debug("Processing set of registry with groupId/market: {}/{}", entrySet.getKey().groupId(), entrySet.getKey().market());
|
||||
String rgsSection = null;
|
||||
for (Registry registry : entrySet.getValue()) {
|
||||
registry.setRegistryStatus(RegistryStatus.POOL.getKey());
|
||||
|
|
@ -164,7 +166,7 @@ public class InclusionObligations implements ISessionStage {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends ExecutionCommon> Collection<ExecutionCommon> updateExecutions(Long sessionId, Long rgsGroupId, String rgsSection) {
|
||||
private <T extends ExecutionCommon> Collection<ExecutionCommon> updateExecutions(Long sessionId, GroupRgsKey groupRgsKey, String rgsSection) {
|
||||
Instant now = Instant.now();
|
||||
SessionType ssnTpe = obtainSessionType(sessionId).orElse(null);
|
||||
if (ssnTpe == null || sessionId == null) {
|
||||
|
|
@ -193,7 +195,10 @@ public class InclusionObligations implements ISessionStage {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
ImdgPredicateBuilder pb = execImdg.predicateBuilder();
|
||||
ImdgPredicate prdct = pb.equals("exchangeExecutionId", rgsGroupId);
|
||||
ImdgPredicate prdct = pb.and(
|
||||
pb.equals("exchangeExecutionId", groupRgsKey.groupId()),
|
||||
StringUtils.hasText(groupRgsKey.market()) ? pb.equals("market", groupRgsKey.market()) : pb.alwaysTrue()
|
||||
);
|
||||
Collection<T> execs = execImdg.getCollectionObjectsByPredicate(prdct);
|
||||
//Imdg<T> finalExecImdg = execImdg;
|
||||
execs.forEach(e -> {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue