From 31c54dae8f0968d644d99f32d6f582e897eef726 Mon Sep 17 00:00:00 2001 From: mmarkelov Date: Wed, 29 Apr 2026 16:26:27 +0300 Subject: [PATCH] fix ExecutionReport checking field values --- .../clearing/fix/quickfix/Application.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/clearing-parent/fix-service/src/main/java/ru/spcex/clearing/fix/quickfix/Application.java b/clearing-parent/fix-service/src/main/java/ru/spcex/clearing/fix/quickfix/Application.java index 5132432e0..a6df06253 100644 --- a/clearing-parent/fix-service/src/main/java/ru/spcex/clearing/fix/quickfix/Application.java +++ b/clearing-parent/fix-service/src/main/java/ru/spcex/clearing/fix/quickfix/Application.java @@ -113,17 +113,10 @@ public class Application extends MessageCracker implements quickfix.Application, ImdgTransaction transaction = imdgProvider.newTransaction(); transaction.beginTransaction(); try { - if (executionReport.isSetField(OrderID.FIELD) && executionReport.isSetField(ExDestination.FIELD) && executionReport.isSetField(TransactTime.FIELD)) { + if (executionReport.isSetField(OrderID.FIELD) && executionReport.isSetField(ExDestination.FIELD) && executionReport.isSetField(TransactTime.FIELD) && executionReport.isSetField(OrdStatus.FIELD)) { OrderID orderId = executionReport.getOrderID(); ExDestination exDestination = (ExDestination) executionReport.getField(new ExDestination()); TransactTime transactTime = executionReport.getTransactTime(); - SecurityID securityID = executionReport.getSecurityID(); - Price price = executionReport.getPrice(); - OrderQty orderQty = executionReport.getOrderQty(); - Account account = executionReport.getAccount(); - Side side = executionReport.getSide(); - Currency currency = executionReport.getCurrency(); - SettlType settlType = executionReport.getSettlType(); OrdStatus ordStatus = executionReport.getOrdStatus(); Pattern orderIdPattern = Pattern.compile("(\\d{6})-([A-Z]+)-(\\d+)"); @@ -145,14 +138,20 @@ public class Application extends MessageCracker implements quickfix.Application, sOrders.setClassCode(exDestination.getValue()); sOrders.setTradeDate(transactTime.getValue().toLocalDate()); - sOrders.setSecCode(securityID.getValue()); - sOrders.setPrice(BigDecimal.valueOf(price.getValue())); - sOrders.setQty(BigDecimal.valueOf(orderQty.getValue())); - sOrders.setAccount(account.getValue()); - sOrders.setSettleCode(settlType.getValue()); - sOrders.setPriceCurrency(currency.getValue()); - sOrders.setState(String.valueOf(ordStatus.getValue())); + if (executionReport.isSetSecurityID()) + sOrders.setSecCode(executionReport.getSecurityID().getValue()); + if (executionReport.isSetPrice()) + sOrders.setPrice(BigDecimal.valueOf(executionReport.getPrice().getValue())); + if (executionReport.isSetOrderQty()) + sOrders.setQty(BigDecimal.valueOf(executionReport.getOrderQty().getValue())); + if (executionReport.isSetAccount()) + sOrders.setAccount(executionReport.getAccount().getValue()); + if (executionReport.isSetSettlType()) + sOrders.setSettleCode(executionReport.getSettlType().getValue()); + if (executionReport.isSetCurrency()) + sOrders.setPriceCurrency(executionReport.getCurrency().getValue()); + sOrders.setState(String.valueOf(ordStatus.getValue())); if (ordStatus.valueEquals(OrdStatus.NEW)) { sOrders.setOrderDateTime(transactTime.getValue().toInstant(ZoneOffset.UTC)); } else if (ordStatus.valueEquals(OrdStatus.CANCELED)) { @@ -161,6 +160,7 @@ public class Application extends MessageCracker implements quickfix.Application, sOrdersImdg.insert(sOrders); } else { + sOrders.setState(String.valueOf(ordStatus.getValue())); if (ordStatus.valueEquals(OrdStatus.NEW)) { sOrders.setOrderDateTime(transactTime.getValue().toInstant(ZoneOffset.UTC)); } else if (ordStatus.valueEquals(OrdStatus.CANCELED)) {