From e8f00cc0506705a2bed7dd4e060541230a7d2ab2 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 28 四月 2020 14:50:55 +0800 Subject: [PATCH] 线上版本用户升级普通会员 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderHongBaoMoneyComputeServiceImpl.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 50 insertions(+), 2 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderHongBaoMoneyComputeServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderHongBaoMoneyComputeServiceImpl.java index 07f35d7..d312159 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderHongBaoMoneyComputeServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderHongBaoMoneyComputeServiceImpl.java @@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; +import com.yeshi.fanli.dto.ConfigParamsDTO; import com.yeshi.fanli.dto.order.UserTeamLevel; import com.yeshi.fanli.dto.order.UserTeamRate; import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; @@ -17,6 +18,8 @@ import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; +import com.yeshi.fanli.util.TimeUtil; +import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.user.UserLevelUtil; @Service @@ -73,6 +76,10 @@ BigDecimal rate = hongBaoManageService.getBaseFanliRate(order.getThirdCreateTime().getTime()) .add(getOfficialSubsidyRate(order.getThirdCreateTime(), getCommonUserLevel(order.getThirdCreateTime(), userLevel), false)); + if (userLevel == UserLevelEnum.normalVIP) { + rate = new BigDecimal("61"); + } + if (order.getState() == CommonOrder.STATE_JS || order.getState() == CommonOrder.STATE_WQ) return MoneyBigDecimalUtil.div(MoneyBigDecimalUtil.mul(rate, order.geteIncome()), new BigDecimal(100)); else if (order.getEstimate() != null) @@ -86,6 +93,11 @@ BigDecimal rate = hongBaoManageService.getBaseFanliRate(order.getThirdCreateTime().getTime()) .add(getOfficialSubsidyRate(order.getThirdCreateTime(), getCommonUserLevel(order.getThirdCreateTime(), userLevel), true)); + + if (userLevel == UserLevelEnum.normalVIP) { + rate = new BigDecimal("61"); + } + if (order.getState() == CommonOrder.STATE_JS || order.getState() == CommonOrder.STATE_WQ) return MoneyBigDecimalUtil.div(MoneyBigDecimalUtil.mul(rate, order.geteIncome()), new BigDecimal(100)); else if (order.getEstimate() != null) @@ -163,14 +175,16 @@ key = String.format("official_subsidy_zigou_%s", userLevel.getLevel()); BigDecimal rate = null; if (date != null) - rate = hongBaoManageService.getByKeyAndMaxTime(key, date.getTime()); + rate = hongBaoManageService.getByKeyAndMaxTimeCache(key, TimeUtil + .convertToTimeTemp(TimeUtil.getGernalTime(date.getTime(), "yyyy-MM-dd HH"), "yyyy-MM-dd HH")); else rate = new BigDecimal(hongBaoManageService.get(key)); return rate; } private BigDecimal getRateByLevel(UserLevelEnum level, Date date) { - BigDecimal baseRate = hongBaoManageService.getBaseFanliRate(date.getTime()); + BigDecimal baseRate = hongBaoManageService.getBaseFanliRateCache( + TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(date.getTime(), "yyyy-MM-dd HH"), "yyyy-MM-dd HH")); BigDecimal subsidyRate = getOfficialSubsidyRate(date, level, false); @@ -217,6 +231,12 @@ rate = null; } } else if (buyerLevel == UserLevelEnum.normalVIP && firstBoss.getLevel() == UserLevelEnum.normalVIP) { + if (boss.getLevel() == UserLevelEnum.normalVIP) + rate = hongBaoManageService.getByKeyAndMaxTime("new_invite_daren_7", date.getTime()); + else { + rate = null; + } + } else if (buyerLevel == UserLevelEnum.daRen && firstBoss.getLevel() == UserLevelEnum.normalVIP) { if (boss.getLevel() == UserLevelEnum.normalVIP) rate = hongBaoManageService.getByKeyAndMaxTime("new_invite_daren_7", date.getTime()); else { @@ -361,4 +381,32 @@ return null; } + private BigDecimal getFanliRate(Date time, UserLevelEnum userLevel) { + BigDecimal rate = hongBaoManageService + .getBaseFanliRateCache(TimeUtil + .convertToTimeTemp(TimeUtil.getGernalTime(time.getTime(), "yyyy-MM-dd HH"), "yyyy-MM-dd HH")) + .add(getOfficialSubsidyRate(time, getCommonUserLevel(time, userLevel), false)); + + if (userLevel == UserLevelEnum.normalVIP) + rate = new BigDecimal("61"); + return rate; + } + + @Override + public ConfigParamsDTO getShowComputeRate(String platform, String version, UserLevelEnum userLevel) { + BigDecimal fanLiRate = getFanliRate(new Date(), userLevel); + BigDecimal shareRate = fanLiRate; + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + getFanliRate(new Date(), UserLevelEnum.superVIP)); + if (VersionUtil.greaterThan_2_0_5(platform, version)) { + paramsDTO.setMaxRewardRate(null); + } + return paramsDTO; + } + + @Override + public ConfigParamsDTO getShowComputeRate(String platform, String version) { + return getShowComputeRate(platform, version, UserLevelEnum.daRen); + } + } -- Gitblit v1.8.0