http://jira.mfd.msk:8088/browse/CLS-283 log unknown properties
This commit is contained in:
parent
37b6b5d4e9
commit
d7400624fa
2 changed files with 38 additions and 0 deletions
|
|
@ -118,6 +118,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
|
|
||||||
ReportRequest req = userRequest.getRequestPayload();
|
ReportRequest req = userRequest.getRequestPayload();
|
||||||
|
|
||||||
|
logUnknownProperties(userRequest);
|
||||||
|
|
||||||
log.debug("Create report type {}...", req.getReportId());
|
log.debug("Create report type {}...", req.getReportId());
|
||||||
|
|
||||||
List<CSVReportBuilder<EmptyParams>> builders = reportBuildersWithoutParams.get(
|
List<CSVReportBuilder<EmptyParams>> builders = reportBuildersWithoutParams.get(
|
||||||
|
|
@ -150,6 +153,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
|
|
||||||
ReportRequestWithSessionId req = userRequest.getRequestPayload();
|
ReportRequestWithSessionId req = userRequest.getRequestPayload();
|
||||||
|
|
||||||
|
logUnknownProperties(userRequest);
|
||||||
|
|
||||||
log.debug("Create report type {}...", req.getReportId());
|
log.debug("Create report type {}...", req.getReportId());
|
||||||
|
|
||||||
List<CSVReportBuilder<SessionIdParam>> builders = reportBuildersWithSessionIdParam.get(
|
List<CSVReportBuilder<SessionIdParam>> builders = reportBuildersWithSessionIdParam.get(
|
||||||
|
|
@ -184,6 +190,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
|
|
||||||
ReportRequestWithSessionIdList req = userRequest.getRequestPayload();
|
ReportRequestWithSessionIdList req = userRequest.getRequestPayload();
|
||||||
|
|
||||||
|
logUnknownProperties(userRequest);
|
||||||
|
|
||||||
log.debug("Create report type {}...", req.getReportId());
|
log.debug("Create report type {}...", req.getReportId());
|
||||||
|
|
||||||
List<CSVReportBuilder<SessionIdListParams>> builders = reportBuildersWithSessionIdListParam.get(
|
List<CSVReportBuilder<SessionIdListParams>> builders = reportBuildersWithSessionIdListParam.get(
|
||||||
|
|
@ -218,6 +227,9 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
if (requestInfoUpdate != null) return null;
|
if (requestInfoUpdate != null) return null;
|
||||||
|
|
||||||
ReportRequestWithPeriod req = userRequest.getRequestPayload();
|
ReportRequestWithPeriod req = userRequest.getRequestPayload();
|
||||||
|
|
||||||
|
logUnknownProperties(userRequest);
|
||||||
|
|
||||||
log.debug("Create report type {}...", req.getReportId());
|
log.debug("Create report type {}...", req.getReportId());
|
||||||
|
|
||||||
List<CSVReportBuilder<PeriodParams>> builders = reportBuildersWithPeriodParams.get(
|
List<CSVReportBuilder<PeriodParams>> builders = reportBuildersWithPeriodParams.get(
|
||||||
|
|
@ -254,6 +266,8 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
|
|
||||||
Long sessionId = userRequest.getRequestPayload().getSessionId();
|
Long sessionId = userRequest.getRequestPayload().getSessionId();
|
||||||
|
|
||||||
|
logUnknownProperties(userRequest);
|
||||||
|
|
||||||
int cntErrors = 0;
|
int cntErrors = 0;
|
||||||
List<String> outFilenames = new ArrayList<>();
|
List<String> outFilenames = new ArrayList<>();
|
||||||
|
|
||||||
|
|
@ -333,4 +347,11 @@ public class ReportService extends QueueConsumer implements InitializingBean {
|
||||||
return null;
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
package ru.spcex.clearing.platform.messaging.domain;
|
package ru.spcex.clearing.platform.messaging.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import ru.spcex.platform.classes.base.interfaces.WithId;
|
import ru.spcex.platform.classes.base.interfaces.WithId;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class BaseRequest<T> implements WithId {
|
public class BaseRequest<T> implements WithId {
|
||||||
/**
|
/**
|
||||||
* Идентификатор запроса
|
* Идентификатор запроса
|
||||||
|
|
@ -27,9 +31,17 @@ public class BaseRequest<T> implements WithId {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private final Map<String, Object> unknownProperties = new HashMap<>();
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private byte[] correlationId;
|
private byte[] correlationId;
|
||||||
|
|
||||||
|
@JsonAnySetter
|
||||||
|
public void add(String key, Object value) {
|
||||||
|
unknownProperties.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -70,4 +82,9 @@ public class BaseRequest<T> implements WithId {
|
||||||
public void setCorrelationId(byte[] correlationId) {
|
public void setCorrelationId(byte[] correlationId) {
|
||||||
this.correlationId = correlationId;
|
this.correlationId = correlationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getUnknownProperties() {
|
||||||
|
return unknownProperties;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue