xiaoyong931011
2021-03-31 65f792e975b7ff985bf42003ceb49245904288b2
src/main/java/com/xcong/excoin/modules/documentary/service/impl/FollowOrderOperationServiceImpl.java
@@ -264,20 +264,24 @@
    public void closingFollowOrders(String orderNo) {
        List<FollowFollowerOrderRelationEntity> orderRelations = followFollowerOrderRelationDao.selectFollowHoldOrderByTradeOrderNo(orderNo);
        if (CollUtil.isNotEmpty(orderRelations)) {
            List<Long> orderIds = new ArrayList<>();
            for (FollowFollowerOrderRelationEntity orderRelation : orderRelations) {
                List<Long> ids= new ArrayList<>();
                ids.add(orderRelation.getOrderId());
                orderIds.add(orderRelation.getOrderId());
                rabbitOrderService.cancelHoldOrder(ids);
            }
            //生成返利记录和资金变化记录
            List<FollowFollowerOrderRelationEntity> orderRelationDone = followFollowerOrderRelationDao.selectFollowOrderByTradeOrderNo(orderNo);
            if(CollUtil.isNotEmpty(orderRelationDone)) {
               List<Long> orderIds = new ArrayList<>();
               for (FollowFollowerOrderRelationEntity orderRelationd : orderRelationDone) {
                    orderIds.add(orderRelationd.getOrderId());
                }
            if(CollUtil.isNotEmpty(orderIds)){
                //获取对应的平仓记录单号
                List<String> orderNosList = new ArrayList<>();
                for(Long orderId : orderIds) {
                    String orderNos = contractOrderDao.selectOrderNoByOrderIds(orderId);
                    ContractOrderEntity contractOrderEntity = contractOrderDao.selectById(orderId);
                    orderNosList.add(orderNos);
                }
                //获取总返佣
@@ -286,8 +290,8 @@
                if(totalAmount.compareTo(BigDecimal.ZERO) > 0){
                    //增加返佣提醒
                    String symbol = contractOrderDao.selectById(orderIds.get(0)).getSymbol();
                    String orderNoTrader = orderRelations.get(0).getTradeOrderNo();
                    Long traderMemberId = orderRelations.get(0).getTradeMemberId();
                       String orderNoTrader = orderRelationDone.get(0).getTradeOrderNo();
                       Long traderMemberId = orderRelationDone.get(0).getTradeMemberId();
                    LogRecordUtils.insertFollowerNotice(traderMemberId,
                            NoticeConstant.RETURN_MONEY_TITLE,
                            StrUtil.format(NoticeConstant.RETURN_MONEY_CONTENT,
@@ -298,7 +302,7 @@
                    LogRecordUtils.insertMemberAccountMoneyChange(
                            traderMemberId,
                            StrUtil.format(NoticeConstant.RETURN_MONEY_CONTENT_MAMC,
                                    orderNoTrader,
                                       orderNoTrader.substring(8),
                                    symbol),
                            totalAmount,
                            MemberWalletCoinEnum.WALLETCOINCODE.getValue(),
@@ -309,3 +313,4 @@
        }
    }
}
}