| | |
| | | package cc.mrbird.febs.mall.quartz; |
| | | |
| | | import cc.mrbird.febs.common.enumerates.AgentLevelEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallMoneyFlow; |
| | | import cc.mrbird.febs.mall.mapper.MallMemberMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMoneyFlowMapper; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberService; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.IMemberProfitService; |
| | | import cc.mrbird.febs.mall.service.impl.CommonService; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2021-09-28 |
| | | **/ |
| | | @Slf4j |
| | | @Component |
| | | @ConditionalOnProperty(prefix = "system", name = "runStep", havingValue = "true") |
| | | public class ProfitJob { |
| | | |
| | | @Autowired |
| | | private IMemberProfitService memberProfitService; |
| | | |
| | | /** |
| | | * 代理分红 |
| | | * 每天凌晨 |
| | | * 清空用户的碳积分 |
| | | * 套餐过期后,更新用户为游客等级 |
| | | */ |
| | | @Scheduled(cron = "0 0 1 * * ?") |
| | | public void profitJob() { |
| | | memberProfitService.agentProfit(null); |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void updateMemberLevel() { |
| | | memberProfitService.updateMemberLevel(); |
| | | } |
| | | |
| | | /** |
| | | * 感恩奖 |
| | | * 每1小时执行一次 |
| | | * 分发碳积分 |
| | | * 根据会员等级分发 |
| | | */ |
| | | @Scheduled(cron = "0 0 2 * * ?") |
| | | public void thankfulJob() { |
| | | memberProfitService.thankfulProfit(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 静态分红 |
| | | */ |
| | | @Scheduled(cron = "0 30 2 * * ?") |
| | | public void staticProfitJob() { |
| | | memberProfitService.staticProfit(); |
| | | } |
| | | |
| | | /** |
| | | * 排名奖 每月1号 |
| | | */ |
| | | @Scheduled(cron = "0 0 3 1 * ?") |
| | | public void rankJob() { |
| | | memberProfitService.rankProfit(); |
| | | @Scheduled(cron = "0 0 0/1 * * ?") |
| | | public void updateRunScore() { |
| | | memberProfitService.updateRunScore(); |
| | | } |
| | | } |