Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
ee40a6e2
Commit
ee40a6e2
authored
Feb 07, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
入参加对象包装
parent
5137c283
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
14 deletions
+81
-14
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
+11
-10
core/src/main/java/com/wecloud/im/friend/param/ImCreateRecommendParam.java
+22
-0
core/src/main/java/com/wecloud/im/friend/param/ImDeleteFriendParam.java
+21
-0
core/src/main/java/com/wecloud/im/friend/param/ImDeleteRecommendParam.java
+22
-0
core/src/main/java/com/wecloud/im/service/impl/ImApplicationServiceImpl.java
+1
-1
core/src/main/java/com/wecloud/im/service/impl/ImClientLoginServiceImpl.java
+3
-3
core/src/main/java/com/wecloud/im/ws/cache/UserStateCacheManager.java
+1
-0
No files found.
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
View file @
ee40a6e2
...
@@ -2,6 +2,9 @@ package com.wecloud.im.friend.controller;
...
@@ -2,6 +2,9 @@ package com.wecloud.im.friend.controller;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.enums.FriendStateEnum
;
import
com.wecloud.im.enums.FriendStateEnum
;
import
com.wecloud.im.friend.param.ImCreateRecommendParam
;
import
com.wecloud.im.friend.param.ImDeleteFriendParam
;
import
com.wecloud.im.friend.param.ImDeleteRecommendParam
;
import
com.wecloud.im.friend.param.ImFriendApplyDto
;
import
com.wecloud.im.friend.param.ImFriendApplyDto
;
import
com.wecloud.im.friend.param.ImFriendApplyParam
;
import
com.wecloud.im.friend.param.ImFriendApplyParam
;
import
com.wecloud.im.friend.param.ImFriendApproveParam
;
import
com.wecloud.im.friend.param.ImFriendApproveParam
;
...
@@ -20,7 +23,6 @@ import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
...
@@ -20,7 +23,6 @@ import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -30,7 +32,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -30,7 +32,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* @author lixiaozhong
* @author lixiaozhong
...
@@ -135,13 +136,13 @@ public class ImFriendController extends BaseController {
...
@@ -135,13 +136,13 @@ public class ImFriendController extends BaseController {
*/
*/
@PostMapping
(
"/batchDelete"
)
@PostMapping
(
"/batchDelete"
)
@ApiOperation
(
value
=
"删除好友"
)
@ApiOperation
(
value
=
"删除好友"
)
public
ApiResult
<
Boolean
>
batchDeleteFriend
(
@RequestBody
List
<
String
>
friendClientIds
)
{
public
ApiResult
<
Boolean
>
batchDeleteFriend
(
@RequestBody
ImDeleteFriendParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCurentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
imFriendService
.
batchDeleteFriend
(
currentClient
,
friendClientIds
);
imFriendService
.
batchDeleteFriend
(
currentClient
,
param
.
getFriendClientIds
()
);
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
...
@@ -167,20 +168,20 @@ public class ImFriendController extends BaseController {
...
@@ -167,20 +168,20 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/recommend/batchCreate"
)
@PostMapping
(
"/recommend/batchCreate"
)
@OperationLog
(
name
=
"批量创建好友推荐"
,
type
=
OperationLogType
.
PAGE
)
@OperationLog
(
name
=
"批量创建好友推荐"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"批量创建好友推荐"
)
@ApiOperation
(
value
=
"批量创建好友推荐"
)
public
ApiResult
<
Boolean
>
batchCreateRecommend
(
@RequestBody
List
<
ImFriendRecommendDto
>
recommendFriends
)
{
public
ApiResult
<
Boolean
>
batchCreateRecommend
(
@RequestBody
ImCreateRecommendParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCurentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
if
(
CollectionUtils
.
isEmpty
(
recommendFriends
))
{
if
(
CollectionUtils
.
isEmpty
(
param
.
getRecommendFriends
()
))
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
for
(
ImFriendRecommendDto
p
:
recommendFriends
)
{
for
(
ImFriendRecommendDto
p
:
param
.
getRecommendFriends
()
)
{
if
(
BaseEnum
.
valueOf
(
FriendStateEnum
.
class
,
p
.
getSource
())
==
null
)
{
if
(
BaseEnum
.
valueOf
(
FriendStateEnum
.
class
,
p
.
getSource
())
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
}
}
imFriendService
.
batchCreateRecommend
(
currentClient
,
recommendFriends
);
imFriendService
.
batchCreateRecommend
(
currentClient
,
param
.
getRecommendFriends
()
);
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
...
@@ -205,12 +206,12 @@ public class ImFriendController extends BaseController {
...
@@ -205,12 +206,12 @@ public class ImFriendController extends BaseController {
*/
*/
@PostMapping
(
"/recommend/batchDelete"
)
@PostMapping
(
"/recommend/batchDelete"
)
@ApiOperation
(
value
=
"删除好友推荐"
)
@ApiOperation
(
value
=
"删除好友推荐"
)
public
ApiResult
<
Boolean
>
batchDeleteRecommend
(
@RequestBody
List
<
String
>
friendClientIds
)
{
public
ApiResult
<
Boolean
>
batchDeleteRecommend
(
@RequestBody
ImDeleteRecommendParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCurentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
imFriendService
.
batchDeleteRecommend
(
currentClient
,
friendClientIds
);
imFriendService
.
batchDeleteRecommend
(
currentClient
,
param
.
getFriendClientIds
()
);
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
}
}
...
...
core/src/main/java/com/wecloud/im/friend/param/ImCreateRecommendParam.java
0 → 100644
View file @
ee40a6e2
package
com
.
wecloud
.
im
.
friend
.
param
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Author wenzhida
* @Date 2022/2/7 16:30
* @Description 批量创建好友推荐入参
*/
@Data
public
class
ImCreateRecommendParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
5228604783548712598L
;
@ApiModelProperty
(
"推荐好友列表"
)
private
List
<
ImFriendRecommendDto
>
recommendFriends
;
}
core/src/main/java/com/wecloud/im/friend/param/ImDeleteFriendParam.java
0 → 100644
View file @
ee40a6e2
package
com
.
wecloud
.
im
.
friend
.
param
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Author wenzhida
* @Date 2022/2/7 16:30
* @Description 删除好友入参
*/
@Data
public
class
ImDeleteFriendParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
5228604783548712598L
;
@ApiModelProperty
(
"好友的client-id"
)
private
List
<
String
>
friendClientIds
;
}
core/src/main/java/com/wecloud/im/friend/param/ImDeleteRecommendParam.java
0 → 100644
View file @
ee40a6e2
package
com
.
wecloud
.
im
.
friend
.
param
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Author wenzhida
* @Date 2022/2/7 16:30
* @Description 批量删除好友推荐入参
*/
@Data
public
class
ImDeleteRecommendParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2325444195601100874L
;
@ApiModelProperty
(
"推荐好友列表"
)
private
List
<
String
>
friendClientIds
;
}
core/src/main/java/com/wecloud/im/service/impl/ImApplicationServiceImpl.java
View file @
ee40a6e2
...
@@ -35,7 +35,7 @@ public class ImApplicationServiceImpl extends BaseServiceImpl<ImApplicationMappe
...
@@ -35,7 +35,7 @@ public class ImApplicationServiceImpl extends BaseServiceImpl<ImApplicationMappe
private
ImApplicationMapper
imApplicationMapper
;
private
ImApplicationMapper
imApplicationMapper
;
@Override
@Override
@Cacheable
(
key
=
"'id_'+#p0"
)
//
@Cacheable(key = "'id_'+#p0")
public
ImApplication
getCacheById
(
Long
id
)
{
public
ImApplication
getCacheById
(
Long
id
)
{
return
super
.
getById
(
id
);
return
super
.
getById
(
id
);
}
}
...
...
core/src/main/java/com/wecloud/im/service/impl/ImClientLoginServiceImpl.java
View file @
ee40a6e2
...
@@ -64,12 +64,12 @@ public class ImClientLoginServiceImpl implements ImClientLoginService {
...
@@ -64,12 +64,12 @@ public class ImClientLoginServiceImpl implements ImClientLoginService {
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
imTokenVerify
.
getAppKey
());
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
imTokenVerify
.
getAppKey
());
if
(
imApplication
==
null
)
{
if
(
imApplication
==
null
)
{
log
.
info
(
"imApplication == null,getAppKey:"
+
imTokenVerify
.
getAppKey
());
log
.
error
(
"imApplication == null,getAppKey:"
+
imTokenVerify
.
getAppKey
());
return
ApiResult
.
result
(
ApiCode
.
FAIL
,
null
);
return
ApiResult
.
result
(
ApiCode
.
FAIL
,
null
);
}
}
if
(
imTokenVerify
.
getPlatform
()
==
null
)
{
if
(
imTokenVerify
.
getPlatform
()
==
null
)
{
log
.
info
(
"platform is null , clientId is: {}"
,
imTokenVerify
.
getClientId
());
log
.
error
(
"platform is null , clientId is: {}"
,
imTokenVerify
.
getClientId
());
return
ApiResult
.
result
(
ApiCode
.
FAIL
,
null
);
return
ApiResult
.
result
(
ApiCode
.
FAIL
,
null
);
}
}
...
@@ -79,7 +79,7 @@ public class ImClientLoginServiceImpl implements ImClientLoginService {
...
@@ -79,7 +79,7 @@ public class ImClientLoginServiceImpl implements ImClientLoginService {
// 验证签名
// 验证签名
if
(!
mySign
.
equals
(
imTokenVerify
.
getSign
()))
{
if
(!
mySign
.
equals
(
imTokenVerify
.
getSign
()))
{
log
.
info
(
"sign不一致"
+
mySign
);
log
.
error
(
"sign不一致,mySign:{},verify sign:{}"
,
mySign
,
imTokenVerify
.
getSign
()
);
return
ApiResult
.
result
(
ApiCode
.
FAIL
,
null
);
return
ApiResult
.
result
(
ApiCode
.
FAIL
,
null
);
}
}
...
...
core/src/main/java/com/wecloud/im/ws/cache/UserStateCacheManager.java
View file @
ee40a6e2
...
@@ -68,6 +68,7 @@ public class UserStateCacheManager extends UserStateListener {
...
@@ -68,6 +68,7 @@ public class UserStateCacheManager extends UserStateListener {
ClientChannelInfo
clientChannelInfo
=
new
ClientChannelInfo
();
ClientChannelInfo
clientChannelInfo
=
new
ClientChannelInfo
();
clientChannelInfo
.
setPlatform
(
Integer
.
valueOf
(
split
[
0
]));
clientChannelInfo
.
setPlatform
(
Integer
.
valueOf
(
split
[
0
]));
clientChannelInfo
.
setLanIp
(
split
[
1
]);
clientChannelInfo
.
setLanIp
(
split
[
1
]);
clientChannelInfo
.
setClientId
(
String
.
valueOf
(
clientId
));
clientChannelInfos
.
add
(
clientChannelInfo
);
clientChannelInfos
.
add
(
clientChannelInfo
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment