diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java index 2cab9440db..4ee6056a2b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java @@ -20,6 +20,7 @@ package com.epmet.modules.notice.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.notice.entity.NoticeEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 小组通知表 @@ -29,5 +30,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface NoticeDao extends BaseDao { - + + /** + * @Author sun + * @Description 查询通知对应的小组的组长Id + **/ + String selectNoticeGroupLeader(@Param("noticeId") String noticeId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java index 11507e85ba..e45a250a0d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java @@ -28,6 +28,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.modules.notice.dao.NoticeDao; import com.epmet.modules.notice.dao.NoticeReafdRecordDao; import com.epmet.modules.notice.entity.NoticeReafdRecordEntity; import com.epmet.modules.notice.redis.NoticeReafdRecordRedis; @@ -60,6 +61,8 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl page(Map params) { @@ -124,6 +127,9 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl readList = new ArrayList<>(); List unReadList = new ArrayList<>(); + //0.查询通知对应的小组的组长Id + String leaderId = noticeDao.selectNoticeGroupLeader(formDTO.getNoticeId()); + //1.根据通知Id查询组成员已读未读数据 List list = baseDao.getByNoticeId(formDTO.getNoticeId()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java index 8ef6c3dcc4..5b7cd69be3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java @@ -275,16 +275,18 @@ public class NoticeServiceImpl extends BaseServiceImpl //6.通知已读未读表初始数据 List 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()); + NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); + reafdRecord.setCustomerId(resultDTO.getCustomerId()); + reafdRecord.setGridId(groupEntity.getGridId()); + reafdRecord.setGroupId(formDTO.getGroupId()); + reafdRecord.setNoticeId(entity.getId()); + reafdRecord.setUserId(m.getCustomerUserId()); + if ("leader".equals(m.getGroupLeaderFlag())) { + reafdRecord.setReadFlag(ReadFlagConstant.READ); + }else { reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); - reafdRecordList.add(reafdRecord); } + reafdRecordList.add(reafdRecord); }); if (reafdRecordList.size() > NumConstant.ZERO) { noticeReafdRecordService.insertBatch(reafdRecordList); @@ -394,16 +396,18 @@ public class NoticeServiceImpl extends BaseServiceImpl noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId()); List 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()); + NoticeReafdRecordEntity reafdRecord = new NoticeReafdRecordEntity(); + reafdRecord.setCustomerId(entity.getCustomerId()); + reafdRecord.setGridId(entity.getGridId()); + reafdRecord.setGroupId(entity.getGroupId()); + reafdRecord.setNoticeId(entity.getId()); + reafdRecord.setUserId(m.getCustomerUserId()); + if ("leader".equals(m.getGroupLeaderFlag())) { + reafdRecord.setReadFlag(ReadFlagConstant.READ); + }else { reafdRecord.setReadFlag(ReadFlagConstant.UN_READ); - reafdRecordList.add(reafdRecord); } + reafdRecordList.add(reafdRecord); }); if (reafdRecordList.size() > NumConstant.ZERO) { noticeReafdRecordService.insertBatch(reafdRecordList); diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml index 7f7dc8e127..332dfa0b5c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml @@ -3,5 +3,19 @@ + \ No newline at end of file