Helius
2021-06-10 23ca56251371e1dcb2f55e9dfd1019c6cb060070
modify
2 files modified
7 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java 2 ●●● patch | view | raw | blame | history
src/test/java/com/xcong/excoin/OtcTest.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
@@ -204,7 +204,7 @@
            throw new GlobalException("资金密码错误");
        }
        BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice());
        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("SALE = CNY:{}, CNY_{}, USDT:{}, USDT_{}", cny, orderAddDto.getCnyAmount(), usdt, orderAddDto.getUsdtAmount());
src/test/java/com/xcong/excoin/OtcTest.java
@@ -108,8 +108,11 @@
    public void bigdecimalTest() {
        BigDecimal one = BigDecimal.valueOf(6.39);
        BigDecimal two = BigDecimal.valueOf(3129.860025);
        BigDecimal three = BigDecimal.valueOf(19999.80);
        System.out.println(one.multiply(two).setScale(2, BigDecimal.ROUND_DOWN));
        BigDecimal cny = one.multiply(two).setScale(2, BigDecimal.ROUND_DOWN);
        BigDecimal usdt = three.divide(one, 2, BigDecimal.ROUND_DOWN);
        System.out.println(cny.compareTo(three) != 0 && usdt.compareTo(two) != 0);
    }
//    @Autowired