| | |
| | | package com.yeshi.fanli.service.impl.order.config;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoManage;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | |
|
| | | @Service
|
| | | public class HongBaoManageServiceImpl implements HongBaoManageService {
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageMapper hongBaoManageMapper;
|
| | |
|
| | | @Transactional
|
| | | public void update(List<HongBaoManage> hongBaoManageList) {
|
| | | for (HongBaoManage hongBaoManage : hongBaoManageList) {
|
| | | hongBaoManageMapper.updateByPrimaryKeySelective(hongBaoManage);
|
| | | }
|
| | | }
|
| | |
|
| | | @Cacheable(value = "homeBaoManage", key = "'get-'+#key+'-'+#system")
|
| | | public String get(final String key, SystemEnum system) {
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKey(key, system);
|
| | | if (hongBaoManage != null)
|
| | | return hongBaoManage.getValue();
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据键值与时间查询比例
|
| | | *
|
| | | * @param key
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public BigDecimal getByKeyAndMaxTime(String key, Long time, SystemEnum system) {
|
| | | if (time == null)
|
| | | time = System.currentTimeMillis();
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time, system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key, system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "homeBaoManage", key = "'getByKeyAndMaxTime-'+#key+'-'+#time+'-'+#system")
|
| | | public BigDecimal getByKeyAndMaxTimeCache(String key, Long time, SystemEnum system) {
|
| | | return getByKeyAndMaxTime(key, time, system);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "homeBaoManage", key = "'convertMap-'+#system")
|
| | | public Map<String, String> convertMap(SystemEnum system) {
|
| | | List<HongBaoManage> list = hongBaoManageMapper.listAll(system);
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | for (HongBaoManage hongBaoManage : list) {
|
| | | map.put(hongBaoManage.getKey(), hongBaoManage.getValue());
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getFanLiRate(UserLevelEnum level, long time, SystemEnum system) {
|
| | |
|
| | | return getBaseFanliRate(time,system).add(new BigDecimal(get("official_subsidy_zigou_" + level.getLevel(),system)));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getShareRate(UserLevelEnum level, long time, SystemEnum system) {
|
| | | return getBaseFanliRate(time,system).add(new BigDecimal(get("official_subsidy_share_" + level.getLevel(),system)));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getFanLiRate(UserLevelEnum level, SystemEnum system) {
|
| | | return getFanLiRate(level, System.currentTimeMillis(),system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getFanLiRate(SystemEnum system) {
|
| | | return getFanLiRate(UserLevelEnum.daRen,system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getShareRate(UserLevelEnum level, SystemEnum system) {
|
| | | return getShareRate(level, System.currentTimeMillis(),system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getShareRate( SystemEnum system) {
|
| | | return getShareRate(UserLevelEnum.daRen,system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getFirstInviteRate(int urank, SystemEnum system) {
|
| | | return getFirstInviteRate(urank, System.currentTimeMillis(),system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getFirstInviteRate(int urank, long time, SystemEnum system) {
|
| | | String key = "sale_6_" + urank;
|
| | |
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | return new BigDecimal(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getSecondInviteRate(int urank, SystemEnum system) {
|
| | | return getSecondInviteRate(urank, System.currentTimeMillis(),system);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getSecondInviteRate(int urank, long time, SystemEnum system) {
|
| | | String key = "sale_7_" + urank;
|
| | |
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | LogHelper.error("获取返利分成比例出错");
|
| | | return new BigDecimal(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getFirstShareRate(int urank, SystemEnum system) {
|
| | | String key = "share_21_" + urank;
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, System.currentTimeMillis(),system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | LogHelper.error("获取返利分成比例出错");
|
| | | return new BigDecimal(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getFirstShareRate(int urank, long time, SystemEnum system) {
|
| | | String key = "share_21_" + urank;
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | LogHelper.error("获取返利分成比例出错");
|
| | | return new BigDecimal(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getSecondShareRate(int urank, SystemEnum system) {
|
| | | String key = "share_22_" + urank;
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, System.currentTimeMillis(),system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | LogHelper.error("获取返利分成比例出错");
|
| | | return new BigDecimal(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getSecondShareRate(int urank, long time, SystemEnum system) {
|
| | | String key = "share_22_" + urank;
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | LogHelper.error("获取返利分成比例出错");
|
| | | return new BigDecimal(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTLJFanLiRate( SystemEnum system) {
|
| | | String key = "tlj_fanli_proportion";
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, System.currentTimeMillis(),system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | LogHelper.error("获取淘礼金返利分成比例出错");
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTLJShareRate(long time, SystemEnum system) {
|
| | | String key = "tlj_share_proportion";
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | LogHelper.error("获取淘礼金分享赚分成比例出错");
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getInviteFirstLevelSubsidyRate(Long time, SystemEnum system) {
|
| | | String key = "invite_subsidy_6";
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | return new BigDecimal(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getInviteSecondLevelSubsidyRate(Long time, SystemEnum system) {
|
| | | String key = "invite_subsidy_7";
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | return new BigDecimal(0);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ConfigParamsDTO getShowComputeRate(String platform, String version, UserLevelEnum userLevel, SystemEnum system) {
|
| | |
|
| | | BigDecimal fanLiRate = getFanLiRate(userLevel,system);
|
| | | BigDecimal shareRate = getShareRate(userLevel,system);
|
| | | ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,
|
| | | getFanLiRate(UserLevelEnum.superVIP,system));
|
| | | if (VersionUtil.greaterThan_2_0_5(platform, version)) {
|
| | | paramsDTO.setMaxRewardRate(null);
|
| | | }
|
| | | return paramsDTO;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ConfigParamsDTO getShowComputeRate(String platform, String version, SystemEnum system) {
|
| | |
|
| | | BigDecimal fanLiRate = getFanLiRate(UserLevelEnum.daRen,system);
|
| | | BigDecimal shareRate = getShareRate(UserLevelEnum.daRen,system);
|
| | | ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,
|
| | | getFanLiRate(UserLevelEnum.superVIP,system));
|
| | | if (VersionUtil.greaterThan_2_0_5(platform, version)) {
|
| | | paramsDTO.setMaxRewardRate(null);
|
| | | }
|
| | | return paramsDTO;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getBaseFanliRate(long time, SystemEnum system) {
|
| | | String key = "base_fanli_rate";
|
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system);
|
| | | if (hongBaoManage == null)
|
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system);
|
| | | if (hongBaoManage != null)
|
| | | return new BigDecimal(hongBaoManage.getValue());
|
| | | LogHelper.error("获取基础返利比例出错");
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getBaseFanliRate(SystemEnum system) {
|
| | | return getBaseFanliRate(System.currentTimeMillis(),system);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "homeBaoManage", key = "'getBaseFanliRate'+#time+'-'+#system")
|
| | | @Override
|
| | | public BigDecimal getBaseFanliRateCache(long time, SystemEnum system) {
|
| | | return getBaseFanliRate(System.currentTimeMillis(),system);
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.service.impl.order.config; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper; |
| | | import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoManage; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.VersionUtil; |
| | | |
| | | @Service |
| | | public class HongBaoManageServiceImpl implements HongBaoManageService { |
| | | |
| | | @Resource |
| | | private HongBaoManageMapper hongBaoManageMapper; |
| | | |
| | | @Transactional |
| | | public void update(List<HongBaoManage> hongBaoManageList) { |
| | | for (HongBaoManage hongBaoManage : hongBaoManageList) { |
| | | hongBaoManageMapper.updateByPrimaryKeySelective(hongBaoManage); |
| | | } |
| | | } |
| | | |
| | | @Cacheable(value = "homeBaoManage", key = "'get-'+#key+'-'+#system") |
| | | public String get(final String key, SystemEnum system) { |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKey(key, system); |
| | | if (hongBaoManage != null) |
| | | return hongBaoManage.getValue(); |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据键值与时间查询比例 |
| | | * |
| | | * @param key |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public BigDecimal getByKeyAndMaxTime(String key, Long time, SystemEnum system) { |
| | | if (time == null) |
| | | time = System.currentTimeMillis(); |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time, system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key, system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | return null; |
| | | } |
| | | |
| | | @Cacheable(value = "homeBaoManage", key = "'getByKeyAndMaxTime-'+#key+'-'+#time+'-'+#system") |
| | | public BigDecimal getByKeyAndMaxTimeCache(String key, Long time, SystemEnum system) { |
| | | return getByKeyAndMaxTime(key, time, system); |
| | | } |
| | | |
| | | @Cacheable(value = "homeBaoManage", key = "'convertMap-'+#system") |
| | | public Map<String, String> convertMap(SystemEnum system) { |
| | | List<HongBaoManage> list = hongBaoManageMapper.listAll(system); |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | for (HongBaoManage hongBaoManage : list) { |
| | | map.put(hongBaoManage.getKey(), hongBaoManage.getValue()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getFanLiRate(UserLevelEnum level, long time, SystemEnum system) { |
| | | |
| | | return getBaseFanliRate(time,system).add(new BigDecimal(get("official_subsidy_zigou_" + level.getLevel(),system))); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getShareRate(UserLevelEnum level, long time, SystemEnum system) { |
| | | return getBaseFanliRate(time,system).add(new BigDecimal(get("official_subsidy_share_" + level.getLevel(),system))); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getFanLiRate(UserLevelEnum level, SystemEnum system) { |
| | | return getFanLiRate(level, System.currentTimeMillis(),system); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getFanLiRate(SystemEnum system) { |
| | | return getFanLiRate(UserLevelEnum.daRen,system); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getShareRate(UserLevelEnum level, SystemEnum system) { |
| | | return getShareRate(level, System.currentTimeMillis(),system); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getShareRate( SystemEnum system) { |
| | | return getShareRate(UserLevelEnum.daRen,system); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getFirstInviteRate(int urank, SystemEnum system) { |
| | | return getFirstInviteRate(urank, System.currentTimeMillis(),system); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getFirstInviteRate(int urank, long time, SystemEnum system) { |
| | | String key = "sale_6_" + urank; |
| | | |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSecondInviteRate(int urank, SystemEnum system) { |
| | | return getSecondInviteRate(urank, System.currentTimeMillis(),system); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSecondInviteRate(int urank, long time, SystemEnum system) { |
| | | String key = "sale_7_" + urank; |
| | | |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | LogHelper.error("获取返利分成比例出错"); |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getFirstShareRate(int urank, SystemEnum system) { |
| | | String key = "share_21_" + urank; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, System.currentTimeMillis(),system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | LogHelper.error("获取返利分成比例出错"); |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getFirstShareRate(int urank, long time, SystemEnum system) { |
| | | String key = "share_21_" + urank; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | LogHelper.error("获取返利分成比例出错"); |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSecondShareRate(int urank, SystemEnum system) { |
| | | String key = "share_22_" + urank; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, System.currentTimeMillis(),system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | LogHelper.error("获取返利分成比例出错"); |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSecondShareRate(int urank, long time, SystemEnum system) { |
| | | String key = "share_22_" + urank; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | LogHelper.error("获取返利分成比例出错"); |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getTLJFanLiRate( SystemEnum system) { |
| | | String key = "tlj_fanli_proportion"; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, System.currentTimeMillis(),system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | LogHelper.error("获取淘礼金返利分成比例出错"); |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getTLJShareRate(long time, SystemEnum system) { |
| | | String key = "tlj_share_proportion"; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | LogHelper.error("获取淘礼金分享赚分成比例出错"); |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getInviteFirstLevelSubsidyRate(Long time, SystemEnum system) { |
| | | String key = "invite_subsidy_6"; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getInviteSecondLevelSubsidyRate(Long time, SystemEnum system) { |
| | | String key = "invite_subsidy_7"; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | @Override |
| | | public GoodsMoneyConfigParamsDTO getShowComputeRate(String platform, String version, UserLevelEnum userLevel, SystemEnum system) { |
| | | |
| | | BigDecimal fanLiRate = getFanLiRate(userLevel,system); |
| | | BigDecimal shareRate = getShareRate(userLevel,system); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = new GoodsMoneyConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, |
| | | getFanLiRate(UserLevelEnum.superVIP,system)); |
| | | if (VersionUtil.greaterThan_2_0_5(platform, version)) { |
| | | paramsDTO.setMaxRewardRate(null); |
| | | } |
| | | return paramsDTO; |
| | | } |
| | | |
| | | @Override |
| | | public GoodsMoneyConfigParamsDTO getShowComputeRate(String platform, String version, SystemEnum system) { |
| | | |
| | | BigDecimal fanLiRate = getFanLiRate(UserLevelEnum.daRen,system); |
| | | BigDecimal shareRate = getShareRate(UserLevelEnum.daRen,system); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = new GoodsMoneyConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, |
| | | getFanLiRate(UserLevelEnum.superVIP,system)); |
| | | if (VersionUtil.greaterThan_2_0_5(platform, version)) { |
| | | paramsDTO.setMaxRewardRate(null); |
| | | } |
| | | return paramsDTO; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getBaseFanliRate(long time, SystemEnum system) { |
| | | String key = "base_fanli_rate"; |
| | | HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKeyAndMaxValidTime(key, time,system); |
| | | if (hongBaoManage == null) |
| | | hongBaoManage = hongBaoManageMapper.selectByKey(key,system); |
| | | if (hongBaoManage != null) |
| | | return new BigDecimal(hongBaoManage.getValue()); |
| | | LogHelper.error("获取基础返利比例出错"); |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getBaseFanliRate(SystemEnum system) { |
| | | return getBaseFanliRate(System.currentTimeMillis(),system); |
| | | } |
| | | |
| | | @Cacheable(value = "homeBaoManage", key = "'getBaseFanliRate'+#time+'-'+#system") |
| | | @Override |
| | | public BigDecimal getBaseFanliRateCache(long time, SystemEnum system) { |
| | | return getBaseFanliRate(System.currentTimeMillis(),system); |
| | | } |
| | | |
| | | } |