| | |
| | | package com.yeshi.fanli.util;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | |
| | | doJDOrderJob();// 京东订单处理
|
| | | doPDDOrderJob();// 拼多多订单处理
|
| | | doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
|
| | | // doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | // doPlaceOrderIntegralJob();// 下单赠送金币任务
|
| | | doDouYinDeviceActiveJob();// 抖音设备激活广告监测
|
| | | // doDouYinDeviceActiveJob();// 抖音设备激活广告监测
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | 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) {// 自购
|
| | | integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId());
|
| | | // 判断是否为该用户的首笔红包
|
| | | 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());
|
| | | }
|
| | | }
|
| | | }
|
| | | // 查询下下级生效时间
|
| | | 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());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享赚
|
| | | integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI
|
| | | || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级邀请赚
|
| | | integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI
|
| | | || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请赚
|
| | | integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
|
| | | // 判断是否为该用户的首笔红包
|
| | | 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.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());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | HongBaoRecieveCMQManager.getInstance()
|
| | | .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, key);
|
| | |
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | private void fanliGetIntegral(HongBaoV2 hongBaoV2) {
|
| | | if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
|
| | | && hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购订单
|
| | | integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享订单
|
| | | integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级邀请
|
| | | integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请
|
| | | integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private boolean isFirstValidOrder(String orderId, int sourceType, Long uid) {
|
| | |
| | | String key = its.next();
|
| | | DouYinDeviceActiveQueueDTO active = map.get(key);
|
| | | if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_AD) {// 抖音
|
| | | DouYinClickEvent event = douYinClickEventService.selectByAid(active.getAid());
|
| | | DouYinClickEvent event = douYinClickEventService.selectByCallback(active.getCallback());
|
| | | if (event != null) {
|
| | | if (event.getOs() == 0) {
|
| | | if (event.getOs() == 0 && !StringUtil.isNullOrEmpty(event.getUuid())) {
|
| | | DeviceActive deviceActive = deviceActiveService
|
| | | .getFirstActiveInfoByImei(event.getUuid());
|
| | | if (deviceActive != null) {
|
| | |
| | | if (active.getPlatform() == 1) {
|
| | | DeviceActive deviceActive = deviceActiveService
|
| | | .getFirstActiveInfo(active.getDevice());
|
| | | if (deviceActive != null && deviceActive.getImei() != null) {
|
| | | if (deviceActive != null && !StringUtil.isNullOrEmpty(deviceActive.getImei())) {
|
| | | DouYinClickEvent event = douYinClickEventService
|
| | | .selectByUuid(deviceActive.getImei());
|
| | | if (event != null) {// 回调
|