From dd5b15229cb15459fa7c31ccea77dac28cbfafbd Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 13 四月 2020 10:04:20 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java | 160 ++++++++++++++++++++++++++++------------------------ 1 files changed, 86 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..d27675e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java @@ -20,6 +20,7 @@ import com.yeshi.fanli.dto.ad.DouYinDeviceActiveQueueDTO; import com.yeshi.fanli.dto.money.UserMoneyChangeDTO; +import com.yeshi.fanli.dto.order.dividents.UserDividentsDayDTO; import com.yeshi.fanli.entity.ad.DouYinClickEvent; import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo; import com.yeshi.fanli.entity.bus.user.HongBaoV2; @@ -57,13 +58,13 @@ import com.yeshi.fanli.service.inter.user.integral.IntegralGetService; import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService; import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; +import com.yeshi.fanli.service.manger.order.TeamDividentsManager; import com.yeshi.fanli.util.ad.DouYinAdUtil; import com.yeshi.fanli.util.cmq.DouYinDeviceActiveCMQManager; import com.yeshi.fanli.util.cmq.HongBaoRecieveCMQManager; 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; @@ -139,6 +140,9 @@ @Resource private DeviceActiveService deviceActiveService; + @Resource + private TeamDividentsManager teamDividentsManager; + private static boolean isInited = false; public void onApplicationEvent(ContextRefreshedEvent arg0) { @@ -166,16 +170,18 @@ doOrderTiChengFanLi();// 澶勭悊璁㈠崟鎻愭垚杩斿埄 doWeiQuanOrder();// 澶勭悊缁存潈璁㈠崟 doPushIOS();// 澶勭悊鍙戦�両OS娑堟伅 - doThreeSaleUserCouponJob();// 澶勭悊閭�璇烽槦鍒� doUserMoneyDebtJob();// 鍊哄姟鍋胯繕 initScheduler();// 鍚姩鍟嗗搧鏇存柊瀹氭椂浠诲姟 doUpdateGoodsJob(); // 鏇存柊鍟嗗搧闃熷垪 doJDOrderJob();// 浜笢璁㈠崟澶勭悊 doPDDOrderJob();// 鎷煎澶氳鍗曞鐞� doImportantTaoBaoGoodsUpdateJob();// 娣樺疂閲嶈鍟嗗搧鐨勪俊鎭洿鏂� - // doHongBaoRecieveIntegralGetJob();// 杩斿埄鍒拌处锛岄噾甯佸鍔� + doHongBaoRecieveIntegralGetJob();// 杩斿埄鍒拌处锛岄噾甯佸鍔� // doPlaceOrderIntegralJob();// 涓嬪崟璧犻�侀噾甯佷换鍔� // doDouYinDeviceActiveJob();// 鎶栭煶璁惧婵�娲诲箍鍛婄洃娴� + + doDividentsJob(); + } } @@ -329,7 +335,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); @@ -516,66 +523,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()); - - } - } - } - }); - - } - - /** * 鐢ㄦ埛鍊熻捶澶勭悊 */ public void doUserMoneyDebtJob() { @@ -722,7 +669,6 @@ } } }); - } /** @@ -744,6 +690,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 +744,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 +762,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 +818,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 +829,7 @@ } } } - // HongBaoRecieveCMQManager.getInstance() - // .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, - // key); + } catch (Exception e) { try { LogHelper.errorDetailInfo(e); @@ -891,6 +844,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) { @@ -1092,4 +1074,34 @@ }); } + // 鍒嗙孩 + public void doDividentsJob() { + executor.execute(new Runnable() { + @Override + public void run() { + while (true) { + Map<String, UserDividentsDayDTO> map = CMQManager.getInstance().consumeTeamDividentsMsg(16); + if (map != null) { + Iterator<String> its = map.keySet().iterator(); + while (its.hasNext()) { + String key = its.next(); + UserDividentsDayDTO dto = map.get(key); + try { + teamDividentsManager.addToTeamEincome(dto.getUid(), dto.getDay()); + } catch (Exception e) { + try { + LogHelper.errorDetailInfo(e); + } catch (Exception e1) { + e1.printStackTrace(); + } + } finally { + + } + } + } + } + } + }); + } + } -- Gitblit v1.8.0