yujian
2020-03-24 88c7df1d5089d8e39f356a68eaccc18f308e190c
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -35,6 +35,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
import com.yeshi.fanli.exception.money.OrderMoneySettleException;
import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
@@ -163,6 +164,7 @@
         doTaoBaoNewOrders();// 处理淘宝订单(刚刚产生的)
         doOrderFanLiNew();// 新版返利
         doOrderTiChengFanLi();// 处理订单提成返利
         doOrderTeamRewardFanLi();// 团队奖励到账
         doWeiQuanOrder();// 处理维权订单
         doPushIOS();// 处理发送IOS消息
         doUserMoneyDebtJob();// 债务偿还
@@ -327,7 +329,8 @@
                        try {
                           HongBaoV2 hongbao = map.get(handler);
                           if (hongbao != null) {
                              String key = "hongbao-fanli-" + hongbao.getId();
                              String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.hongBaoFanLi,
                                    hongbao.getId() + "");
                              if (StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
                                 // 处理之后要隔2小时再次进行处理
                                 redisManager.cacheCommonString(key, "1", 60 * 60 * 2);
@@ -378,6 +381,47 @@
                           orderProcessService.fanliInvaiteAndShare(map.get(handler));
                           CMQManager.getInstance().deleteFanLiTiChengMsg(handler);
                        } catch (TaoBaoWeiQuanException e) {
                           try {
                              LogHelper.errorDetailInfo(e);
                           } catch (Exception e1) {
                              e1.printStackTrace();
                           }
                        } catch (Exception e) {
                           try {
                              LogHelper.errorDetailInfo(e, map.get(handler).toString(), "");
                           } catch (Exception e1) {
                              e1.printStackTrace();
                           }
                        }
                     }
                  }
               } catch (Exception e) {
               }
            }
         }
      });
   }
   /**
    * 订单团队奖励到账
    */
   public void doOrderTeamRewardFanLi() {
      executor.execute(new Runnable() {
         @Override
         public void run() {
            while (true) {
               try {
                  Map<String, Long> map = CMQManager.getInstance().consumeOrderTeamRewardMsg(16);
                  if (map != null) {
                     Iterator<String> its = map.keySet().iterator();
                     while (its.hasNext()) {
                        String handler = its.next();
                        try {
                           orderProcessService.fanliOrderTeamReward(map.get(handler));
                           CMQManager.getInstance().deleteOrderTeamRewardMsg(handler);
                        } catch (OrderMoneySettleException e) {
                           try {
                              LogHelper.errorDetailInfo(e);
                           } catch (Exception e1) {
@@ -840,14 +884,28 @@
   private void fanliGetIntegral(HongBaoV2 hongBaoV2) {
      if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
            && hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
         // 查询对应的订单号
         Long mainHongBaoId = hongBaoV2.getId();
         if (hongBaoV2.getParent() != null && hongBaoV2.getParent().getId() != null)
            mainHongBaoId = hongBaoV2.getParent().getId();
         HongBaoOrder hongbaoOrder = hongBaoOrderService.selectDetailByHongBaoId(mainHongBaoId);
         if (hongbaoOrder == null || hongbaoOrder.getCommonOrder() == null)
            return;
         CommonOrder commonOrder = hongbaoOrder.getCommonOrder();
         if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购订单
            integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId());
            integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
                  commonOrder.getSourceType());
         } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享订单
            integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId());
            integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
                  commonOrder.getSourceType());
         } else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级邀请
            integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
            integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
                  commonOrder.getSourceType());
         } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请
            integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId());
            integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
                  commonOrder.getSourceType());
         }
      }
   }