|
@@ -1,14 +1,10 @@
|
|
package com.yonge.cooleshow.student.controller;
|
|
package com.yonge.cooleshow.student.controller;
|
|
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
|
-import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
|
import com.yonge.cooleshow.biz.dal.dto.ImGroupResultDto;
|
|
import com.yonge.cooleshow.biz.dal.dto.ImGroupResultDto;
|
|
import com.yonge.cooleshow.biz.dal.dto.ImGroupSearchDto;
|
|
import com.yonge.cooleshow.biz.dal.dto.ImGroupSearchDto;
|
|
import com.yonge.cooleshow.biz.dal.entity.ImGroup;
|
|
import com.yonge.cooleshow.biz.dal.entity.ImGroup;
|
|
import com.yonge.cooleshow.biz.dal.entity.ImGroupMember;
|
|
import com.yonge.cooleshow.biz.dal.entity.ImGroupMember;
|
|
-import com.yonge.cooleshow.biz.dal.entity.ImUserFriend;
|
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
import com.yonge.cooleshow.biz.dal.enums.ImGroupMemberRoleType;
|
|
import com.yonge.cooleshow.biz.dal.enums.ImGroupMemberRoleType;
|
|
import com.yonge.cooleshow.biz.dal.enums.MK;
|
|
import com.yonge.cooleshow.biz.dal.enums.MK;
|
|
@@ -27,15 +23,8 @@ import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
-
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
@@ -53,13 +42,10 @@ public class ImGroupController extends BaseController {
|
|
/**
|
|
/**
|
|
* 服务对象
|
|
* 服务对象
|
|
*/
|
|
*/
|
|
- @Resource
|
|
|
|
|
|
+ @Autowired
|
|
private ImGroupService imGroupService;
|
|
private ImGroupService imGroupService;
|
|
- @Resource
|
|
|
|
- private SysUserService sysUserService;
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
|
-
|
|
|
|
|
|
+ private SysUserService sysUserService;
|
|
@Autowired
|
|
@Autowired
|
|
private ImUserFriendService imUserFriendService;
|
|
private ImUserFriendService imUserFriendService;
|
|
|
|
|
|
@@ -69,26 +55,22 @@ public class ImGroupController extends BaseController {
|
|
@ApiOperation("获取群详情")
|
|
@ApiOperation("获取群详情")
|
|
@PostMapping(value = "/getDetail/{groupId}")
|
|
@PostMapping(value = "/getDetail/{groupId}")
|
|
public HttpResponseResult<ImGroup> getDetail(@ApiParam(value = "群编号", required = true) @PathVariable("groupId") String groupId) throws Exception {
|
|
public HttpResponseResult<ImGroup> getDetail(@ApiParam(value = "群编号", required = true) @PathVariable("groupId") String groupId) throws Exception {
|
|
-
|
|
|
|
- // 获取用户ID
|
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
|
- return failed("用户信息获取失败");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ImGroup group = imGroupService.findGroupInfoById(groupId, sysUser.getId());
|
|
|
|
|
|
+ Long userId = sysUserService.getUserId();
|
|
|
|
+ ImGroup group = imGroupService.findGroupInfoById(groupId, userId);
|
|
// ImGroup group = imGroupService.getById(groupId);
|
|
// ImGroup group = imGroupService.getById(groupId);
|
|
if (group == null) {
|
|
if (group == null) {
|
|
return failed(HttpStatus.NO_CONTENT, "群组不存在");
|
|
return failed(HttpStatus.NO_CONTENT, "群组不存在");
|
|
}
|
|
}
|
|
ImGroupMember admin = imGroupMemberService.lambdaQuery()
|
|
ImGroupMember admin = imGroupMemberService.lambdaQuery()
|
|
.eq(ImGroupMember::getGroupId, group.getId())
|
|
.eq(ImGroupMember::getGroupId, group.getId())
|
|
- .eq(ImGroupMember::getUserId, sysUserService.getUser().getId())
|
|
|
|
|
|
+ .eq(ImGroupMember::getUserId, userId)
|
|
|
|
+ .eq(ImGroupMember::getRoleType, ImGroupMemberRoleType.STUDENT)
|
|
.last("limit 1").one();
|
|
.last("limit 1").one();
|
|
if (admin == null) {
|
|
if (admin == null) {
|
|
// 该用户不在该群,无权限查看,处理用户退出群后,查看历史消息校验
|
|
// 该用户不在该群,无权限查看,处理用户退出群后,查看历史消息校验
|
|
return failed(HttpStatus.NO_CONTENT, "群组不存在");
|
|
return failed(HttpStatus.NO_CONTENT, "群组不存在");
|
|
}
|
|
}
|
|
|
|
+ group.setAllowPrivateChatFlag(admin.getAllowPrivateChatFlag());
|
|
return succeed(group);
|
|
return succeed(group);
|
|
}
|
|
}
|
|
|
|
|