代码优化-又清理了部分前朝遗物代码
This commit is contained in:
@@ -29,7 +29,6 @@ import javax.jms.Topic;
|
||||
@ConfigurationProperties(prefix = "activemq")
|
||||
public class JmsConfig {
|
||||
|
||||
|
||||
private String brokerUrl;
|
||||
|
||||
private String user;
|
||||
@@ -40,32 +39,19 @@ public class JmsConfig {
|
||||
|
||||
private int idleTimeout;
|
||||
|
||||
|
||||
|
||||
|
||||
public final static String MY_QUEUE = "spring-queue";
|
||||
public final static String GIFT_QUEUE = "gift-queue";
|
||||
|
||||
public final static String OPENBOX_QUEUE = "openbox-queue";
|
||||
|
||||
|
||||
|
||||
//用户退出清除已点歌曲的延迟队列
|
||||
public final static String CLEAN_MUSIC_QUEUE = "clean-music-queue";
|
||||
//活动礼包队列
|
||||
public final static String ACTIVITY_PACK_QUEUE = "activity-pack-queue";
|
||||
|
||||
public final static String GIFT_TOPIC = "erban-gift-topic";
|
||||
|
||||
public final static String PAY_FINISH_QUEUE = "pay-finish-queue";
|
||||
|
||||
public final static String LINEARLY_POOL_DEFAULT_QUEUE = "linearly-pool-draw-queue";
|
||||
|
||||
/**
|
||||
* 许愿星杯每日首登队列
|
||||
*/
|
||||
public final static String WISH_STAR_CUP_USER_LOGIN_MSG_QUEUE = "wish_star_cup_user_login_msg_queue";
|
||||
|
||||
/**
|
||||
* 定义点对点队列
|
||||
* @return
|
||||
@@ -101,9 +87,6 @@ public class JmsConfig {
|
||||
return new ActiveMQQueue(PAY_FINISH_QUEUE);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue wishStarCupUserLoginMsgQueue() { return new ActiveMQQueue(WISH_STAR_CUP_USER_LOGIN_MSG_QUEUE); }
|
||||
|
||||
@Bean
|
||||
public Queue linearlyPoolDefaultQueue() {
|
||||
return new ActiveMQQueue(LINEARLY_POOL_DEFAULT_QUEUE);
|
||||
@@ -123,18 +106,6 @@ public class JmsConfig {
|
||||
return pooledConnectionFactory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定义一个主题
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Topic giftTopic() {
|
||||
return new ActiveMQTopic(GIFT_TOPIC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 配置队列生产者的JmsTemplate
|
||||
* @param activeMQConnectionFactory
|
||||
@@ -158,17 +129,6 @@ public class JmsConfig {
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean("giftTopicJmsTemplate")
|
||||
public JmsTemplate giftTopicJmsTemplate(@Qualifier("myConnectionFactory")ConnectionFactory activeMQConnectionFactory) {
|
||||
JmsTemplate template = new JmsTemplate(activeMQConnectionFactory);
|
||||
template.setExplicitQosEnabled(true);
|
||||
template.setDeliveryMode(DeliveryMode.PERSISTENT);
|
||||
template.setDefaultDestination(giftTopic());
|
||||
template.setSessionTransacted(true);
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
@Bean("openBoxJmsTemplate")
|
||||
public JmsTemplate openBoxJmsTemplate(@Qualifier("myConnectionFactory")ConnectionFactory activeMQConnectionFactory) {
|
||||
JmsTemplate template = new JmsTemplate(activeMQConnectionFactory);
|
||||
@@ -176,9 +136,6 @@ public class JmsConfig {
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Bean("cleanMusicJmsTemplate")
|
||||
public JmsTemplate cleanMusicJmsTemplate(@Qualifier("myConnectionFactory")ConnectionFactory activeMQConnectionFactory) {
|
||||
JmsTemplate template = new JmsTemplate(activeMQConnectionFactory);
|
||||
@@ -267,38 +224,6 @@ public class JmsConfig {
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Bean("jmsContainer4")
|
||||
public DefaultJmsListenerContainerFactory jmsContainer4() {
|
||||
DefaultJmsListenerContainerFactory factory
|
||||
= new DefaultJmsListenerContainerFactory();
|
||||
factory.setConnectionFactory(connectionFactory());
|
||||
factory.setSessionTransacted(true);
|
||||
factory.setSessionAcknowledgeMode(4);
|
||||
factory.setSubscriptionDurable(false);
|
||||
factory.setPubSubDomain(true);
|
||||
factory.setConcurrency("4-8");
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@Bean("newyearJmsContainer")
|
||||
public DefaultJmsListenerContainerFactory newyearJmsContainer() {
|
||||
DefaultJmsListenerContainerFactory factory
|
||||
= new DefaultJmsListenerContainerFactory();
|
||||
factory.setConnectionFactory(connectionFactory());
|
||||
factory.setSessionTransacted(true);
|
||||
factory.setSessionAcknowledgeMode(4);
|
||||
factory.setSubscriptionDurable(false);
|
||||
factory.setPubSubDomain(true);
|
||||
factory.setConcurrency("4-8");
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Bean("cleanMusicContainer")
|
||||
public DefaultJmsListenerContainerFactory cleanMusicContainer() {
|
||||
DefaultJmsListenerContainerFactory factory
|
||||
@@ -389,52 +314,6 @@ public class JmsConfig {
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Bean("wishStarCupLoginMsgJmsTemplate")
|
||||
public JmsTemplate wishStarCupLoginMsgJmsTemplate(@Qualifier("myConnectionFactory")ConnectionFactory activeMQConnectionFactory) {
|
||||
JmsTemplate template = new JmsTemplate(activeMQConnectionFactory);
|
||||
template.setDefaultDestination(wishStarCupUserLoginMsgQueue());
|
||||
return template;
|
||||
}
|
||||
|
||||
|
||||
@Bean("wishStarCupUserLoginMsgContainer")
|
||||
public DefaultJmsListenerContainerFactory wishStarCupUserLoginMsgContainer() {
|
||||
DefaultJmsListenerContainerFactory factory
|
||||
= new DefaultJmsListenerContainerFactory();
|
||||
factory.setConnectionFactory(connectionFactory());
|
||||
factory.setSessionTransacted(true);
|
||||
factory.setSessionAcknowledgeMode(4);
|
||||
factory.setConcurrency("4-8");
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
public final static String WISHSTARCUP_QUEUE = "wishstarcup-queue";
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue wishStarCupQueue() {
|
||||
return new ActiveMQQueue(WISHSTARCUP_QUEUE);
|
||||
}
|
||||
|
||||
@Bean("wishStarCupJmsTemplate")
|
||||
public JmsTemplate wishStarCupJmsTemplate(@Qualifier("myConnectionFactory")ConnectionFactory activeMQConnectionFactory) {
|
||||
JmsTemplate template = new JmsTemplate(activeMQConnectionFactory);
|
||||
template.setDefaultDestination(wishStarCupQueue());
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean("wishStarCupContainer")
|
||||
public DefaultJmsListenerContainerFactory wishStarCupContainer() {
|
||||
DefaultJmsListenerContainerFactory factory
|
||||
= new DefaultJmsListenerContainerFactory();
|
||||
factory.setConnectionFactory(connectionFactory());
|
||||
factory.setSessionTransacted(true);
|
||||
factory.setSessionAcknowledgeMode(4);
|
||||
factory.setConcurrency("4-8");
|
||||
return factory;
|
||||
}
|
||||
|
||||
public String getBrokerUrl() {
|
||||
return brokerUrl;
|
||||
}
|
||||
|
@@ -1,112 +0,0 @@
|
||||
package com.accompany.scheduler.task;
|
||||
|
||||
import com.accompany.business.service.activity.ActYearCeremonyService;
|
||||
import com.accompany.business.vo.activity.*;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ActYearCeremonyTask extends BaseTask {
|
||||
|
||||
// 固化状态
|
||||
private static final String FIXATION = "fixation";
|
||||
|
||||
@Autowired
|
||||
private ActYearCeremonyService actYearCeremonyService;
|
||||
|
||||
/**
|
||||
* 神豪王座数据
|
||||
*/
|
||||
@Scheduled(cron = "45 00 * * * ?")
|
||||
public void createRankKing() {
|
||||
log.info("ActYearCeremonyTask.createRankKing 初始化神豪王座数据");
|
||||
actYearCeremonyService.createRankKingInit(new Date());
|
||||
log.info("ActYearCeremonyTask.createRankKing 结束");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 固化土豪榜并发放奖励
|
||||
*/
|
||||
@Scheduled(cron = "0 04 00,12 * * ? ")
|
||||
public void saveTycoonRank() {
|
||||
ActYearCeremonyConfig config = actYearCeremonyService.getActYearCeremonyConf();
|
||||
Date date = new Date();
|
||||
log.info("ActYearCeremonyTask.saveExpertRank 开始固化达人榜单时间:{}", date);
|
||||
if(date.getTime() < config.getStartTime().getTime()){
|
||||
return ;
|
||||
}
|
||||
// 获取前一天的数据进行固化
|
||||
Date days = DateTimeUtil.addDays(date, -1);
|
||||
String dayTime = DateTimeUtil.convertDate(days, DateTimeUtil.DEFAULT_DATE_PATTERN);
|
||||
|
||||
Byte tycoonByte = Constant.YearCeremonyConstant.TYCOON;
|
||||
String awardKey = RedisKey.act_year_ceremony_award.getKey();
|
||||
|
||||
// 判断日榜数据是否已固化
|
||||
String fixationStr = jedisService.hget(RedisKey.act_year_ceremony_tycoon.getKey(FIXATION), dayTime);
|
||||
if(! Boolean.valueOf(fixationStr)){
|
||||
actYearCeremonyService.sendTycoonDayRankAward(days, dayTime, awardKey, tycoonByte);
|
||||
}
|
||||
|
||||
if(date.getTime() > config.getEndTime().getTime() && ! actYearCeremonyService.checkAwardStatus(awardKey, tycoonByte.toString())){
|
||||
// 发放总榜奖励
|
||||
actYearCeremonyService.sendTycoonRankAward(days, awardKey, tycoonByte);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 固化达人榜
|
||||
*/
|
||||
@Scheduled(cron = "${scheduler.year-ceremony.fixation-rank-cron}")
|
||||
public void saveExpertRank() {
|
||||
Date date = new Date();
|
||||
log.info("ActYearCeremonyTask.saveExpertRank 开始固化达人榜单时间:{}", date);
|
||||
// 获取达人榜单所有时间
|
||||
ActYearCeremonyConfig expertConf = actYearCeremonyService.getActYearExpertConf();
|
||||
ActYearCeremonyTimeVo expertTime = expertConf.getExpertTime();
|
||||
if(date.getTime() < expertTime.getVoteStartTime().getTime()){
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
// 固化榜单
|
||||
String rankKey = RedisKey.act_year_ceremony_expert.getKey();
|
||||
actYearCeremonyService.fixationRankType(expertTime, date,rankKey, Constant.YearCeremonyConstant.EXPERT);
|
||||
log.info("ActYearCeremonyTask.saveExpertRank 固化成功达人榜单时间", date);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 固化房间榜
|
||||
*/
|
||||
@Scheduled(cron = "${scheduler.year-ceremony.fixation-rank-cron}")
|
||||
public void saveRoomRank() {
|
||||
Date date = new Date();
|
||||
log.info("ActYearCeremonyTask.saveRoomRank 开始固化房间榜单时间:{}", date);
|
||||
// 获取达人榜单所有时间
|
||||
ActYearCeremonyConfig roomConf = actYearCeremonyService.getActYearRoomConf();
|
||||
ActYearCeremonyTimeVo roomTime = roomConf.getRoomTime();
|
||||
|
||||
if(date.getTime() < roomTime.getVoteStartTime().getTime()){
|
||||
return ;
|
||||
}
|
||||
|
||||
// 固化榜单
|
||||
String rankKey = RedisKey.act_year_ceremony_room.getKey();
|
||||
actYearCeremonyService.fixationRankType(roomTime, date,rankKey, Constant.YearCeremonyConstant.ROOM);
|
||||
log.info("ActYearCeremonyTask.saveRoomRank 固化成功房间榜单时间:{}", date);
|
||||
}
|
||||
|
||||
}
|
@@ -1,105 +0,0 @@
|
||||
package com.accompany.scheduler.task;
|
||||
|
||||
import com.accompany.business.service.activities.ActivitiesCoupleService;
|
||||
import com.accompany.business.service.activity.*;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Created By LeeNana on 2020/3/11.
|
||||
* 活动定时器
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ActivityTask extends BaseTask {
|
||||
|
||||
@Autowired
|
||||
private ActivitiesCoupleService activitiesCoupleService;
|
||||
@Autowired
|
||||
private ActivityYearBeastService activityYearBeastService;
|
||||
@Autowired
|
||||
private ActivityLoveWallService activityLoveWallService;
|
||||
@Autowired
|
||||
private ActivityLoveRankService activityLoveRankService;
|
||||
@Autowired
|
||||
private ActivityOneYearService activityOneYearService;
|
||||
@Autowired
|
||||
private ActivityOneYearSweetCakeService activityOneYearSweetCakeService;
|
||||
@Autowired
|
||||
private ActMagicSchoolService actMagicSchoolService;
|
||||
|
||||
/**
|
||||
* 三日情侣活动
|
||||
*/
|
||||
// @Scheduled(cron = "0 0 0 18 3 ?")
|
||||
public void sendMsgToUser(){
|
||||
log.info("sendMsgToUser() start..........");
|
||||
try {
|
||||
activitiesCoupleService.sendMsgToUser();
|
||||
log.info("sendMsgToUser() end..........");
|
||||
}catch (Exception e){
|
||||
log.error("sendMsgToUser() failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 年兽活动奖励
|
||||
*/
|
||||
// @Scheduled(cron = "0 02 00,12 * * ? ")
|
||||
public void sendYearBeastAward(){
|
||||
log.info("ActivityTask.sendYearBeastAward 开始发放年兽活动奖励");
|
||||
activityYearBeastService.sendActYearBeastAward();
|
||||
log.info("ActivityTask.sendYearBeastAward 发放年兽活动奖励结束");
|
||||
}
|
||||
|
||||
/**
|
||||
* 2022情人节活动奖励
|
||||
*/
|
||||
// @Scheduled(cron = "0 02 00,12 * * ? ")
|
||||
public void sendLoveWallAward(){
|
||||
try {
|
||||
log.info("ActivityTask.sendLoveWallAward 发放情人节表白墙奖励开始");
|
||||
activityLoveWallService.sendLoveWallAward();
|
||||
log.info("ActivityTask.sendLoveWallAward 发放情人节表白墙奖励结束");
|
||||
}catch (Exception e){
|
||||
log.error("ActivityTask.sendLoveWallAward() failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 02 00,12 * * ?")
|
||||
public void sednActLoveRankAward(){
|
||||
try {
|
||||
log.info("ActivityTask.sednActLoveRankAward 开始发放 520榜单活动奖励");
|
||||
activityLoveRankService.sednActLoveRankAward();
|
||||
log.info("ActivityTask.sednActLoveRankAward 520榜单活动奖励发放结束");
|
||||
}catch (Exception e){
|
||||
log.error("ActivityTask.sendLoveWallAward() failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 02 00,12 * * ?")
|
||||
public void sednActOneYearAward(){
|
||||
try {
|
||||
log.info("ActivityTask.sednActOneYearAward 开始发放 一周年奖励");
|
||||
activityOneYearService.sednActOneYearAward();
|
||||
log.info("ActivityTask.sednActOneYearAward 一周年奖励发放结束");
|
||||
activityOneYearSweetCakeService.sendCompoundCakeAward();
|
||||
}catch (Exception e){
|
||||
log.error("ActivityTask.sednActOneYearAward() failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 02 00,12 * * ?")
|
||||
public void sednActMagicSchoolRankAward(){
|
||||
try {
|
||||
log.info("ActivityTask.sendActRankAward 开始发放 魔法学院榜单");
|
||||
actMagicSchoolService.sendActRankAward();
|
||||
log.info("ActivityTask.sendActRankAward 魔法学院榜单");
|
||||
}catch (Exception e){
|
||||
log.error("ActivityTask.sednActOneYearAward() failed", e);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
package com.accompany.scheduler.task;
|
||||
|
||||
import com.accompany.business.constant.FlowStatisEnum;
|
||||
import com.accompany.business.service.activity.ActYearCeremonyService;
|
||||
import com.accompany.business.service.flow.FlowStatisService;
|
||||
import com.accompany.business.vo.activity.ActYearCeremonyConfig;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class FlowStatisTask extends BaseTask {
|
||||
|
||||
@Autowired
|
||||
private FlowStatisService flowStatisticsService;
|
||||
@Autowired
|
||||
private ActYearCeremonyService actYearCeremonyService;
|
||||
|
||||
/**
|
||||
* 2021年度庆典 每天 00:10(12点预留以防定时器宕机) 分保存昨日流量数据
|
||||
*/
|
||||
@Scheduled(cron = "0 10 00,12 * * ?")
|
||||
public void yearCeremonyFlow() {
|
||||
log.info("FlowStatisTask.yearCeremonyFlow start ================");
|
||||
ActYearCeremonyConfig config = actYearCeremonyService.getActYearCeremonyConf();
|
||||
if(DateTimeUtil.isBetweenDate(new Date(), config.getStartTime(), config.getEndTime())){
|
||||
flowStatisticsService.statisYesterDayFlow(FlowStatisEnum.YEAR_CEREMONY);
|
||||
}
|
||||
log.info("FlowStatisTask.yearCeremonyFlow end ================");
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 文 件 名: ActLuckyBagRankTask
|
||||
* 版 权:
|
||||
* 描 述: <描述>
|
||||
* 创建人: H1
|
||||
* 创建时间: 2022/4/18
|
||||
* 修改人:
|
||||
* 修改内容:
|
||||
* 修改时间:
|
||||
*/
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activities.ActCandyBizService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* <br>类描述: 2022糖果集市定时任务
|
||||
* <br>功能详细描述:
|
||||
*
|
||||
* @author H1
|
||||
* @date [2022/4/18]
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ActCandy2022Task {
|
||||
|
||||
@Autowired
|
||||
private ActCandyBizService actCandyBizService;
|
||||
|
||||
/**
|
||||
* 2022糖果集市活动自动发放奖励
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void sendAward() {
|
||||
log.info("2022糖果集市活动自动发放奖励...");
|
||||
actCandyBizService.sendAward();
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 文 件 名: ActLuckyBagRankTask
|
||||
* 版 权:
|
||||
* 描 述: <描述>
|
||||
* 创建人: H1
|
||||
* 创建时间: 2022/4/18
|
||||
* 修改人:
|
||||
* 修改内容:
|
||||
* 修改时间:
|
||||
*/
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activity.ActLuckyBagRankService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* <br>类描述:
|
||||
* <br>功能详细描述:
|
||||
*
|
||||
* @author H1
|
||||
* @date [2022/4/18]
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ActLuckyBagRankTask {
|
||||
|
||||
@Autowired
|
||||
private ActLuckyBagRankService actLuckyBagRankService;
|
||||
|
||||
/**
|
||||
* 2022福袋榜单活动自动发放奖励
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void sendAward() {
|
||||
log.info("2022福袋榜单活动自动发放奖励...");
|
||||
actLuckyBagRankService.sendAward();
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activity.ActivityLuckyPlanetService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ActLuckyPlanetTask {
|
||||
@Autowired
|
||||
private ActivityLuckyPlanetService activityLuckyPlanetService;
|
||||
|
||||
/**
|
||||
* 2022福袋榜单活动日榜奖励自动发放
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void sendAward() {
|
||||
log.info("2022福袋榜单活动自动发放奖励...");
|
||||
// 幸运榜
|
||||
activityLuckyPlanetService.sendDayRankReward(1);
|
||||
// 魅力榜
|
||||
activityLuckyPlanetService.sendDayRankReward(2);
|
||||
}
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activity.ActivityMidAutumnService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ActMinAutumn2022Task {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ActivityMidAutumnService activityMidAutumnService;
|
||||
|
||||
/**
|
||||
* 2022中秋活动cp日榜奖励自动发放
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void sendAward() {
|
||||
log.info("2022福袋榜单活动自动发放奖励...");
|
||||
activityMidAutumnService.sendDailyRankReward();
|
||||
}
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activity.ActivityFortuneService;
|
||||
import com.accompany.business.vo.activity.ActivityFortuneConfig;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ActivityFortuneTask extends BaseTask {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ActivityFortuneTask.class);
|
||||
|
||||
@Autowired
|
||||
private ActivityFortuneService activityFortuneService;
|
||||
|
||||
@Scheduled(cron = "0 0/20 * * * ? ")
|
||||
public void caveUpRedPacket() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
logger.info("开始执行许愿集福气,当前时间为:" + currentTime);
|
||||
ActivityFortuneConfig config = activityFortuneService.getFortuneConfig();
|
||||
long collectEndTime = DateTimeUtil.convertStrToDate(config.getCollectEndTime(), DateTimeUtil.DEFAULT_DATETIME_PATTERN).getTime();
|
||||
long drawStartTime = DateTimeUtil.convertStrToDate(config.getDrawStartTime(), DateTimeUtil.DEFAULT_DATETIME_PATTERN).getTime();
|
||||
long drawEndTime = DateTimeUtil.convertStrToDate(config.getDrawEndTime(), DateTimeUtil.DEFAULT_DATETIME_PATTERN).getTime();
|
||||
Long listNum = jedisService.llen(RedisKey.activity_fortune_red_packet.getKey());
|
||||
if(currentTime > collectEndTime && currentTime < drawStartTime){
|
||||
activityFortuneService.redPacket(listNum,config.getCaveUpGold());
|
||||
}else if(currentTime > drawEndTime){
|
||||
activityFortuneService.caveUpRemainingGold(listNum);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,67 +0,0 @@
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.constant.BackpackReduceRecordEnum;
|
||||
import com.accompany.business.model.BackpackReduceRecord;
|
||||
import com.accompany.business.model.Gift;
|
||||
import com.accompany.business.mybatismapper.ActivityAudioCardMapper;
|
||||
import com.accompany.business.mybatismapper.BackpackReduceRecordMapper;
|
||||
import com.accompany.business.service.activity.ActivityAudioCardService;
|
||||
import com.accompany.business.service.gift.GiftService;
|
||||
import com.accompany.business.service.user.UserBackpackService;
|
||||
import com.accompany.business.vo.UserBackpackVo;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AudioCardActTask extends BaseTask {
|
||||
|
||||
@Autowired
|
||||
private ActivityAudioCardService activityAudioCardService;
|
||||
@Autowired
|
||||
private ActivityAudioCardMapper activityAudioCardMapper;
|
||||
@Autowired
|
||||
private UserBackpackService userBackpackService;
|
||||
@Autowired
|
||||
private GiftService giftService;
|
||||
@Autowired
|
||||
private BackpackReduceRecordMapper backpackReduceRecordMapper;
|
||||
|
||||
/**
|
||||
* 试音卡礼物有效期三天
|
||||
*/
|
||||
@Scheduled(cron = "0 0/30 * * * ?")
|
||||
public void sendBonus() {
|
||||
Integer audioCardId = activityAudioCardService.getAudioCardConfig();
|
||||
// 试音卡三天后过期
|
||||
List<Long> uidList = activityAudioCardMapper.getAudioCardExpireByTime(audioCardId);
|
||||
Gift gift = giftService.newGetGiftById(audioCardId);
|
||||
BackpackReduceRecord record;
|
||||
Integer giftCount = 0;
|
||||
for(Long uid : uidList){
|
||||
record = new BackpackReduceRecord();
|
||||
List<UserBackpackVo> userBackpackList = userBackpackService.getUserBackpackList(uid);
|
||||
for(UserBackpackVo vo : userBackpackList){
|
||||
if(vo.getGiftId().equals(gift.getGiftId())){
|
||||
giftCount = vo.getCount();
|
||||
record.setCount(giftCount);
|
||||
}
|
||||
}
|
||||
record.setReduceCount(giftCount);
|
||||
record.setUid(uid);
|
||||
record.setReduceType(BackpackReduceRecordEnum.AUDIO_CARD.getValue());
|
||||
record.setObjDes(BackpackReduceRecordEnum.AUDIO_CARD.getDesc());
|
||||
record.setReduceTime(new Date());
|
||||
backpackReduceRecordMapper.insert(record);
|
||||
userBackpackService.reduceBackpackGift(uid,gift.getGiftId(),giftCount);
|
||||
log.info("试音卡活动:用户"+ uid + " 的试音卡过期,自动清空");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 文 件 名: ActLuckyBagRankTask
|
||||
* 版 权:
|
||||
* 描 述: <描述>
|
||||
* 创建人: H1
|
||||
* 创建时间: 2022/4/18
|
||||
* 修改人:
|
||||
* 修改内容:
|
||||
* 修改时间:
|
||||
*/
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activities.CpAct2022BizService;
|
||||
import com.accompany.business.service.activities.SummerAct2022BizService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* <br>类描述: 2022七夕定时任务
|
||||
* <br>功能详细描述:
|
||||
*
|
||||
* @author H1
|
||||
* @date [2022/4/18]
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CpAct2022Task {
|
||||
|
||||
@Autowired
|
||||
private CpAct2022BizService cpAct2022BizService;
|
||||
|
||||
/**
|
||||
* 2022七夕活动自动发放奖励
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void sendAward() {
|
||||
log.info("2022七夕活动自动发放奖励...");
|
||||
cpAct2022BizService.sendAward();
|
||||
}
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activity.MoonActivityService;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
@Component
|
||||
public class MoonActivityTask extends BaseTask {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MoonActivityTask.class);
|
||||
|
||||
@Autowired
|
||||
MoonActivityService moonActivityService;
|
||||
|
||||
/**
|
||||
* 活动结束发放奖励
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0,12 24 9 ?")
|
||||
public void sendBonus() {
|
||||
logger.info("ActivityTask sendBonus start ===============");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String year = String.valueOf(calendar.get(Calendar.YEAR));
|
||||
logger.info("ActivityTask current year: {}", year);
|
||||
String key = RedisKey.moon_activity_key.getKey();
|
||||
Boolean sendRewardStatus = jedisService.hexists(key, "sendReward");
|
||||
// 只在2021年且未发放过奖励的情况下执行任务
|
||||
if (year.equals("2021") && ! sendRewardStatus) {
|
||||
moonActivityService.sendBonus();
|
||||
}
|
||||
logger.info("ActivityTask sendBonus finish ===============");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 文 件 名: ActLuckyBagRankTask
|
||||
* 版 权:
|
||||
* 描 述: <描述>
|
||||
* 创建人: H1
|
||||
* 创建时间: 2022/4/18
|
||||
* 修改人:
|
||||
* 修改内容:
|
||||
* 修改时间:
|
||||
*/
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activities.SummerAct2022BizService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* <br>类描述: 2022夏日大作战定时任务
|
||||
* <br>功能详细描述:
|
||||
*
|
||||
* @author H1
|
||||
* @date [2022/4/18]
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SummerAct2022Task {
|
||||
|
||||
@Autowired
|
||||
private SummerAct2022BizService summerAct2022BizService;
|
||||
|
||||
/**
|
||||
* 2022福袋榜单活动自动发放奖励
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void sendAward() {
|
||||
log.info("2022夏日大作战活动自动发放奖励...");
|
||||
summerAct2022BizService.sendAward();
|
||||
}
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activity.SummerActivityService;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
//@Component
|
||||
public class SummerActivityTask extends BaseTask {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SummerActivityTask.class);
|
||||
|
||||
@Autowired
|
||||
SummerActivityService summerActivityService;
|
||||
|
||||
/**
|
||||
* 活动结束发放奖励
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 18 7 *")
|
||||
public void sendBonus() {
|
||||
logger.info("ActivityTask sendBonus start ===============");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String year = String.valueOf(calendar.get(Calendar.YEAR));
|
||||
logger.info("ActivityTask current year: {}", year);
|
||||
// 只在2020年执行任务
|
||||
if (year.equals("2020")) {
|
||||
summerActivityService.activityOverSettle();
|
||||
}
|
||||
logger.info("ActivityTask sendBonus finish ===============");
|
||||
}
|
||||
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activity.SweetActivityService;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
//@Component
|
||||
public class SweetActivityTask extends BaseTask {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SweetActivityTask.class);
|
||||
|
||||
@Autowired
|
||||
SweetActivityService sweetActivityService;
|
||||
|
||||
/**
|
||||
* 每天0点1分发放昨天日榜奖励
|
||||
*/
|
||||
@Scheduled(cron = "0 1 0 * * *")
|
||||
public void sendBonus() {
|
||||
logger.info("ActivityTask sendBonus start ===============");
|
||||
sweetActivityService.sendDailyBonus();
|
||||
logger.info("ActivityTask sendBonus finish ===============");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 文 件 名: WishStarCupTask
|
||||
* 版 权:
|
||||
* 描 述: <描述>
|
||||
* 创建人: H1
|
||||
* 创建时间: 2021/12/13
|
||||
* 修改人:
|
||||
* 修改内容:
|
||||
* 修改时间:
|
||||
*/
|
||||
package com.accompany.scheduler.task.activity;
|
||||
|
||||
import com.accompany.business.service.activity.WishStarCupDrawService;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* <br>类描述: 许愿星杯定时任务
|
||||
* <br>功能详细描述:
|
||||
*
|
||||
* @author H1
|
||||
* @date [2021/12/13]
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class WishStarCupTask extends BaseTask {
|
||||
|
||||
@Autowired
|
||||
private WishStarCupDrawService wishStarCupDrawService;
|
||||
|
||||
@Scheduled(cron = "0 50 23 * * ?")
|
||||
public void initPrizePoolTask() {
|
||||
log.info("【许愿星杯】, 开始执行初始化奖池库存任务");
|
||||
wishStarCupDrawService.initTomorrowWishStarCup();
|
||||
log.info("【许愿星杯】, 结束执行初始化奖池库存任务");
|
||||
}
|
||||
|
||||
|
||||
@Scheduled(cron = "0 30 20 * * ?")
|
||||
public void handleSpecialPrizeTask() {
|
||||
log.info("【许愿星杯】, 开始执行判断是否需要加入限定奖池任务");
|
||||
wishStarCupDrawService.handleSpecialPrize();
|
||||
log.info("【许愿星杯】, 结束执行判断是否需要加入限定奖池任务");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user