定时任务添加
This commit is contained in:
parent
16794132b2
commit
abfb6c13e6
@ -53,13 +53,13 @@ JTA事务处理 | ✔
|
|||||||
OSS上传功能 | ✔
|
OSS上传功能 | ✔
|
||||||
Elasticsearch搜索功能 | ✔
|
Elasticsearch搜索功能 | ✔
|
||||||
HTTPS支持 | ✔
|
HTTPS支持 | ✔
|
||||||
SpringSecurity权限管理功能 |
|
|
||||||
ELK日志收集功能 |
|
ELK日志收集功能 |
|
||||||
Redis数字型ID生成 |
|
Redis数字型ID生成 |
|
||||||
SpringTask定时任务支持 |
|
SpringTask定时任务支持 | ✔
|
||||||
RestTemplate服务间调用 |
|
RestTemplate服务间调用 |
|
||||||
docker容器化部署 | ✔
|
docker容器化部署 | ✔
|
||||||
配置区分生产和测试环境 | ✔
|
配置区分生产和测试环境 | ✔
|
||||||
|
SpringSecurity权限管理功能 |
|
||||||
|
|
||||||
### 使用工具
|
### 使用工具
|
||||||
|
|
||||||
|
@ -3,9 +3,11 @@ package com.macro.mall.portal;
|
|||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan({"com.macro.mall.mapper","com.macro.mall.portal.dao"})
|
@MapperScan({"com.macro.mall.mapper","com.macro.mall.portal.dao"})
|
||||||
|
@EnableScheduling
|
||||||
public class MallPortalApplication {
|
public class MallPortalApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.macro.mall.portal.component;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by macro on 2018/8/24.
|
||||||
|
* 订单超时取消并解锁库存的定时器
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class OrderTimeOutCancelTask {
|
||||||
|
private Logger LOGGER =LoggerFactory.getLogger(OrderTimeOutCancelTask.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cron表达式:Seconds Minutes Hours DayofMonth Month DayofWeek [Year]
|
||||||
|
* 每10分钟扫描一次,扫描超时时间*2时间内所下订单,如果没支付则取消该订单
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0/10 * ? * ?")
|
||||||
|
private void cancelTimeOutOrder(){
|
||||||
|
LOGGER.info("取消订单,并根据sku编号释放锁定库存");
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user