Browse Source

已读未读消息新增添加组长已读记录,查询列表不查询组长已读未读记录

dev_shibei_match
sunyuchao 4 years ago
parent
commit
9329921568
  1. 6
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/dao/NoticeDao.java
  2. 6
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReafdRecordServiceImpl.java
  3. 12
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
  4. 14
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml

6
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;
/**
* 小组通知表
@ -30,4 +31,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface NoticeDao extends BaseDao<NoticeEntity> {
/**
* @Author sun
* @Description 查询通知对应的小组的组长Id
**/
String selectNoticeGroupLeader(@Param("noticeId") String noticeId);
}

6
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<NoticeReafdRec
private NoticeReafdRecordRedis noticeReafdRecordRedis;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private NoticeDao noticeDao;
@Override
public PageData<NoticeReafdRecordDTO> page(Map<String, Object> params) {
@ -124,6 +127,9 @@ public class NoticeReafdRecordServiceImpl extends BaseServiceImpl<NoticeReafdRec
NoticeReadListResultDTO resultDTO = new NoticeReadListResultDTO();
List<NoticeReadListResultDTO.NoticeReafdRecord> readList = new ArrayList<>();
List<NoticeReadListResultDTO.NoticeReafdRecord> unReadList = new ArrayList<>();
//0.查询通知对应的小组的组长Id
String leaderId = noticeDao.selectNoticeGroupLeader(formDTO.getNoticeId());
//1.根据通知Id查询组成员已读未读数据
List<NoticeReafdRecordDTO> list = baseDao.getByNoticeId(formDTO.getNoticeId());

12
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<NoticeDao, NoticeEntity>
//6.通知已读未读表初始数据
List<NoticeReafdRecordEntity> 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());
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<NoticeDao, NoticeEntity>
noticeReafdRecordDao.delByNoticeId(formDTO.getNoticeId());
List<NoticeReafdRecordEntity> 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());
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);

14
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/notice/NoticeDao.xml

@ -3,5 +3,19 @@
<mapper namespace="com.epmet.modules.notice.dao.NoticeDao">
<select id="selectNoticeGroupLeader" resultType="java.lang.String">
SELECT
rgm.customer_user_id
FROM
notice n
INNER JOIN resi_group rg ON n.group_id = rg.id
INNER JOIN resi_group_member rgm ON n.group_id = rgm.resi_group_id
WHERE
n.del_flag = '0'
AND rg.del_flag = '0'
AND rgm.del_flag = '0'
AND rgm.group_leader_flag = 'leader'
AND n.id = #{noticeId}
</select>
</mapper>
Loading…
Cancel
Save