|
@@ -41,11 +41,11 @@ public class WeComAccessTokenServiceImpl implements WeComAccessTokenService {
|
|
|
@Override
|
|
|
public String getWeComAccessToken(Long corpId) {
|
|
|
try {
|
|
|
-// String key = String.format(WE_COM_ACCESS_TOKEN, corpId);
|
|
|
-// String accessToken = (String) redisTemplate.opsForValue().get(key);
|
|
|
-// if (StringUtils.isNotEmpty(accessToken)) {
|
|
|
-// return accessToken;
|
|
|
-// }
|
|
|
+ String key = String.format(WE_COM_ACCESS_TOKEN, corpId);
|
|
|
+ String accessToken = (String) redisTemplate.opsForValue().get(key);
|
|
|
+ if (StringUtils.isNotEmpty(accessToken)) {
|
|
|
+ return accessToken;
|
|
|
+ }
|
|
|
CorpExample example = new CorpExample();
|
|
|
example.createCriteria().andIdEqualTo(corpId);
|
|
|
List<Corp> corps = corpMapper.selectByExample(example);
|
|
@@ -67,7 +67,7 @@ public class WeComAccessTokenServiceImpl implements WeComAccessTokenService {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
Long expiresIn = jsonObject.getLong("expires_in");
|
|
|
String newAccessToken = jsonObject.getString("access_token");
|
|
|
-// redisTemplate.opsForValue().set(key, newAccessToken, expiresIn, TimeUnit.SECONDS);
|
|
|
+ redisTemplate.opsForValue().set(key, newAccessToken, expiresIn, TimeUnit.SECONDS);
|
|
|
return newAccessToken;
|
|
|
} catch (IOException e) {
|
|
|
LarkRobotUtil.sendMessage("getWeComAccessToken error:" + e);
|