parent
9062ab23d5
commit
a015fa8520
@ -0,0 +1,31 @@
|
||||
package com.luoo.user.quartz;
|
||||
|
||||
import com.luoo.user.service.UserInfoService;
|
||||
import enums.UserVipStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @program: luoo_parent
|
||||
* @description: 每晚处理过期会员
|
||||
* @author: yawei.huang
|
||||
* @create: 2024-08-05 14:47
|
||||
**/
|
||||
@Component
|
||||
public class MembershipQuartz {
|
||||
|
||||
@Autowired
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
/**
|
||||
* 每晚一点更新会员状态
|
||||
*/
|
||||
@Scheduled(cron = "0 0 1 * * *")
|
||||
public void updateVip() {
|
||||
userInfoService.getExpireVipList().forEach(userInfo -> {
|
||||
userInfo.setVipStatus(UserVipStatusEnum.EXPIRED.getCode());
|
||||
userInfoService.update(userInfo);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in new issue