| | |
| | | import com.xcong.excoin.modules.otc.dao.OtcEntrustOrderDao; |
| | | import com.xcong.excoin.modules.otc.dao.OtcMarketBussinessDao; |
| | | import com.xcong.excoin.modules.otc.dto.HasPayDto; |
| | | import com.xcong.excoin.modules.otc.dto.OrderAddDto; |
| | | import com.xcong.excoin.modules.otc.dto.OrderListDto; |
| | | import com.xcong.excoin.modules.otc.dto.OtcOrderAddDto; |
| | | import com.xcong.excoin.modules.otc.entity.OtcEntrustOrder; |
| | | import com.xcong.excoin.modules.otc.entity.OtcMarketBussiness; |
| | | import com.xcong.excoin.modules.otc.entity.OtcOrder; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void buyOrder(OrderAddDto orderAddDto) { |
| | | public void buyOrder(OtcOrderAddDto orderAddDto) { |
| | | MemberEntity member = LoginUserUtils.getAppLoginUser(); |
| | | OtcEntrustOrder entrustOrder = otcEntrustOrderDao.selectById(orderAddDto.getId()); |
| | | if (entrustOrder == null) { |
| | |
| | | throw new GlobalException("低于最低限额"); |
| | | } |
| | | |
| | | if (orderAddDto.getUsdtAmount().compareTo(entrustOrder.getLimitMaxAmount()) > 0) { |
| | | if (orderAddDto.getCnyAmount().compareTo(entrustOrder.getLimitMaxAmount()) > 0) { |
| | | throw new GlobalException("高于最高限额"); |
| | | } |
| | | |
| | | if (orderAddDto.getCnyAmount().compareTo(entrustOrder.getRemainCoinAmount()) > 0) { |
| | | throw new GlobalException("剩余数量不足"); |
| | | } |
| | | |
| | | BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saleOrder(OrderAddDto orderAddDto) { |
| | | public void saleOrder(OtcOrderAddDto orderAddDto) { |
| | | MemberEntity member = LoginUserUtils.getAppLoginUser(); |
| | | OtcEntrustOrder entrustOrder = otcEntrustOrderDao.selectById(orderAddDto.getId()); |
| | | if (entrustOrder == null) { |
| | |
| | | throw new GlobalException("无法出售"); |
| | | } |
| | | |
| | | if (orderAddDto.getUsdtAmount().compareTo(entrustOrder.getLimitMinAmount()) < 0) { |
| | | if (orderAddDto.getCnyAmount().compareTo(entrustOrder.getLimitMinAmount()) < 0) { |
| | | throw new GlobalException("低于最低限额"); |
| | | } |
| | | |
| | | if (orderAddDto.getUsdtAmount().compareTo(entrustOrder.getLimitMaxAmount()) > 0) { |
| | | if (orderAddDto.getCnyAmount().compareTo(entrustOrder.getLimitMaxAmount()) > 0) { |
| | | throw new GlobalException("高于最高限额"); |
| | | } |
| | | |
| | | if (orderAddDto.getUsdtAmount().compareTo(entrustOrder.getRemainCoinAmount()) > 0) { |
| | | throw new GlobalException("剩余数量不足"); |
| | | } |
| | | |
| | | if (StrUtil.isBlank(orderAddDto.getPassword())) { |
| | | throw new GlobalException("资金密码不能为空"); |
| | | } |