h5周菜谱
This commit is contained in:
parent
33b2a4aebc
commit
22b5870fcb
|
|
@ -13,7 +13,7 @@ import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CookRecipeTask {
|
public class CookRecipeTask {
|
||||||
private static final Logger log = LoggerFactory.getLogger(CookRecipeTask.class);
|
private static final Logger logger = LoggerFactory.getLogger(CookRecipeTask.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICookRecipeService cookRecipeService;
|
private ICookRecipeService cookRecipeService;
|
||||||
|
|
||||||
|
|
@ -21,17 +21,17 @@ public class CookRecipeTask {
|
||||||
private TransactionTemplate transactionTemplate;
|
private TransactionTemplate transactionTemplate;
|
||||||
|
|
||||||
//@XxlJob("cookRecipeHandler")
|
//@XxlJob("cookRecipeHandler")
|
||||||
@Scheduled(fixedDelay = 1*60*60*1000)
|
@Scheduled(fixedDelay = 12*60*60*1000)
|
||||||
public void couponFixedTimeHandler() {
|
public void cookRecipeHandler() {
|
||||||
boolean cookRecipeHandler = RedisUtil.setNx("cookRecipeHandler", "1", 3600);
|
boolean cookRecipeHandler = RedisUtil.setNx("cookRecipeHandler", "1", 3600);
|
||||||
System.err.println("cookRecipeHandler="+cookRecipeHandler);
|
logger.info("cookRecipeHandler="+cookRecipeHandler);
|
||||||
if (cookRecipeHandler) {
|
if (cookRecipeHandler) {
|
||||||
transactionTemplate.execute(status -> {
|
transactionTemplate.execute(status -> {
|
||||||
try {
|
try {
|
||||||
// 业务代码
|
// 业务代码
|
||||||
log.info("[定时生成菜谱]开始:{},{}", status, LocalDateTime.now());
|
logger.info("[定时生成菜谱]开始:{},{}", status, LocalDateTime.now());
|
||||||
this.cookRecipeService.generateRecipe();
|
this.cookRecipeService.generateRecipe();
|
||||||
log.info("[定时生成菜谱]结束:{},{}", status, LocalDateTime.now());
|
logger.info("[定时生成菜谱]结束:{},{}", status, LocalDateTime.now());
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
status.setRollbackOnly(); // 标记回滚
|
status.setRollbackOnly(); // 标记回滚
|
||||||
|
|
@ -40,5 +40,4 @@ public class CookRecipeTask {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue