This commit is contained in:
parent
7c45242687
commit
b4a3bb9910
2 changed files with 27 additions and 15 deletions
|
|
@ -69,6 +69,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
|||
protected final Imdg<GatewayResult> gatewayResultImdg;
|
||||
private final static Pattern REPORT_FILE_NAME_PATTERN = Pattern.compile("(\\S*)_(\\d{15}).csv");
|
||||
private final String clearingSystemValue;
|
||||
private final GatewayApiSettings gatewayApiSettings;
|
||||
|
||||
public GatewayService(Consumer<String, Object> kafkaQueue,
|
||||
Producer<String, Object> kafkaProducer,
|
||||
|
|
@ -81,6 +82,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
|||
super(kafkaQueue, kafkaProducer);
|
||||
this.restTemplate = restTemplate;
|
||||
this.userRoleVerification = userRoleVerification;
|
||||
this.gatewayApiSettings = gatewayApiSettings;
|
||||
this.clearingSystemValue = StringUtils.isNotEmpty(gatewayApiSettings.getClearingSystem()) ?
|
||||
gatewayApiSettings.getClearingSystem() : "SPVB";
|
||||
this.inboundServerSettings = gatewayApiSettings.getInboundServer();
|
||||
|
|
@ -99,7 +101,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
|||
.setConsumer(this::requestOnDemandSecurity)
|
||||
.forDestination(Task.loadIssue_LOSC.topic(), callbacks::put);
|
||||
callback(GatewayTaskRequest.class)
|
||||
.setConsumer(this::requestOn)
|
||||
.setConsumer(this::requestOnRates)
|
||||
.forDestination(Task.LORT.topic(), callbacks::put);
|
||||
callback(LimExportedRequest.class)
|
||||
.setConsumer(this::requestOnLimit)
|
||||
|
|
@ -195,16 +197,20 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
|||
log.debug("LOSC task 4/4 complete (CURR section)");
|
||||
}
|
||||
|
||||
public void requestOn(BaseRequest<GatewayTaskRequest> userRequest) {
|
||||
public void requestOnRates(BaseRequest<GatewayTaskRequest> userRequest) {
|
||||
OutboundRequest settleRateReq = OutboundRequestBuilder.builder()
|
||||
.type(OutboundRequestType.CURRENCY_RATE.getKey())
|
||||
.content(ContentBuilder.builder().settleRateBuild())
|
||||
.content(ContentBuilder.builder()
|
||||
.withSettings(gatewayApiSettings)
|
||||
.settleRateBuild())
|
||||
.clearingSystem(clearingSystemValue)
|
||||
.build();
|
||||
|
||||
OutboundRequest cbRateReq = OutboundRequestBuilder.builder()
|
||||
.type(OutboundRequestType.CURRENCY_RATE.getKey())
|
||||
.content(ContentBuilder.builder().cbRateBuild())
|
||||
.content(ContentBuilder.builder()
|
||||
.withSettings(gatewayApiSettings)
|
||||
.cbRateBuild())
|
||||
.clearingSystem(clearingSystemValue)
|
||||
.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,32 +2,38 @@ package ru.spcex.clearing.gatewayapi.service.builders;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import ru.spcex.clearing.gatewayapi.config.GatewayApiSettings;
|
||||
|
||||
public class ContentBuilder {
|
||||
|
||||
private GatewayApiSettings settings;
|
||||
private ContentBuilder(){}
|
||||
|
||||
public static ContentBuilder builder(){
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
public ContentBuilder withSettings(final GatewayApiSettings settings) {
|
||||
this.settings = settings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, Object> settleRateBuild() {
|
||||
return new HashMap<>() {{
|
||||
put("sender_organization_code", "SPVB");
|
||||
put("sender_subsystem_code", "KS");
|
||||
put("recipient_organization_code", "SPVB");
|
||||
put("sender_rate_type_code", "SETTLE_RATE");
|
||||
put("recipient_rate_type_code", "NCC_RATE");
|
||||
put("sender_organization_code", settings.getSenderOrganizationCode());
|
||||
put("sender_subsystem_code", settings.getSenderSubsystemCode());
|
||||
put("recipient_organization_code", settings.getRecipientOrganizationCode());
|
||||
put("sender_rate_type_code", settings.getSenderSettleRateTypeCode());
|
||||
put("recipient_rate_type_code", settings.getRecipientSettleRateTypeCode());
|
||||
}};
|
||||
}
|
||||
|
||||
public Map<String, Object> cbRateBuild() {
|
||||
return new HashMap<>() {{
|
||||
put("sender_organization_code", "SPVB");
|
||||
put("sender_subsystem_code", "KS");
|
||||
put("recipient_organization_code", "SPVB");
|
||||
put("sender_rate_type_code", "CB_RATE");
|
||||
put("recipient_rate_type_code", "CBR_RATE");
|
||||
put("sender_organization_code", settings.getSenderOrganizationCode());
|
||||
put("sender_subsystem_code", settings.getSenderSubsystemCode());
|
||||
put("recipient_organization_code", settings.getRecipientOrganizationCode());
|
||||
put("sender_rate_type_code", settings.getSenderCbRateTypeCode());
|
||||
put("recipient_rate_type_code", settings.getRecipientCbRateTypeCode());
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue