This commit is contained in:
parent
db8fd60495
commit
02b870f95b
2 changed files with 20 additions and 15 deletions
|
|
@ -29,6 +29,7 @@ import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||||
import ru.spcex.clearing.util.security.UserRoleVerification;
|
import ru.spcex.clearing.util.security.UserRoleVerification;
|
||||||
import ru.spcex.platform.enumeration.ReportKeys;
|
import ru.spcex.platform.enumeration.ReportKeys;
|
||||||
|
import ru.spcex.platform.enumeration.ReportType;
|
||||||
import ru.spcex.platform.enumeration.Section;
|
import ru.spcex.platform.enumeration.Section;
|
||||||
import ru.spcex.platform.enumeration.Task;
|
import ru.spcex.platform.enumeration.Task;
|
||||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||||
|
|
@ -94,7 +95,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
||||||
String url = formingInboundUrl(inboundServerSettings.getPathLOCM());
|
String url = formingInboundUrl(inboundServerSettings.getPathLOCM());
|
||||||
|
|
||||||
OutboundRequest outboundFondRequest = OutboundRequestBuilder.builder()
|
OutboundRequest outboundFondRequest = OutboundRequestBuilder.builder()
|
||||||
.type(OutboundRequestType.MEMBER_ON_DEMAND)
|
.type(OutboundRequestType.MEMBER_ON_DEMAND.getKey())
|
||||||
.build();
|
.build();
|
||||||
HttpEntity<OutboundRequest> request = makeDefaultRequest(outboundFondRequest);
|
HttpEntity<OutboundRequest> request = makeDefaultRequest(outboundFondRequest);
|
||||||
|
|
||||||
|
|
@ -114,7 +115,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
||||||
|
|
||||||
OutboundRequest outboundFondRequest = OutboundRequestBuilder.builder()
|
OutboundRequest outboundFondRequest = OutboundRequestBuilder.builder()
|
||||||
.section(exportedRequest.getSection())
|
.section(exportedRequest.getSection())
|
||||||
.type(OutboundRequestType.FILL_LIMITS)
|
.type(OutboundRequestType.FILL_LIMITS.getKey())
|
||||||
.content(content)
|
.content(content)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
@ -139,12 +140,12 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
||||||
|
|
||||||
OutboundRequest outboundFondRequest = OutboundRequestBuilder.builder()
|
OutboundRequest outboundFondRequest = OutboundRequestBuilder.builder()
|
||||||
.section(Section.FOND.getKey())
|
.section(Section.FOND.getKey())
|
||||||
.type(OutboundRequestType.ON_DEMAND)
|
.type(OutboundRequestType.ON_DEMAND.getKey())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
OutboundRequest outboundMkrRequest = OutboundRequestBuilder.builder()
|
OutboundRequest outboundMkrRequest = OutboundRequestBuilder.builder()
|
||||||
.section(Section.MKR.getKey())
|
.section(Section.MKR.getKey())
|
||||||
.type(OutboundRequestType.ON_DEMAND)
|
.type(OutboundRequestType.ON_DEMAND.getKey())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
HttpEntity<OutboundRequest> requestFond = makeDefaultRequest(outboundFondRequest);
|
HttpEntity<OutboundRequest> requestFond = makeDefaultRequest(outboundFondRequest);
|
||||||
|
|
@ -183,7 +184,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
||||||
|
|
||||||
OutboundRequest outboundRequest = OutboundRequestBuilder.builder()
|
OutboundRequest outboundRequest = OutboundRequestBuilder.builder()
|
||||||
.section(Section.MKR.getKey())
|
.section(Section.MKR.getKey())
|
||||||
.type(OutboundRequestType.ASSET_OPERATION)
|
.type(OutboundRequestType.ASSET_OPERATION.getKey())
|
||||||
.content(content).build();
|
.content(content).build();
|
||||||
|
|
||||||
String url = formingInboundUrl(inboundServerSettings.getPathLOCM());
|
String url = formingInboundUrl(inboundServerSettings.getPathLOCM());
|
||||||
|
|
@ -210,8 +211,8 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
||||||
|
|
||||||
public void requestOnReport(BaseRequest<SendReportRequest> request) {
|
public void requestOnReport(BaseRequest<SendReportRequest> request) {
|
||||||
SendReportRequest reportRequest = request.getRequestPayload();
|
SendReportRequest reportRequest = request.getRequestPayload();
|
||||||
OutboundRequestType outboundRequestType = IEnumKey.getEnumByKey(OutboundRequestType.class, reportRequest.getType());
|
ReportType reportType = IEnumKey.getEnumByKey(ReportType.class, reportRequest.getType());
|
||||||
if (outboundRequestType == null) {
|
if (reportType == null) {
|
||||||
log.warn("Undefined type of request: {}; skip", reportRequest.getType());
|
log.warn("Undefined type of request: {}; skip", reportRequest.getType());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +221,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
||||||
Map<String, Object> content = makeContentByReportRequest(reportPart);
|
Map<String, Object> content = makeContentByReportRequest(reportPart);
|
||||||
OutboundRequest outboundRequest = OutboundRequestBuilder.builder()
|
OutboundRequest outboundRequest = OutboundRequestBuilder.builder()
|
||||||
.section(Section.FOND.getKey())
|
.section(Section.FOND.getKey())
|
||||||
.type(outboundRequestType)
|
.type(reportType.getKey())
|
||||||
.content(content).build();
|
.content(content).build();
|
||||||
|
|
||||||
String url = formingInboundUrl(inboundServerSettings.getPathLOCM());
|
String url = formingInboundUrl(inboundServerSettings.getPathLOCM());
|
||||||
|
|
@ -236,13 +237,17 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
|
||||||
protected Map<String, Object> makeContentByReportRequest(ReportPart reportPart) {
|
protected Map<String, Object> makeContentByReportRequest(ReportPart reportPart) {
|
||||||
Map<String, Object> content = new HashMap<>();
|
Map<String, Object> content = new HashMap<>();
|
||||||
Matcher matcher = REPORT_FILE_NAME_PATTERN.matcher(reportPart.getFileName());
|
Matcher matcher = REPORT_FILE_NAME_PATTERN.matcher(reportPart.getFileName());
|
||||||
ReportKeys reportKeys = null;
|
ReportKeys reportKey = null;
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
String rowKey = matcher.group(1);
|
String rowKey = matcher.group(1);
|
||||||
reportKeys = IEnumKey.getEnumByKeyOrUndefined(ReportKeys.class, rowKey);
|
reportKey = IEnumKey.getEnumByKeyOrUndefined(ReportKeys.class, rowKey);
|
||||||
|
}
|
||||||
|
if (reportKey == null) {
|
||||||
|
log.warn("Mismatched filename pattern : {}; {}", reportPart.getFileName(), REPORT_FILE_NAME_PATTERN);
|
||||||
|
return content;
|
||||||
}
|
}
|
||||||
String paramName = null;
|
String paramName = null;
|
||||||
switch (reportKeys) {
|
switch (reportKey) {
|
||||||
case KS_BR_PFX64_INFTYPE_1 -> paramName = "inftype_1";
|
case KS_BR_PFX64_INFTYPE_1 -> paramName = "inftype_1";
|
||||||
case KS_BR_PFX64_INFTYPE_2 -> paramName = "inftype_2";
|
case KS_BR_PFX64_INFTYPE_2 -> paramName = "inftype_2";
|
||||||
case KS_BR_PFX64_INFTYPE_3 -> paramName = "inftype_3";
|
case KS_BR_PFX64_INFTYPE_3 -> paramName = "inftype_3";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package ru.spcex.clearing.gatewayapi.service.builders;
|
package ru.spcex.clearing.gatewayapi.service.builders;
|
||||||
|
|
||||||
import ru.spcex.clearing.gatewayapi.controller.outbound.request.OutboundRequest;
|
import ru.spcex.clearing.gatewayapi.controller.outbound.request.OutboundRequest;
|
||||||
import ru.spcex.clearing.gatewayapi.enums.OutboundRequestType;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -10,7 +9,7 @@ import java.util.UUID;
|
||||||
public class OutboundRequestBuilder {
|
public class OutboundRequestBuilder {
|
||||||
|
|
||||||
private String section;
|
private String section;
|
||||||
private OutboundRequestType requestType;
|
private String requestType;
|
||||||
private Map<String, Object> content;
|
private Map<String, Object> content;
|
||||||
|
|
||||||
private OutboundRequestBuilder() {
|
private OutboundRequestBuilder() {
|
||||||
|
|
@ -25,11 +24,12 @@ public class OutboundRequestBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OutboundRequestBuilder type(OutboundRequestType outboundRequestType) {
|
public OutboundRequestBuilder type(String outboundRequestType) {
|
||||||
this.requestType = outboundRequestType;
|
this.requestType = outboundRequestType;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public OutboundRequestBuilder content(Map<String, Object> content) {
|
public OutboundRequestBuilder content(Map<String, Object> content) {
|
||||||
this.content = content;
|
this.content = content;
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -43,7 +43,7 @@ public class OutboundRequestBuilder {
|
||||||
outboundRequest.setSection(section);
|
outboundRequest.setSection(section);
|
||||||
}
|
}
|
||||||
if (requestType != null) {
|
if (requestType != null) {
|
||||||
outboundRequest.setType(requestType.getKey());
|
outboundRequest.setType(requestType);
|
||||||
}
|
}
|
||||||
outboundRequest.setContent(content);
|
outboundRequest.setContent(content);
|
||||||
return outboundRequest;
|
return outboundRequest;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue