package com.sandu.ximon.admin.schedule; import com.sandu.ximon.admin.service.LightTaskService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * @author ZZQ * @date 2022/5/20 16:46 */ @Component @Slf4j @AllArgsConstructor @EnableScheduling public class LightEnergySchedule { private final LightTaskService lightTaskService; //每天00:05 开始执行 @Scheduled(cron = "0 5 0 * * ? ") public void UserSubjectRefund() { lightTaskService.energy(); } }