| | |
| | | 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.dao.FollowFollowerOrderRelationDao; |
| | | import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity; |
| | | import com.xcong.excoin.modules.documentary.service.FollowOrderOperationService; |
| | | import com.xcong.excoin.modules.member.dao.MemberDao; |
| | | import com.xcong.excoin.modules.member.dao.MemberWalletContractDao; |
| | | import com.xcong.excoin.modules.member.entity.AgentReturnEntity; |
| | |
| | | @Resource |
| | | private RedisUtils redisUtils; |
| | | |
| | | @Resource |
| | | private FollowFollowerOrderRelationDao followFollowerOrderRelationDao; |
| | | @Resource |
| | | private FollowOrderOperationService followOrderOperationService; |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void cancelHoldOrder(List<Long> ids) { |
| | |
| | | } |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void cancelHoldOrderMethod(ContractHoldOrderEntity holdOrderEntity) { |
| | | String symbol = holdOrderEntity.getSymbol(); |
| | | // 获取最新价 |
| | |
| | | |
| | | // 计算佣金 |
| | | ThreadPoolUtils.calReturnMoney(memberEntity.getId(), contractOrderEntity.getClosingFeeAmount(), contractOrderEntity, AgentReturnEntity.ORDER_TYPE_CLOSE); |
| | | |
| | | // 判断当前持仓是否为跟单订单 |
| | | if (ContractOrderEntity.CONTRACTTYPE_DOCUMENTARY == holdOrderEntity.getContractType()) { |
| | | updateFollowOrderRelation(holdOrderEntity.getId(), contractOrderEntity.getId()); |
| | | |
| | | // 若为交易员,则平仓跟随者订单 |
| | | if (MemberEntity.IS_TRADER_Y.equals(memberEntity.getIsTrader())) { |
| | | followOrderOperationService.closingFollowOrders(holdOrderEntity.getOrderNo()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 更新跟单订单关系 |
| | | * |
| | | * @param oldOrderId 当前持仓ID |
| | | * @param newOrderId 历史订单ID |
| | | */ |
| | | public void updateFollowOrderRelation(Long oldOrderId, Long newOrderId) { |
| | | FollowFollowerOrderRelationEntity orderRelationEntity = followFollowerOrderRelationDao.selectNowOneByorderId(oldOrderId); |
| | | if (orderRelationEntity != null) { |
| | | orderRelationEntity.setOrderId(newOrderId); |
| | | orderRelationEntity.setOrderType(FollowFollowerOrderRelationEntity.ORDER_TYPE_HISTORY); |
| | | followFollowerOrderRelationDao.updateById(orderRelationEntity); |
| | | } |
| | | } |
| | | } |