|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
package co.yixiang.modules.hotList.service.impl; |
|
|
|
|
package co.yixiang.utils; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; |
|
|
|
|
import co.yixiang.annotation.AnonymousAccess; |
|
|
|
|
import co.yixiang.enums.CommonEnum; |
|
|
|
|
import co.yixiang.enums.ShopCommonEnum; |
|
|
|
|
import co.yixiang.event.TemplateBean; |
|
|
|
@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.context.ApplicationEventPublisher; |
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.util.Calendar; |
|
|
|
|
import java.util.Date; |
|
|
|
@ -42,10 +45,11 @@ public class TaskMsg {
|
|
|
|
|
|
|
|
|
|
//定时器,每天下午17点触发
|
|
|
|
|
@Scheduled(cron = "0 0 17 * * ?") |
|
|
|
|
// @Scheduled(cron = "0 50 17 * * ?")
|
|
|
|
|
// @Scheduled(cron = "0/8 * * * * ? ")
|
|
|
|
|
public void scheduled(){ |
|
|
|
|
log.info("=====>>>>>使用cron {}",System.currentTimeMillis()); |
|
|
|
|
log.info("=====>>>>>使用cron {}",System.currentTimeMillis()); |
|
|
|
|
TenantContextHolder.setIgnore(true); |
|
|
|
|
//查出所有用户拥有的券使用时间小于24小时且未使用的券
|
|
|
|
|
Date now=new Date(); |
|
|
|
|
Date endTime = DateUtil.offsetDay(now,1); |
|
|
|
@ -62,9 +66,10 @@ public class TaskMsg {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Scheduled(fixedRate = 20000) |
|
|
|
|
public void execute() { |
|
|
|
|
log.info("[execute][定时第 ({}) 次执行]", System.currentTimeMillis()); |
|
|
|
|
// @Scheduled(fixedRate = 20000)
|
|
|
|
|
// public void execute() {
|
|
|
|
|
// log.info("[execute][定时第 ({}) 次执行]", System.currentTimeMillis());
|
|
|
|
|
// TenantContextHolder.setIgnore(true);
|
|
|
|
|
// Date now=new Date();
|
|
|
|
|
// Date endTime = DateUtil.offsetDay(now,1);
|
|
|
|
|
// List<YxStoreCouponUser> storeCouponUsers=yxStoreCouponUserMapper.selectUserCouponList(endTime);
|
|
|
|
@ -78,14 +83,16 @@ public class TaskMsg {
|
|
|
|
|
// .build();
|
|
|
|
|
// publisher.publishEvent(new TemplateEvent(this, templateBean));
|
|
|
|
|
// });
|
|
|
|
|
} |
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//每个月最后一天23:30生成该月的榜单
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
@Scheduled(cron = "0 30 23 L * ?") |
|
|
|
|
public void setYxStoreHotListRecord(){ |
|
|
|
|
log.info("=====>>>>>使用cron {}",System.currentTimeMillis()); |
|
|
|
|
log.info("=====>>>>>使用cron {}",System.currentTimeMillis()); |
|
|
|
|
TenantContextHolder.setIgnore(true); |
|
|
|
|
LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) |
|
|
|
|
.eq(YxStoreProduct::getIsDel, CommonEnum.DEL_STATUS_0.getValue()) |