正式 shardingsphere
This commit is contained in:
@@ -28,7 +28,7 @@ public class SpinningTask3 {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Scheduled(cron = "0 0/2 * * * ? ")
|
||||
@Scheduled(cron = "0 0/5 * * * ? ")
|
||||
public void record() {
|
||||
record("1");
|
||||
}
|
||||
@@ -41,8 +41,8 @@ public class SpinningTask3 {
|
||||
params = "1";
|
||||
}
|
||||
// 获取五分钟前的时间
|
||||
Date fiveMinutesAgo = DateUtil.offsetMinute(now, Integer.valueOf(params) * -5);
|
||||
Date tenMinutesAgo = DateUtil.offsetMinute(now, (Integer.valueOf(params) * -5) - 5);
|
||||
Date fiveMinutesAgo = DateUtil.offsetMinute(now, Integer.valueOf(params) * -6);
|
||||
Date tenMinutesAgo = DateUtil.offsetMinute(now, (Integer.valueOf(params) * -6) - 6);
|
||||
// 将五分钟前的时间转换为指定格式的时间字符串,这里采用常见的"yyyy-MM-dd HH:mm:ss"格式
|
||||
String fiveMinutesAgoStr = DateUtil.format(fiveMinutesAgo, "yyyy-MM-dd HH:mm:ss");
|
||||
String tenMinutesAgoStr = DateUtil.format(tenMinutesAgo, "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.sqx.modules.sys.entity.SysUserEntity;
|
||||
import com.sqx.modules.sys.service.SysUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -71,11 +72,13 @@ public class TempOrdersTask {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
public void run(String params) {
|
||||
|
||||
@Scheduled(cron = "0 0/10 * * * ? ")
|
||||
public void order() {
|
||||
logger.info("订单表数据处理开始");
|
||||
List<Orders> orders = ordersDao.selectList(Wrappers.<Orders>lambdaQuery()
|
||||
.eq(Orders::getStatus, 0)
|
||||
.lt(Orders::getCreateTime, DateUtil.offsetMinute(DateUtil.date(), -5)));
|
||||
.lt(Orders::getCreateTime, DateUtil.offsetMinute(DateUtil.date(), -15)));
|
||||
if (CollUtil.isEmpty(orders)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user