This commit is contained in:
parent
95ff52de20
commit
7cc1097c69
1 changed files with 12 additions and 6 deletions
|
|
@ -36,6 +36,7 @@ import ru.spcex.platform.enumeration.TradingClearingRegistryPurpose;
|
||||||
import ru.spcex.platform.enumeration.TradingClearingRegistryType;
|
import ru.spcex.platform.enumeration.TradingClearingRegistryType;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
|
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||||
import ru.spcex.platform.utils.validation.IValidator;
|
import ru.spcex.platform.utils.validation.IValidator;
|
||||||
|
|
||||||
|
|
@ -250,7 +251,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
tradingClearingRegistry.setTradingClearingRegistryPurpose(registryPurpose.getKey());
|
tradingClearingRegistry.setTradingClearingRegistryPurpose(registryPurpose.getKey());
|
||||||
|
|
||||||
Company company = companyImdg.getSingleObjectByID(req.getCompanyId());
|
Company company = companyImdg.getSingleObjectByID(req.getCompanyId());
|
||||||
Long seqId = companySequenceNextId(req.getCompanyId());
|
Long seqId = companySequenceNextId(req.getCompanyId(), registryPurpose, tradingRegistryType);
|
||||||
String code = makeCode(company.getClearingCode(), registryPurpose, tradingRegistryType, seqId);
|
String code = makeCode(company.getClearingCode(), registryPurpose, tradingRegistryType, seqId);
|
||||||
log.debug("For new TCR.id={} of companyId={} next sequence={}; code={}", id, req.getCompanyId(), seqId, code);
|
log.debug("For new TCR.id={} of companyId={} next sequence={}; code={}", id, req.getCompanyId(), seqId, code);
|
||||||
tradingClearingRegistry.setCode(code);
|
tradingClearingRegistry.setCode(code);
|
||||||
|
|
@ -329,7 +330,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
tradingClearingRegistry.setTradingClearingRegistryPurpose(registryPurpose.getKey());
|
tradingClearingRegistry.setTradingClearingRegistryPurpose(registryPurpose.getKey());
|
||||||
|
|
||||||
Company company = companyImdg.getSingleObjectByID(req.getCompanyId());
|
Company company = companyImdg.getSingleObjectByID(req.getCompanyId());
|
||||||
Long seqId = companySequenceNextId(req.getCompanyId());
|
Long seqId = companySequenceNextId(req.getCompanyId(), registryPurpose, tradingRegistryType);
|
||||||
String code = makeCode(company.getClearingCode(), registryPurpose, tradingRegistryType, seqId);
|
String code = makeCode(company.getClearingCode(), registryPurpose, tradingRegistryType, seqId);
|
||||||
log.debug("For new TCR.id={} of companyId={} next sequence={}; code={}", id, req.getCompanyId(), seqId, code);
|
log.debug("For new TCR.id={} of companyId={} next sequence={}; code={}", id, req.getCompanyId(), seqId, code);
|
||||||
tradingClearingRegistry.setCode(code);
|
tradingClearingRegistry.setCode(code);
|
||||||
|
|
@ -348,10 +349,15 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Long companySequenceNextId(Long companyId) {
|
protected Long companySequenceNextId(Long companyId, TradingClearingRegistryPurpose registryPurpose, String tradingRegistryType) {
|
||||||
Collection<TradingClearingRegistry> existTCR = tradingClearingRegistryImdg.getCollectionObjectsByFieldValues(Map.of(
|
ImdgPredicateBuilder pb = tradingClearingRegistryImdg.predicateBuilder();
|
||||||
"companyId", companyId
|
Collection<TradingClearingRegistry> existTCR = tradingClearingRegistryImdg.getCollectionObjectsByPredicate(
|
||||||
));
|
pb.and(
|
||||||
|
pb.equals("companyId", companyId),
|
||||||
|
pb.equals("tradingClearingRegistryPurpose", registryPurpose.getKey()),
|
||||||
|
pb.equals("tradingClearingRegistryType", tradingRegistryType)
|
||||||
|
)
|
||||||
|
);
|
||||||
if (existTCR.isEmpty()) {
|
if (existTCR.isEmpty()) {
|
||||||
log.trace("For company id={} not found exist TCR.", companyId);
|
log.trace("For company id={} not found exist TCR.", companyId);
|
||||||
return 1L;
|
return 1L;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue