| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -2,8 +2,12 @@ package com.epmet.service.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.ExtConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.UserMessageFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.WxSubscribeMessageFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.WxmpMessagePushFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetMessageOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.UserMessageService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.WxmpMessageExtService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.WxmpMessageService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.BeanUtils; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -24,20 +28,37 @@ public class WxmpMessageExtServiceImpl implements WxmpMessageExtService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private WxmpMessageService wxmpMessageService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private UserMessageService userMessageService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public Result pushWxmpMessage(List<WxmpMessagePushFormDTO> dtos) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<WxSubscribeMessageFormDTO> wxmpMsgList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<UserMessageFormDTO> userMsgList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for (WxmpMessagePushFormDTO dto : dtos) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            try{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //站内信
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            BeanUtils.copyProperties(dto,userMessageFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageFormDTO.setTitle("您有一条"+dto.getTitle()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMsgList.add(userMessageFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //如果推送微信订阅flag为"1",推送微信订阅
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (ExtConstant.PUSH_WXMP.equals(dto.getPushWxmpFlag())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                BeanUtils.copyProperties(dto,wxSubscribeMessageFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //设置ClientType
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (ExtConstant.APP_RESI.equals(dto.getApp())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    wxSubscribeMessageFormDTO.setClientType(ExtConstant.APP_RESI); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (ExtConstant.APP_GOV.equals(dto.getApp())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    wxSubscribeMessageFormDTO.setClientType(ExtConstant.APP_WORK); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                wxSubscribeMessageFormDTO.setBehaviorType(dto.getTitle()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                wxSubscribeMessageFormDTO.setMessageTime(new Date()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                msgList.add(wxSubscribeMessageFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }catch (Exception e){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException("转换bean失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                wxmpMsgList.add(wxSubscribeMessageFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wxmpMessageService.sendWxSubscribeMessage(msgList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wxmpMessageService.sendWxSubscribeMessage(wxmpMsgList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return userMessageService.saveUserMessageList(userMsgList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |