zainali5120
2020-10-14 071433a3b29cc73bddd6d9ea5ac3bc4c8807948c
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
@@ -1077,14 +1077,13 @@
        if (CollectionUtils.isNotEmpty(trades)) {
            for (OrderCoinsEntity trade : trades) {
                if (trade != null) {
                    orderCoinsDao.updateStatus(trade.getId(),OrderCoinsEntity.ORDERSTATUS_DONE);
                    //orderCoinsDao.updateStatus(trade.getId(),OrderCoinsEntity.ORDERSTATUS_DONE);
                    ids.add(trade.getId());
                    // 买单 实际成交金额小于委托的 这一部分从冻结扣除
                    if(OrderCoinsEntity.ORDERTYPE_BUY==trade.getOrderType()){
                        if(trade.getEntrustAmount().compareTo(trade.getDealAmount())>0){
                            // 此时退回这部分的差额
                            BigDecimal subtract = trade.getEntrustAmount().subtract(trade.getDealAmount());
                            System.out.println(subtract);
                            MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(trade.getMemberId(), CoinTypeEnum.USDT.name());
                            if(memberWalletCoinEntity!=null){
                                memberWalletCoinDao.updateWalletBalance(memberWalletCoinEntity.getId(),subtract,null,subtract.negate());
@@ -1095,7 +1094,7 @@
            }
        }
        if (CollectionUtils.isNotEmpty(ids)) {
           // orderCoinsDao.batchUpdateStatus(ids, OrderCoinsEntity.ORDERSTATUS_DONE);
            orderCoinsDao.batchUpdateStatus(ids, OrderCoinsEntity.ORDERSTATUS_DONE);
        }
    }