|
@@ -4,12 +4,10 @@ import com.google.common.collect.Lists;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dto.ImUserFriendDto;
|
|
|
import com.ym.mec.biz.dal.entity.ImGroup;
|
|
|
+import com.ym.mec.biz.dal.entity.ImGroupMemberPlus;
|
|
|
import com.ym.mec.biz.dal.enums.im.ClientEnum;
|
|
|
import com.ym.mec.biz.dal.page.ImGroupNoticeQueryInfo;
|
|
|
-import com.ym.mec.biz.service.ImGroupNoticeService;
|
|
|
-import com.ym.mec.biz.service.ImGroupService;
|
|
|
-import com.ym.mec.biz.service.ImUserFriendService;
|
|
|
-import com.ym.mec.biz.service.SysUserService;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.vo.ImUserWrapper;
|
|
@@ -20,6 +18,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -47,6 +46,9 @@ public class ImGroupController extends BaseController {
|
|
|
@Autowired
|
|
|
private SysUserService userLoginService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ImGroupMemberPlusService imGroupMemberPlusService;
|
|
|
+
|
|
|
@ApiOperation("查询群列表")
|
|
|
@GetMapping(value = "/queryGroupList")
|
|
|
public Object queryGroupList(String search,String groupType) {
|
|
@@ -69,7 +71,19 @@ public class ImGroupController extends BaseController {
|
|
|
if (imGroupId.contains("S") || imGroupId.contains("I")){
|
|
|
imGroupId = imGroupId.substring(1);
|
|
|
}
|
|
|
- ImGroup imGroup = imGroupService.get(imGroupId);
|
|
|
+ ImGroup imGroup = imGroupService.get(imGroupId);
|
|
|
+
|
|
|
+ if (imGroup == null) {
|
|
|
+ return failed(HttpStatus.NO_CONTENT, "群组不存在");
|
|
|
+ }
|
|
|
+ ImGroupMemberPlus admin = imGroupMemberPlusService.lambdaQuery()
|
|
|
+ .eq(ImGroupMemberPlus::getImGroupId, imGroup.getId())
|
|
|
+ .eq(ImGroupMemberPlus::getUserId, userLoginService.getUser().getId())
|
|
|
+ .last("limit 1").one();
|
|
|
+ if (admin == null) {
|
|
|
+ // 该用户不在该群,无权限查看,处理用户退出群后,查看历史消息校验
|
|
|
+ return failed(HttpStatus.NO_CONTENT, "群组不存在");
|
|
|
+ }
|
|
|
// 设置默认头像
|
|
|
if (Objects.nonNull(imGroup.getGroupType()) && StringUtils.isBlank(imGroup.getImg())) {
|
|
|
imGroup.setImg(imGroup.getGroupType().getAvatar());
|
|
@@ -86,6 +100,19 @@ public class ImGroupController extends BaseController {
|
|
|
if (imGroupId.contains("S") || imGroupId.contains("I")){
|
|
|
imGroupId = imGroupId.substring(1);
|
|
|
}
|
|
|
+ ImGroup imGroup = imGroupService.get(imGroupId);
|
|
|
+
|
|
|
+ if (imGroup == null) {
|
|
|
+ return failed(HttpStatus.NO_CONTENT, "群组不存在");
|
|
|
+ }
|
|
|
+ ImGroupMemberPlus admin = imGroupMemberPlusService.lambdaQuery()
|
|
|
+ .eq(ImGroupMemberPlus::getImGroupId, imGroup.getId())
|
|
|
+ .eq(ImGroupMemberPlus::getUserId, userLoginService.getUser().getId())
|
|
|
+ .last("limit 1").one();
|
|
|
+ if (admin == null) {
|
|
|
+ // 该用户不在该群,无权限查看,处理用户退出群后,查看历史消息校验
|
|
|
+ return failed(HttpStatus.NO_CONTENT, "群组不存在");
|
|
|
+ }
|
|
|
return succeed(imGroupService.get(imGroupId));
|
|
|
}
|
|
|
|