This commit is contained in:
akulikov 2023-05-30 14:51:43 +03:00
parent 37b6b5d4e9
commit d7400624fa
2 changed files with 38 additions and 0 deletions

View file

@ -118,6 +118,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
if (requestInfoUpdate != null) return null;
ReportRequest req = userRequest.getRequestPayload();
logUnknownProperties(userRequest);
log.debug("Create report type {}...", req.getReportId());
List<CSVReportBuilder<EmptyParams>> builders = reportBuildersWithoutParams.get(
@ -150,6 +153,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
if (requestInfoUpdate != null) return null;
ReportRequestWithSessionId req = userRequest.getRequestPayload();
logUnknownProperties(userRequest);
log.debug("Create report type {}...", req.getReportId());
List<CSVReportBuilder<SessionIdParam>> builders = reportBuildersWithSessionIdParam.get(
@ -184,6 +190,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
if (requestInfoUpdate != null) return null;
ReportRequestWithSessionIdList req = userRequest.getRequestPayload();
logUnknownProperties(userRequest);
log.debug("Create report type {}...", req.getReportId());
List<CSVReportBuilder<SessionIdListParams>> builders = reportBuildersWithSessionIdListParam.get(
@ -218,6 +227,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
if (requestInfoUpdate != null) return null;
ReportRequestWithPeriod req = userRequest.getRequestPayload();
logUnknownProperties(userRequest);
log.debug("Create report type {}...", req.getReportId());
List<CSVReportBuilder<PeriodParams>> builders = reportBuildersWithPeriodParams.get(
@ -254,6 +266,8 @@ public class ReportService extends QueueConsumer implements InitializingBean {
Long sessionId = userRequest.getRequestPayload().getSessionId();
logUnknownProperties(userRequest);
int cntErrors = 0;
List<String> outFilenames = new ArrayList<>();
@ -333,4 +347,11 @@ public class ReportService extends QueueConsumer implements InitializingBean {
return null;
}
private void logUnknownProperties(BaseRequest<?> request) {
Map<String, Object> unknownProperties = request.getUnknownProperties();
for (Map.Entry<String, Object> unknownProperty : unknownProperties.entrySet()) {
log.warn("Unknown property in request {} = {}", unknownProperty.getKey(), unknownProperty.getValue());
}
}
}

View file

@ -1,9 +1,13 @@
package ru.spcex.clearing.platform.messaging.domain;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import ru.spcex.platform.classes.base.interfaces.WithId;
import java.util.HashMap;
import java.util.Map;
public class BaseRequest<T> implements WithId {
/**
* Идентификатор запроса
@ -27,9 +31,17 @@ public class BaseRequest<T> implements WithId {
@JsonProperty
private Long userId;
@JsonIgnore
private final Map<String, Object> unknownProperties = new HashMap<>();
@JsonIgnore
private byte[] correlationId;
@JsonAnySetter
public void add(String key, Object value) {
unknownProperties.put(key, value);
}
@Override
public Long getId() {
return id;
@ -70,4 +82,9 @@ public class BaseRequest<T> implements WithId {
public void setCorrelationId(byte[] correlationId) {
this.correlationId = correlationId;
}
public Map<String, Object> getUnknownProperties() {
return unknownProperties;
}
}