| 
						
						
							
								
							
						
						
					 | 
					@ -120,7 +120,16 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void sendWxSubscribeMessage(List<WxSubscribeMessageFormDTO> msgList) { | 
					 | 
					 | 
					    public void sendWxSubscribeMessage(List<WxSubscribeMessageFormDTO> msgList) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        logger.info("待发送订阅消息数量:{}", msgList.size()); | 
					 | 
					 | 
					        logger.info("待发送订阅消息数量:{}", msgList.size()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (!(msgList.size()>NumConstant.ZERO)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            throw new RenException("待发送消息不能为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        int succecssCount = 0; | 
					 | 
					 | 
					        int succecssCount = 0; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					//        获取templateId
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        CustomerTemplateListFormDTO customerTemplateListFormDTO = new CustomerTemplateListFormDTO(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        customerTemplateListFormDTO.setCustomerId(msgList.get(0).getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        customerTemplateListFormDTO.setPublicId(WxmpMessageConstant.TEMPLATE_TYPE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<CustomerTemplateListResultDTO> customerTemplateListResultDTOS = customerTemplateList(customerTemplateListFormDTO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        for (WxSubscribeMessageFormDTO msg : msgList) { | 
					 | 
					 | 
					        for (WxSubscribeMessageFormDTO msg : msgList) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            try { | 
					 | 
					 | 
					            try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                String userId = msg.getUserId(); | 
					 | 
					 | 
					                String userId = msg.getUserId(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -142,7 +151,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        throw new WxSubscribeException("clientType有误", "", openId); | 
					 | 
					 | 
					                        throw new WxSubscribeException("clientType有误", "", openId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    } | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } catch (Exception e) { | 
					 | 
					 | 
					                } catch (Exception e) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    throw new WxSubscribeException("连接User服务失败", "", ""); | 
					 | 
					 | 
					                    throw new WxSubscribeException("连接User服务失败"+e.getMessage(), "", ""); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (StringUtils.isBlank(openId)) { | 
					 | 
					 | 
					                if (StringUtils.isBlank(openId)) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -162,7 +171,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                try { | 
					 | 
					 | 
					                try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    authorizerRefreshToken = wxmpMessageRedis.getAuthorizerRefreshToken(key.toString()); | 
					 | 
					 | 
					                    authorizerRefreshToken = wxmpMessageRedis.getAuthorizerRefreshToken(key.toString()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } catch (Exception e) { | 
					 | 
					 | 
					                } catch (Exception e) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    throw new WxSubscribeException("连接缓存服务器失败", "", openId); | 
					 | 
					 | 
					                    throw new WxSubscribeException("连接缓存服务器失败"+e.getMessage(), "", openId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                String accessToken = (String) authorizerRefreshToken.get(WxmpMessageConstant.AUTHORIZER_ACCESS_TOKEN); | 
					 | 
					 | 
					                String accessToken = (String) authorizerRefreshToken.get(WxmpMessageConstant.AUTHORIZER_ACCESS_TOKEN); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (StringUtils.isBlank(accessToken)) { | 
					 | 
					 | 
					                if (StringUtils.isBlank(accessToken)) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -170,15 +179,6 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                //获取模板id
 | 
					 | 
					 | 
					                //获取模板id
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//                if (WxmpMessageConstant.RESI.equals(clientType)) {
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//                    templateId = wxmpResiUserSubscribeDao.getResiSubscribeTemplateId(openId, customerId);
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//                } else if (WxmpMessageConstant.GOV_DB.equals(clientType)) {
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//                    templateId = wxmpWorkUserSubscribeDao.getWorkSubscribeTemplateId(openId, customerId);
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//                }
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                CustomerTemplateListFormDTO customerTemplateListFormDTO = new CustomerTemplateListFormDTO(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                customerTemplateListFormDTO.setCustomerId(customerId); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                customerTemplateListFormDTO.setPublicId(WxmpMessageConstant.TEMPLATE_TYPE); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<CustomerTemplateListResultDTO> customerTemplateListResultDTOS = customerTemplateList(customerTemplateListFormDTO); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (customerTemplateListResultDTOS.size() > NumConstant.ZERO) { | 
					 | 
					 | 
					                if (customerTemplateListResultDTOS.size() > NumConstant.ZERO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    for (CustomerTemplateListResultDTO customerTemplateListResultDTO : customerTemplateListResultDTOS) { | 
					 | 
					 | 
					                    for (CustomerTemplateListResultDTO customerTemplateListResultDTO : customerTemplateListResultDTOS) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        if (WxmpMessageConstant.GOV_REDIS.equals(customerTemplateListResultDTO.getClientType())){ | 
					 | 
					 | 
					                        if (WxmpMessageConstant.GOV_REDIS.equals(customerTemplateListResultDTO.getClientType())){ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -197,9 +197,9 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                //判断用户是否有次数
 | 
					 | 
					 | 
					                //判断用户是否有次数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                Integer count = null; | 
					 | 
					 | 
					                Integer count = null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (WxmpMessageConstant.RESI.equals(clientType)) { | 
					 | 
					 | 
					                if (WxmpMessageConstant.RESI.equals(clientType)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    count = wxmpResiUserSubscribeDao.getResiSubscribeInfo(openId, templateId, customerId); | 
					 | 
					 | 
					                    count = wxmpResiUserSubscribeDao.getResiSubscribeInfo(openId, templateId, customerId,userId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                } else if (WxmpMessageConstant.GOV_DB.equals(clientType)) { | 
					 | 
					 | 
					                } else if (WxmpMessageConstant.GOV_DB.equals(clientType)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    count = wxmpWorkUserSubscribeDao.getWorkSubscribeInfo(openId, templateId, customerId); | 
					 | 
					 | 
					                    count = wxmpWorkUserSubscribeDao.getWorkSubscribeInfo(openId, templateId, customerId,userId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (count == null) { | 
					 | 
					 | 
					                if (count == null) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    //用户未订阅
 | 
					 | 
					 | 
					                    //用户未订阅
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |