From e13b1f9d6817a29f528f70493685371ae4004eb7 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Thu, 10 Jun 2021 16:49:42 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java | 2 ++ src/test/java/com/xcong/excoin/OtcTest.java | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java index 16294e8..bc57902 100644 --- a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java @@ -103,6 +103,7 @@ BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()).setScale(2, BigDecimal.ROUND_DOWN); BigDecimal usdt = orderAddDto.getCnyAmount().divide(entrustOrder.getUnitPrice(), 2, BigDecimal.ROUND_DOWN); if (cny.compareTo(orderAddDto.getCnyAmount()) != 0 && usdt.compareTo(orderAddDto.getUsdtAmount()) != 0) { + log.info("BUY = CNY:{}, CNY_{}, USDT:{}, USDT_{}", cny, orderAddDto.getCnyAmount(), usdt, orderAddDto.getUsdtAmount()); throw new GlobalException("数量与金额不符"); } /** @@ -206,6 +207,7 @@ BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()); BigDecimal usdt = orderAddDto.getCnyAmount().divide(entrustOrder.getUnitPrice(), 2, BigDecimal.ROUND_DOWN); if (cny.compareTo(orderAddDto.getCnyAmount()) != 0 && usdt.compareTo(orderAddDto.getUsdtAmount()) != 0) { + log.info("SALE = CNY:{}, CNY_{}, USDT:{}, USDT_{}", cny, orderAddDto.getCnyAmount(), usdt, orderAddDto.getUsdtAmount()); throw new GlobalException("数量与金额不符"); } diff --git a/src/test/java/com/xcong/excoin/OtcTest.java b/src/test/java/com/xcong/excoin/OtcTest.java index 2f2a67e..052a89a 100644 --- a/src/test/java/com/xcong/excoin/OtcTest.java +++ b/src/test/java/com/xcong/excoin/OtcTest.java @@ -107,17 +107,17 @@ @Test public void bigdecimalTest() { BigDecimal one = BigDecimal.valueOf(6.39); - BigDecimal two = BigDecimal.valueOf(15.64); + BigDecimal two = BigDecimal.valueOf(3129.860025); - System.out.println(one.multiply(two)); + System.out.println(one.multiply(two).setScale(2, BigDecimal.ROUND_DOWN)); } - @Autowired - private OtcConsumer otcConsumer; +// @Autowired +// private OtcConsumer otcConsumer; @Test public void returnMoneyTest() { // otcConsumer.orderReturn("20210605446780002"); - otcProducter.sendOrderReturn("20210605446780002"); +// otcProducter.sendOrderReturn("20210605446780002"); } } -- Gitblit v1.9.1