| | |
| | | import com.baomidou.mybatisplus.extension.exceptions.ApiException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @ConditionalOnProperty(prefix = "system", name = "job", havingValue = "true") |
| | | public class WxxcxJob { |
| | | |
| | | private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class); |
| | |
| | | private RedisUtils redisUtils; |
| | | @Resource |
| | | RestTemplate restTemplate; |
| | | @Autowired |
| | | private SpringContextHolder springContextHolder; |
| | | /** |
| | | * 获取access_token |
| | | * 有效期两小时 |
| | | */ |
| | | @Scheduled(cron = "0 0/5 * * * ? ") |
| | | @Scheduled(cron = "0 0 0/1 * * ? ") |
| | | public void getAccessToken() throws IOException { |
| | | String appId = xcxProperties.getXcxAppid(); |
| | | String appSecret = xcxProperties.getXcxSecret(); |