| 
						
						
						
					 | 
					@ -1,9 +1,12 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					package com.epmet.controller; | 
					 | 
					 | 
					package com.epmet.controller; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.distributedlock.DistributedLock; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.ExceptionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.constant.ModuleConstant; | 
					 | 
					 | 
					import com.epmet.constant.ModuleConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.ComponentVerifyTicketService; | 
					 | 
					 | 
					import com.epmet.service.ComponentVerifyTicketService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.redisson.api.RLock; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.web.bind.annotation.PostMapping; | 
					 | 
					 | 
					import org.springframework.web.bind.annotation.PostMapping; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.web.bind.annotation.RequestMapping; | 
					 | 
					 | 
					import org.springframework.web.bind.annotation.RequestMapping; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -20,6 +23,8 @@ public class WeChatNotifyController { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private ComponentVerifyTicketService componentVerifyTicketService; | 
					 | 
					 | 
					    private ComponentVerifyTicketService componentVerifyTicketService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private DistributedLock distributedLock; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  定时获取  (令牌,component_access_token) | 
					 | 
					 | 
					     * @Description  定时获取  (令牌,component_access_token) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -53,9 +58,18 @@ public class WeChatNotifyController { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @PostMapping("refreshtoken") | 
					 | 
					 | 
					    @PostMapping("refreshtoken") | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public Result refreshToken(){ | 
					 | 
					 | 
					    public Result refreshToken(){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        log.info("开始刷新/获取接口调用令牌......"); | 
					 | 
					 | 
					        RLock lock = null; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        componentVerifyTicketService.refreshToken(); | 
					 | 
					 | 
					        try { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        log.info("刷新/获取接口调用令牌......成功了"); | 
					 | 
					 | 
					            lock = distributedLock.getLock("refresh_authorizer_access_token"); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.info("开始刷新/获取接口调用令牌......"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            componentVerifyTicketService.refreshToken(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.info("刷新/获取接口调用令牌......成功了"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }catch (Exception e){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error("定时刷新authorizer_access_token失败:".concat(ExceptionUtils.getErrorStackTrace(e))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            throw e; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }finally { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            distributedLock.unLock(lock); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return new Result(); | 
					 | 
					 | 
					        return new Result(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |