| | |
| | | package com.yeshi.fanli.service.impl.integral;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.ThreeSaleMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTask;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRank;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTask.FrequencyEnum;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTask.TaskUniqueKeyEnum;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
|
| | |
| | | import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskRankService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.annotation.integral.IntegralGetFrequencyLimit;
|
| | | import com.yeshi.fanli.util.annotation.integral.IntegralGetVersionLimit;
|
| | |
|
| | | @Lazy
|
| | |
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | | @Resource
|
| | | private IntegralTaskRankService integralTaskRankService;
|
| | |
|
| | | // TODO 有bug
|
| | | private UserInfo getBossByUid(Long uid) {
|
| | | return threeSaleMapper.selectBoss(uid);
|
| | | }
|
| | |
|
| | | @IntegralGetVersionLimit(uid="#uid")
|
| | | @IntegralGetVersionLimit(uid = "#uid")
|
| | | @Override
|
| | | public IntegralTaskRecord addEventStatistic(Long uid, String event) throws IntegralGetException {
|
| | | Date nowDate = new Date();
|
| | |
| | | if (count > 0)
|
| | | throw new IntegralGetException(2, "事件触发达到上限");
|
| | | }
|
| | | |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null)
|
| | | throw new IntegralGetException(2, "额外信息不存在");
|
| | | |
| | | UserRank userRank = userInfoExtra.getUserRank();
|
| | | if (userRank == null)
|
| | | throw new IntegralGetException(2,"等级信息不存在");
|
| | |
|
| | | int goldCoin = task.getGoldCoin();
|
| | | if (task.getDoubleNum() != null && task.getDoubleNum() > 0)
|
| | | goldCoin = task.getDoubleNum() * goldCoin;
|
| | | |
| | | Long taskId = task.getId();
|
| | | IntegralTaskRank traskRank = integralTaskRankService.getByTsakIdAndRankId(taskId, userRank.getId());
|
| | | if (traskRank != null) {
|
| | | Integer addCoin = traskRank.getAddCoin();
|
| | | if (addCoin != null && addCoin > 0)
|
| | | goldCoin += addCoin;
|
| | |
|
| | | Integer doubleNum = traskRank.getDoubleNum();
|
| | | if (doubleNum != null && doubleNum > 0) {
|
| | | goldCoin = goldCoin * doubleNum;
|
| | | }
|
| | | }
|
| | |
|
| | | IntegralTaskRecord record = new IntegralTaskRecord();
|
| | | record.setCid(task.getTaskClass().getId());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addRecommendSearch-'+#uid")
|
| | | @IntegralGetFrequencyLimit(key = "'addRecommendSearch-'+#uid")
|
| | | @Override
|
| | | public IntegralTaskRecord addRecommendSearch(Long uid) {
|
| | | try {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addSearchResultScan-'+#uid+'-'+#kw")
|
| | | @IntegralGetFrequencyLimit(key = "'addSearchResultScan-'+#uid+'-'+#kw")
|
| | | @Override
|
| | | public IntegralTaskRecord addSearchResultScan(Long uid, String kw) {
|
| | | try {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addShareInvite-'+#uid")
|
| | | @IntegralGetFrequencyLimit(key = "'addShareInvite-'+#uid")
|
| | | @Override
|
| | | public IntegralTaskRecord addShareInvite(Long uid) {
|
| | | try {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addIntoShop-'+#uid+'-'+#shopUrlMD5")
|
| | | @IntegralGetFrequencyLimit(key = "'addIntoShop-'+#uid+'-'+#shopUrlMD5")
|
| | | @Override
|
| | | public IntegralTaskRecord addIntoShop(Long uid, String shopUrlMD5) {
|
| | | try {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addScanPushHistory-'+#uid")
|
| | | @IntegralGetFrequencyLimit(key = "'addScanPushHistory-'+#uid")
|
| | | @Override
|
| | | public IntegralTaskRecord addScanPushHistory(Long uid) {
|
| | | try {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addScanGoodsDetail-'+#uid+'-'+#goodsType+'-'+#goodsId")
|
| | | @IntegralGetFrequencyLimit(key = "'addScanGoodsDetail-'+#uid+'-'+#goodsType+'-'+#goodsId")
|
| | | @Override
|
| | | public IntegralTaskRecord addScanGoodsDetail(Long uid, int goodsType, Long goodsId) {
|
| | | try {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addScanRecommendBanner-'+#uid+'-'+#id")
|
| | | @IntegralGetFrequencyLimit(key = "'addScanRecommendBanner-'+#uid+'-'+#id")
|
| | | @Override
|
| | | public IntegralTaskRecord addScanRecommendBanner(Long uid, String id) {
|
| | | try {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addScanRecommendSpecial-'+#uid+'-'+#id")
|
| | | @IntegralGetFrequencyLimit(key = "'addScanRecommendSpecial-'+#uid+'-'+#id")
|
| | | @Override
|
| | | public IntegralTaskRecord addScanRecommendSpecial(Long uid, String id) {
|
| | | try {
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "integralGetCache", key = "'addScanTaoBaoCart-'+#uid")
|
| | | @IntegralGetFrequencyLimit(key = "'addScanTaoBaoCart-'+#uid")
|
| | | @Override
|
| | | public IntegralTaskRecord addScanTaoBaoCart(Long uid) {
|
| | | try {
|