admin
2020-11-09 2147d023563a7c9d05d97547c00d6b0162c0644c
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -801,169 +801,169 @@
        new JobThreadExecutorServiceImpl().run(new Runnable() {
            @Override
            public void run() {
                    Map<String, Long> map = HongBaoRecieveCMQManager.getInstance()
                            .consumeQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, 16);
                    if (map != null) {
                        Iterator<String> its = map.keySet().iterator();
                        while (its.hasNext()) {
                            String key = its.next();
                            Long hongBaoId = map.get(key);
                            try {
                                HongBaoV2 hongBaoV2 = hongBaoV2Service.selectByPrimaryKey(hongBaoId);
                                if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
                                        && hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
                                    // 到账送金币
                                    fanliGetIntegral(hongBaoV2);
                                    HongBaoRecieveCMQManager.getInstance()
                                            .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, key);
                Map<String, Long> map = HongBaoRecieveCMQManager.getInstance()
                        .consumeQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, 16);
                if (map != null) {
                    Iterator<String> its = map.keySet().iterator();
                    while (its.hasNext()) {
                        String key = its.next();
                        Long hongBaoId = map.get(key);
                        try {
                            HongBaoV2 hongBaoV2 = hongBaoV2Service.selectByPrimaryKey(hongBaoId);
                            if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
                                    && hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
                                // 到账送金币
                                fanliGetIntegral(hongBaoV2);
                                HongBaoRecieveCMQManager.getInstance()
                                        .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, key);
                                    // 返利不足0.01元送金币
                                    if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购
                                        // 判断是否为该用户的首笔红包
                                        List<Integer> typeList = new ArrayList<>();
                                        typeList.add(HongBaoV2.TYPE_ZIGOU);
                                        HongBaoV2 firstHongBao = hongBaoV2Service.getFirstValidHongBaoByTypeAndUid(
                                                typeList, hongBaoV2.getUserInfo().getId());
                                        if (firstHongBao != null
                                                && firstHongBao.getId().longValue() == hongBaoV2.getId()) {// 自购首单到账
                                            // 查询下级红包
                                            BigDecimal firstLevelMoney = new BigDecimal(0);
                                            BigDecimal secondLevelMoney = new BigDecimal(0);
                                            // 获取改单下面的红包
                                            List<HongBaoV2> hongBaoList = new ArrayList<>();
                                            HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                    .selectDetailByHongBaoId(hongBaoV2.getId());
                                            if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {// 计算改订单号下面的所有返利金额
                                                CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
                                                List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(
                                                        commonOrder.getSourceType(), commonOrder.getOrderNo());
                                                for (CommonOrder co : list) {
                                                    HongBaoOrder hbo = hongBaoOrderService
                                                            .selectDetailByCommonOrderId(co.getId());
                                                    if (hbo != null && hbo.getHongBaoV2() != null)
                                                        hongBaoList.add(hbo.getHongBaoV2());
                                                }
                                // 返利不足0.01元送金币
                                if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购
                                    // 判断是否为该用户的首笔红包
                                    List<Integer> typeList = new ArrayList<>();
                                    typeList.add(HongBaoV2.TYPE_ZIGOU);
                                    HongBaoV2 firstHongBao = hongBaoV2Service.getFirstValidHongBaoByTypeAndUid(
                                            typeList, hongBaoV2.getUserInfo().getId());
                                    if (firstHongBao != null
                                            && firstHongBao.getId().longValue() == hongBaoV2.getId()) {// 自购首单到账
                                        // 查询下级红包
                                        BigDecimal firstLevelMoney = new BigDecimal(0);
                                        BigDecimal secondLevelMoney = new BigDecimal(0);
                                        // 获取改单下面的红包
                                        List<HongBaoV2> hongBaoList = new ArrayList<>();
                                        HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                .selectDetailByHongBaoId(hongBaoV2.getId());
                                        if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {// 计算改订单号下面的所有返利金额
                                            CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
                                            List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(
                                                    commonOrder.getSourceType(), commonOrder.getOrderNo());
                                            for (CommonOrder co : list) {
                                                HongBaoOrder hbo = hongBaoOrderService
                                                        .selectDetailByCommonOrderId(co.getId());
                                                if (hbo != null && hbo.getHongBaoV2() != null)
                                                    hongBaoList.add(hbo.getHongBaoV2());
                                            }
                                        }
                                            for (HongBaoV2 hb : hongBaoList) {
                                                List<HongBaoV2> children = hongBaoV2Service
                                                        .listChildrenById(hb.getId());
                                                if (children != null)
                                                    for (HongBaoV2 child : children)
                                                        if (child.getType() == HongBaoV2.TYPE_YIJI) {
                                                            firstLevelMoney = firstLevelMoney.add(child.getMoney());
                                                        } else if (child.getType() == HongBaoV2.TYPE_ERJI) {
                                                            secondLevelMoney = secondLevelMoney.add(child.getMoney());
                                                        }
                                            }
                                            // 查询下级的生效时间
                                            ThreeSale threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                    hongBaoV2.getUserInfo().getId(), ThreeSale.STATE_SUCCESS);
                                            if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
                                                    .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
                                                // 成功时间要大于20190910日才开始送金币
                                                if (threeSale.getSucceedTime() > TimeUtil.convertToTimeTemp("20190901",
                                                        "yyyyMMdd")) {
                                                    if (firstLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 一级返利小于0.01
                                                        integralTaskRecordService.firstRebateOrderRewardBoss(
                                                                threeSale.getBoss().getId(),
                                                                hongBaoV2.getUserInfo().getId(), null);
                                                        LogHelper.test("自购-一级用户-" + threeSale.getBoss().getId()
                                                                + "-hongBaoId:" + hongBaoV2.getId());
                                        for (HongBaoV2 hb : hongBaoList) {
                                            List<HongBaoV2> children = hongBaoV2Service
                                                    .listChildrenById(hb.getId());
                                            if (children != null)
                                                for (HongBaoV2 child : children)
                                                    if (child.getType() == HongBaoV2.TYPE_YIJI) {
                                                        firstLevelMoney = firstLevelMoney.add(child.getMoney());
                                                    } else if (child.getType() == HongBaoV2.TYPE_ERJI) {
                                                        secondLevelMoney = secondLevelMoney.add(child.getMoney());
                                                    }
                                                }
                                            }
                                            // 查询下下级生效时间
                                            if (threeSale != null) {
                                                threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                        threeSale.getBoss().getId(), ThreeSale.STATE_SUCCESS);
                                                if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
                                                        .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
                                                    // 成功时间要大于20190910日才开始送金币
                                                    if (threeSale.getSucceedTime() > TimeUtil
                                                            .convertToTimeTemp("20190901", "yyyyMMdd")) {
                                                        if (secondLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 二级返利小于0.01
                                                            integralTaskRecordService.firstRebateOrderRewardBossSuper(
                                                                    threeSale.getBoss().getId(),
                                                                    hongBaoV2.getUserInfo().getId(), null);
                                                            LogHelper.test("自购-二级用户-" + threeSale.getBoss().getId()
                                                                    + "-hongBaoId:" + hongBaoV2.getId());
                                                        }
                                                    }
                                        }
                                        // 查询下级的生效时间
                                        ThreeSale threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                hongBaoV2.getUserInfo().getId(), ThreeSale.STATE_SUCCESS);
                                        if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
                                                .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
                                            // 成功时间要大于20190910日才开始送金币
                                            if (threeSale.getSucceedTime() > TimeUtil.convertToTimeTemp("20190901",
                                                    "yyyyMMdd")) {
                                                if (firstLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 一级返利小于0.01
                                                    integralTaskRecordService.firstRebateOrderRewardBoss(
                                                            threeSale.getBoss().getId(),
                                                            hongBaoV2.getUserInfo().getId(), null);
                                                    LogHelper.test("自购-一级用户-" + threeSale.getBoss().getId()
                                                            + "-hongBaoId:" + hongBaoV2.getId());
                                                }
                                            }
                                        }
                                    } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享赚
                                        // 判断是否为该用户的首笔红包
                                        List<Integer> typeList = new ArrayList<>();
                                        typeList.add(HongBaoV2.TYPE_SHARE_GOODS);
                                        HongBaoV2 firstHongBao = hongBaoV2Service.getFirstValidHongBaoByTypeAndUid(
                                                typeList, hongBaoV2.getUserInfo().getId());
                                        if (firstHongBao != null
                                                && firstHongBao.getId().longValue() == hongBaoV2.getId()) // 分享首笔到账
                                        {
                                            // 查询下级红包
                                            BigDecimal firstLevelMoney = new BigDecimal(0);
                                            // 获取改单下面的红包
                                            List<HongBaoV2> hongBaoList = new ArrayList<>();
                                            HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                    .selectDetailByHongBaoId(hongBaoV2.getId());
                                            if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {// 计算改订单号下面的所有返利金额
                                                CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
                                                List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(
                                                        commonOrder.getSourceType(), commonOrder.getOrderNo());
                                                for (CommonOrder co : list) {
                                                    HongBaoOrder hbo = hongBaoOrderService
                                                            .selectDetailByCommonOrderId(co.getId());
                                                    if (hbo != null && hbo.getHongBaoV2() != null)
                                                        hongBaoList.add(hbo.getHongBaoV2());
                                                }
                                            }
                                            for (HongBaoV2 hb : hongBaoList) {
                                                List<HongBaoV2> children = hongBaoV2Service
                                                        .listChildrenById(hb.getId());
                                                if (children != null)
                                                    for (HongBaoV2 child : children)
                                                        if (child.getType() == HongBaoV2.TYPE_SHARE_YIJI) {
                                                            firstLevelMoney = firstLevelMoney.add(child.getMoney());
                                                        }
                                            }
                                            ThreeSale threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                    hongBaoV2.getUserInfo().getId(), ThreeSale.STATE_SUCCESS);
                                        // 查询下下级生效时间
                                        if (threeSale != null) {
                                            threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                    threeSale.getBoss().getId(), ThreeSale.STATE_SUCCESS);
                                            if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
                                                    .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
                                                // 成功时间要大于20190910日才开始送金币
                                                if (threeSale.getSucceedTime() > TimeUtil.convertToTimeTemp("20190901",
                                                        "yyyyMMdd")) {
                                                    if (firstLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 一级返利小于0.01
                                                        integralTaskRecordService.firstSharerOrderRewardBoss(
                                                if (threeSale.getSucceedTime() > TimeUtil
                                                        .convertToTimeTemp("20190901", "yyyyMMdd")) {
                                                    if (secondLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 二级返利小于0.01
                                                        integralTaskRecordService.firstRebateOrderRewardBossSuper(
                                                                threeSale.getBoss().getId(),
                                                                hongBaoV2.getUserInfo().getId(), null);
                                                        LogHelper.test("分享-一级用户-" + threeSale.getBoss().getId()
                                                        LogHelper.test("自购-二级用户-" + threeSale.getBoss().getId()
                                                                + "-hongBaoId:" + hongBaoV2.getId());
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享赚
                                    // 判断是否为该用户的首笔红包
                                    List<Integer> typeList = new ArrayList<>();
                                    typeList.add(HongBaoV2.TYPE_SHARE_GOODS);
                                    HongBaoV2 firstHongBao = hongBaoV2Service.getFirstValidHongBaoByTypeAndUid(
                                            typeList, hongBaoV2.getUserInfo().getId());
                                    if (firstHongBao != null
                                            && firstHongBao.getId().longValue() == hongBaoV2.getId()) // 分享首笔到账
                                    {
                            } catch (Exception e) {
                                try {
                                    LogHelper.errorDetailInfo(e);
                                } catch (Exception e1) {
                                    e1.printStackTrace();
                                }
                            } finally {
                                        // 查询下级红包
                                        BigDecimal firstLevelMoney = new BigDecimal(0);
                                        // 获取改单下面的红包
                                        List<HongBaoV2> hongBaoList = new ArrayList<>();
                                        HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                .selectDetailByHongBaoId(hongBaoV2.getId());
                                        if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {// 计算改订单号下面的所有返利金额
                                            CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
                                            List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(
                                                    commonOrder.getSourceType(), commonOrder.getOrderNo());
                                            for (CommonOrder co : list) {
                                                HongBaoOrder hbo = hongBaoOrderService
                                                        .selectDetailByCommonOrderId(co.getId());
                                                if (hbo != null && hbo.getHongBaoV2() != null)
                                                    hongBaoList.add(hbo.getHongBaoV2());
                                            }
                                        }
                                        for (HongBaoV2 hb : hongBaoList) {
                                            List<HongBaoV2> children = hongBaoV2Service
                                                    .listChildrenById(hb.getId());
                                            if (children != null)
                                                for (HongBaoV2 child : children)
                                                    if (child.getType() == HongBaoV2.TYPE_SHARE_YIJI) {
                                                        firstLevelMoney = firstLevelMoney.add(child.getMoney());
                                                    }
                                        }
                                        ThreeSale threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                hongBaoV2.getUserInfo().getId(), ThreeSale.STATE_SUCCESS);
                                        if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
                                                .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
                                            // 成功时间要大于20190910日才开始送金币
                                            if (threeSale.getSucceedTime() > TimeUtil.convertToTimeTemp("20190901",
                                                    "yyyyMMdd")) {
                                                if (firstLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 一级返利小于0.01
                                                    integralTaskRecordService.firstSharerOrderRewardBoss(
                                                            threeSale.getBoss().getId(),
                                                            hongBaoV2.getUserInfo().getId(), null);
                                                    LogHelper.test("分享-一级用户-" + threeSale.getBoss().getId()
                                                            + "-hongBaoId:" + hongBaoV2.getId());
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        } catch (Exception e) {
                            try {
                                LogHelper.errorDetailInfo(e);
                            } catch (Exception e1) {
                                e1.printStackTrace();
                            }
                        } finally {
                        }
                    }
                }
            }
        });
    }
@@ -1010,97 +1010,97 @@
        new JobThreadExecutorServiceImpl().run(new Runnable() {
            @Override
            public void run() {
                    Map<String, Order> map = PlaceOrderCMQManager.getInstance()
                            .consumeQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL, 16);
                    if (map != null) {
                Map<String, Order> map = PlaceOrderCMQManager.getInstance()
                        .consumeQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL, 16);
                if (map != null) {
                        for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) {
                            try {
                                String key = its.next();
                                Order order = map.get(key);
                                // 是否是首单
                                if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
                                        order.getUserInfo().getId())) {
                                    // 统计订单下的用户所获得的返利金额
                                    List<CommonOrder> list = commonOrderService
                                            .listBySourceTypeAndOrderId(order.getOrderType(), order.getOrderId());
                                    Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
                                    if (list != null)
                                        for (CommonOrder commonOrder : list) {
                                            HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                    .selectDetailByCommonOrderId(commonOrder.getId());
                                            if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
                                                Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
                                                if (hongBaoMoney.get(mainUid) == null)
                                                    hongBaoMoney.put(mainUid, new BigDecimal(0));
                                                hongBaoMoney.put(mainUid, hongBaoMoney.get(mainUid)
                                                        .add(hongBaoOrder.getHongBaoV2().getMoney()));
                                                // 查询上级
                                                List<HongBaoV2> children = hongBaoV2Service
                                                        .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
                                                if (children != null) {
                                                    for (HongBaoV2 hongBao : children) {
                                                        Long uid = hongBao.getUserInfo().getId();
                                                        if (hongBaoMoney.get(uid) == null)
                                                            hongBaoMoney.put(uid, new BigDecimal(0));
                                                        hongBaoMoney.put(uid,
                                                                hongBaoMoney.get(uid).add(hongBao.getMoney()));
                                                    }
                                                }
                                            }
                                        }
                                    if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
                                            order.getUserInfo().getId())) {// 有效的首单
                                        if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
                                                .get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
                                            // 分享奖金是0
                                            integralTaskRecordService.firstShareOrderReward(order.getUserInfo().getId(),
                                                    null);
                                        }
                                        // 获取上两级数据
                                        UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                        if (boss != null) {// 判断上级的红包
                                            if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney.get(boss.getId())
                                                    .compareTo(new BigDecimal("0")) <= 0) {
                                                // 补偿金币
                                                integralTaskRecordService.firstSharerOrderRewardBoss(boss.getId(),
                                                        order.getUserInfo().getId(), null);
                                            }
                                        }
                                    } else {// 自购订单
                                        UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                        if (boss != null) {// 判断上级的红包
                                            if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney.get(boss.getId())
                                                    .compareTo(new BigDecimal("0")) <= 0) {
                                                // 补偿金币1级
                                                integralTaskRecordService.firstRebateOrderRewardBoss(boss.getId(),
                                                        order.getUserInfo().getId(), null);
                                            }
                                            boss = threeSaleSerivce.getBoss(boss.getId());
                                            if (boss != null) {// 判断上级的红包
                                                if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney
                                                        .get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                                    // 补偿金币2级
                                                    integralTaskRecordService.firstRebateOrderRewardBossSuper(
                                                            boss.getId(), order.getUserInfo().getId(), null);
                    for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) {
                        try {
                            String key = its.next();
                            Order order = map.get(key);
                            // 是否是首单
                            if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
                                    order.getUserInfo().getId())) {
                                // 统计订单下的用户所获得的返利金额
                                List<CommonOrder> list = commonOrderService
                                        .listBySourceTypeAndOrderId(order.getOrderType(), order.getOrderId());
                                Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
                                if (list != null)
                                    for (CommonOrder commonOrder : list) {
                                        HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                .selectDetailByCommonOrderId(commonOrder.getId());
                                        if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
                                            Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
                                            if (hongBaoMoney.get(mainUid) == null)
                                                hongBaoMoney.put(mainUid, new BigDecimal(0));
                                            hongBaoMoney.put(mainUid, hongBaoMoney.get(mainUid)
                                                    .add(hongBaoOrder.getHongBaoV2().getMoney()));
                                            // 查询上级
                                            List<HongBaoV2> children = hongBaoV2Service
                                                    .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
                                            if (children != null) {
                                                for (HongBaoV2 hongBao : children) {
                                                    Long uid = hongBao.getUserInfo().getId();
                                                    if (hongBaoMoney.get(uid) == null)
                                                        hongBaoMoney.put(uid, new BigDecimal(0));
                                                    hongBaoMoney.put(uid,
                                                            hongBaoMoney.get(uid).add(hongBao.getMoney()));
                                                }
                                            }
                                        }
                                    }
                                }
                                PlaceOrderCMQManager.getInstance().deleteQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL,
                                        key);
                            } catch (Exception e) {
                                LogHelper.errorDetailInfo(e);
                            }
                        }
                                if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
                                        order.getUserInfo().getId())) {// 有效的首单
                                    if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
                                            .get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
                                        // 分享奖金是0
                                        integralTaskRecordService.firstShareOrderReward(order.getUserInfo().getId(),
                                                null);
                                    }
                                    // 获取上两级数据
                                    UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                    if (boss != null) {// 判断上级的红包
                                        if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney.get(boss.getId())
                                                .compareTo(new BigDecimal("0")) <= 0) {
                                            // 补偿金币
                                            integralTaskRecordService.firstSharerOrderRewardBoss(boss.getId(),
                                                    order.getUserInfo().getId(), null);
                                        }
                                    }
                                } else {// 自购订单
                                    UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                    if (boss != null) {// 判断上级的红包
                                        if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney.get(boss.getId())
                                                .compareTo(new BigDecimal("0")) <= 0) {
                                            // 补偿金币1级
                                            integralTaskRecordService.firstRebateOrderRewardBoss(boss.getId(),
                                                    order.getUserInfo().getId(), null);
                                        }
                                        boss = threeSaleSerivce.getBoss(boss.getId());
                                        if (boss != null) {// 判断上级的红包
                                            if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney
                                                    .get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                                // 补偿金币2级
                                                integralTaskRecordService.firstRebateOrderRewardBossSuper(
                                                        boss.getId(), order.getUserInfo().getId(), null);
                                            }
                                        }
                                    }
                                }
                            }
                            PlaceOrderCMQManager.getInstance().deleteQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL,
                                    key);
                        } catch (Exception e) {
                            LogHelper.errorDetailInfo(e);
                        }
                    }
                }
            }
        });
    }
@@ -1135,56 +1135,56 @@
        new JobThreadExecutorServiceImpl().run(new Runnable() {
            @Override
            public void run() {
                    Map<String, DouYinDeviceActiveQueueDTO> map = DouYinDeviceActiveCMQManager.getInstance()
                            .consume(16);
                    if (map != null) {
                        // 是否是首单
                        for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) {
                            String key = its.next();
                            DouYinDeviceActiveQueueDTO active = map.get(key);
                            if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_AD) {// 抖音
                                DouYinClickEvent event = douYinClickEventService.selectByCallback(active.getCallback());
                                if (event != null) {
                                    if (event.getOs() == 0 && !StringUtil.isNullOrEmpty(event.getUuid())) {
                                        DeviceActive deviceActive = deviceActiveService
                                                .getFirstActiveInfoByImei(event.getUuid());
                                        if (deviceActive != null) {
                                            if (event != null) {
                                                if (event.getOs() == 0)
                                                    DouYinAdUtil.activeAndroid(event.getCallback(), event.getImei(),
                                                            deviceActive.getCreateTime().getTime());
                                                else if (event.getOs() == 1)
                                                    DouYinAdUtil.activeIOS(event.getCallback(), event.getIdfa(),
                                                            deviceActive.getCreateTime().getTime());
                                            }
                                        }
                                    } else {// TODO 处理IOS
                                    }
                                }
                            } else if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_DEVICE) {// 设备
                                if (active.getPlatform() == 1) {
                Map<String, DouYinDeviceActiveQueueDTO> map = DouYinDeviceActiveCMQManager.getInstance()
                        .consume(16);
                if (map != null) {
                    // 是否是首单
                    for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) {
                        String key = its.next();
                        DouYinDeviceActiveQueueDTO active = map.get(key);
                        if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_AD) {// 抖音
                            DouYinClickEvent event = douYinClickEventService.selectByCallback(active.getCallback());
                            if (event != null) {
                                if (event.getOs() == 0 && !StringUtil.isNullOrEmpty(event.getUuid())) {
                                    DeviceActive deviceActive = deviceActiveService
                                            .getFirstActiveInfo(active.getDevice());
                                    if (deviceActive != null && !StringUtil.isNullOrEmpty(deviceActive.getImei())) {
                                        DouYinClickEvent event = douYinClickEventService
                                                .selectByUuid(deviceActive.getImei());
                                        if (event != null) {// 回调
                                            if (deviceActive != null)
                                            .getFirstActiveInfoByImei(event.getUuid());
                                    if (deviceActive != null) {
                                        if (event != null) {
                                            if (event.getOs() == 0)
                                                DouYinAdUtil.activeAndroid(event.getCallback(), event.getImei(),
                                                        deviceActive.getCreateTime().getTime());
                                            else if (event.getOs() == 1)
                                                DouYinAdUtil.activeIOS(event.getCallback(), event.getIdfa(),
                                                        deviceActive.getCreateTime().getTime());
                                        }
                                    }
                                } else {
                                    // TODO 兼容IOS
                                } else {// TODO 处理IOS
                                }
                            }
                            DouYinDeviceActiveCMQManager.getInstance().delete(key);
                        } else if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_DEVICE) {// 设备
                            if (active.getPlatform() == 1) {
                                DeviceActive deviceActive = deviceActiveService
                                        .getFirstActiveInfo(active.getDevice());
                                if (deviceActive != null && !StringUtil.isNullOrEmpty(deviceActive.getImei())) {
                                    DouYinClickEvent event = douYinClickEventService
                                            .selectByUuid(deviceActive.getImei());
                                    if (event != null) {// 回调
                                        if (deviceActive != null)
                                            DouYinAdUtil.activeAndroid(event.getCallback(), event.getImei(),
                                                    deviceActive.getCreateTime().getTime());
                                    }
                                }
                            } else {
                                // TODO 兼容IOS
                            }
                        }
                        DouYinDeviceActiveCMQManager.getInstance().delete(key);
                    }
                }
            }
        });
    }
@@ -1193,37 +1193,37 @@
        new JobThreadExecutorServiceImpl().run(new Runnable() {
            @Override
            public void run() {
                    Map<String, UidDateDTO> map = TeamOrderCMQManager.getInstance().consumeTeamDividentsPreMsg(16);
                    if (map != null) {
                        Iterator<String> its = map.keySet().iterator();
                        while (its.hasNext()) {
                            String key = its.next();
                            UidDateDTO dto = map.get(key);
                            try {
                                teamDividentsManager.addToTeamEincome(dto.getUid(), dto.getDate());
                Map<String, UidDateDTO> map = TeamOrderCMQManager.getInstance().consumeTeamDividentsPreMsg(16);
                if (map != null) {
                    Iterator<String> its = map.keySet().iterator();
                    while (its.hasNext()) {
                        String key = its.next();
                        UidDateDTO dto = map.get(key);
                        try {
                            teamDividentsManager.addToTeamEincome(dto.getUid(), dto.getDate());
                            TeamOrderCMQManager.getInstance().deleteTeamDividentsPreMsg(key);
                        } catch (TeamDividentsRecordException e1) {
                            if (e1.getCode() == TeamDividentsRecordException.CODE_EXIST) {
                                TeamOrderCMQManager.getInstance().deleteTeamDividentsPreMsg(key);
                            } catch (TeamDividentsRecordException e1) {
                                if (e1.getCode() == TeamDividentsRecordException.CODE_EXIST) {
                                    TeamOrderCMQManager.getInstance().deleteTeamDividentsPreMsg(key);
                                } else {
                                    try {
                                        LogHelper.errorDetailInfo(e1);
                                    } catch (Exception e2) {
                                        e2.printStackTrace();
                                    }
                                }
                            } catch (Exception e) {
                            } else {
                                try {
                                    LogHelper.errorDetailInfo(e);
                                } catch (Exception e1) {
                                    e1.printStackTrace();
                                    LogHelper.errorDetailInfo(e1);
                                } catch (Exception e2) {
                                    e2.printStackTrace();
                                }
                            } finally {
                            }
                        } catch (Exception e) {
                            try {
                                LogHelper.errorDetailInfo(e);
                            } catch (Exception e1) {
                                e1.printStackTrace();
                            }
                        } finally {
                        }
                    }
                }
            }
        });
    }
@@ -1232,26 +1232,26 @@
        new JobThreadExecutorServiceImpl().run(new Runnable() {
            @Override
            public void run() {
                    Map<String, UidDateDTO> map = TeamOrderCMQManager.getInstance().consumeTeamDividentsMsg(16);
                    if (map != null) {
                        Iterator<String> its = map.keySet().iterator();
                        while (its.hasNext()) {
                            String key = its.next();
                            UidDateDTO dto = map.get(key);
                Map<String, UidDateDTO> map = TeamOrderCMQManager.getInstance().consumeTeamDividentsMsg(16);
                if (map != null) {
                    Iterator<String> its = map.keySet().iterator();
                    while (its.hasNext()) {
                        String key = its.next();
                        UidDateDTO dto = map.get(key);
                        try {
                            teamEincomeManager.addTeamDividentsTOUserAccount(dto.getDate(), dto.getUid());
                            TeamOrderCMQManager.getInstance().deleteTeamDividentsMsg(key);
                        } catch (Exception e) {
                            try {
                                teamEincomeManager.addTeamDividentsTOUserAccount(dto.getDate(), dto.getUid());
                                TeamOrderCMQManager.getInstance().deleteTeamDividentsMsg(key);
                            } catch (Exception e) {
                                try {
                                    LogHelper.errorDetailInfo(e);
                                } catch (Exception e1) {
                                    e1.printStackTrace();
                                }
                            } finally {
                                LogHelper.errorDetailInfo(e);
                            } catch (Exception e1) {
                                e1.printStackTrace();
                            }
                        } finally {
                        }
                    }
                }
            }
        });
    }
@@ -1262,27 +1262,29 @@
        new JobThreadExecutorServiceImpl().run(new Runnable() {
            @Override
            public void run() {
                    Map<String, PushContentDetailDTO> map = PushCMQManager.getInstance().consumeHWPush(16);
                    if (map != null) {
                        Iterator<String> its = map.keySet().iterator();
                        while (its.hasNext()) {
                            String key = its.next();
                            PushContentDetailDTO dto = map.get(key);
                            try {
                                hwPushService.push(dto);
                                PushCMQManager.getInstance().deleteHWPush(key);
                            } catch (Exception e) {
                                try {
                                    LogHelper.errorDetailInfo(e);
                                } catch (Exception e1) {
                                    e1.printStackTrace();
                                }
                            } finally {
                Map<String, PushContentDetailDTO> map = PushCMQManager.getInstance().consumeHWPush(16);
                if (map != null) {
                    Iterator<String> its = map.keySet().iterator();
                    while (its.hasNext()) {
                        String key = its.next();
                        PushContentDetailDTO dto = map.get(key);
                        LogHelper.pushHW("接受到消息:" + new Gson().toJson(dto));
                        try {
                            hwPushService.push(dto);
                            PushCMQManager.getInstance().deleteHWPush(key);
                        } catch (Exception e) {
                            try {
                                LogHelper.errorDetailInfo(e);
                            } catch (Exception e1) {
                                e1.printStackTrace();
                            }
                        } finally {
                        }
                    }
                }
            }
        });
    }