|
@@ -1,10 +1,24 @@
|
|
|
package com.ym.mec.web.controller;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+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.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+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.common.controller.BaseController;
|
|
|
|
|
|
@RequestMapping("imGroup")
|
|
@@ -12,4 +26,94 @@ import com.ym.mec.common.controller.BaseController;
|
|
|
@RestController
|
|
|
public class ImGroupController extends BaseController {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ImGroupService imGroupService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ImUserFriendService imUserFriendService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ImGroupNoticeService imGroupNoticeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+
|
|
|
+ @ApiOperation("查询群列表")
|
|
|
+ @GetMapping(value = "/queryGroupList")
|
|
|
+ public Object queryGroupList(String search) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (Objects.isNull(sysUser)) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+
|
|
|
+ return succeed(imGroupService.queryByUserId(sysUser.getId(), search));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询群详情")
|
|
|
+ @GetMapping(value = "/queryGroupDetail")
|
|
|
+ public Object queryGroupList(Long imGroupId) {
|
|
|
+
|
|
|
+ return succeed(imGroupService.get(imGroupId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询群成员列表")
|
|
|
+ @GetMapping(value = "/queryGroupMemberList")
|
|
|
+ public Object queryGroupMemberList(Long imGroupId) {
|
|
|
+
|
|
|
+ return succeed(imGroupService.queryMemberById(imGroupId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询群学生列表")
|
|
|
+ @GetMapping(value = "/queryGroupStudentList")
|
|
|
+ public Object queryGroupStudentList(Long imGroupId) {
|
|
|
+
|
|
|
+ return succeed(imGroupService.queryMemberById(imGroupId).stream().filter(e -> StringUtils.isBlank(e.getRoleType())).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询群成员详情")
|
|
|
+ @GetMapping(value = "/queryGroupMemberDetail")
|
|
|
+ public Object queryGroupMemberDetail(Long imGroupId, Integer userId) {
|
|
|
+
|
|
|
+ return succeed(imGroupService.queryMember(imGroupId, userId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询好友详情")
|
|
|
+ @GetMapping(value = "/queryFriendDetail")
|
|
|
+ public Object queryFriendDetail(Integer userId) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (Objects.isNull(sysUser)) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+
|
|
|
+ return succeed(imUserFriendService.queryFriendDetail(sysUser.getId(), userId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @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));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询好友中的学生列表")
|
|
|
+ @GetMapping(value = "/queryFriendStudentList")
|
|
|
+ public Object queryFriendStudentList(String search) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (Objects.isNull(sysUser)) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+
|
|
|
+ return succeed(imUserFriendService.queryFriendListByUserId(sysUser.getId(), search).stream().filter(e -> StringUtils.isBlank(e.getTags()))
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("查询群公告列表")
|
|
|
+ @GetMapping(value = "/queryNoticeList")
|
|
|
+ public Object queryNoticeList(ImGroupNoticeQueryInfo queryInfo) {
|
|
|
+ return succeed(imGroupNoticeService.queryPage(queryInfo));
|
|
|
+ }
|
|
|
}
|