| | |
| | | import com.yeshi.fanli.util.cmq.JDOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.PDDOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.PlaceOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.ThreeSaleCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.UserMoneyChangeCMQManager;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
| | | doTaoBaoOrders();// 处理淘宝订单
|
| | | doTaoBaoNewOrders();// 处理淘宝订单(刚刚产生的)
|
| | | doOrderFanLiNew();// 新版返利
|
| | | doOrderTiChengFanLi();// 处理订单提成返利
|
| | | // doOrderTiChengFanLi();// 处理订单提成返利
|
| | | doWeiQuanOrder();// 处理维权订单
|
| | | doPushIOS();// 处理发送IOS消息
|
| | | doThreeSaleUserCouponJob();// 处理邀请队列
|
| | | doUserMoneyDebtJob();// 债务偿还
|
| | | initScheduler();// 启动商品更新定时任务
|
| | | doUpdateGoodsJob(); // 更新商品队列
|
| | | doJDOrderJob();// 京东订单处理
|
| | | doPDDOrderJob();// 拼多多订单处理
|
| | | doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
|
| | | // doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | // doPlaceOrderIntegralJob();// 下单赠送金币任务
|
| | | // doDouYinDeviceActiveJob();// 抖音设备激活广告监测
|
| | | }
|
| | |
| | | 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);
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请关系变化后券的更新
|
| | | */
|
| | | public void doThreeSaleUserCouponJob() {
|
| | |
|
| | | // 采用2个线程做更新
|
| | | for (int i = 0; i < 2; i++)
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | |
|
| | | while (true) {
|
| | | try {
|
| | | Map<String, ThreeSale> map = ThreeSaleCMQManager.getInstance()
|
| | | .consumeQueueMsg(ThreeSaleCMQManager.QUEUE_USER_COUPON, 16);
|
| | | if (map != null) {
|
| | |
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | try {
|
| | | ThreeSale threeSale = map.get(key);
|
| | | if (threeSale != null)
|
| | | threeSale = threeSaleSerivce.selectByPrimaryKey(threeSale.getId());
|
| | | if (threeSale != null) {
|
| | | if (threeSale.getState() != null && threeSale.getState() == true) {
|
| | | // 邀请成功 - 券激活生效
|
| | | LogHelper.test("doThreeSaleUserCouponJob-" + threeSale.getId());
|
| | |
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | // 下级昵称
|
| | |
|
| | | String workerNickName = userInfoService
|
| | | .selectByPKey(threeSale.getWorker().getId()).getNickName();
|
| | |
|
| | | userSystemCouponService.activatedWelfareFreeCoupon(bossId,
|
| | | workerNickName);
|
| | | }
|
| | | }
|
| | | ThreeSaleCMQManager.getInstance()
|
| | | .deleteQueueMsg(ThreeSaleCMQManager.QUEUE_USER_COUPON, key);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("更新商品出错:" + e.getMessage());
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 用户借贷处理
|
| | | */
|
| | | public void doUserMoneyDebtJob() {
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | 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<>();
|
| | |
| | | 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);
|
| | | integralTaskRecordService.firstRebateOrderRewardBoss(
|
| | | threeSale.getBoss().getId(),
|
| | | hongBaoV2.getUserInfo().getId(), null);
|
| | | LogHelper.test("自购-一级用户-" + threeSale.getBoss().getId()
|
| | | + "-hongBaoId:" + hongBaoV2.getId());
|
| | | }
|
| | |
| | | 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);
|
| | | integralTaskRecordService.firstRebateOrderRewardBossSuper(
|
| | | threeSale.getBoss().getId(),
|
| | | hongBaoV2.getUserInfo().getId(), null);
|
| | | LogHelper.test("自购-二级用户-" + threeSale.getBoss().getId()
|
| | | + "-hongBaoId:" + hongBaoV2.getId());
|
| | | }
|
| | |
| | | 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);
|
| | | 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) {
|
| | | // 查询对应的订单号
|
| | | 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(), commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享订单
|
| | | 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(), commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType());
|
| | | } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请
|
| | | integralGetService.addInviteOrderLevelTwo(hongBaoV2.getUserInfo().getId(), commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private boolean isFirstValidOrder(String orderId, int sourceType, Long uid) {
|
| | | CommonOrder commonOrder = commonOrderService.selectLatestValidByUid(uid);
|
| | | if (commonOrder != null && commonOrder.getOrderNo().equalsIgnoreCase(orderId)
|