会员定时任务

This commit is contained in:
张松
2025-09-26 10:17:12 +08:00
parent ac7af967a1
commit c7f5acf2e1
4 changed files with 18 additions and 4 deletions

View File

@@ -15,6 +15,8 @@ import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 订单定时任务
*
@@ -23,7 +25,7 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
public class MemberDeliverTask {
public class MemberTask {
@Resource
private OrderInfoService orderInfoService;
@DubboReference
@@ -36,10 +38,19 @@ public class MemberDeliverTask {
* order 过期
*/
// @Scheduled(cron = "0 0 1 * * ? ")
public void run() {
public void deliver() {
shopUserService.list(new QueryWrapper().eq(ShopUser::getIsVip, 1).lt(ShopUser::getNextDeliverTime, DateUtil.date().toLocalDateTime())).forEach(item -> {
memberConfigService.deliver(item.getSourceShopId(), item.getUserId(), TableValueConstant.MemberExpFlow.Type.MEMBER_TASK, null, null, null);
});
}
public void check() {
List<ShopUser> shopUsers = shopUserService.list(new QueryWrapper().isNotNull(ShopUser::getEndTime).eq(ShopUser::getIsVip, 1).lt(ShopUser::getEndTime, DateUtil.date()));
shopUsers.forEach(item -> {
item.setIsVip(0);
});
shopUserService.updateBatch(shopUsers);
}
}