| | |
| | | import com.xcong.excoin.common.system.service.CommonService; |
| | | import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao; |
| | | import com.xcong.excoin.modules.contract.dao.ContractOrderDao; |
| | | import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity; |
| | | 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.FollowTraderInfoDao; |
| | | import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitDetailDao; |
| | | import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity; |
| | |
| | | private FollowTraderInfoDao followTraderInfoDao; |
| | | @Resource |
| | | private FollowTraderProfitDetailDao followTraderProfitDetailDao; |
| | | @Resource |
| | | private FollowFollowerProfitDao followFollowerProfitDao; |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | |
| | | try { |
| | | if (ids.size() == 1) { |
| | | ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectById(ids.get(0)); |
| | | cancelHoldOrderMethod(holdOrderEntity); |
| | | // 判断仓位类型是否逐仓 |
| | | if (holdOrderEntity.getPositionType() == ContractEntrustOrderEntity.POSITION_TYPE_ADD) { |
| | | // 逐仓平仓 |
| | | cancelHoldOrderMethod(holdOrderEntity); |
| | | } else { |
| | | // 全仓模式平仓 |
| | | closingWholeOrder(holdOrderEntity); |
| | | } |
| | | } else { |
| | | List<ContractHoldOrderEntity> holdOrderEntities = contractHoldOrderDao.selectBatchIds(ids); |
| | | if (CollUtil.isNotEmpty(holdOrderEntities)) { |
| | |
| | | if (MemberEntity.IS_TRADER_Y.equals(memberEntity.getIsTrader())) { |
| | | followOrderOperationService.closingFollowOrders(holdOrderEntity.getOrderNo()); |
| | | } else { |
| | | LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.CLOSE_ORDER_TITLE, StrUtil.format(NoticeConstant.CLOSE_ORDER_CONTENT, contractOrderEntity.getSymbol(), contractOrderEntity.getClosingPrice(), profitOrLoss)); |
| | | followFollowerProfitDao.updateFollowerProfitByTradeMemberId(holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()), profitOrLoss, traderInfoEntity.getMemberId(), memberEntity.getId()); |
| | | LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.CLOSE_ORDER_TITLE, StrUtil.format(NoticeConstant.CLOSE_ORDER_CONTENT, contractOrderEntity.getSymbol(), contractOrderEntity.getClosingPrice(), profitOrLoss, traderInfoEntity.getNickname())); |
| | | } |
| | | } |
| | | } |
| | |
| | | profitDetailEntity.setOrderNo(orderNo); |
| | | followTraderProfitDetailDao.insert(profitDetailEntity); |
| | | } |
| | | |
| | | /** |
| | | * 全仓模式平仓逻辑 |
| | | */ |
| | | public void closingWholeOrder(ContractHoldOrderEntity contractHoldOrderEntity) { |
| | | |
| | | } |
| | | } |