|
|
@ -193,25 +193,22 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr |
|
|
|
} |
|
|
|
|
|
|
|
private void saveActReadRecord(GroupActInfoEntity groupActInfoEntity,List<ResiGroupMemberDTO> memberDTOList) { |
|
|
|
/*String actReadKey= RedisKeys.getGroupMsgReadKey(GroupActConstant.ACT_STR,groupActInfoEntity.getGroupId(),groupActInfoEntity.getId()); |
|
|
|
String actShoudReadUserKey=RedisKeys.getGroupMsgShouldReadUser(GroupActConstant.ACT_STR,groupActInfoEntity.getGroupId(),groupActInfoEntity.getId());*/ |
|
|
|
List<ActReadRecordEntity> readRecordEntityList=new ArrayList<>(); |
|
|
|
memberDTOList.forEach(memberDTO->{ |
|
|
|
ActReadRecordEntity actReadRecordEntity=new ActReadRecordEntity(); |
|
|
|
actReadRecordEntity.setCustomerId(groupActInfoEntity.getCustomerId()); |
|
|
|
actReadRecordEntity.setGroupActId(groupActInfoEntity.getId()); |
|
|
|
actReadRecordEntity.setReadFlag(GroupActConstant.UN_READ); |
|
|
|
actReadRecordEntity.setUserId(memberDTO.getCustomerUserId()); |
|
|
|
actReadRecordEntity.setShouldBeRead(Constant.YES); |
|
|
|
actReadRecordEntity.setGroupId(groupActInfoEntity.getGroupId()); |
|
|
|
actReadRecordEntity.setGridId(groupActInfoEntity.getGridId()); |
|
|
|
//组长默认已读,组员默认未读
|
|
|
|
if(!groupActInfoEntity.getPublishUserId().equals(memberDTO.getCustomerUserId())){ |
|
|
|
readRecordEntityList.add(actReadRecordEntity); |
|
|
|
/* //默认是未读
|
|
|
|
redisUtils.setBit(actReadKey,memberDTO.getTempNum(),false); |
|
|
|
//当前所有成员默认应读
|
|
|
|
redisUtils.setBit(actShoudReadUserKey,memberDTO.getTempNum(),true);*/ |
|
|
|
actReadRecordEntity.setReadFlag(GroupActConstant.UN_READ); |
|
|
|
}else{ |
|
|
|
actReadRecordEntity.setReadFlag(GroupActConstant.READ); |
|
|
|
} |
|
|
|
readRecordEntityList.add(actReadRecordEntity); |
|
|
|
}); |
|
|
|
readRecordEntityList.forEach(readRecordEntity->{ |
|
|
|
actReadRecordDao.insert(readRecordEntity); |
|
|
@ -505,27 +502,30 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr |
|
|
|
resultDTO.setUserRole(resiGroupMemberDTO.getGroupLeaderFlag()); |
|
|
|
// 有签到后不可以修改活动时间:true可以修改,false不可以,
|
|
|
|
resultDTO.setStartTimeEditFlag(groupActInfoEntity.getSignedInNum() > NumConstant.ZERO ? false : true); |
|
|
|
//返回详情,并且已读状态
|
|
|
|
ActReadRecordEntity actReadRecordEntity=actReadRecordDao.selectUserRec(formDTO.getGroupActId(),formDTO.getUserId()); |
|
|
|
if(null== actReadRecordEntity){ |
|
|
|
if(!GroupActConstant.CLOSED.equals(groupActInfoEntity.getStatus())){ |
|
|
|
//插入已读记录,默认不属于应读人。
|
|
|
|
ActReadRecordEntity insertEntity=new ActReadRecordEntity(); |
|
|
|
insertEntity.setCustomerId(groupActInfoEntity.getCustomerId()); |
|
|
|
insertEntity.setGroupActId(formDTO.getGroupActId()); |
|
|
|
insertEntity.setReadFlag(GroupActConstant.READ); |
|
|
|
insertEntity.setShouldBeRead(Constant.NO); |
|
|
|
insertEntity.setUserId(formDTO.getUserId()); |
|
|
|
insertEntity.setGridId(groupActInfoEntity.getGridId()); |
|
|
|
insertEntity.setGroupId(groupActInfoEntity.getGroupId()); |
|
|
|
actReadRecordDao.insert(insertEntity); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(GroupActConstant.UN_READ.equals(actReadRecordEntity.getReadFlag())){ |
|
|
|
//未读->已读
|
|
|
|
actReadRecordEntity.setReadFlag(GroupActConstant.READ); |
|
|
|
actReadRecordEntity.setUpdatedTime(new Date()); |
|
|
|
actReadRecordDao.updateById(actReadRecordEntity); |
|
|
|
if (!GroupActConstant.CLOSED.equals(groupActInfoEntity.getStatus())) { |
|
|
|
//如果活动关闭,则不更新已读记录
|
|
|
|
//非关闭状态下,返回详情,并且已读状态
|
|
|
|
ActReadRecordEntity actReadRecordEntity = actReadRecordDao.selectUserRec(formDTO.getGroupActId(), formDTO.getUserId()); |
|
|
|
if (null == actReadRecordEntity) { |
|
|
|
if (!GroupActConstant.CLOSED.equals(groupActInfoEntity.getStatus())) { |
|
|
|
//插入已读记录,默认不属于应读人。
|
|
|
|
ActReadRecordEntity insertEntity = new ActReadRecordEntity(); |
|
|
|
insertEntity.setCustomerId(groupActInfoEntity.getCustomerId()); |
|
|
|
insertEntity.setGroupActId(formDTO.getGroupActId()); |
|
|
|
insertEntity.setReadFlag(GroupActConstant.READ); |
|
|
|
insertEntity.setShouldBeRead(Constant.NO); |
|
|
|
insertEntity.setUserId(formDTO.getUserId()); |
|
|
|
insertEntity.setGridId(groupActInfoEntity.getGridId()); |
|
|
|
insertEntity.setGroupId(groupActInfoEntity.getGroupId()); |
|
|
|
actReadRecordDao.insert(insertEntity); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (GroupActConstant.UN_READ.equals(actReadRecordEntity.getReadFlag())) { |
|
|
|
//未读->已读
|
|
|
|
actReadRecordEntity.setReadFlag(GroupActConstant.READ); |
|
|
|
actReadRecordEntity.setUpdatedTime(new Date()); |
|
|
|
actReadRecordDao.updateById(actReadRecordEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return resultDTO; |
|
|
@ -618,28 +618,31 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr |
|
|
|
if (!CollectionUtils.isEmpty(resultDTOList)) { |
|
|
|
//3.遍历封装数据并返回
|
|
|
|
list.forEach(l -> { |
|
|
|
StringBuffer name = new StringBuffer(); |
|
|
|
StringBuffer url = new StringBuffer(); |
|
|
|
resultDTOList.forEach(user -> { |
|
|
|
if (l.getUserId().equals(user.getUserId())) { |
|
|
|
name.append(user.getSurname()).append(user.getName()); |
|
|
|
url.append(user.getHeadImgUrl()); |
|
|
|
//不展示组长的记录
|
|
|
|
if (!l.getUserId().equals(actReadViewFormDTO.getUserId())) { |
|
|
|
StringBuffer name = new StringBuffer(); |
|
|
|
StringBuffer url = new StringBuffer(); |
|
|
|
resultDTOList.forEach(user -> { |
|
|
|
if (l.getUserId().equals(user.getUserId())) { |
|
|
|
name.append(user.getSurname()).append(user.getName()); |
|
|
|
url.append(user.getHeadImgUrl()); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (GroupActConstant.READ.equals(l.getReadFlag())) { |
|
|
|
//已读
|
|
|
|
NoticeReadListResultDTO.NoticeReafdRecord read = new NoticeReadListResultDTO.NoticeReafdRecord(); |
|
|
|
read.setUserId(l.getUserId()); |
|
|
|
read.setUserName(name.toString()); |
|
|
|
read.setUserHeadPhoto(url.toString()); |
|
|
|
readList.add(read); |
|
|
|
} else { |
|
|
|
//未读
|
|
|
|
NoticeReadListResultDTO.NoticeReafdRecord unRead = new NoticeReadListResultDTO.NoticeReafdRecord(); |
|
|
|
unRead.setUserId(l.getUserId()); |
|
|
|
unRead.setUserName(name.toString()); |
|
|
|
unRead.setUserHeadPhoto(url.toString()); |
|
|
|
unReadList.add(unRead); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (GroupActConstant.READ.equals(l.getReadFlag())) { |
|
|
|
//已读
|
|
|
|
NoticeReadListResultDTO.NoticeReafdRecord read = new NoticeReadListResultDTO.NoticeReafdRecord(); |
|
|
|
read.setUserId(l.getUserId()); |
|
|
|
read.setUserName(name.toString()); |
|
|
|
read.setUserHeadPhoto(url.toString()); |
|
|
|
readList.add(read); |
|
|
|
} else { |
|
|
|
//未读
|
|
|
|
NoticeReadListResultDTO.NoticeReafdRecord unRead = new NoticeReadListResultDTO.NoticeReafdRecord(); |
|
|
|
unRead.setUserId(l.getUserId()); |
|
|
|
unRead.setUserName(name.toString()); |
|
|
|
unRead.setUserHeadPhoto(url.toString()); |
|
|
|
unReadList.add(unRead); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|