| | |
| | | import com.xcong.excoin.modules.otc.vo.BuyOrderDetailVo; |
| | | import com.xcong.excoin.modules.otc.vo.OrderListVo; |
| | | import com.xcong.excoin.modules.otc.vo.SaleOrderDetailVo; |
| | | import com.xcong.excoin.rabbit.producer.OtcProducter; |
| | | import com.xcong.excoin.utils.RedisUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private final OtcBlackListDao otcBlackListDao; |
| | | private final OtcSettingDao otcSettingDao; |
| | | private final RedisUtils redisUtils; |
| | | private final OtcProducter otcProducter; |
| | | |
| | | |
| | | @Override |
| | |
| | | throw new GlobalException("剩余数量不足"); |
| | | } |
| | | |
| | | BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()); |
| | | BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()).setScale(2,BigDecimal.ROUND_DOWN);; |
| | | if (cny.compareTo(orderAddDto.getCnyAmount()) != 0) { |
| | | throw new GlobalException("数量与金额不符"); |
| | | } |
| | |
| | | memberWalletCoinDao.reduceFrozenBalance(saleWallet.getId(), buyOrder.getCoinAmount()); |
| | | |
| | | this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_FINISH, null, otcOrder.getOrderNo()); |
| | | otcProducter.sendMarketBussinessMsg(otcOrder.getEntrustOrderId(), OtcOrder.STATUS_FINISH); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | otcEntrustOrderDao.updateRemainAmount(otcOrder.getEntrustOrderId(), otcOrder.getCoinAmount()); |
| | | this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_CANCEL, null, otcOrder.getOrderNo()); |
| | | |
| | | otcProducter.sendMarketBussinessMsg(otcOrder.getEntrustOrderId(), OtcOrder.STATUS_CANCEL); |
| | | } |
| | | |
| | | @Override |