Browse Source

刷新component_access_token加锁

master
zxc 3 years ago
parent
commit
1f227799c3
  1. 17
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java

17
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java

@ -34,10 +34,19 @@ public class WeChatNotifyController {
*/
@PostMapping("componentaccesstoken")
public Result getComponentAccessToken() {
log.info("开始获取【component_access_token】......");
String accessTokenCountFlag = ModuleConstant.ACCOUNT_TOKEN_FLAG_TWO;
componentVerifyTicketService.getComponentAccessToken(accessTokenCountFlag);
log.info("已成功获取到【component_access_token】......");
RLock lock = null;
try {
lock = distributedLock.getLock("refresh_component_access_token");
log.info("开始获取【component_access_token】......");
String accessTokenCountFlag = ModuleConstant.ACCOUNT_TOKEN_FLAG_TWO;
componentVerifyTicketService.getComponentAccessToken(accessTokenCountFlag);
log.info("已成功获取到【component_access_token】......");
}catch (Exception e){
log.error("定时刷新component_access_token失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
throw e;
}finally {
distributedLock.unLock(lock);
}
return new Result();
}

Loading…
Cancel
Save