|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.zy.asrs.task.handler.ErpAccessTokenHandler; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.scheduling.annotation.Scheduled; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ErpAccessTokenHandler erpAccessTokenHandler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${erp.enable}") | 
|---|
|  |  |  | private Boolean erpEnable; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostConstruct | 
|---|
|  |  |  | @Scheduled(cron = "* 15,30,45,59 * * * ?") | 
|---|
|  |  |  | @Scheduled(cron = "10 15,30,45,59 * * * ?") | 
|---|
|  |  |  | private void accessToken(){ | 
|---|
|  |  |  | if (!erpEnable) return; | 
|---|
|  |  |  | erpAccessTokenHandler.getAccessToken(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|