| | |
| | | throw new GlobalException("委托单不存在"); |
| | | } |
| | | |
| | | if (member.getId().equals(entrustOrder.getMemberId())) { |
| | | throw new GlobalException("不能购买自己的委托单"); |
| | | } |
| | | |
| | | if (!OtcEntrustOrder.ORDER_TYPE_S.equals(entrustOrder.getOrderType())) { |
| | | throw new GlobalException("无法购买"); |
| | | } |
| | |
| | | OtcEntrustOrder entrustOrder = otcEntrustOrderDao.selectById(orderAddDto.getId()); |
| | | if (entrustOrder == null) { |
| | | throw new GlobalException("委托单不存在"); |
| | | } |
| | | |
| | | if (member.getId().equals(entrustOrder.getMemberId())) { |
| | | throw new GlobalException("不能购买自己的委托单"); |
| | | } |
| | | |
| | | if (!OtcEntrustOrder.ORDER_TYPE_B.equals(entrustOrder.getOrderType())) { |
| | |
| | | // 出售者钱包冻结减少币 |
| | | memberWalletCoinDao.reduceFrozenBalance(saleWallet.getId(), buyOrder.getCoinAmount()); |
| | | |
| | | this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_PAY, null, otcOrder.getOrderNo()); |
| | | this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_FINISH, null, otcOrder.getOrderNo()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | return Result.ok(saleDetail); |
| | | } |
| | | |
| | | @Override |
| | | public void cancelOrder(Long id) { |
| | | OtcOrder otcOrder = this.baseMapper.selectById(id); |
| | | if (otcOrder == null) { |
| | | throw new GlobalException("订单不存在"); |
| | | } |
| | | |
| | | if (!OtcOrder.STATUS_SUBMIT.equals(otcOrder.getStatus())) { |
| | | throw new GlobalException("不能取消"); |
| | | } |
| | | this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_CANCEL, null, otcOrder.getOrderNo()); |
| | | } |
| | | } |