|  |  | @ -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、取消活动 | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
	
		
			
				
					|  |  | 
 |