定时任务防重处理
This commit is contained in:
parent
d60531b0dd
commit
586f89765f
@ -1,5 +1,6 @@
|
|||||||
package com.red.circle.other.app.scheduler;
|
package com.red.circle.other.app.scheduler;
|
||||||
|
|
||||||
|
import com.red.circle.component.redis.annotation.TaskCacheLock;
|
||||||
import com.red.circle.other.domain.gateway.PropCouponGateway;
|
import com.red.circle.other.domain.gateway.PropCouponGateway;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -24,6 +25,7 @@ public class PropCouponExpireTask {
|
|||||||
* 每小时执行一次
|
* 每小时执行一次
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 * * * ?")
|
@Scheduled(cron = "0 0 * * * ?")
|
||||||
|
@TaskCacheLock(key = "PROP_COUPON_EXPIRE_TASK", expireSecond = 60 * 50)
|
||||||
public void expireCoupons() {
|
public void expireCoupons() {
|
||||||
try {
|
try {
|
||||||
Integer count = propCouponGateway.expireOverdueCoupons();
|
Integer count = propCouponGateway.expireOverdueCoupons();
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
package com.red.circle.other.app.scheduler;
|
package com.red.circle.other.app.scheduler;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.red.circle.component.redis.annotation.TaskCacheLock;
|
||||||
import com.red.circle.other.app.service.room.RocketStatusCacheService;
|
import com.red.circle.other.app.service.room.RocketStatusCacheService;
|
||||||
import com.red.circle.other.domain.gateway.RocketStatusGateway;
|
import com.red.circle.other.domain.gateway.RocketStatusGateway;
|
||||||
import com.red.circle.other.domain.rocket.RocketStatus;
|
import com.red.circle.other.domain.rocket.RocketStatus;
|
||||||
@ -32,6 +33,7 @@ public class RocketStatusSyncTask {
|
|||||||
* 每5分钟同步一次火箭状态
|
* 每5分钟同步一次火箭状态
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 */5 * * * ?")
|
@Scheduled(cron = "0 */5 * * * ?")
|
||||||
|
@TaskCacheLock(key = "ROCKET_STATUS_SYNC_TASK", expireSecond = 60 * 4)
|
||||||
public void syncRocketStatus() {
|
public void syncRocketStatus() {
|
||||||
try {
|
try {
|
||||||
// 获取当前日期 格式: yyyyMMdd
|
// 获取当前日期 格式: yyyyMMdd
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.red.circle.other.app.scheduler;
|
package com.red.circle.other.app.scheduler;
|
||||||
|
|
||||||
|
import com.red.circle.component.redis.annotation.TaskCacheLock;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.activity.RoomContributionActivityCount;
|
import com.red.circle.other.infra.database.mongo.entity.activity.RoomContributionActivityCount;
|
||||||
import com.red.circle.other.infra.database.mongo.service.activity.RoomContributionActivityCountService;
|
import com.red.circle.other.infra.database.mongo.service.activity.RoomContributionActivityCountService;
|
||||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||||
@ -45,6 +46,7 @@ public class RoomContributionWeeklyRewardTask {
|
|||||||
* Asia/Riyadh 时区(UTC+3)
|
* Asia/Riyadh 时区(UTC+3)
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 0 * * MON", zone = "Asia/Riyadh")
|
@Scheduled(cron = "0 0 0 * * MON", zone = "Asia/Riyadh")
|
||||||
|
@TaskCacheLock(key = "ROOM_CONTRIBUTION_REWARD_TASK", expireSecond = 86400)
|
||||||
public void execute() {
|
public void execute() {
|
||||||
log.info("【房间贡献周奖励】定时任务开始执行...");
|
log.info("【房间贡献周奖励】定时任务开始执行...");
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.red.circle.other.app.scheduler;
|
package com.red.circle.other.app.scheduler;
|
||||||
|
|
||||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||||
|
import com.red.circle.component.redis.annotation.TaskCacheLock;
|
||||||
import com.red.circle.other.domain.gateway.RoomRedPacketGateway;
|
import com.red.circle.other.domain.gateway.RoomRedPacketGateway;
|
||||||
import com.red.circle.other.domain.redpacket.RoomRedPacket;
|
import com.red.circle.other.domain.redpacket.RoomRedPacket;
|
||||||
import com.red.circle.other.domain.redpacket.RoomRedPacketRefundStatus;
|
import com.red.circle.other.domain.redpacket.RoomRedPacketRefundStatus;
|
||||||
@ -33,9 +34,10 @@ public class RoomRedPacketExpireTask {
|
|||||||
private final WalletGoldClient walletGoldClient;
|
private final WalletGoldClient walletGoldClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每分钟执行一次
|
* 每30秒执行一次
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0/30 * * * * ?")
|
@Scheduled(cron = "0/30 * * * * ?")
|
||||||
|
@TaskCacheLock(key = "ROOM_RED_PACKET_TASK", expireSecond = 20)
|
||||||
public void refundExpiredPackets() {
|
public void refundExpiredPackets() {
|
||||||
try {
|
try {
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user