| 
						
						
							
								
							
						
						
					 | 
					@ -201,24 +201,26 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); | 
					 | 
					 | 
					            jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); | 
					 | 
					 | 
					            String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            Map hashMap = JSON.parseObject(post, Map.class); | 
					 | 
					 | 
					            Map hashMap = JSON.parseObject(post, Map.class); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            String componentAccessToken = hashMap.get(COMPONENT_ACCESS_TOKEN).toString(); | 
					 | 
					 | 
					            if (!hashMap.containsKey(ModuleConstant.ERR_MSG)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); | 
					 | 
					 | 
					                String componentAccessToken = hashMap.get(COMPONENT_ACCESS_TOKEN).toString(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Date expiresInTime = this.countExpirationTime(expiresIn.toString()); | 
					 | 
					 | 
					                Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if (StringUtils.isNotEmpty(componentAccessToken)) { | 
					 | 
					 | 
					                Date expiresInTime = this.countExpirationTime(expiresIn.toString()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                //令牌信息存DB
 | 
					 | 
					 | 
					                if (StringUtils.isNotEmpty(componentAccessToken)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); | 
					 | 
					 | 
					                    //令牌信息存DB
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                formDTO.setComponentAccessToken(componentAccessToken); | 
					 | 
					 | 
					                    ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                formDTO.setExpiresInTime(expiresInTime); | 
					 | 
					 | 
					                    formDTO.setComponentAccessToken(componentAccessToken); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                //先逻辑删,在插入
 | 
					 | 
					 | 
					                    formDTO.setExpiresInTime(expiresInTime); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); | 
					 | 
					 | 
					                    //先逻辑删,在插入
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                componentAccessTokenDao.deleteOldComponentAccessToken(); | 
					 | 
					 | 
					                    log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                componentAccessTokenDao.insertComponentAccessToken(formDTO); | 
					 | 
					 | 
					                    componentAccessTokenDao.deleteOldComponentAccessToken(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                //存缓存
 | 
					 | 
					 | 
					                    componentAccessTokenDao.insertComponentAccessToken(formDTO); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                redisThird.setComponentAccessToken(componentAccessToken); | 
					 | 
					 | 
					                    //存缓存
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            } else { | 
					 | 
					 | 
					                    redisThird.setComponentAccessToken(componentAccessToken); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); | 
					 | 
					 | 
					                } else { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -232,31 +234,27 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public String preAuthCode() { | 
					 | 
					 | 
					    public String preAuthCode() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        log.info(START_GET_PRE_AUTH_CODE); | 
					 | 
					 | 
					        log.info(START_GET_PRE_AUTH_CODE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        String preAuthCode = ""; | 
					 | 
					 | 
					        String preAuthCode = ""; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        try { | 
					 | 
					 | 
					        String accessToken = redisThird.getComponentAccessToken(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            String accessToken = redisThird.getComponentAccessToken(); | 
					 | 
					 | 
					        JSONObject jsonObject = new JSONObject(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            JSONObject jsonObject = new JSONObject(); | 
					 | 
					 | 
					        jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); | 
					 | 
					 | 
					        String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); | 
					 | 
					 | 
					        log.info(String.format(POST_RESULT,post)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            log.info(String.format(POST_RESULT,post)); | 
					 | 
					 | 
					        Map hashMap = JSON.parseObject(post, Map.class); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Map hashMap = JSON.parseObject(post, Map.class); | 
					 | 
					 | 
					        preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE).toString(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE).toString(); | 
					 | 
					 | 
					        Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); | 
					 | 
					 | 
					        Date expiresInTime = this.countExpirationTime(expiresIn.toString()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Date expiresInTime = this.countExpirationTime(expiresIn.toString()); | 
					 | 
					 | 
					        if (StringUtils.isNotEmpty(preAuthCode)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if (StringUtils.isNotEmpty(preAuthCode)) { | 
					 | 
					 | 
					            //预授权码 存DB
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                //预授权码 存DB
 | 
					 | 
					 | 
					            PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); | 
					 | 
					 | 
					            formDTO.setPreAuthToken(preAuthCode); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                formDTO.setPreAuthToken(preAuthCode); | 
					 | 
					 | 
					            formDTO.setExpiresInTime(expiresInTime); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                formDTO.setExpiresInTime(expiresInTime); | 
					 | 
					 | 
					            //先逻辑删除,在插入DB
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                //先逻辑删除,在插入DB
 | 
					 | 
					 | 
					            preAuthTokenDao.updateOldPreAuthCode(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                preAuthTokenDao.updateOldPreAuthCode(); | 
					 | 
					 | 
					            preAuthTokenDao.insertPreAuthToken(formDTO); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                preAuthTokenDao.insertPreAuthToken(formDTO); | 
					 | 
					 | 
					            //预授权码 放入缓存
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                //预授权码 放入缓存
 | 
					 | 
					 | 
					            redisThird.setPreAuthCode(preAuthCode); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                redisThird.setPreAuthCode(preAuthCode); | 
					 | 
					 | 
					        } else { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            } else { | 
					 | 
					 | 
					            throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } catch (Exception e) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            e.printStackTrace(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        log.info(END_GET_PRE_AUTH_CODE); | 
					 | 
					 | 
					        log.info(END_GET_PRE_AUTH_CODE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return preAuthCode; | 
					 | 
					 | 
					        return preAuthCode; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |