| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -46,15 +46,23 @@ import com.epmet.modules.constant.UserMessageConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.dao.ResiGroupDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.entity.ResiGroupEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.member.dao.ResiGroupMemberDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.dao.NoticeAttachmentDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.dao.NoticeDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.dao.NoticeReafdRecordDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.entity.NoticeAttachmentEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.entity.NoticeEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.entity.NoticeReafdRecordEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.redis.NoticeRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.service.NoticeAttachmentService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.service.NoticeReafdRecordService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.notice.service.NoticeService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.constant.TopicConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.notice.NoticeDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.topic.form.AddNoticeFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.topic.form.EditNoticeFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.topic.form.FileDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.collections4.CollectionUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.logging.Log; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.logging.LogFactory; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -64,6 +72,7 @@ import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.concurrent.atomic.AtomicInteger; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.concurrent.atomic.AtomicReference; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -92,6 +101,14 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetUserOpenFeignClient epmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private NoticeAttachmentService noticeAttachmentService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private NoticeAttachmentDao noticeAttachmentDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private NoticeReafdRecordService noticeReafdRecordService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private NoticeReafdRecordDao noticeReafdRecordDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -110,8 +127,8 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return ConvertUtils.sourceToTarget(entityList, NoticeDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private QueryWrapper<NoticeEntity> getWrapper(Map<String, Object> params){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String id = (String)params.get(FieldConstant.ID_HUMP); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private QueryWrapper<NoticeEntity> getWrapper(Map<String, Object> params) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String id = (String) params.get(FieldConstant.ID_HUMP); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        QueryWrapper<NoticeEntity> wrapper = new QueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -157,31 +174,32 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void add(TokenDto tokenDto, AddNoticeFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //1.查询组内成员数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ResiGroupMemberDTO> memberList = resiGroupMemberDao.getMemberList(formDTO.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(CollUtil.isEmpty(memberList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollUtil.isEmpty(memberList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("保存小组通知,获取组内成员列表失败,小组Id->", formDTO.getGroupId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //2.校验当前操作人员是否为组长
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        AtomicReference<Boolean> bl = new AtomicReference<>(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        memberList.forEach(m->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(m.getCustomerUserId().equals(tokenDto.getUserId())&&"leader".equals(m.getGroupLeaderFlag())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        memberList.forEach(m -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (m.getCustomerUserId().equals(tokenDto.getUserId()) && "leader".equals(m.getGroupLeaderFlag())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                bl.set(false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(bl.get()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (bl.get()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("保存小组通知,当前操作人员不是群组长,小组Id->", formDTO.getGroupId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //3.文字、图片安全校验
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> wordList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wordList.add(formDTO.getTitle());wordList.add(formDTO.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wordList.add(formDTO.getTitle()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wordList.add(formDTO.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> imageList = formDTO.getImageList().stream().map(FileDTO::getUrl).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        safetyCheck(wordList, imageList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //4.保存小组通知基础数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //4-1.获取小组信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupEntity groupEntity = resiGroupDao.selectById(formDTO.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(null == groupEntity){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == groupEntity) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", tokenDto.getUserId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //4-2.获取token用户所属组织信息
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -207,10 +225,71 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        entity.setChangeTime(new Date()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insert(entity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //5.组内成员推送站内信
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //5.保存附件数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<NoticeAttachmentEntity> AttachmentEntityList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(formDTO.getImageList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AtomicInteger sort = new AtomicInteger(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            formDTO.getImageList().forEach(img -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                NoticeAttachmentEntity attachment = new NoticeAttachmentEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setCustomerId(resultDTO.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setNoticeId(entity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setFileName(img.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentName(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentSize(img.getSize()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentFormat(img.getFormat()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentType(img.getType()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentUrl(img.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setSort(sort.get()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setDuration(img.getDuration()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                sort.getAndIncrement(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                AttachmentEntityList.add(attachment); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(formDTO.getDocList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AtomicInteger i = new AtomicInteger(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            formDTO.getDocList().forEach(doc -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                NoticeAttachmentEntity attachment = new NoticeAttachmentEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setCustomerId(resultDTO.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setNoticeId(entity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setFileName(doc.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentName(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentSize(doc.getSize()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentFormat(doc.getFormat()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentType(doc.getType()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentUrl(doc.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setSort(i.get()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setDuration(doc.getDuration()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                i.getAndIncrement(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                AttachmentEntityList.add(attachment); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (AttachmentEntityList.size() > NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            noticeAttachmentService.insertBatch(AttachmentEntityList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //6.通知已读未读表初始数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<NoticeReafdRecordEntity> reafdRecordList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        memberList.forEach(m -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!"".equals(m.getGroupLeaderFlag())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setCustomerId(resultDTO.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setGridId(groupEntity.getGridId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setGroupId(formDTO.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setNoticeId(entity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setUserId(m.getCustomerUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecordList.add(reafdRecord); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (reafdRecordList.size() > NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            noticeReafdRecordService.insertBatch(reafdRecordList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //7.组内成员推送站内信
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<UserMessageFormDTO> userMessageFormDTOS = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        memberList.forEach(m->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(!"".equals(m.getGroupLeaderFlag())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        memberList.forEach(m -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!"".equals(m.getGroupLeaderFlag())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setCustomerId(resultDTO.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setUserId(m.getCustomerUserId()); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -229,13 +308,137 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param formDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Author sun | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 小组通知变更 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void edit(TokenDto tokenDto, EditNoticeFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //1.查询通知是否存在
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        NoticeEntity entity = baseDao.selectById(formDTO.getNoticeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(null == entity){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("小组通知变更,获取通知数据失败,通知Id->", formDTO.getNoticeId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //2.文字、图片安全校验
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> wordList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wordList.add(formDTO.getTitle()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        wordList.add(formDTO.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> imageList = formDTO.getImageList().stream().map(FileDTO::getUrl).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        safetyCheck(wordList, imageList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //3.查询组成员列表数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ResiGroupMemberDTO> memberList = resiGroupMemberDao.getMemberList(entity.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollUtil.isEmpty(memberList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("保存小组通知,获取组内成员列表失败,小组Id->", entity.getGroupId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //4.通知基础数据修改
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        entity.setTitle(formDTO.getTitle()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        entity.setContent(formDTO.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        entity.setIsChange("yes"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        entity.setChangeTime(new Date()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        baseDao.updateById(entity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //5.通知附件表数据先删后增
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        noticeAttachmentDao.delByNoticeId(formDTO.getNoticeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //保存附件数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<NoticeAttachmentEntity> AttachmentEntityList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(formDTO.getImageList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AtomicInteger sort = new AtomicInteger(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            formDTO.getImageList().forEach(img -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                NoticeAttachmentEntity attachment = new NoticeAttachmentEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setCustomerId(entity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setNoticeId(entity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setFileName(img.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentName(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentSize(img.getSize()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentFormat(img.getFormat()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentType(img.getType()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentUrl(img.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setSort(sort.get()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setDuration(img.getDuration()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                sort.getAndIncrement(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                AttachmentEntityList.add(attachment); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(formDTO.getDocList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            AtomicInteger i = new AtomicInteger(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            formDTO.getDocList().forEach(doc -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                NoticeAttachmentEntity attachment = new NoticeAttachmentEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setCustomerId(entity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setNoticeId(entity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setFileName(doc.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentName(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentSize(doc.getSize()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentFormat(doc.getFormat()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentType(doc.getType()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setAttachmentUrl(doc.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setSort(i.get()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                attachment.setDuration(doc.getDuration()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                i.getAndIncrement(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                AttachmentEntityList.add(attachment); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (AttachmentEntityList.size() > NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            noticeAttachmentService.insertBatch(AttachmentEntityList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //6.通知已读未读消息表数据先删后增
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<NoticeReafdRecordEntity> reafdRecordList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        memberList.forEach(m -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!"".equals(m.getGroupLeaderFlag())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setCustomerId(entity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setGridId(entity.getGridId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setGroupId(entity.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setNoticeId(entity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setUserId(m.getCustomerUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                reafdRecordList.add(reafdRecord); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (reafdRecordList.size() > NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            noticeReafdRecordService.insertBatch(reafdRecordList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //7.推送站内信
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //7-1.获取小组信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupEntity groupEntity = resiGroupDao.selectById(entity.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == groupEntity) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(String.format("保存小组通知,获取小组数据失败,小组Id->", tokenDto.getUserId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //7-2.推送站内信信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<UserMessageFormDTO> userMessageFormDTOS = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        memberList.forEach(m -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!"".equals(m.getGroupLeaderFlag())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setCustomerId(entity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setUserId(m.getCustomerUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setGridId(entity.getGridId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setApp(AppClientConstant.APP_RESI); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setTitle(UserMessageConstant.GROUP_TITLE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.GROUP_NOTICE_EDIT, groupEntity.getGroupName(), formDTO.getTitle())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userMessageFormDTOS.add(userMessageFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result sendMessageRes = epmetMessageOpenFeignClient.saveUserMessageList(userMessageFormDTOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!sendMessageRes.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            logger.warn("小组通知,给组内成员推送站内信失败。"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Author sun | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 文字、图片安全校验 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void safetyCheck(List<String> wordList, List<String> imageList){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (imageList.size() != NumConstant.ZERO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wordList.forEach(word->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void safetyCheck(List<String> wordList, List<String> imageList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (imageList.size() != NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wordList.forEach(word -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //创建话题内容审核
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                TextTaskDTO taskDTO = new TextTaskDTO(); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -254,7 +457,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //创建话题图片审核
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (imageList.size() != NumConstant.ZERO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (imageList.size() != NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            imageList.forEach(url -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                ImgTaskDTO task = new ImgTaskDTO(); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -263,7 +466,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                imgScanParamDTO.getTasks().add(task); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!imgScanResult.success()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!imgScanResult.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!imgScanResult.getData().isAllPass()) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |