修改3-15问题

This commit is contained in:
2023-03-15 14:07:40 +08:00
parent 5c9813c1a6
commit f473451293
13 changed files with 95 additions and 4 deletions

View File

@@ -13,4 +13,5 @@ import com.zscat.mallplus.sms.entity.SmsCouponHistory;
*/
public interface ISmsCouponHistoryService extends IService<SmsCouponHistory> {
int updateUseStatus(int i, String tomorrow);
}

View File

@@ -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);
}
}

View File

@@ -17,4 +17,8 @@ import org.springframework.stereotype.Service;
@Service
public class SmsCouponHistoryServiceImpl extends ServiceImpl<SmsCouponHistoryMapper, SmsCouponHistory> implements ISmsCouponHistoryService {
@Override
public int updateUseStatus(int i, String tomorrow) {
return baseMapper.updateUseStatus(i,tomorrow);
}
}