группировка registry с учетом market и groupId для шага 7 активной сессии
This commit is contained in:
parent
8b21e7aec2
commit
aa38fa986a
2 changed files with 10 additions and 8 deletions
|
|
@ -23,6 +23,7 @@ import ru.clearing.classes.statics.data.registry.Registry;
|
|||
import ru.clearing.classes.statics.data.sdf.SDf03;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf12;
|
||||
import ru.clearing.classes.statics.data.security.Security;
|
||||
import ru.spcex.clearing.component.GroupRgsKey;
|
||||
import ru.spcex.clearing.error.ClearingError;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
|
|
@ -126,18 +127,18 @@ public class FormingPaymentInstructionDepositReturn implements ISessionStage {
|
|||
.filter(rgs -> rgs.getSettlementDate().isAfter(rgs.getValueDate()))
|
||||
.toList();
|
||||
|
||||
Map<Long, List<Registry>> registriesByGroup = obligations
|
||||
Map<GroupRgsKey, List<Registry>> registriesByGroup = obligations
|
||||
.stream().
|
||||
collect(Collectors.groupingBy(Registry::getGroupId));
|
||||
collect(Collectors.groupingBy(registry -> new GroupRgsKey(registry.getGroupId(), registry.getMarket())));
|
||||
log.info("registry groups found {}", registriesByGroup.size());
|
||||
|
||||
ArrayList<PaymentInstruction> pmtCreated = new ArrayList<>();
|
||||
for (Map.Entry<Long, List<Registry>> entry : registriesByGroup.entrySet()) {
|
||||
for (Map.Entry<GroupRgsKey, List<Registry>> entry : registriesByGroup.entrySet()) {
|
||||
List<Registry> groupRgs = entry.getValue();
|
||||
Optional<Registry> lmtO = groupRgs.stream().filter(rgs -> RegistryManager.equalsByCode(RegistryTradingParams.OM_T, rgs)).findFirst();
|
||||
Optional<Registry> cmtO = groupRgs.stream().filter(rgs -> RegistryManager.equalsByCode(RegistryTradingParams.TM_T, rgs)).findFirst();
|
||||
if (lmtO.isEmpty() || cmtO.isEmpty()) {
|
||||
log.error("groupId {} LM*T or CM*T not found", entry.getKey());
|
||||
log.error("groupId/market {}/{} LM*T or CM*T not found", entry.getKey().groupId(), entry.getKey().market());
|
||||
continue;
|
||||
}
|
||||
Registry lm_t = lmtO.get(); //obligation by money
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import ru.clearing.classes.statics.data.registry.Registry;
|
|||
import ru.clearing.classes.statics.data.sdf.SDf03;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf12;
|
||||
import ru.clearing.classes.statics.data.security.Security;
|
||||
import ru.spcex.clearing.component.GroupRgsKey;
|
||||
import ru.spcex.clearing.error.ClearingError;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
|
|
@ -151,16 +152,16 @@ public class FormingPaymentInstructionReturnMkr implements ISessionStage {
|
|||
|
||||
List<PaymentInstruction> pmtCreated = new ArrayList<>();
|
||||
|
||||
Map<Long, List<Registry>> registriesByGroup = rgsAll
|
||||
Map<GroupRgsKey, List<Registry>> registriesByGroup = rgsAll
|
||||
.stream().
|
||||
collect(Collectors.groupingBy(Registry::getGroupId));
|
||||
collect(Collectors.groupingBy(registry -> new GroupRgsKey(registry.getGroupId(), registry.getMarket())));
|
||||
log.info("registry groups found {}", registriesByGroup.size());
|
||||
for (Map.Entry<Long, List<Registry>> entry : registriesByGroup.entrySet()) {
|
||||
for (Map.Entry<GroupRgsKey, List<Registry>> entry : registriesByGroup.entrySet()) {
|
||||
List<Registry> groupRgs = entry.getValue();
|
||||
Optional<Registry> lmtO = groupRgs.stream().filter(rgs -> equalByRgs(RegistryTradingParams.OM_T, rgs)).findFirst();
|
||||
Optional<Registry> cmtO = groupRgs.stream().filter(rgs -> equalByRgs(RegistryTradingParams.TM_T, rgs)).findFirst();
|
||||
if (lmtO.isEmpty() || cmtO.isEmpty()) {
|
||||
log.error("LM*T or CM*T not found for group {}", entry.getKey());
|
||||
log.error("LM*T or CM*T not found for group/market {}/{}", entry.getKey().groupId(), entry.getKey().market());
|
||||
continue;
|
||||
}
|
||||
Registry lm_t = lmtO.get(); //obligation by money
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue