|
@@ -1,13 +1,9 @@
|
|
|
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.entity.ImUserFriend;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.MK;
|
|
|
-import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.service.ImGroupService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysUserService;
|
|
@@ -15,20 +11,13 @@ import com.yonge.cooleshow.biz.dal.vo.im.ImUserFriendVO;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.im.ImUserWrapper;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-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.RestController;
|
|
|
+import com.yonge.toolset.base.exception.BizException;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
@@ -44,32 +33,21 @@ public class ImUserFriendController extends BaseController {
|
|
|
/**
|
|
|
* 服务对象
|
|
|
*/
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ImUserFriendService imUserFriendService;
|
|
|
- @Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
+ private SysUserService sysUserService;
|
|
|
+ @Resource
|
|
|
private ImGroupService imGroupService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private SysUserMapper sysUserMapper;
|
|
|
-
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "search", dataType = "String", value = "根据用户编号、昵称模糊查询")
|
|
|
})
|
|
|
@ApiOperation("获取通讯录成员列表")
|
|
|
@PostMapping(value = "/queryAll")
|
|
|
- public HttpResponseResult<List<ImUserWrapper.ImUserFriend>> queryAll(@RequestBody Map<String,Object> params) throws Exception {
|
|
|
-
|
|
|
- // 用户ID
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (Objects.isNull(sysUser)) {
|
|
|
- return failed("请登录");
|
|
|
- }
|
|
|
-
|
|
|
+ public HttpResponseResult<List<ImUserWrapper.ImUserFriend>> queryAll(@RequestBody ImUserWrapper.ImUserFriendQuery friendQuery) throws Exception {
|
|
|
// 学生好友列表
|
|
|
- List<ImUserWrapper.ImUserFriend> userFriends = imUserFriendService.findUserAllImFriendInfo(ClientEnum.STUDENT, sysUser.getId(), params);
|
|
|
+ List<ImUserWrapper.ImUserFriend> userFriends = imUserFriendService.findUserAllImFriendInfo(ClientEnum.STUDENT, sysUserService.getUserId(), friendQuery);
|
|
|
|
|
|
/*Object search = params.get("search");
|
|
|
List<ImUserFriend> userFriends = imUserFriendService.getBaseMapper().selectList(Wrappers.<ImUserFriend>query().lambda()
|
|
@@ -119,5 +97,22 @@ public class ImUserFriendController extends BaseController {
|
|
|
return succeed(imMessageUser);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("拉黑好友")
|
|
|
+ @PostMapping(value = "/blackFriend")
|
|
|
+ public HttpResponseResult<ImUserFriendVO.ImUserFriend> blackFriend(String imUserId,Boolean blackFlag) {
|
|
|
+ if(StringUtils.isEmpty(imUserId)){
|
|
|
+ throw new BizException("参数校验失败");
|
|
|
+ }
|
|
|
+ Long userId = sysUserService.getUserId();
|
|
|
+ String friendId = imGroupService.analysisImUserId(imUserId);
|
|
|
+ imUserFriendService.lambdaUpdate()
|
|
|
+ .eq(ImUserFriend::getUserId, userId)
|
|
|
+ .eq(ImUserFriend::getFriendId, friendId)
|
|
|
+ .eq(ImUserFriend::getClientType, ClientEnum.STUDENT)
|
|
|
+ .set(ImUserFriend::getBlackFlag, blackFlag)
|
|
|
+ .update();
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
}
|
|
|
|