| | |
| | | BigDecimal prePaymentAmount = bondAmount.add(openFeePrice).add(openFeePrice); |
| | | if (prePaymentAmount.compareTo(walletContract.getAvailableBalance()) > -1) { |
| | | log.info("可用金额不足"); |
| | | LogRecordUtils.insertFollowerNotice(followerSetting.getMemberId(), NoticeConstant.MONEY_NOT_ENOUGH_TITLE, StrUtil.format(NoticeConstant.MONEY_NOT_ENOUGH_CONTENT, followTraderInfoEntity.getNickname())); |
| | | continue; |
| | | } |
| | | |
| | |
| | | followHoldOrder.setTradeType(ContractHoldOrderEntity.TRADE_TYPE_MARK); |
| | | followHoldOrder.setSymbol(holdOrderEntity.getSymbol()); |
| | | followHoldOrder.setSymbolCnt(symbolCnt); |
| | | followHoldOrder.setSymbolCntSale(symbolCnt); |
| | | followHoldOrder.setSymbolSku(lotNumber); |
| | | followHoldOrder.setLeverRatio(levelRateEntity.getLevelRateUp()); |
| | | followHoldOrder.setForceClosingPrice(forceClosingPrice); |
| | |
| | | followFollowerOrderRelationDao.insert(relationEntity); |
| | | |
| | | // 发送爆仓消息 |
| | | sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), forceClosingPrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo()); |
| | | sendOrderBombMsg(followHoldOrder.getId(), followHoldOrder.getOpeningType(), forceClosingPrice, followHoldOrder.getSymbol(), followHoldOrder.getOperateNo(), followHoldOrder.getMemberId()); |
| | | |
| | | // 计算佣金 |
| | | ThreadPoolUtils.calReturnMoney(memberEntity.getId(), contractOrderEntity.getOpeningFeeAmount(), contractOrderEntity, AgentReturnEntity.ORDER_TYPE_OPEN); |
| | |
| | | } |
| | | } |
| | | |
| | | public void sendOrderBombMsg(Long id, int type, BigDecimal forceClosingPrice, String symbol, int operateNo) { |
| | | public void sendOrderBombMsg(Long id, int type, BigDecimal forceClosingPrice, String symbol, int operateNo, Long memberId) { |
| | | OrderModel model = null; |
| | | // 开多 |
| | | if (ContractHoldOrderEntity.OPENING_TYPE_MORE == type) { |
| | | model = new OrderModel(id, RabbitPriceTypeEnum.CLOSE_MORE_BOMB.getValue(), forceClosingPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), symbol, operateNo); |
| | | model = new OrderModel(id, RabbitPriceTypeEnum.CLOSE_MORE_BOMB.getValue(), forceClosingPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), symbol, operateNo, memberId); |
| | | // 开空 |
| | | } else { |
| | | model = new OrderModel(id, RabbitPriceTypeEnum.CLOSE_LESS_BOMB.getValue(), forceClosingPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), symbol, operateNo); |
| | | model = new OrderModel(id, RabbitPriceTypeEnum.CLOSE_LESS_BOMB.getValue(), forceClosingPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), symbol, operateNo, memberId); |
| | | } |
| | | producer.sendPriceOperate(JSONObject.toJSONString(model)); |
| | | } |