admin
2021-05-19 a1be6075c6b1365a7abc66bf559d6058039248ab
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java
@@ -112,8 +112,16 @@
    private RocketMQManager rocketMQManager;
    // 下级被封禁,红包失效
    private void invalidHongBaoForbidden(Long id) {
        HongBaoV2 updateHongBaoV2 = new HongBaoV2(id);
    private void invalidHongBaoForbidden(HongBaoV2 hongBaoV2) throws TeamRewardDebtException {
        if (hongBaoV2.getState() == HongBaoV2.STATE_SHIXIAO || hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU || hongBaoV2.getState() == HongBaoV2.STATE_LINGQUING)
            return;
        //如果在偿还里面就先偿还,然后再失效
        TeamRewardDebt debt = teamRewardDebtService.selectBySourceId(hongBaoV2.getId());
        if (debt != null && debt.getLeftMoney().compareTo(hongBaoV2.getMoney()) <= 0) {
            teamRewardDebtService.repayDebt(debt.getId(), hongBaoV2.getMoney(), "封禁失效,先偿还再失效");
        }
        HongBaoV2 updateHongBaoV2 = new HongBaoV2(hongBaoV2.getId());
        updateHongBaoV2.setState(HongBaoV2.STATE_SHIXIAO);
        updateHongBaoV2.setBeizhu("封禁失效");
        updateHongBaoV2.setUpdateTime(new Date());
@@ -125,7 +133,7 @@
    public void inviteSettleTB(Long uid, Date maxPregetTime) throws OrderMoneySettleException {
        // 查询UID的一二级邀请赚
        int sourceType = Constant.SOURCE_TYPE_TAOBAO;
        inviteSettle(uid,sourceType,maxPregetTime);
        inviteSettle(uid, sourceType, maxPregetTime);
    }
    @Transactional(rollbackFor = Exception.class)
@@ -133,7 +141,7 @@
    public void inviteSettleJD(Long uid, Date maxPregetTime) throws OrderMoneySettleException {
        // 查询UID的一二级邀请赚
        int sourceType = Constant.SOURCE_TYPE_JD;
        inviteSettle(uid,sourceType,maxPregetTime);
        inviteSettle(uid, sourceType, maxPregetTime);
    }
    @Transactional(rollbackFor = Exception.class)
@@ -141,7 +149,7 @@
    public void inviteSettlePDD(Long uid, Date maxPregetTime) throws OrderMoneySettleException {
        // 查询UID的一二级邀请赚
        int sourceType = Constant.SOURCE_TYPE_PDD;
        inviteSettle(uid,sourceType,maxPregetTime);
        inviteSettle(uid, sourceType, maxPregetTime);
    }
    @Transactional(rollbackFor = Exception.class)
@@ -149,7 +157,7 @@
    public void inviteSettleVipShop(Long uid, Date maxPregetTime) throws OrderMoneySettleException {
        // 查询UID的一二级邀请赚
        int sourceType = Constant.SOURCE_TYPE_VIP;
        inviteSettle(uid,sourceType,maxPregetTime);
        inviteSettle(uid, sourceType, maxPregetTime);
    }
@@ -158,7 +166,7 @@
    public void inviteSettleSuning(Long uid, Date maxPregetTime) throws OrderMoneySettleException {
        // 查询UID的一二级邀请赚
        int sourceType = Constant.SOURCE_TYPE_SUNING;
        inviteSettle(uid,sourceType,maxPregetTime);
        inviteSettle(uid, sourceType, maxPregetTime);
    }
@@ -190,7 +198,11 @@
                        // 上级用户不是正常用户,订单均不能到账
                        UserInfo userInfo = userInfoMapper.selectAvailableByPrimaryKey(co.getUserInfo().getId());
                        if (userInfo == null || userInfo.getState() != UserInfo.STATE_NORMAL) {
                            invalidHongBaoForbidden(item.getId());
                            try {
                                invalidHongBaoForbidden(item);
                            } catch (TeamRewardDebtException e) {
                                throw new OrderMoneySettleException(10, "偿还出错");
                            }
                            hongBaoList.remove(i);
                            i--;
                        }
@@ -535,7 +547,7 @@
                        && money.compareTo(debt.getLeftMoney()) >= 0) {
                    money = money.subtract(debt.getLeftMoney());
                    // 还钱
                    teamRewardDebtService.repayDebt(debt.getId(), debt.getLeftMoney());
                    teamRewardDebtService.repayDebt(debt.getId(), debt.getLeftMoney(), null);
                }
                invitemoney = invitemoney.add(money);