13 changed files with 95 additions and 4 deletions
@ -0,0 +1,36 @@ |
|||
package com.zscat.mallplus.sms.service; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2023/3/15 10:47 |
|||
* @Description |
|||
*/ |
|||
@Component |
|||
public class ScheduledService { |
|||
|
|||
@Autowired |
|||
private ISmsCouponHistoryService smsCouponHistoryService; |
|||
|
|||
// @Scheduled(cron = "0 0 0 * * ?")
|
|||
// @Scheduled(cron = "0 0/5 11 * * ?")
|
|||
@Scheduled(cron = "*/5 * * * * ?") |
|||
public void remindVehicle() { |
|||
Date now = new Date(); |
|||
//获取当前时间
|
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|||
//得到今天凌晨时间
|
|||
Calendar calendar = Calendar.getInstance(); |
|||
calendar.setTime(now); |
|||
String tomorrow = sdf.format(calendar.getTime()); |
|||
//查询优惠券历史记录中已超过endTime时间的
|
|||
smsCouponHistoryService.updateUseStatus(2,tomorrow); |
|||
} |
|||
} |
Loading…
Reference in new issue