diff --git a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/GatewayService.java b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/GatewayService.java index 5146c850a..d723eb82d 100644 --- a/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/GatewayService.java +++ b/clearing-parent/gateway-api/src/main/java/ru/spcex/clearing/gatewayapi/service/GatewayService.java @@ -152,16 +152,17 @@ public class GatewayService extends QueueConsumer implements InitializingBean { Collection assetOperations = request.getRequestPayload().getAssetOperationRequests(); List assets = new ArrayList<>(); for (AssetOperationRequest assetOperation : assetOperations) { - Map content = Map.of("direction", assetOperation.getDirection(), - "amount", assetOperation.getAmount(), - "code", assetOperation.getCode(), - "asset", assetOperation.getSecuritySymbol(), - "firm_id", assetOperation.getTradingCode()); -// if (assetOperationRequest.getAmount() != null) { -// content.put("amount", assetOperationRequest.getAmount()); -// } else { -// content.put("quantity", assetOperationRequest.getQuantity()); -// } + Map content = new HashMap<>() {{ + put("direction", assetOperation.getDirection()); + put("code", assetOperation.getCode()); + put("asset", assetOperation.getSecuritySymbol()); + put("firm_id", assetOperation.getTradingCode()); + }}; + if (assetOperation.getAmount() != null) { + content.put("amount", assetOperation.getAmount().toString()); + } else { + content.put("quantity", assetOperation.getQuantity().toString()); + } OutboundRequest outboundRequest = OutboundRequestBuilder.builder() .section(Section.MKR.getKey()) @@ -174,7 +175,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean { ResponseEntity response = restTemplate.exchange(url, HttpMethod.POST, r, Map.class); Map bodyResponse = response.getBody(); log.debug("Response from service: {}", bodyResponse != null ? bodyResponse : "empty"); - } catch (Throwable err){ + } catch (Throwable err) { log.error("Exchange error: {}", ExceptionUtils.getStackTrace(err)); } finally { SentAsset sentAsset = new SentAsset();