From a3e1aec60d2f886b8c48966c889b567719d0c5ea Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期三, 16 十月 2019 16:50:25 +0800 Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div --- fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java | 140 +++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 130 insertions(+), 10 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 29292f9..61f3503 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java @@ -1,6 +1,7 @@ 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; @@ -744,19 +745,138 @@ 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()); + // 鍒ゆ柇鏄惁涓鸿鐢ㄦ埛鐨勯绗旂孩鍖� + 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); + // HongBaoRecieveCMQManager.getInstance() + // .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, + // key); } catch (Exception e) { try { LogHelper.errorDetailInfo(e); -- Gitblit v1.8.0