This commit is contained in:
parent
68bf6a78d0
commit
6bff686528
1 changed files with 19 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ import org.springframework.util.StringUtils;
|
|||
import ru.spcex.clearing.platform.messaging.domain.cud.securitites.DigitalCertificateSecurityGatewayRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.securitites.DigitalCertificateSecurityNewRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.securitites.DigitalCertificateSecurityUpdateRequest;
|
||||
import ru.spcex.platform.enumeration.Allowed;
|
||||
import ru.spcex.platform.enumeration.InstrumentType;
|
||||
import ru.spcex.platform.enumeration.NominalTypeCode;
|
||||
|
||||
|
|
@ -44,8 +45,10 @@ public class DigitalCertificateRequestBuilder {
|
|||
|
||||
Optional<InstrumentType> clrInstrumentType = resolveInstrumentType(gatewayRequest.getInstrumentType());
|
||||
Optional<NominalTypeCode> clrNominalTypeCode = resolveTypeCode(gatewayRequest.getTypeCode());
|
||||
Optional<Allowed> nominalIndexationSign = resolveNominalIndexFact(gatewayRequest.getNominalIndexFact());
|
||||
clrInstrumentType.ifPresent(instrumentType -> newRequest.setInstrumentType(instrumentType.getKey()));
|
||||
clrNominalTypeCode.ifPresent(nominalTypeCode -> newRequest.setNominalTypeCode(nominalTypeCode.getKey()));
|
||||
nominalIndexationSign.ifPresent(indexFact -> newRequest.setNominalIndexationSign(indexFact.getKey()));
|
||||
|
||||
newRequest.setBaseCode(gatewayRequest.getDepoDcId());
|
||||
newRequest.setIssuerId(companyId);
|
||||
|
|
@ -61,7 +64,6 @@ public class DigitalCertificateRequestBuilder {
|
|||
newRequest.setDepository(gatewayRequest.getSettlementDepository());
|
||||
newRequest.setNominalIndexationDate(gatewayRequest.getNominalIndexDate());
|
||||
newRequest.setNominalValue(gatewayRequest.getNominalDenominationUnitForDate());
|
||||
newRequest.setNominalIndexationSign(gatewayRequest.getNominalIndexFact());
|
||||
return newRequest;
|
||||
}
|
||||
|
||||
|
|
@ -71,8 +73,10 @@ public class DigitalCertificateRequestBuilder {
|
|||
updateRequest.setId(digitalSecurityId);
|
||||
Optional<InstrumentType> clrInstrumentType = resolveInstrumentType(gatewayRequest.getInstrumentType());
|
||||
Optional<NominalTypeCode> clrNominalTypeCode = resolveTypeCode(gatewayRequest.getTypeCode());
|
||||
Optional<Allowed> nominalIndexationSign = resolveNominalIndexFact(gatewayRequest.getNominalIndexFact());
|
||||
clrInstrumentType.ifPresent(instrumentType -> updateRequest.setInstrumentType(instrumentType.getKey()));
|
||||
clrNominalTypeCode.ifPresent(nominalTypeCode -> updateRequest.setNominalTypeCode(nominalTypeCode.getKey()));
|
||||
nominalIndexationSign.ifPresent(indexFact -> updateRequest.setNominalIndexationSign(indexFact.getKey()));
|
||||
|
||||
updateRequest.setBaseCode(gatewayRequest.getDepoDcId());
|
||||
updateRequest.setIssuerId(companyId);
|
||||
|
|
@ -88,7 +92,6 @@ public class DigitalCertificateRequestBuilder {
|
|||
updateRequest.setDepository(gatewayRequest.getSettlementDepository());
|
||||
updateRequest.setNominalIndexationDate(gatewayRequest.getNominalIndexDate());
|
||||
updateRequest.setNominalValue(gatewayRequest.getNominalDenominationUnitForDate());
|
||||
updateRequest.setNominalIndexationSign(gatewayRequest.getNominalIndexFact());
|
||||
return updateRequest;
|
||||
}
|
||||
|
||||
|
|
@ -115,4 +118,18 @@ public class DigitalCertificateRequestBuilder {
|
|||
}
|
||||
return Optional.of(clrNominalTypeCode);
|
||||
}
|
||||
|
||||
private Optional<Allowed> resolveNominalIndexFact(final String nominalIndexFact) {
|
||||
Allowed allowed = null;
|
||||
if (StringUtils.hasLength(nominalIndexFact)) {
|
||||
allowed =
|
||||
nominalIndexFact.equals("Y") ? Allowed.ALLOWED :
|
||||
nominalIndexFact.equals("N") ? Allowed.DENIED : null;
|
||||
}
|
||||
if (allowed == null) {
|
||||
log.warn("Not defined nominalIndexFact={}", nominalIndexFact);
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(allowed);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue