| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -19,22 +19,21 @@ package com.epmet.service.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.AppClientConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.StrConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.dto.form.FileCommonDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.UserMessageConstans; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.OrgCommonDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.OrgStaffFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.RoleStaffIdFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.SendInfoFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.SendInfoResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.InfoAttEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.InfoEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.InfoProfileEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.InfoReceiversEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.GovOrgOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.InfoService; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -76,6 +75,8 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetUserOpenFeignClient epmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private GovOrgOpenFeignClient govOrgOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private UserMessageDao userMessageDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 发送消息 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -102,7 +103,7 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        log.info("群组选择的人:"+JSON.toJSONString(groupStaffIds,true)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //3、计算接收人:
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> totalReceiver=new LinkedHashSet<String>();; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> totalReceiver=new LinkedHashSet<String>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        totalReceiver.addAll(formDTO.getStaffIdList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        totalReceiver.addAll(orgStaffIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        totalReceiver.addAll(roleStaffIds); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -116,6 +117,7 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        baseDao.insert(infoEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //5、插入附件表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String firstAttId= StrConstant.EPMETY_STR; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(CollectionUtils.isNotEmpty(formDTO.getAttachmentList())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            int sort=1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for (FileCommonDTO att : formDTO.getAttachmentList()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                InfoAttEntity infoAttEntity = new InfoAttEntity(); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -126,12 +128,15 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                infoAttEntity.setAttachmentType(att.getType()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                infoAttEntity.setAttachmentUrl(att.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                infoAttEntity.setSort(sort); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                infoAttEntity.setAttachmentSize(att.getSize()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                infoAttEntity.setDuration(att.getDuration()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                infoAttDao.insert(infoAttEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(sort==1){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    firstAttId=infoAttEntity.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                sort++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //6、接收人
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        totalReceiver.forEach(staffId->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            InfoReceiversEntity infoReceiversEntity=new InfoReceiversEntity(); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -140,17 +145,29 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            infoReceiversEntity.setStaffId(staffId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            infoReceiversEntity.setReadFlag(false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            infoReceiversDao.insert(infoReceiversEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 6.1 插入站内信:
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            UserMessageEntity userMessageEntity=new UserMessageEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setCustomerId(formDTO.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setGridId(StrConstant.STAR); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setUserId(staffId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setApp(AppClientConstant.APP_GOV); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setTitle(UserMessageConstans.INFO_TITLE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setMessageContent(String.format(UserMessageConstans.INFO_CONTENT_TEMP, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    infoEntity.getContent().length() >= NumConstant.FIFTY ? | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    StringUtils.substring(infoEntity.getContent(), NumConstant.FORTY_NINE) : infoEntity.getContent())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setReadFlag(UserMessageConstans.UNREAD); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setMessageType(UserMessageConstans.MESSAGE_TYPE_INFO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setTargetId(infoEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setCreatedBy(formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageEntity.setUpdatedBy(formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            userMessageDao.insert(userMessageEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //7、插入概要表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        InfoProfileEntity infoProfileEntity=new InfoProfileEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        infoProfileEntity.setCustomerId(formDTO.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        infoProfileEntity.setInfoId(infoEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(infoEntity.getContent().length()>NumConstant.ONE_HUNDRED){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            infoProfileEntity.setContent(StringUtils.substring(infoEntity.getContent(),NumConstant.NINETY_NINE)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            infoProfileEntity.setContent(infoEntity.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        infoProfileEntity.setContent(infoEntity.getContent().length() >= NumConstant.FIFTY ? StringUtils.substring(infoEntity.getContent(), NumConstant.FORTY_NINE) : infoEntity.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        infoProfileEntity.setPublishStaffId(formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        infoProfileEntity.setTotalReceiver(totalReceiver.size()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        infoProfileEntity.setFirstAttId(firstAttId); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -160,8 +177,8 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        infoProfileEntity.setUpdatedTime(infoEntity.getUpdatedTime()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        infoProfileDao.insert(infoProfileEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //8、发送站内信 todo
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        SendInfoResultDTO resultDTO=new SendInfoResultDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setInfoId(infoEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return resultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |