Helius
2021-03-31 3143298c452614a386edf9b52aa6ff618d744d90
Merge branch 'activity' of http://120.27.238.55:7000/r/exchange into activity
4 files modified
31 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/documentary/common/NoticeConstant.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java 1 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/service/impl/FollowOrderOperationServiceImpl.java 21 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml 7 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/common/NoticeConstant.java
@@ -32,6 +32,6 @@
    public static final String RETURN_MONEY_TITLE = "跟单-平仓返利";
    public static final String RETURN_MONEY_CONTENT = "平仓成功,收到的合约{},币种{}的返利金额:{}";
    public static final String RETURN_MONEY_CONTENT_MAMC = "合约{},币种{}的返利";
    public static final String RETURN_MONEY_CONTENT_MAMC = "合约-{},订单{}的带单返利";
}
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerOrderRelationDao.java
@@ -18,6 +18,7 @@
    FollowFollowerOrderRelationEntity selectNowOneByorderId(@Param("orderId")Long orderId);
    List<FollowFollowerOrderRelationEntity> selectFollowHoldOrderByTradeOrderNo(@Param("orderNo") String orderNo);
    List<FollowFollowerOrderRelationEntity> selectFollowOrderByTradeOrderNo(@Param("orderNo") String orderNo);
    BigDecimal selectTraderTotalProfit(@Param("memberId") Long memberId);
    BigDecimal selectTraderTotalProfitSelf(@Param("memberId") Long memberId);
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,8 +302,8 @@
                    LogRecordUtils.insertMemberAccountMoneyChange(
                            traderMemberId,
                            StrUtil.format(NoticeConstant.RETURN_MONEY_CONTENT_MAMC,
                                    orderNoTrader,
                                    symbol),
                                        symbol,
                                        orderNoTrader.substring(8)),
                            totalAmount,
                            MemberWalletCoinEnum.WALLETCOINCODE.getValue(),
                            MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER,
@@ -309,3 +313,4 @@
        }
    }
}
}
src/main/resources/mapper/documentary/FollowFollowerOrderRelationDao.xml
@@ -33,6 +33,13 @@
        and a.order_type=1
    </select>
    <select id="selectFollowOrderByTradeOrderNo" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity">
        select a.*
        from follow_follower_order_relation a, follow_follower_profit b
        where a.trade_member_id=b.trade_member_id and a.trade_order_no=#{orderNo} and b.is_follow=1
          and a.order_type=2
    </select>
    <select id="selectTraderTotalProfit" resultType="java.math.BigDecimal">
        select sum(b.reward_amount)
        from follow_follower_order_relation a, contract_order b