|
@@ -1,23 +1,20 @@
|
|
|
package com.ym.mec.student.controller;
|
|
|
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dto.ImUserFriendDto;
|
|
|
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.*;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
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.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import java.util.Objects;
|
|
|
-
|
|
|
@RequestMapping("imGroup")
|
|
|
@Api(tags = "IM群服务")
|
|
|
@RestController
|
|
@@ -33,17 +30,15 @@ public class ImGroupController extends BaseController {
|
|
|
private ImGroupNoticeService imGroupNoticeService;
|
|
|
|
|
|
@Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
+ private ImGroupMemberService imGroupMemberService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
@ApiOperation("查询群列表")
|
|
|
@GetMapping(value = "/queryGroupList")
|
|
|
public Object queryGroupList(String search,String groupType) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (Objects.isNull(sysUser)) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
-
|
|
|
- return succeed(imGroupService.queryByUserId(sysUser.getId(), search,groupType));
|
|
|
+ return succeed(imGroupService.queryByUserId(sysUserService.getUserId(), search,groupType));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("查询群详情")
|
|
@@ -72,15 +67,10 @@ public class ImGroupController extends BaseController {
|
|
|
@ApiOperation("查询好友详情")
|
|
|
@GetMapping(value = "/queryFriendDetail")
|
|
|
public Object queryFriendDetail(Integer userId) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (Objects.isNull(sysUser)) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
-
|
|
|
- ImUserFriendDto dto = imUserFriendService.queryFriendDetail(sysUser.getId(), userId);
|
|
|
+ ImUserFriendDto dto = imUserFriendService.queryFriendDetail(sysUserService.getUserId(), userId);
|
|
|
if (dto == null) {
|
|
|
dto = new ImUserFriendDto();
|
|
|
- SysUser user = sysUserFeignService.queryUserById(userId);
|
|
|
+ SysUser user = sysUserService.queryUserById(userId);
|
|
|
dto.setFriend(user);
|
|
|
if (user.getUserType().contains("STUDENT")) {
|
|
|
dto.setFriendNickname(user.getUsername());
|
|
@@ -95,12 +85,7 @@ public class ImGroupController extends BaseController {
|
|
|
@ApiOperation("查询好友列表")
|
|
|
@GetMapping(value = "/queryFriendList")
|
|
|
public Object queryFriendList(String search) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (Objects.isNull(sysUser)) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
-
|
|
|
- return succeed(imUserFriendService.queryFriendListByUserId(sysUser.getId(), search));
|
|
|
+ return succeed(imUserFriendService.queryFriendListByUserId(sysUserService.getUserId(), search));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("查询群公告列表")
|
|
@@ -108,4 +93,14 @@ public class ImGroupController extends BaseController {
|
|
|
public Object queryNoticeList(ImGroupNoticeQueryInfo queryInfo) {
|
|
|
return succeed(imGroupNoticeService.queryPage(queryInfo));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("入群")
|
|
|
+ @PostMapping(value = "/addGroupMember")
|
|
|
+ @ApiImplicitParams({ @ApiImplicitParam(name = "imGroupId", value = "群编号", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "roleType", value = "指导老师,乐队指导,乐团主管,运营主管,学员不传", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "isAdmin", value = "是否管理员", required = true, dataType = "Boolean"),
|
|
|
+ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer")})
|
|
|
+ public Object addGroupMember(String imGroupId, Integer userId, String roleType, boolean isAdmin) {
|
|
|
+ return succeed(imGroupMemberService.join(imGroupId,userId,roleType,isAdmin));
|
|
|
+ }
|
|
|
}
|