| | |
| | | import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity; |
| | | import com.xcong.excoin.modules.contract.entity.ContractOrderEntity; |
| | | import com.xcong.excoin.modules.contract.mapper.ContractHoldOrderEntityMapper; |
| | | import com.xcong.excoin.modules.contract.service.RabbitOrderService; |
| | | import com.xcong.excoin.modules.documentary.common.NoticeConstant; |
| | | import com.xcong.excoin.modules.documentary.dao.FollowFollowerOrderRelationDao; |
| | | import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao; |
| | | import com.xcong.excoin.modules.documentary.dao.FollowFollowerSettingDao; |
| | | import com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao; |
| | | import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity; |
| | | import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity; |
| | | import com.xcong.excoin.modules.documentary.entity.FollowFollowerSettingEntity; |
| | | import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @Resource |
| | | private FollowTraderInfoDao followTraderInfoDao; |
| | | |
| | | @Resource |
| | | private RabbitOrderService rabbitOrderService; |
| | | |
| | | |
| | | @Override |
| | | public void addFollowerOrder(Long id) { |
| | | log.info("进入跟单处理逻辑"); |
| | | // 查询交易员订单 |
| | | ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectById(id); |
| | | |
| | |
| | | } |
| | | |
| | | if (symbolCnt <= 0) { |
| | | LogRecordUtils.insertFollowerNotice(followerSetting.getMemberId(), NoticeConstant.OPEN_ORDER_FOLLOW_FAIL_TITLE, StrUtil.format(NoticeConstant.OPEN_ORDER_FOLLOW_FAIL_CONTENT, followTraderInfoEntity.getNickname())); |
| | | continue; |
| | | } |
| | | } |
| | |
| | | followHoldOrder.setBondAmount(bondAmount.add(openFeePrice)); |
| | | followHoldOrder.setOperateNo(1); |
| | | // 设置合约类型 |
| | | holdOrderEntity.setContractType(ContractOrderEntity.CONTRACTTYPE_DOCUMENTARY); |
| | | followHoldOrder.setContractType(ContractOrderEntity.CONTRACTTYPE_DOCUMENTARY); |
| | | |
| | | ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(holdOrderEntity); |
| | | ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(followHoldOrder); |
| | | contractOrderEntity.setOpeningTime(new Date()); |
| | | contractHoldOrderDao.insert(holdOrderEntity); |
| | | contractHoldOrderDao.insert(followHoldOrder); |
| | | int i = contractOrderDao.insert(contractOrderEntity); |
| | | |
| | | if (i > 0) { |
| | | memberWalletContractDao.increaseWalletContractBalanceById(prePaymentAmount.negate(), openFeePrice.negate(), null, walletContract.getId()); |
| | | |
| | | FollowFollowerOrderRelationEntity relationEntity = new FollowFollowerOrderRelationEntity(); |
| | | relationEntity.setIsShow(FollowFollowerOrderRelationEntity.IS_SHOW_Y); |
| | | relationEntity.setMemberId(followHoldOrder.getMemberId()); |
| | | relationEntity.setOrderId(followHoldOrder.getId()); |
| | | relationEntity.setOrderType(FollowFollowerOrderRelationEntity.ORDER_TYPE_HOLD); |
| | | relationEntity.setTradeId(followTraderInfoEntity.getId()); |
| | | relationEntity.setTradeMemberId(followTraderInfoEntity.getMemberId()); |
| | | relationEntity.setTradeOrderNo(holdOrderEntity.getOrderNo()); |
| | | followFollowerOrderRelationDao.insert(relationEntity); |
| | | |
| | | // 发送爆仓消息 |
| | | sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), forceClosingPrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo()); |
| | |
| | | } |
| | | producer.sendPriceOperate(JSONObject.toJSONString(model)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void closingFollowOrders(String orderNo) { |
| | | List<FollowFollowerOrderRelationEntity> orderRelations = followFollowerOrderRelationDao.selectFollowHoldOrderByTradeOrderNo(orderNo); |
| | | if (CollUtil.isNotEmpty(orderRelations)) { |
| | | for (FollowFollowerOrderRelationEntity orderRelation : orderRelations) { |
| | | List<Long> ids= new ArrayList<>(); |
| | | ids.add(orderRelation.getOrderId()); |
| | | rabbitOrderService.cancelHoldOrder(ids); |
| | | } |
| | | } |
| | | } |
| | | } |