parent
271a616af0
commit
bdd1f92f11
@ -0,0 +1,12 @@
|
||||
package org.jeecg.modules.demo.erp.service;
|
||||
|
||||
/**
|
||||
* @author NH-LHG
|
||||
*/
|
||||
public interface JeecgJobService {
|
||||
/**
|
||||
* 自动取消订单
|
||||
*
|
||||
*/
|
||||
public void autoCancelOrder();
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package org.jeecg.modules.demo.erp.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.demo.erp.entity.Order;
|
||||
import org.jeecg.modules.demo.erp.service.IOrderService;
|
||||
import org.jeecg.modules.demo.erp.service.JeecgJobService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author NH-LHG
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class JeecgJobServiceImpl implements JeecgJobService {
|
||||
@Autowired
|
||||
private IOrderService iOrderService;
|
||||
/**
|
||||
* 自动取消订单
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
@Scheduled(cron = "0 */1 * * * ?")
|
||||
public void autoCancelOrder() {
|
||||
log.info("执行autoCancelOrder()订单失效处理开始......");
|
||||
List<Order> orderList = iOrderService.getTimeoutOrder();
|
||||
if (null != orderList && orderList.size() > 0) {
|
||||
orderList.forEach(e -> {
|
||||
e.setState(5);
|
||||
});
|
||||
iOrderService.saveOrUpdateBatch(orderList);
|
||||
}
|
||||
log.info("执行autoCancelOrder()订单失效处理结束......");
|
||||
}
|
||||
}
|
Loading…
Reference in new issue