|  | @@ -13,8 +13,10 @@ import com.xunmei.common.core.domain.message.domain.CoreAnnouncementNotification
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.message.domain.CoreAnnouncementNotificationToOrg;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.message.domain.CoreAnnouncementNotificationToRole;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.message.domain.CoreAnnouncementNotificationToUser;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.domain.message.dto.CoreAnnouncementNotificationAppPageDto;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.message.dto.CoreAnnouncementNotificationDto;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.message.dto.CoreAnnouncementNotificationPageDto;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.domain.message.vo.CoreAnnouncementNotificationAppPageVo;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.message.vo.CoreAnnouncementNotificationPageVo;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.util.BeanHelper;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.utils.DateUtils;
 | 
	
	
		
			
				|  | @@ -28,6 +30,7 @@ import com.xunmei.system.api.RemoteUserService;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysOrg;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysUser;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
 | 
	
		
			
				|  |  | +import org.springframework.scheduling.annotation.Async;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -99,6 +102,49 @@ public class CoreAnnouncementNotificationServiceImpl extends ServiceImpl<CoreAnn
 | 
	
		
			
				|  |  |          coreAnnouncementNotificationMapper.updateById(coreAnnouncementNotification);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public TableDataInfo<CoreAnnouncementNotificationAppPageVo> selectAppPage(CoreAnnouncementNotificationAppPageDto request) {
 | 
	
		
			
				|  |  | +        Page<CoreAnnouncementNotificationAppPageVo> page;
 | 
	
		
			
				|  |  | +        //分页
 | 
	
		
			
				|  |  | +        if (request.getPageNum()!=null&&request.getPageSize()!=null)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            page = new Page<>(request.getPageNum(), request.getPageSize());
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            page = new Page<>();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        page = coreAnnouncementNotificationMapper.selectAppPage(page, request);
 | 
	
		
			
				|  |  | +        if(page!=null&&CollectionUtil.isNotEmpty(page.getRecords())){
 | 
	
		
			
				|  |  | +            page = this.buildNewNotificationAppPageVo(page,request);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //抓换为TableDataInfo适配前端
 | 
	
		
			
				|  |  | +        return TableDataInfo.build(page);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Async
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void markIsRead(CoreAnnouncementNotificationAppPageDto request) {
 | 
	
		
			
				|  |  | +        CoreAnnouncementNotificationToUser notificationUser = coreAnnouncementNotificationMapper.checkIsRead(request);
 | 
	
		
			
				|  |  | +        if(ObjectUtil.isEmpty(notificationUser)){
 | 
	
		
			
				|  |  | +            notificationUser = new CoreAnnouncementNotificationToUser();
 | 
	
		
			
				|  |  | +            notificationUser.setId(IdWorker.getId());
 | 
	
		
			
				|  |  | +            notificationUser.setUserId(request.getUserId());
 | 
	
		
			
				|  |  | +            notificationUser.setOrgId(request.getOrgId());
 | 
	
		
			
				|  |  | +            notificationUser.setAnnouncementNotificationId(request.getAnnouncementNotificationId());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        coreAnnouncementNotificationMapper.insertNotificationUser(notificationUser);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private Page<CoreAnnouncementNotificationAppPageVo> buildNewNotificationAppPageVo(Page<CoreAnnouncementNotificationAppPageVo> page, CoreAnnouncementNotificationAppPageDto request) {
 | 
	
		
			
				|  |  | +        List<CoreAnnouncementNotificationAppPageVo> records = page.getRecords();
 | 
	
		
			
				|  |  | +        List<CoreAnnouncementNotificationToUser> list = coreAnnouncementNotificationMapper.selectNotificationToUsers(request,records);
 | 
	
		
			
				|  |  | +            records.forEach(r->{
 | 
	
		
			
				|  |  | +                int num = (int) list.stream().filter(a->a.getUserId().equals(request.getUserId())&&a.getAnnouncementNotificationId().equals(r.getId())).count();
 | 
	
		
			
				|  |  | +                r.setIsRead(num);
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        return page;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private Page<CoreAnnouncementNotificationPageVo> getOrgAndRoleListMap(Page<CoreAnnouncementNotificationPageVo> page) {
 | 
	
		
			
				|  |  |          List<CoreAnnouncementNotificationPageVo> records = page.getRecords();
 | 
	
		
			
				|  |  |          List<CoreAnnouncementNotificationToOrg> notificationToOrgs = coreAnnouncementNotificationMapper.selectOrgIds(records);
 |