|  |  | @ -48,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.util.CollectionUtils; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Date; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -138,13 +139,18 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     @Transactional(rollbackFor = Exception.class) | 
			
		
	
		
			
				
					|  |  |  |     public void readType(ReadTypeFormDTO formDTO) { | 
			
		
	
		
			
				
					|  |  |  |         //1.根据通知Id和当前用户查询是否存在通知阅读记录
 | 
			
		
	
		
			
				
					|  |  |  |         //1.查询通知详情,判断有没有过期
 | 
			
		
	
		
			
				
					|  |  |  |         NoticeEntity notice = noticeDao.selectById(formDTO.getNoticeId()); | 
			
		
	
		
			
				
					|  |  |  |         //已经过期的通知,新用户阅读不算阅读,在通知有效期内没有阅读的就不算已读
 | 
			
		
	
		
			
				
					|  |  |  |         if(notice.getChangeTime().before(new Date())){ | 
			
		
	
		
			
				
					|  |  |  |             return; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //2.根据通知Id和当前用户查询是否存在通知阅读记录
 | 
			
		
	
		
			
				
					|  |  |  |         NoticeReadRecordEntity entity = baseDao.selectByNoticeId(formDTO.getNoticeId(), formDTO.getUserId()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //2.不存在记录时新增已读记录
 | 
			
		
	
		
			
				
					|  |  |  |         //3.不存在记录时新增已读记录
 | 
			
		
	
		
			
				
					|  |  |  |         if (null == entity || StringUtils.isEmpty(entity.getId())) { | 
			
		
	
		
			
				
					|  |  |  |             //查询通知详情
 | 
			
		
	
		
			
				
					|  |  |  |             NoticeEntity notice = noticeDao.selectById(formDTO.getNoticeId()); | 
			
		
	
		
			
				
					|  |  |  |             //新增当前人员已读数据
 | 
			
		
	
		
			
				
					|  |  |  |             NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity(); | 
			
		
	
		
			
				
					|  |  |  |             reafdRecord.setCustomerId(notice.getCustomerId()); | 
			
		
	
	
		
			
				
					|  |  | @ -155,7 +161,7 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor | 
			
		
	
		
			
				
					|  |  |  |             reafdRecord.setReadFlag(ReadFlagConstant.READ); | 
			
		
	
		
			
				
					|  |  |  |             insert(reafdRecord); | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |             //3.已存在记录且是已读状态不在修改
 | 
			
		
	
		
			
				
					|  |  |  |             //4.已存在记录且是已读状态不在修改
 | 
			
		
	
		
			
				
					|  |  |  |             if (ReadFlagConstant.UN_READ.equals(entity.getReadFlag())) { | 
			
		
	
		
			
				
					|  |  |  |                 entity.setReadFlag(ReadFlagConstant.READ); | 
			
		
	
		
			
				
					|  |  |  |                 baseDao.updateById(entity); | 
			
		
	
	
		
			
				
					|  |  | 
 |