| | |
| | | |
| | | MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberEntity.getId(), CoinTypeConvert.convertContractTypeToCoin(submitEntrustDto.getSymbol())); |
| | | |
| | | ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectWholeHoldOrderByOrderType(memberEntity.getId(), submitEntrustDto.getEntrustType()); |
| | | ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectWholeHoldOrderByOrderType(memberEntity.getId(), submitEntrustDto.getEntrustType(), submitEntrustDto.getSymbol()); |
| | | |
| | | BigDecimal bondAmount; |
| | | BigDecimal openFeePrice; |
| | |
| | | ContractOrderEntity orderEntity = ContractEntrustOrderEntityMapper.INSTANCE.entrustOrderToOrder(entrustOrderEntity); |
| | | orderEntity.setTradeType(ContractOrderEntity.TRADE_TYPE_MARK_PRICE); |
| | | orderEntity.setOrderStatus(ContractOrderEntity.ORDER_STATUS_CANCEL); |
| | | |
| | | if (entrustOrderEntity.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_CLOSE_LESS || entrustOrderEntity.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_CLOSE_MORE) { |
| | | orderEntity.setClosingType(entrustOrderEntity.getEntrustType()); |
| | | } |
| | | int i = contractOrderDao.insert(orderEntity); |
| | | |
| | | contractEntrustOrderDao.deleteById(entrustOrderEntity.getId()); |
| | |
| | | entrustOrder.setLeverRatio(holdOrderEntity.getLeverRatio()); |
| | | entrustOrder.setSymbolSku(holdOrderEntity.getSymbolSku()); |
| | | entrustOrder.setEntrustType(closeType); |
| | | entrustOrder.setSymbolCnt(holdOrderEntity.getSymbolCnt()); |
| | | entrustOrder.setSymbolCnt(submitCloseEntrustDto.getSymbolCnt()); |
| | | entrustOrder.setSymbol(holdOrderEntity.getSymbol()); |
| | | |
| | | int i = contractEntrustOrderDao.insert(entrustOrder); |
| | | |
| | | |
| | | memberWalletContractDao.increaseWalletContractBalanceById(null, null, bondAmount, walletContract.getId()); |
| | | // memberWalletContractDao.increaseWalletContractBalanceById(null, null, bondAmount, walletContract.getId()); |
| | | |
| | | if (i > 0) { |
| | | // 发送委托消息 |
| | | if (holdOrderEntity.getOpeningType() == ContractEntrustOrderEntity.ENTRUST_TYPE_OPEN_MORE) { |
| | | OrderModel model = new OrderModel(holdOrderEntity.getId(), RabbitPriceTypeEnum.ENTRUST_CLOSE_MORE.getValue(), submitCloseEntrustDto.getEntrustPrice().setScale(8, RoundingMode.HALF_UP).toPlainString(), holdOrderEntity.getSymbol()); |
| | | OrderModel model = new OrderModel(entrustOrder.getId(), RabbitPriceTypeEnum.ENTRUST_CLOSE_MORE.getValue(), submitCloseEntrustDto.getEntrustPrice().setScale(8, RoundingMode.HALF_UP).toPlainString(), holdOrderEntity.getSymbol()); |
| | | producer.sendPriceOperate(JSONObject.toJSONString(model)); |
| | | } else { |
| | | OrderModel model = new OrderModel(holdOrderEntity.getId(), RabbitPriceTypeEnum.ENTRUST_CLOSE_LESS.getValue(), submitCloseEntrustDto.getEntrustPrice().setScale(8, RoundingMode.HALF_UP).toPlainString(), holdOrderEntity.getSymbol()); |
| | | OrderModel model = new OrderModel(entrustOrder.getId(), RabbitPriceTypeEnum.ENTRUST_CLOSE_LESS.getValue(), submitCloseEntrustDto.getEntrustPrice().setScale(8, RoundingMode.HALF_UP).toPlainString(), holdOrderEntity.getSymbol()); |
| | | producer.sendPriceOperate(JSONObject.toJSONString(model)); |
| | | } |
| | | } |