修改pc消息已读、未读接口

This commit is contained in:
sh
2025-11-06 12:28:19 +08:00
parent 8bbc66e7ff
commit e5ba8fe0e7
6 changed files with 45 additions and 12 deletions

View File

@@ -63,6 +63,9 @@ public class EmployeeConfirm extends BaseEntity {
@ApiModelProperty("工作id")
private Long jobId;
@ApiModelProperty("移动端用户id")
private Long userId;
/**
* 申请id
*/

View File

@@ -31,7 +31,7 @@ public class Notice extends BaseEntity
private Integer notReadCount;
@ApiModelProperty("是否阅读 0未读 1已读")
private Integer isRead;
private String isRead;
@JsonFormat(pattern = "MM-dd")
@ApiModelProperty("日期")

View File

@@ -4,7 +4,10 @@ package com.ruoyi.cms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.cms.domain.Notice;
import java.util.List;
public interface NoticeMapper extends BaseMapper<Notice>
{
List<Notice> getNoticlist(Notice notice);
}

View File

@@ -127,7 +127,7 @@ public class AppNoticeServiceImpl implements IAppNoticeService
Notice notice = new Notice();
notice.setUserId(appUser.getUserId());
notice.setTitle("职位上新");
notice.setIsRead(0);
notice.setIsRead(StringUtil.NOTICE_WD);
notice.setDate(new Date());
//todo update number of job
notice.setSubTitle("这里有10个岗位很适合你快来看看吧");
@@ -169,14 +169,14 @@ public class AppNoticeServiceImpl implements IAppNoticeService
List<Long> longs = StringUtil.convertStringToLongList(ids);
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
notices.forEach(notice -> {
notice.setIsRead(1);
notice.setIsRead(StringUtil.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(1);
notice.setIsRead(StringUtil.NOTICE_YD);
}
noticeInfoMapper.updateById(notice);
}
@@ -186,7 +186,7 @@ public class AppNoticeServiceImpl implements IAppNoticeService
List<Long> longs = StringUtil.convertStringToLongList(ids);
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
notices.forEach(notice -> {
notice.setIsRead(1);
notice.setIsRead(StringUtil.NOTICE_YD);
notice.setNotReadCount(0);
noticeInfoMapper.updateById(notice);
});
@@ -201,8 +201,10 @@ public class AppNoticeServiceImpl implements IAppNoticeService
@Override
public List<Notice> selectListAppNotRead(Notice notice) {
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 sysNoticeList;
notice.setRemark(StringUtil.NOTICE_TYPE);
notice.setIsRead(StringUtil.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);
}
@Override
@@ -210,22 +212,22 @@ public class AppNoticeServiceImpl implements IAppNoticeService
List<Long> longs = StringUtil.convertStringToLongList(ids);
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
notices.forEach(notice -> {
notice.setIsRead(1);
notice.setIsRead(StringUtil.NOTICE_YD);
noticeInfoMapper.updateById(notice);
});
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(1);
notice.setIsRead(StringUtil.NOTICE_YD);
}
noticeInfoMapper.updateById(notice);
}
@Override
public List<Notice> selectListAppNotics(Notice notice) {
List<Notice> sysNoticeList = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, notice.getUserId()).eq(Notice::getRemark,"notice_bar").orderByDesc(Notice::getCreateTime));
return sysNoticeList;
notice.setRemark(StringUtil.NOTICE_TYPE);
return noticeInfoMapper.getNoticlist(notice);
}
}

View File

@@ -25,6 +25,16 @@ public class StringUtil {
* pc端-企业
*/
public static final String SYS_QY = "100";
/**
* 消息已读
*/
public static final String NOTICE_YD="1";
/**
* 消息未读
*/
public static final String NOTICE_WD="0";
public static final String NOTICE_TYPE="notice_bar";
public static Boolean isEmptyOrNull(String s){
if(Objects.isNull(s)){return true;}