parent
e04766d22d
commit
16f8ca25d9
@ -0,0 +1,38 @@ |
||||
package com.hai.schedule; |
||||
|
||||
import com.hai.entity.HighDiscountUserRel; |
||||
import com.hai.entity.HighOrder; |
||||
import com.hai.service.HighDiscountUserRelService; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Auther: 胡锐 |
||||
* @Description: 优惠券定时任务 |
||||
* @Date: 2021/4/4 22:43 |
||||
*/ |
||||
@Configuration |
||||
public class HighDiscountSchedule { |
||||
|
||||
@Resource |
||||
private HighDiscountUserRelService highDiscountUserRelService; |
||||
|
||||
/** |
||||
* @Author 胡锐 |
||||
* @Description 处理过期的优惠券 |
||||
* @Date 2021/4/4 22:44 |
||||
**/ |
||||
@Scheduled(cron = "0 0 0 * * ?") //每1分钟执行一次
|
||||
public void expiredDiscount() { |
||||
List<HighDiscountUserRel> expiredDiscount = highDiscountUserRelService.getExpiredDiscount(); |
||||
for (HighDiscountUserRel rel : expiredDiscount) { |
||||
rel.setStatus(0); |
||||
highDiscountUserRelService.updateDiscountUserRel(rel); |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue