etreschenkov 2024-10-03 16:42:07 +03:00
parent 9976273567
commit 70a0316d19
5 changed files with 43 additions and 0 deletions

View file

@ -16,6 +16,7 @@ public class GatewayApiSettings {
private KafkaConsumerSettings kafkaConsumer;
private InboundServerSettings inboundServer;
private InboundExternalServerSettings inboundExternalServer;
private String clearingSystem;
public HazelcastClientParams getHazelcast() {
return hazelcast;
@ -56,4 +57,12 @@ public class GatewayApiSettings {
public void setInboundExternalServer(InboundExternalServerSettings inboundExternalServer) {
this.inboundExternalServer = inboundExternalServer;
}
public String getClearingSystem() {
return clearingSystem;
}
public void setClearingSystem(String clearingSystem) {
this.clearingSystem = clearingSystem;
}
}

View file

@ -48,6 +48,10 @@ public class OutboundRequest {
)
private String section = "";
@JsonProperty("clearing_system")
@ApiModelProperty(value = "Клиринговая система", example = "SPVB/LCC")
private String clearingSystem;
// todo Пока так, чтобы отсылал null, в дальнейшем тип надо заменить на используемый в запросе. Возможно с помощью параметризации
@JsonProperty("content")
@ApiModelProperty(
@ -88,6 +92,14 @@ public class OutboundRequest {
this.section = section;
}
public String getClearingSystem() {
return clearingSystem;
}
public void setClearingSystem(String clearingSystem) {
this.clearingSystem = clearingSystem;
}
public Map<String, Object> getContent() {
return content;
}

View file

@ -0,0 +1,15 @@
package ru.spcex.clearing.gatewayapi.enums;
public enum ClearingSystems {
SPVB("SPVB"),
LCC("LCC");
private final String name;
ClearingSystems(final String name) {
this.name = name;
}
public String getName() {
return name;
}
}

View file

@ -62,6 +62,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
private final RestTemplate restTemplate;
private final InboundServerSettings inboundServerSettings;
private final InboundExternalServerSettings inboundExternalServerSettings;
private final GatewayApiSettings gatewayApiSettings;
private final Map<Long, List<SentAsset>> sentAssets;
private final Map<UUID, OutboundRequest> outboundRequestByUuid;
protected final Imdg<GatewayResult> gatewayResultImdg;
@ -78,6 +79,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
super(kafkaQueue, kafkaProducer);
this.restTemplate = restTemplate;
this.userRoleVerification = userRoleVerification;
this.gatewayApiSettings = gatewayApiSettings;
this.inboundServerSettings = gatewayApiSettings.getInboundServer();
this.inboundExternalServerSettings = gatewayApiSettings.getInboundExternalServer();
this.sentAssets = sentAssets;
@ -274,6 +276,8 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
case KS_REP_FIRM_DETAILS -> paramName = "ks_rep_firm_details";
case KS_SESSION_LIST -> paramName = "ks_session_list";
case KS_COMMISSION_TRADES -> paramName = "ks_commission_trades";
case KS_REP_LCC_TRADES_REPORT -> paramName = "ks_rep_lcc_trades";
case KS_REP_LCC_NETTO_REPORT -> paramName = "ks_rep_lcc_netto";
}
if (paramName != null) {
content.put(paramName, reportPart.getFileName());
@ -281,6 +285,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
}
private void sendRequest(OutboundRequest request) {
request.setClearingSystem(gatewayApiSettings.getClearingSystem());
if (inboundServerSettings.getAllowedTypes().isEmpty() ||
inboundServerSettings.getAllowedTypes().contains(request.getType())) {
String url = formingInboundUrl(inboundServerSettings.getEnableSsl(),

View file

@ -25,6 +25,8 @@ gateway-api.kafka-consumer.auto-offset-reset=latest
gateway-api.kafka-consumer.linger-ms=1
gateway-api.kafka-consumer.buffer-memory=33554432
gateway-api.clearing-system=LCC
gateway-api.inbound-server.enable-ssl=false
gateway-api.inbound-server.host=10.200.200.183
gateway-api.inbound-server.port=8084