From dcfd801ea435c1c87ed47f2ee24cdabaaf230d6f Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 31 三月 2020 12:15:56 +0800 Subject: [PATCH] 大淘客商品过滤修改 --- fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java | 165 ++++++++++++++++++++++++++++++------------------------ 1 files changed, 91 insertions(+), 74 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java b/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java index 61f3503..5133d26 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java +++ b/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; @@ -63,7 +64,6 @@ 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; @@ -164,16 +164,16 @@ doTaoBaoNewOrders();// 澶勭悊娣樺疂璁㈠崟锛堝垰鍒氫骇鐢熺殑锛� doOrderFanLiNew();// 鏂扮増杩斿埄 doOrderTiChengFanLi();// 澶勭悊璁㈠崟鎻愭垚杩斿埄 + doOrderTeamRewardFanLi();// 鍥㈤槦濂栧姳鍒拌处 doWeiQuanOrder();// 澶勭悊缁存潈璁㈠崟 doPushIOS();// 澶勭悊鍙戦�両OS娑堟伅 - doThreeSaleUserCouponJob();// 澶勭悊閭�璇烽槦鍒� doUserMoneyDebtJob();// 鍊哄姟鍋胯繕 initScheduler();// 鍚姩鍟嗗搧鏇存柊瀹氭椂浠诲姟 doUpdateGoodsJob(); // 鏇存柊鍟嗗搧闃熷垪 doJDOrderJob();// 浜笢璁㈠崟澶勭悊 doPDDOrderJob();// 鎷煎澶氳鍗曞鐞� doImportantTaoBaoGoodsUpdateJob();// 娣樺疂閲嶈鍟嗗搧鐨勪俊鎭洿鏂� - // doHongBaoRecieveIntegralGetJob();// 杩斿埄鍒拌处锛岄噾甯佸鍔� + doHongBaoRecieveIntegralGetJob();// 杩斿埄鍒拌处锛岄噾甯佸鍔� // doPlaceOrderIntegralJob();// 涓嬪崟璧犻�侀噾甯佷换鍔� // doDouYinDeviceActiveJob();// 鎶栭煶璁惧婵�娲诲箍鍛婄洃娴� } @@ -329,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); @@ -380,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) { @@ -513,66 +555,6 @@ } } }); - } - - /** - * 閭�璇峰叧绯诲彉鍖栧悗鍒哥殑鏇存柊 - */ - 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()); - - } - } - } - }); - } /** @@ -722,7 +704,6 @@ } } }); - } /** @@ -744,6 +725,12 @@ 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<>(); @@ -792,8 +779,9 @@ 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()); } @@ -809,8 +797,9 @@ 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()); } @@ -864,8 +853,9 @@ 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()); } @@ -874,9 +864,7 @@ } } } - // HongBaoRecieveCMQManager.getInstance() - // .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, - // key); + } catch (Exception e) { try { LogHelper.errorDetailInfo(e); @@ -893,6 +881,35 @@ }); } + 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) -- Gitblit v1.8.0