Browse Source

bug fix

dev_shibei_match
yinzuomei 4 years ago
parent
commit
f011fe21c6
  1. 1
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java
  2. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java
  3. 1
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java
  4. 122
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java
  5. 1
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java

1
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java

@ -104,5 +104,4 @@ public class ResiGroupMemberDTO implements Serializable {
* */
private String customerId;
private Integer tempNum;
}

7
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java

@ -93,13 +93,6 @@ public class GroupActInfoController {
return new Result<NoticeReadListResultDTO>().ok(groupActInfoService.queryReadList(actReadViewFormDTO));
}
@PostMapping("readlistV2")
public Result<NoticeReadListResultDTO> queryReadListV2(@RequestBody @LoginUser TokenDto tokenDto, @RequestBody ActReadViewFormDTO actReadViewFormDTO){
actReadViewFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(actReadViewFormDTO,ActReadViewFormDTO.AddUserInternalGroup.class);
return new Result<NoticeReadListResultDTO>().ok(groupActInfoService.queryReadListV2(actReadViewFormDTO));
}
/**
* @return
* @param formDTO

1
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java

@ -58,7 +58,6 @@ public interface GroupActInfoService extends BaseService<GroupActInfoEntity> {
*/
NoticeReadListResultDTO queryReadList(ActReadViewFormDTO actReadViewFormDTO);
NoticeReadListResultDTO queryReadListV2(ActReadViewFormDTO actReadViewFormDTO);
/**
* 011取消活动
*

122
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java

@ -25,8 +25,6 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
@ -124,8 +122,6 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
private ActSummaryService actSummaryService;
@Autowired
private GroupMessageService groupMessageService;
@Autowired
private RedisUtils redisUtils;
/**
* 003发布编辑组织活动
@ -149,6 +145,11 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
//组织活动信息
GroupActInfoEntity groupActInfoEntity = constructGroupActInfoEntity(formDTO);
//包含组长
List<ResiGroupMemberDTO> memberDTOList=resiGroupMemberService.getMemberList(formDTO.getGroupId());
//应读数减-1,去掉组长
groupActInfoEntity.setShouldRead(memberDTOList.size()-NumConstant.ONE);
//1、插入活修改活动信息表
if (StringUtils.isNotBlank(groupActInfoEntity.getId())) {
//删除group_act_content、删除act_read_record
@ -164,10 +165,6 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
//构造活动内容表
List<GroupActContentEntity> contentList = constructText(groupActInfoEntity.getId(), formDTO.getCustomerId(), formDTO.getTextList());
List<GroupActContentEntity> imgList = constructImg(groupActInfoEntity.getId(), formDTO.getCustomerId(), formDTO.getImgList());
//包含组长
List<ResiGroupMemberDTO> memberDTOList=resiGroupMemberService.getMemberList(formDTO.getGroupId());
//应读数减-1,去掉组长
groupActInfoEntity.setShouldRead(memberDTOList.size()-NumConstant.ONE);
//2、插入活动内容
contentList.forEach(textContentEntity->{
@ -192,8 +189,8 @@ 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());
/*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();
@ -206,10 +203,10 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
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);
redisUtils.setBit(actShoudReadUserKey,memberDTO.getTempNum(),true);*/
}
});
readRecordEntityList.forEach(readRecordEntity->{
@ -503,33 +500,28 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
resultDTO.setUserRole(resiGroupMemberDTO.getGroupLeaderFlag());
// 有签到后不可以修改活动时间:true可以修改,false不可以,
resultDTO.setStartTimeEditFlag(groupActInfoEntity.getSignedInNum()>NumConstant.ZERO?false:true);
resultDTO.setStartTimeEditFlag(groupActInfoEntity.getSignedInNum() > NumConstant.ZERO ? false : true);
//返回详情,并且已读状态
ActReadRecordEntity actReadRecordEntity=actReadRecordDao.selectUserRec(formDTO.getGroupActId(),formDTO.getUserId());
String actReadKey= RedisKeys.getGroupMsgReadKey(GroupActConstant.ACT_STR,groupActInfoEntity.getGroupId(),groupActInfoEntity.getId());
if(null== actReadRecordEntity){
//todo 插入不在应读列表里的是否还记录呢????
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());
// todo
actReadRecordDao.insert(insertEntity);
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());
// todo
actReadRecordDao.updateById(actReadRecordEntity);
//状态改为已读
redisUtils.setBit(actReadKey,resiGroupMemberDTO.getTempNum(),true);
}
}
return resultDTO;
@ -659,76 +651,6 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr
return resultDTO;
}
@Override
public NoticeReadListResultDTO queryReadListV2(ActReadViewFormDTO actReadViewFormDTO) {
NoticeReadListResultDTO resultDTO = new NoticeReadListResultDTO();
List<NoticeReadListResultDTO.NoticeReafdRecord> readList = new ArrayList<>();
List<NoticeReadListResultDTO.NoticeReafdRecord> unReadList = new ArrayList<>();
//1.根据活动id,查询应读人员列表
GroupActInfoEntity groupActInfoEntity=baseDao.selectById(actReadViewFormDTO.getGroupActId());
List<ResiGroupMemberDTO> memembersList=resiGroupMemberService.getMemberList(groupActInfoEntity.getGroupId());
//2.调用user服务,查询人员基础数据
List<String> userIdList = memembersList.stream().map(ResiGroupMemberDTO::getCustomerUserId).collect(Collectors.toList());
Result<List<UserBaseInfoResultDTO>> result = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
if (!result.success()) {
throw new RenException("调用user服务,获取用户基础数据失败");
}
List<UserBaseInfoResultDTO> resultDTOList = result.getData();
if (!CollectionUtils.isEmpty(resultDTOList)) {
//3.遍历封装数据并返回
for (ResiGroupMemberDTO memberDTO : memembersList) {
//todo
//1)怎么判断当前组员属于应读人员?
//2)应读人员,是否已读??
String userActKey = RedisKeys.getGroupMsgReadKey(GroupActConstant.ACT_STR, groupActInfoEntity.getGroupId(), groupActInfoEntity.getId());
Boolean readFlag = redisUtils.getBit(userActKey, memberDTO.getTempNum());
if (readFlag) {
//已读
StringBuffer name = new StringBuffer();
StringBuffer url = new StringBuffer();
resultDTOList.forEach(user -> {
if (memberDTO.getCustomerUserId().equals(user.getUserId())) {
name.append(user.getSurname()).append(user.getName());
url.append(user.getHeadImgUrl());
}
});
NoticeReadListResultDTO.NoticeReafdRecord read = new NoticeReadListResultDTO.NoticeReafdRecord();
read.setUserId(memberDTO.getCustomerUserId());
read.setUserName(name.toString());
read.setUserHeadPhoto(url.toString());
readList.add(read);
} else {
//todo
// 未读人员 ??????
StringBuffer name = new StringBuffer();
StringBuffer url = new StringBuffer();
resultDTOList.forEach(user -> {
if (memberDTO.getCustomerUserId().equals(user.getUserId())) {
name.append(user.getSurname()).append(user.getName());
url.append(user.getHeadImgUrl());
}
});
NoticeReadListResultDTO.NoticeReafdRecord unRead = new NoticeReadListResultDTO.NoticeReafdRecord();
unRead.setUserId(memberDTO.getCustomerUserId());
unRead.setUserName(name.toString());
unRead.setUserHeadPhoto(url.toString());
unReadList.add(unRead);
}
}
}
//已读人数
String actReadKey= RedisKeys.getGroupMsgReadKey(GroupActConstant.ACT_STR,groupActInfoEntity.getGroupId(),groupActInfoEntity.getId());
long readNum=redisUtils.bitCount(actReadKey);
resultDTO.setReadCount((int) readNum);
//未读人数
resultDTO.setUnReadCount(groupActInfoEntity.getShouldRead()-resultDTO.getReadCount());
//已读列表
resultDTO.setReadList(readList);
//未读列表
resultDTO.setUnReadList(unReadList);
return resultDTO;
}
/**
* 011取消活动
*

1
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ResiGroupMemberEntity.java

@ -73,6 +73,5 @@ public class ResiGroupMemberEntity extends BaseEpmetEntity {
@TableField(fill = FieldFill.INSERT)
private String customerId;
private Integer tempNum;
}

Loading…
Cancel
Save