未支付订单 删除 每天1点13
This commit is contained in:
@@ -40,10 +40,7 @@ public class OrderTask {
|
|||||||
@Resource
|
@Resource
|
||||||
private CommonInfoService commonRepository;
|
private CommonInfoService commonRepository;
|
||||||
|
|
||||||
final static int COUNT = 100;
|
@Scheduled(cron = "0 13 1 * * ? ")
|
||||||
final static int SLEEP_TIME = 300;
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/5 * * * ? ")
|
|
||||||
public void record() {
|
public void record() {
|
||||||
String value = commonRepository.findOne(939).getValue();
|
String value = commonRepository.findOne(939).getValue();
|
||||||
if (!"1".equals(value)) {
|
if (!"1".equals(value)) {
|
||||||
@@ -67,16 +64,8 @@ public class OrderTask {
|
|||||||
if (orderCount == 0) {
|
if (orderCount == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int orderPage = orderCount / COUNT;
|
log.info("未支付订单order删除开始,{}", orderCount);
|
||||||
if (orderCount % COUNT != 0) {
|
ordersService.remove(queryWrapper);
|
||||||
orderPage++;
|
|
||||||
}
|
|
||||||
log.info("未支付订单order删除开始,{}", orderPage);
|
|
||||||
for (int i = 0; i < orderPage; i++) {
|
|
||||||
queryWrapper.last(" limit " + COUNT);
|
|
||||||
ordersService.remove(queryWrapper);
|
|
||||||
ThreadUtil.sleep(SLEEP_TIME);
|
|
||||||
}
|
|
||||||
log.info("未支付订单order删除结束");
|
log.info("未支付订单order删除结束");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,16 +78,8 @@ public class OrderTask {
|
|||||||
if (payCount == 0) {
|
if (payCount == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int payPage = payCount / COUNT;
|
log.info("未支付订单detail删除开始,{}", payCount);
|
||||||
if (payCount % COUNT != 0) {
|
payDetailsDao.delete(queryWrapper2);
|
||||||
payPage++;
|
|
||||||
}
|
|
||||||
log.info("未支付订单detail删除开始,{}", payPage);
|
|
||||||
for (int i = 0; i < payPage; i++) {
|
|
||||||
queryWrapper2.last(" limit " + COUNT);
|
|
||||||
payDetailsDao.delete(queryWrapper2);
|
|
||||||
ThreadUtil.sleep(SLEEP_TIME);
|
|
||||||
}
|
|
||||||
log.info("未支付订单detail删除结束");
|
log.info("未支付订单detail删除结束");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user