package com.iailab.module.data.job.task;
|
|
import com.iailab.module.data.common.enums.CommonConstant;
|
import com.iailab.module.data.http.service.HttpTokenService;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import javax.annotation.Resource;
|
import org.springframework.stereotype.Component;
|
|
import java.time.LocalDateTime;
|
|
/**
|
* 更新httpToken
|
* 每天更新一次,token每两天过期
|
*
|
* @author lirm
|
* @Description
|
* @createTime 2024年05月21日
|
*/
|
@Component("httpTokenTask")
|
public class HttpTokenTask implements ITask {
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
@Resource
|
HttpTokenService httpTokenService;
|
|
@Override
|
public void run(String params) {
|
logger.info("httpTokenTask定时任务正在执行,参数为:{}", params);
|
|
try {
|
logger.info("clientId=" + CommonConstant.HTTP_CLIENT_ID_SD);
|
httpTokenService.updateToken(CommonConstant.HTTP_CLIENT_ID_SD);
|
logger.info("httpTokenTask定时任务完成时间:" + LocalDateTime.now());
|
} catch (Exception ex) {
|
ex.printStackTrace();
|
logger.info("httpTokenTask定时任务失败时间:" + LocalDateTime.now());
|
}
|
}
|
}
|