From 89e89fe2b2a1578a94b2e2c8ee81efbfbbf85f08 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期五, 23 八月 2019 14:18:42 +0800 Subject: [PATCH] 兑换邀请码调整 --- fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java | 87 +++++++++++++++++++++++++++++++------------ 1 files changed, 63 insertions(+), 24 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java index b1fedcc..e98c957 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java @@ -53,6 +53,7 @@ import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; +import com.yeshi.fanli.util.TaoBaoConstant; import com.yeshi.fanli.util.TimeUtil; @Service @@ -180,27 +181,27 @@ BigDecimal money = notify.getMoney(); switch (t) { case HongBaoV2.TYPE_ZIGOU: - userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType,commonOrder.getPayment(), - money, goodsCount, state); + userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, orderType, + commonOrder.getPayment(), money, goodsCount, state); break; case HongBaoV2.TYPE_SHARE_GOODS: - - userOrderMsgNotificationService.orderShareStatistic(uid, orderId,orderType, commonOrder.getPayment(), - money, goodsCount, state); + + userOrderMsgNotificationService.orderShareStatistic(uid, orderId, orderType, + commonOrder.getPayment(), money, goodsCount, state); break; case HongBaoV2.TYPE_YIJI: - - userOrderMsgNotificationService.orderInviteStatistic(uid, orderId,orderType, commonOrder.getPayment(), - money, goodsCount, state); + + userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, + commonOrder.getPayment(), money, goodsCount, state); break; case HongBaoV2.TYPE_ERJI: - - userOrderMsgNotificationService.orderInviteStatistic(uid, orderId,orderType, commonOrder.getPayment(), - money, goodsCount, state); + + userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, orderType, + commonOrder.getPayment(), money, goodsCount, state); break; case HongBaoV2.TYPE_SHARE_YIJI: - userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId,orderType, + userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId, orderType, commonOrder.getPayment(), money, goodsCount, state, notify.getBeizhu()); break; } @@ -220,23 +221,23 @@ BigDecimal money = notify.getMoney(); switch (t) { case HongBaoV2.TYPE_ZIGOU: - userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId,orderType, commonOrder.getPayment(), - money, state); + userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId, orderType, + commonOrder.getPayment(), money, state); break; case HongBaoV2.TYPE_SHARE_GOODS: - userOrderMsgNotificationService.orderShareStateChanged(uid, orderId,orderType, commonOrder.getPayment(), - money, state); + userOrderMsgNotificationService.orderShareStateChanged(uid, orderId, orderType, + commonOrder.getPayment(), money, state); break; case HongBaoV2.TYPE_YIJI: - userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId,orderType, commonOrder.getPayment(), - money, state); + userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, orderType, + commonOrder.getPayment(), money, state); break; case HongBaoV2.TYPE_ERJI: - userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId,orderType, commonOrder.getPayment(), - money, state); + userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, orderType, + commonOrder.getPayment(), money, state); break; case HongBaoV2.TYPE_SHARE_YIJI: - userOrderMsgNotificationService.orderShareFirstLevelStateChanged(uid, orderId,orderType, + userOrderMsgNotificationService.orderShareFirstLevelStateChanged(uid, orderId, orderType, commonOrder.getPayment(), money, state); } } @@ -501,7 +502,13 @@ } } } else if (type == HongBaoV2.TYPE_SHARE_GOODS) { - BigDecimal fanliRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime()); + BigDecimal fanliRate = null; + if (commonOrder.getSourceType() == Constant.SOURCE_TYPE_TAOBAO + && commonOrder.getSourcePosition().equalsIgnoreCase(TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT)) + fanliRate = hongBaoManageService.getTLJShareRate(commonOrder.getCreateTime().getTime()); + else + fanliRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime()); + List<ShareGoodsActivityOrder> list = shareGoodsActivityOrderService .listByOrderIdAndUid(commonOrder.getUserInfo().getId(), commonOrder.getOrderNo()); if (list != null && list.size() > 0) { @@ -645,6 +652,7 @@ } } } else if (commonOrder.getState() == CommonOrder.STATE_SX) {// 璁剧疆鍏嶅崟鍒稿け鏁� + commonOrder.setPayment(new BigDecimal(0));// 璁㈠崟澶辨晥鍚庣殑浠樻閲戦璁剧疆涓�0 try { userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo()); } catch (Exception e) { @@ -817,7 +825,12 @@ if (commonOrder.getState() == CommonOrder.STATE_SX || commonOrder.getState() == CommonOrder.STATE_WQ) return; // 鍒嗕韩璧� - BigDecimal shareRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime()); + BigDecimal shareRate = null; + if (commonOrder.getSourceType() == Constant.SOURCE_TYPE_TAOBAO + && commonOrder.getSourcePosition().equalsIgnoreCase(TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT))// 鏉ヨ嚜浜庢窐绀奸噾鐨勫垎浜� + shareRate = hongBaoManageService.getTLJShareRate(commonOrder.getCreateTime().getTime()); + else + shareRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime()); // 鍒ゆ柇璁㈠崟鍒嗕韩娲诲姩鏄惁寮�鍚� if ("1".equalsIgnoreCase(configService.get("share_goods_activity_open"))) { @@ -956,7 +969,7 @@ hb.setMoney(hongBao.getMoney()); try { - userShareGoodsGroupService.updateOrderRecord(hb,commonOrder.getSourceType()); + userShareGoodsGroupService.updateOrderRecord(hb, commonOrder.getSourceType()); } catch (UserShareGoodsRecordException e) { try { LogHelper.errorDetailInfo(e); @@ -1046,4 +1059,30 @@ public List<Long> getUidByNear30DayShareSucceed() { return hongBaoV2Mapper.getUidByNear30DayShareSucceed(); } + + @Override + public void invalidInviteHongBaoByParentUid(Long parentUid, String beiZhu) { + List<Integer> typeList = new ArrayList<>(); + typeList.add(HongBaoV2.TYPE_YIJI); + typeList.add(HongBaoV2.TYPE_ERJI); + typeList.add(HongBaoV2.TYPE_SHARE_YIJI); + typeList.add(HongBaoV2.TYPE_SHARE_ERJI); + List<Integer> stateList = new ArrayList<>(); + stateList.add(HongBaoV2.STATE_KELINGQU); + stateList.add(HongBaoV2.STATE_BUKELINGQU); + long count = hongBaoV2Mapper.countByParentUidAndTypeAndState(parentUid, typeList, stateList); + int page = (int) (count % 100 == 0 ? count / 100 : count / 100 + 1); + for (int i = 1; i <= page; i++) { + List<HongBaoV2> list = hongBaoV2Mapper.listByParentUidAndTypeAndState(parentUid, typeList, stateList, 0, + 100); + if (list != null) + for (HongBaoV2 v2 : list) { + HongBaoV2 update = new HongBaoV2(v2.getId()); + update.setUpdateTime(new Date()); + update.setState(HongBaoV2.STATE_SHIXIAO); + update.setBeizhu(beiZhu); + hongBaoV2Mapper.updateByPrimaryKeySelective(update); + } + } + } } -- Gitblit v1.8.0