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