修改pc已读消息列表

This commit is contained in:
sh
2025-11-06 15:03:34 +08:00
parent e270fcc531
commit 1b7d5c5451
11 changed files with 137 additions and 34 deletions

View File

@@ -6,6 +6,7 @@ import com.ruoyi.cms.domain.AppNotice;
import com.ruoyi.cms.domain.Job;
import com.ruoyi.cms.domain.Notice;
import com.ruoyi.cms.domain.vo.AppNoticeVO;
import com.ruoyi.cms.domain.vo.NoticeTotal;
import java.util.List;
@@ -89,4 +90,8 @@ public interface IAppNoticeService
* @return
*/
List<Notice> selectListAppNotices(Notice notice);
NoticeTotal noticTotal(Notice notice);
int removeNotice(Long[] ids);
}

View File

@@ -3,14 +3,17 @@ package com.ruoyi.cms.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.cms.domain.*;
import com.ruoyi.cms.domain.vo.NoticeTotal;
import com.ruoyi.cms.mapper.*;
import com.ruoyi.cms.service.IAppNoticeService;
import com.ruoyi.cms.util.NoticeUtils;
import com.ruoyi.cms.util.StringUtil;
import com.ruoyi.common.core.domain.entity.AppUser;
import com.ruoyi.common.utils.SiteSecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -127,7 +130,7 @@ public class AppNoticeServiceImpl implements IAppNoticeService
Notice notice = new Notice();
notice.setUserId(appUser.getUserId());
notice.setTitle("职位上新");
notice.setIsRead(StringUtil.NOTICE_WD);
notice.setIsRead(NoticeUtils.NOTICE_WD);
notice.setDate(new Date());
//todo update number of job
notice.setSubTitle("这里有10个岗位很适合你快来看看吧");
@@ -169,14 +172,14 @@ public class AppNoticeServiceImpl implements IAppNoticeService
List<Long> longs = StringUtil.convertStringToLongList(ids);
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
notices.forEach(notice -> {
notice.setIsRead(StringUtil.NOTICE_YD);
notice.setIsRead(NoticeUtils.NOTICE_YD);
noticeInfoMapper.updateById(notice);
});
List<Notice> notices1 = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, SiteSecurityUtils.getUserId()).eq(Notice::getRemark, "notice_bar").eq(Notice::getTitle, "系统通知").orderByDesc(Notice::getCreateTime).last("limit 1"));
Notice notice = notices1.get(0);
notice.setNotReadCount(notice.getNotReadCount() - longs.size());
if(notice.getNotReadCount()==0){
notice.setIsRead(StringUtil.NOTICE_YD);
notice.setIsRead(NoticeUtils.NOTICE_YD);
}
noticeInfoMapper.updateById(notice);
}
@@ -186,7 +189,7 @@ public class AppNoticeServiceImpl implements IAppNoticeService
List<Long> longs = StringUtil.convertStringToLongList(ids);
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
notices.forEach(notice -> {
notice.setIsRead(StringUtil.NOTICE_YD);
notice.setIsRead(NoticeUtils.NOTICE_YD);
notice.setNotReadCount(0);
noticeInfoMapper.updateById(notice);
});
@@ -201,8 +204,8 @@ public class AppNoticeServiceImpl implements IAppNoticeService
@Override
public List<Notice> selectListAppNotRead(Notice notice) {
notice.setRemark(StringUtil.NOTICE_TYPE);
notice.setIsRead(StringUtil.NOTICE_WD);
notice.setRemark(NoticeUtils.NOTICE_TYPE);
notice.setIsRead(NoticeUtils.NOTICE_WD);
//List<Notice> sysNoticeList = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, notice.getUserId()).eq(Notice::getRemark,"notice_bar").eq(Notice::getIsRead,0).orderByDesc(Notice::getCreateTime));
return noticeInfoMapper.getNoticlist(notice);
}
@@ -212,26 +215,41 @@ public class AppNoticeServiceImpl implements IAppNoticeService
List<Long> longs = StringUtil.convertStringToLongList(ids);
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
notices.forEach(notice -> {
notice.setIsRead(StringUtil.NOTICE_YD);
noticeInfoMapper.updateById(notice);
Notice upNotic=new Notice();
upNotic.setNoticeId(notice.getNoticeId());
upNotic.setIsRead(NoticeUtils.NOTICE_YD);
noticeInfoMapper.updateById(upNotic);
});
List<Notice> notices1 = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, userId).eq(Notice::getRemark, "notice_bar").eq(Notice::getTitle, "系统通知").orderByDesc(Notice::getCreateTime).last("limit 1"));
Notice notice = notices1.get(0);
notice.setNotReadCount(notice.getNotReadCount() - longs.size());
if(notice.getNotReadCount()==0){
notice.setIsRead(StringUtil.NOTICE_YD);
List<Notice> notices1 = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, userId).eq(Notice::getRemark, "notice_bar").orderByDesc(Notice::getCreateTime).last("limit 1"));
if(notices1!=null&&notices1.size()>0){
Notice parmNotice = notices1.get(0);
Notice notice=new Notice();
notice.setNoticeId(parmNotice.getNoticeId());
notice.setNotReadCount(parmNotice.getNotReadCount()!=null?parmNotice.getNotReadCount() - longs.size():0);
if(notice.getNotReadCount()==0){
notice.setIsRead(NoticeUtils.NOTICE_YD);
}
noticeInfoMapper.updateById(notice);
}
noticeInfoMapper.updateById(notice);
}
@Override
public List<Notice> selectListAppNotics(Notice notice) {
notice.setRemark(StringUtil.NOTICE_TYPE);
notice.setRemark(NoticeUtils.NOTICE_TYPE);
return noticeInfoMapper.getNoticlist(notice);
}
public List<Notice> selectListAppNotices(Notice notice){
return noticeInfoMapper.getNoticlist(notice);
}
public NoticeTotal noticTotal(Notice notice){
return noticeInfoMapper.noticTotal(notice);
}
public int removeNotice(Long[] ids){
int t=noticeInfoMapper.deleteBatchIds(Arrays.asList(ids));
return t;
}
}

View File

@@ -7,6 +7,7 @@ import com.ruoyi.cms.mapper.EmployeeConfirmMapper;
import com.ruoyi.cms.mapper.JobApplyMapper;
import com.ruoyi.cms.mapper.NoticeMapper;
import com.ruoyi.cms.service.EmployeeConfirmService;
import com.ruoyi.cms.util.NoticeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -39,12 +40,12 @@ public class EmployeeConfirmServiceImpl implements EmployeeConfirmService {
jobApplyMapper.updateById(apply);
}
//添加消息
/*Notice notice=new Notice();
notice.setUserId();
notice.setBussinessId();
notice.setIsRead(0);
notice
noticeMapper.insert(notice);*/
Notice notice=new Notice();
notice.setUserId(employeeConfirm.getUserId());
notice.setBussinessId(employeeConfirm.getId());
notice.setIsRead(NoticeUtils.NOTICE_WD);
notice.setTitle("");
noticeMapper.insert(notice);
return t;
}