生日有礼定时奖励

This commit is contained in:
张松
2025-10-15 11:09:43 +08:00
parent f22f32daf9
commit 86e96d48a4
13 changed files with 236 additions and 21 deletions

View File

@@ -0,0 +1,39 @@
package com.czg.task;
import cn.hutool.core.date.DateUtil;
import com.czg.account.entity.ShopUser;
import com.czg.account.service.ShopUserService;
import com.czg.constant.TableValueConstant;
import com.czg.market.service.MkBirthdayGiftService;
import com.czg.market.service.TbMemberConfigService;
import com.czg.order.service.OrderInfoService;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 生日有礼奖励发放
*
* @author ww
* @description
*/
@Slf4j
@Component
public class BirthdayGiftTask {
@Resource
private MkBirthdayGiftService birthdayGiftService;
/**
* 生日有礼奖励发放
*/
@Scheduled(cron = "0 0 12 * * ?")
public void deliver() {
birthdayGiftService.deliver();
}
}

View File

@@ -18,7 +18,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
/**
* 订单定时任务
* 会员奖励发放
*
* @author ww
* @description
@@ -35,13 +35,12 @@ public class MemberTask {
private TbMemberConfigService memberConfigService;
/**
* order 过期
* 奖励发放
*/
// @Scheduled(cron = "0 0 1 * * ? ")
@Scheduled(cron = "0 0 1 * * ? ")
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);
});
}