gateway-api http://jira.mfd.msk:8088/browse/CLS-464 игнор без обязательных полей, вывод в log debug проигноренных

This commit is contained in:
AKurakin 2023-09-07 16:05:05 +03:00
parent 54d2183b45
commit 6ebc2dc2c6
2 changed files with 18 additions and 4 deletions

View file

@ -37,7 +37,13 @@ public class SecurityService {
FondSecurity::getSecuritySymbol,
FondSecurity::getWorkflowStatus);
List<FondSecurity> securityList = request.getSecurities().stream()
.filter(r->r.getSecuritySymbol() != null && r.getWorkflowStatus() != null)
.filter(r -> {
boolean ok = r.getSecuritySymbol() != null && r.getWorkflowStatus() != null;
if (!ok) {
log.debug("FondSecurity {}, ignore 1002: required field 'SecuritySymbol' or 'WorkflowStatus' was empty", r.getId());
}
return ok;
})
.sorted(comparatorBySecSymbolAndWorkflowStatus).toList();
for (FondSecurity security : securityList) {
try {

View file

@ -15,6 +15,7 @@ import ru.spcex.platform.utils.log.ExceptionUtils;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@Service
public class ListingMMProcessor {
@ -32,9 +33,16 @@ public class ListingMMProcessor {
public void process(MMListingsRequest request) {
List<ExchangeInstrument> exchangeInstrumentList = request.getExchangeInstrumentList();
CodeStatusComparator<ExchangeInstrument> comparatorByCodeAndWorkflowStatus = CodeStatusComparator.create(
ExchangeInstrument::getCode,
ExchangeInstrument::getWorkflowStatus);
exchangeInstrumentList.sort(comparatorByCodeAndWorkflowStatus);
ExchangeInstrument::getCode,
ExchangeInstrument::getWorkflowStatus);
exchangeInstrumentList = exchangeInstrumentList.stream()
.filter(ei -> {
if (ei.getCode() == null) {
log.debug("ExchangeInstrument {}, ignore 1002: required field 'code' was empty", ei.getId());
}
return ei.getCode() != null;
})
.sorted(comparatorByCodeAndWorkflowStatus).collect(Collectors.toList());
for (ExchangeInstrument exchangeInstrument : exchangeInstrumentList) {
try {
UUID exchangeInstrumentId = exchangeInstrument.getId();