Browse Source

通知阅读状态添加过期后阅读的状态

master
sunyuchao 4 years ago
parent
commit
45f2b50ff3
  1. 7
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReadRecordDTO.java
  2. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReadRecordEntity.java
  3. 29
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java
  4. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java
  5. 12
      epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.20__alter_read.sql

7
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeReadRecordDTO.java

@ -64,10 +64,15 @@ public class NoticeReadRecordDTO implements Serializable {
private String userId;
/**
* read已读un_read未读
* (通知过期前的阅读状态)read已读un_read未读
*/
private String readFlag;
/**
* (通知过期后的阅读状态)已读:read未读:un_read;
*/
private String viewDetail;
/**
* 删除标识
*/

7
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeReadRecordEntity.java

@ -64,8 +64,13 @@ public class NoticeReadRecordEntity extends BaseEpmetEntity {
private String userId;
/**
* read已读un_read未读
* (通知过期前的阅读状态)read已读un_read未读
*/
private String readFlag;
/**
* (通知过期后的阅读状态)已读:read未读:un_read;
*/
private String viewDetail;
}

29
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeReadRecordServiceImpl.java

@ -141,16 +141,18 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor
public void readType(ReadTypeFormDTO formDTO) {
//1.查询通知详情,判断有没有过期
NoticeEntity notice = noticeDao.selectById(formDTO.getNoticeId());
//已经过期的通知,新用户阅读不算阅读,在通知有效期内没有阅读的就不算已读
if(notice.getChangeTime().before(new Date())){
return;
//已经过期的通知,新用户阅读只修改过期后的阅读状态
boolean bl = true;
if (notice.getChangeTime().before(new Date())) {
//通知过期
bl = false;
}
//2.根据通知Id和当前用户查询是否存在通知阅读记录
NoticeReadRecordEntity entity = baseDao.selectByNoticeId(formDTO.getNoticeId(), formDTO.getUserId());
//3.不存在记录时新增已读记录
if (null == entity || StringUtils.isEmpty(entity.getId())) {
//3.不存在记录且通知未过期时新增已读记录
if ((null == entity || StringUtils.isEmpty(entity.getId())) && bl) {
//新增当前人员已读数据
NoticeReadRecordEntity reafdRecord = new NoticeReadRecordEntity();
reafdRecord.setCustomerId(notice.getCustomerId());
@ -161,11 +163,20 @@ public class NoticeReadRecordServiceImpl extends BaseServiceImpl<NoticeReadRecor
reafdRecord.setReadFlag(ReadFlagConstant.READ);
insert(reafdRecord);
} else {
//4.已存在记录且是已读状态不在修改
if (ReadFlagConstant.UN_READ.equals(entity.getReadFlag())) {
entity.setReadFlag(ReadFlagConstant.READ);
baseDao.updateById(entity);
//4.根据是否过期判断已存在记录且是已读状态不在修改
if (bl) {
if (ReadFlagConstant.UN_READ.equals(entity.getReadFlag())) {
entity.setReadFlag(ReadFlagConstant.READ);
entity.setViewDetail(ReadFlagConstant.READ);
baseDao.updateById(entity);
}
} else {
if (ReadFlagConstant.UN_READ.equals(entity.getViewDetail())) {
entity.setViewDetail(ReadFlagConstant.READ);
baseDao.updateById(entity);
}
}
}
}

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java

@ -237,8 +237,10 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
reafdRecord.setUserId(m.getCustomerUserId());
if ("leader".equals(m.getGroupLeaderFlag())) {
reafdRecord.setReadFlag(ReadFlagConstant.READ);
reafdRecord.setViewDetail(ReadFlagConstant.READ);
}else {
reafdRecord.setReadFlag("un_read");
reafdRecord.setViewDetail("un_read");
}
reafdRecordList.add(reafdRecord);
});
@ -381,8 +383,10 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
reafdRecord.setUserId(m.getCustomerUserId());
if ("leader".equals(m.getGroupLeaderFlag())) {
reafdRecord.setReadFlag(ReadFlagConstant.READ);
reafdRecord.setViewDetail(ReadFlagConstant.READ);
}else {
reafdRecord.setReadFlag("un_read");
reafdRecord.setViewDetail("un_read");
}
reafdRecordList.add(reafdRecord);
});

12
epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.20__alter_read.sql

@ -0,0 +1,12 @@
ALTER TABLE `act_read_record`
MODIFY COLUMN `READ_FLAG` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'un_read' COMMENT '活动关闭前已读:read;未读:un_read' AFTER `GROUP_ACT_ID`,
ADD COLUMN `VIEW_DETAIL` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '已读:read未读:un_read;' AFTER `READ_FLAG`;
UPDATE act_read_record set VIEW_DETAIL = READ_FLAG;
ALTER TABLE `notice_read_record`
MODIFY COLUMN `READ_FLAG` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'unread' COMMENT '(通知过期前的阅读状态)read已读、un_read未读' AFTER `USER_ID`,
ADD COLUMN `VIEW_DETAIL` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '(通知过期后的阅读状态)已读:read未读:un_read;' AFTER `READ_FLAG`;
UPDATE notice_read_record set VIEW_DETAIL = READ_FLAG;
Loading…
Cancel
Save