From 584b7333c3396dec602a14cd2934c403412f2f20 Mon Sep 17 00:00:00 2001 From: hokli <2629910752@qq.com> Date: Thu, 7 Aug 2025 16:47:07 +0800 Subject: [PATCH] =?UTF-8?q?eparty-=E5=B1=8F=E8=94=BD=E9=A6=96=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/service/FirstChargeService.java | 171 +++++++++--------- 1 file changed, 81 insertions(+), 90 deletions(-) diff --git a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/FirstChargeService.java b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/FirstChargeService.java index 5fc9c9359..b526a657f 100644 --- a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/FirstChargeService.java +++ b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/FirstChargeService.java @@ -7,21 +7,14 @@ import com.accompany.business.service.activity.h5.ActivityH5LevelAwardService; import com.accompany.business.service.activity.h5.ActivityH5LevelExpService; import com.accompany.business.service.activity.h5.ActivityRankRuleService; import com.accompany.business.service.user.UsersService; -import com.accompany.business.vo.activity.h5.ActivityDiffExpVo; import com.accompany.business.vo.activity.h5.ActivityExpVo; -import com.accompany.business.vo.firstcharge.FirstChargeBannerConfigVo; import com.accompany.business.vo.firstcharge.FirstChargeExpVo; import com.accompany.business.vo.firstcharge.FirstChargeRewardVo; import com.accompany.business.vo.firstcharge.FirstChargeVo; -import com.accompany.common.constant.Constant; import com.accompany.common.utils.StringUtils; -import com.accompany.core.enumeration.BillObjTypeEnum; -import com.accompany.core.enumeration.CurrencyEnum; import com.accompany.core.model.Users; import com.accompany.core.service.SysConfService; -import com.accompany.core.util.I18NMessageSourceUtil; import com.accompany.payment.service.RechargeUserService; -import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.redisson.api.RBucket; @@ -29,8 +22,6 @@ import org.redisson.api.RedissonClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.math.BigDecimal; -import java.math.RoundingMode; import java.time.Duration; import java.util.ArrayList; import java.util.List; @@ -38,9 +29,7 @@ import java.util.Map; import java.util.stream.Collectors; import static com.accompany.business.constant.activity.ActivityType.FIRST_CHARGE; -import static com.accompany.common.constant.Constant.SysConfId.FIRST_CHARGE_BANNER_CONFIG; import static com.accompany.common.redis.RedisKey.*; -import static com.accompany.core.enumeration.I18nAlertEnum.FIRST_CHARGE_REWARD_SYS; @Slf4j @Service @@ -68,52 +57,54 @@ public class FirstChargeService { public FirstChargeVo info(Long uid, String ip, String deviceId) { FirstChargeVo firstChargeVo = new FirstChargeVo(); - if (rechargeUserService.isRechargeUser(uid)) { - firstChargeVo.setChargeStatus(Boolean.TRUE); - return firstChargeVo; - } - Boolean chargeStatus = checkStatus(uid, ip, deviceId); - firstChargeVo.setChargeStatus(chargeStatus); - if (chargeStatus) { - return firstChargeVo; - } - Users users = usersService.getUsersByUid(uid); - Integer partitionId = users.getPartitionId(); - String confValueById = sysConfService.getSysConfValueById(FIRST_CHARGE_BANNER_CONFIG); - if (StringUtils.isNotEmpty(confValueById)) { - FirstChargeBannerConfigVo bannerConfigVo = JSONObject.parseObject(confValueById, FirstChargeBannerConfigVo.class); - firstChargeVo.setChargeBanner(bannerConfigVo.getConfigByPartitionId(partitionId)); - } - List activityExpVos = activityH5LevelExpService.getLevelList(FIRST_CHARGE, partitionId); - if (CollectionUtils.isEmpty(activityExpVos)) { - return firstChargeVo; - } - - Map> awardMap = - activityH5LevelAwardService.levelMapByPartition(partitionId, FIRST_CHARGE.getType()); - if (awardMap.isEmpty()) { - return firstChargeVo; - } - - List levelCharge = new ArrayList<>(); - firstChargeVo.setLevelCharge(levelCharge); - - for (ActivityExpVo activityExpVo : activityExpVos) { - FirstChargeRewardVo firstChargeRewardVo = new FirstChargeRewardVo(); - firstChargeRewardVo.setExp(activityExpVo.getExp()); - List activityH5LevelAwards = awardMap.get(activityExpVo.getLevel()); - if (CollectionUtils.isEmpty(activityH5LevelAwards)) { - continue; - } - for (ActivityH5LevelAward h5LevelAward : activityH5LevelAwards) { - if (RewardTypeEnum.DIAMOND.getType().equals(h5LevelAward.getAwardType())) { - firstChargeRewardVo.setAwardNum(h5LevelAward.getAwardNum()); - break; - } - } - levelCharge.add(firstChargeRewardVo); - } + firstChargeVo.setChargeStatus(Boolean.TRUE); return firstChargeVo; +// if (rechargeUserService.isRechargeUser(uid)) { +// firstChargeVo.setChargeStatus(Boolean.TRUE); +// return firstChargeVo; +// } +// Boolean chargeStatus = checkStatus(uid, ip, deviceId); +// firstChargeVo.setChargeStatus(chargeStatus); +// if (chargeStatus) { +// return firstChargeVo; +// } +// Users users = usersService.getUsersByUid(uid); +// Integer partitionId = users.getPartitionId(); +// String confValueById = sysConfService.getSysConfValueById(FIRST_CHARGE_BANNER_CONFIG); +// if (StringUtils.isNotEmpty(confValueById)) { +// FirstChargeBannerConfigVo bannerConfigVo = JSONObject.parseObject(confValueById, FirstChargeBannerConfigVo.class); +// firstChargeVo.setChargeBanner(bannerConfigVo.getConfigByPartitionId(partitionId)); +// } +// List activityExpVos = activityH5LevelExpService.getLevelList(FIRST_CHARGE, partitionId); +// if (CollectionUtils.isEmpty(activityExpVos)) { +// return firstChargeVo; +// } +// +// Map> awardMap = +// activityH5LevelAwardService.levelMapByPartition(partitionId, FIRST_CHARGE.getType()); +// if (awardMap.isEmpty()) { +// return firstChargeVo; +// } +// +// List levelCharge = new ArrayList<>(); +// firstChargeVo.setLevelCharge(levelCharge); +// +// for (ActivityExpVo activityExpVo : activityExpVos) { +// FirstChargeRewardVo firstChargeRewardVo = new FirstChargeRewardVo(); +// firstChargeRewardVo.setExp(activityExpVo.getExp()); +// List activityH5LevelAwards = awardMap.get(activityExpVo.getLevel()); +// if (CollectionUtils.isEmpty(activityH5LevelAwards)) { +// continue; +// } +// for (ActivityH5LevelAward h5LevelAward : activityH5LevelAwards) { +// if (RewardTypeEnum.DIAMOND.getType().equals(h5LevelAward.getAwardType())) { +// firstChargeRewardVo.setAwardNum(h5LevelAward.getAwardNum()); +// break; +// } +// } +// levelCharge.add(firstChargeRewardVo); +// } +// return firstChargeVo; } public List firstChargeReward(Long uid, Integer pageType) { @@ -170,40 +161,40 @@ public class FirstChargeService { public void firstChargeCheckAndReward(Long uid, String ip, String deviceId, Long totalGoldNum, String channel) { log.info("firstChargeCheckAndReward-begin,uid:{}, ip:{}, deviceId:{}, totalGoldNum:{},channel:{}" , uid, ip, deviceId, totalGoldNum, channel); - if (checkStatus(uid, ip, deviceId)) { - return; - } - firstChargeRecordService.saveRecord(uid, ip, deviceId, totalGoldNum); - this.deleteCache(uid, ip, deviceId); - if (!Constant.ChargeChannel.google_play_billing.equals(channel) - && !Constant.ChargeChannel.ios_pay.equals(channel)) { - log.info("firstChargeCheckAndReward-not reward channel"); - return; - } - if (rechargeUserService.isRechargeUser(uid)) { - log.info("firstChargeCheckAndReward-not reward user"); - return; - } - Users users = usersService.getUsersByUid(uid); - Integer partitionId = users.getPartitionId(); - ActivityDiffExpVo diffExpVo = activityRankRuleService.getDiffExpVo(FIRST_CHARGE, partitionId, totalGoldNum.doubleValue()); - List activityH5LevelAwards = activityH5LevelAwardService.listByLevelPartition(partitionId, diffExpVo.getLevel(), FIRST_CHARGE.getType()); - if (CollectionUtils.isEmpty(activityH5LevelAwards)) { - log.info("firstChargeCheckAndReward-emptyAward"); - return; - } - Integer rewardGold = 0; - for (ActivityH5LevelAward activityH5LevelAward : activityH5LevelAwards) { - if (RewardTypeEnum.DIAMOND.getType().equals(activityH5LevelAward.getAwardType())) { - rewardGold = activityH5LevelAward.getAwardNum(); - break; - } - } - BigDecimal usd = BigDecimal.valueOf(totalGoldNum).divide(CurrencyEnum.DIAMOND.getExchangeRate(), 2, RoundingMode.DOWN); - activityRankRuleService.sendLevelRankAwardOnlyLevelWithBill(FIRST_CHARGE, uid, diffExpVo.getLevel(), - "" , partitionId, BillObjTypeEnum.FIRST_CHARGE_REWARD_BILL); - String message = I18NMessageSourceUtil.getMessage(FIRST_CHARGE_REWARD_SYS, new Object[]{usd.doubleValue(), rewardGold}, uid); - baseSendService.sendSystemMsg(uid.toString(), message); +// if (checkStatus(uid, ip, deviceId)) { +// return; +// } +// firstChargeRecordService.saveRecord(uid, ip, deviceId, totalGoldNum); +// this.deleteCache(uid, ip, deviceId); +// if (!Constant.ChargeChannel.google_play_billing.equals(channel) +// && !Constant.ChargeChannel.ios_pay.equals(channel)) { +// log.info("firstChargeCheckAndReward-not reward channel"); +// return; +// } +// if (rechargeUserService.isRechargeUser(uid)) { +// log.info("firstChargeCheckAndReward-not reward user"); +// return; +// } +// Users users = usersService.getUsersByUid(uid); +// Integer partitionId = users.getPartitionId(); +// ActivityDiffExpVo diffExpVo = activityRankRuleService.getDiffExpVo(FIRST_CHARGE, partitionId, totalGoldNum.doubleValue()); +// List activityH5LevelAwards = activityH5LevelAwardService.listByLevelPartition(partitionId, diffExpVo.getLevel(), FIRST_CHARGE.getType()); +// if (CollectionUtils.isEmpty(activityH5LevelAwards)) { +// log.info("firstChargeCheckAndReward-emptyAward"); +// return; +// } +// Integer rewardGold = 0; +// for (ActivityH5LevelAward activityH5LevelAward : activityH5LevelAwards) { +// if (RewardTypeEnum.DIAMOND.getType().equals(activityH5LevelAward.getAwardType())) { +// rewardGold = activityH5LevelAward.getAwardNum(); +// break; +// } +// } +// BigDecimal usd = BigDecimal.valueOf(totalGoldNum).divide(CurrencyEnum.DIAMOND.getExchangeRate(), 2, RoundingMode.DOWN); +// activityRankRuleService.sendLevelRankAwardOnlyLevelWithBill(FIRST_CHARGE, uid, diffExpVo.getLevel(), +// "" , partitionId, BillObjTypeEnum.FIRST_CHARGE_REWARD_BILL); +// String message = I18NMessageSourceUtil.getMessage(FIRST_CHARGE_REWARD_SYS, new Object[]{usd.doubleValue(), rewardGold}, uid); +// baseSendService.sendSystemMsg(uid.toString(), message); // JSONObject jsonObject = new JSONObject(); // jsonObject.put("msg", message); // baseSendService.sendMsg(SystemConfig.systemMessageUid, uid, FIRST_CHARGE_REWARD, FIRST_CHARGE_REWARD_MSG_NEW, jsonObject);