|
|
@ -172,7 +172,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
//2.创建话题
|
|
|
|
if(resiTopicPublishFormDTO.getTopicContent().length() > TopicConstant.MAX_NUMBER_OF_CONTENT){ |
|
|
|
//内容超过最大限制
|
|
|
|
return new Result().error(); |
|
|
|
return new Result().error(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED); |
|
|
|
} |
|
|
|
ResiTopicEntity topic = ConvertUtils.sourceToTarget(resiTopicPublishFormDTO,ResiTopicEntity.class); |
|
|
|
topic.setCreatedBy(tokenDto.getUserId()); |
|
|
@ -180,7 +180,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
baseDao.insertOne(topic); |
|
|
|
if(StringUtils.isBlank(topic.getId())){ |
|
|
|
//没有返回主键
|
|
|
|
return new Result().error(); |
|
|
|
return new Result().error(ModuleConstant.NO_PRIMARY_KEY_RETURNED); |
|
|
|
} |
|
|
|
if(null != resiTopicPublishFormDTO.getAttachmentList() && resiTopicPublishFormDTO.getAttachmentList().size() > 0){ |
|
|
|
ResiTopicAttachmentEntity attachment = new ResiTopicAttachmentEntity(); |
|
|
@ -211,7 +211,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
* @Date 2020.04.01 08:59 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result<List<ResiTopicInfoResultDTO>> getLatestTenTopics(TokenDto tokenDto, String groupId) { |
|
|
|
public Result<List<ResiTopicInfoResultDTO>> getLatestTopics(TokenDto tokenDto, String groupId) { |
|
|
|
if (null == tokenDto) { |
|
|
|
return new Result().error(ModuleConstant.USER_NOT_NULL); |
|
|
|
} |
|
|
@ -314,6 +314,10 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result cancelHiddenTopics(TokenDto tokenDto, List<String> topicIds) { |
|
|
|
|
|
|
|
if(null == topicIds || topicIds.size() <= 0){ |
|
|
|
return new Result().error(ModuleConstant.TOPIC_ID_LIST_NOT_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
//1.1拿到组Id
|
|
|
|
ResiTopicEntity topic = baseDao.selectById(topicIds.get(0)); |
|
|
|
|
|
|
@ -393,10 +397,14 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
//1.获取话题基本信息
|
|
|
|
ResiTopicEntity topicDetail = baseDao.selectById(topicId); |
|
|
|
if(null == topicDetail || !StringUtils.equals(topicDetail.getId(),topicId)){ |
|
|
|
return new Result().error(); |
|
|
|
return new Result().error(ModuleConstant.NO_SUCH_TOPIC); |
|
|
|
} |
|
|
|
ResiTopicDetailResultDTO resultDTO = new ResiTopicDetailResultDTO(); |
|
|
|
resultDTO.setTopicId(topicId); |
|
|
|
resultDTO.setReleaseTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(topicDetail.getCreatedTime())); |
|
|
|
resultDTO.setTopicContent(topicDetail.getTopicContent()); |
|
|
|
resultDTO.setReleaseAddress(topicDetail.getAddress()); |
|
|
|
resultDTO.setTopicStatus(topicDetail.getStatus()); |
|
|
|
//2.查询话题附件
|
|
|
|
QueryWrapper<ResiTopicAttachmentEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(TopicConstant.TOPIC_ID,topicId); |
|
|
@ -409,8 +417,6 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
} |
|
|
|
|
|
|
|
resultDTO.setTopicImgs(attachmentUrls); |
|
|
|
resultDTO.setReleaseTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(topicDetail.getCreatedTime())); |
|
|
|
resultDTO.setTopicContent(topicDetail.getTopicContent()); |
|
|
|
|
|
|
|
//3.拿取用户信息
|
|
|
|
ResiTopicDTO topic = get(topicId); |
|
|
@ -467,16 +473,16 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
if(null != resiGroupMemberDTO){ |
|
|
|
if(MemberStateConstant.SILENT.equals(resiGroupMemberDTO.getStatus())){ |
|
|
|
//当前用户被禁言
|
|
|
|
return new Result().error(); |
|
|
|
return new Result().error(ModuleConstant.SLIENT_MEMBER); |
|
|
|
}else if(MemberStateConstant.REMOVED.equals(resiGroupMemberDTO.getStatus())){ |
|
|
|
//当前用户已被移出群
|
|
|
|
return new Result().error(); |
|
|
|
return new Result().error(ModuleConstant.REMOVED_MEMBER); |
|
|
|
}else{ |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
//当前用户非组内成员
|
|
|
|
return new Result().error(); |
|
|
|
return new Result().error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -494,15 +500,18 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
//1.2判断是否是组长
|
|
|
|
if(!StringUtils.equals(leaderVerify.getCustomerUserId(),userId)){ |
|
|
|
//非组长,无权限进行操作
|
|
|
|
return new Result().error(); |
|
|
|
return new Result().error(ModuleConstant.NO_TEAMLEADER_AUTH); |
|
|
|
}else{ |
|
|
|
//是组长
|
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new Result().error(); |
|
|
|
//未找到当前用户的成员信息
|
|
|
|
return new Result().error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return new Result().error(); |
|
|
|
//未能识别该话题基本信息
|
|
|
|
return new Result().error(ModuleConstant.NO_SUCH_TOPIC); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|