From d759e54f6ddc89abd7487a092989a720fe9646d2 Mon Sep 17 00:00:00 2001 From: etreschenkov Date: Thu, 22 Jun 2023 16:04:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B2=D0=B2=D0=BE=D0=B4=D1=8B/=D0=B2=D1=8B?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D1=8B=20-=20gateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gatewayapi/service/GatewayService.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) 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();