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
e3a4b34c
Commit
e3a4b34c
authored
May 31, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加或修改推送设备信息(每次请求都会覆盖之前的数据)
parent
adfd5e2f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
2 deletions
+83
-2
common/src/main/java/com/wecloud/im/controller/ImClientController.java
+22
-2
common/src/main/java/com/wecloud/im/entity/ImClient.java
+3
-0
common/src/main/java/com/wecloud/im/param/add/ImClientDeviceInfoAdd.java
+31
-0
common/src/main/java/com/wecloud/im/service/ImClientService.java
+14
-0
common/src/main/java/com/wecloud/im/service/impl/ImClientServiceImpl.java
+13
-0
No files found.
common/src/main/java/com/wecloud/im/controller/ImClientController.java
View file @
e3a4b34c
package
com
.
wecloud
.
im
.
controller
;
package
com
.
wecloud
.
im
.
controller
;
import
com.wecloud.im.param.add.ImClientDeviceInfoAdd
;
import
com.wecloud.im.service.ImClientService
;
import
com.wecloud.im.service.ImClientService
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.core.validator.groups.Add
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.enums.OperationLogType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -17,12 +26,23 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -17,12 +26,23 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
"/imClient"
)
@RequestMapping
(
"/imClient"
)
@Api
(
value
=
"终端
表API"
,
tags
=
{
"终端表
"
})
@Api
(
value
=
"终端
"
,
tags
=
{
"终端
"
})
public
class
ImClientController
extends
BaseController
{
public
class
ImClientController
extends
BaseController
{
@Autowired
@Autowired
private
ImClientService
imClientService
;
private
ImClientService
imClientService
;
//
/**
* 添加或修改推送设备信息
*/
@PostMapping
(
"/addDeviceInfo"
)
@OperationLog
(
name
=
"添加或修改推送设备信息"
,
type
=
OperationLogType
.
ADD
)
@ApiOperation
(
value
=
"添加或修改推送设备信息(每次请求都会覆盖之前的数据)"
)
public
ApiResult
<
Boolean
>
addDeviceInfo
(
@Validated
(
Add
.
class
)
@RequestBody
ImClientDeviceInfoAdd
imClientDevice
)
throws
Exception
{
boolean
flag
=
imClientService
.
addDeviceInfo
(
imClientDevice
);
return
ApiResult
.
result
(
flag
);
}
// /**
// /**
// * 添加终端表
// * 添加终端表
// */
// */
...
...
common/src/main/java/com/wecloud/im/entity/ImClient.java
View file @
e3a4b34c
...
@@ -50,4 +50,7 @@ public class ImClient extends BaseEntity {
...
@@ -50,4 +50,7 @@ public class ImClient extends BaseEntity {
@ApiModelProperty
(
"设备类型1:ios; 2:android"
)
@ApiModelProperty
(
"设备类型1:ios; 2:android"
)
private
Integer
deviceType
;
private
Integer
deviceType
;
@ApiModelProperty
(
"设备推送token"
)
private
String
deviceToken
;
}
}
common/src/main/java/com/wecloud/im/param/add/ImClientDeviceInfoAdd.java
0 → 100644
View file @
e3a4b34c
package
com
.
wecloud
.
im
.
param
.
add
;
import
io.geekidea.springbootplus.framework.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
/**
* 添加或修改推送设备信息
*
* @author wei
* @since 2021-04-27
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"添加或修改推送设备信息"
)
public
class
ImClientDeviceInfoAdd
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"设备不想收到推送提醒, 1想, 0不想"
)
private
Integer
valid
;
@ApiModelProperty
(
"设备类型1:ios; 2:android"
)
private
Integer
deviceType
;
@ApiModelProperty
(
"设备推送token"
)
private
String
deviceToken
;
}
common/src/main/java/com/wecloud/im/service/ImClientService.java
View file @
e3a4b34c
...
@@ -3,6 +3,7 @@ package com.wecloud.im.service;
...
@@ -3,6 +3,7 @@ package com.wecloud.im.service;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.param.ImClientPageParam
;
import
com.wecloud.im.param.ImClientPageParam
;
import
com.wecloud.im.param.ImClientQueryVo
;
import
com.wecloud.im.param.ImClientQueryVo
;
import
com.wecloud.im.param.add.ImClientDeviceInfoAdd
;
import
io.geekidea.springbootplus.framework.common.service.BaseService
;
import
io.geekidea.springbootplus.framework.common.service.BaseService
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
...
@@ -24,6 +25,14 @@ public interface ImClientService extends BaseService<ImClient> {
...
@@ -24,6 +25,14 @@ public interface ImClientService extends BaseService<ImClient> {
boolean
saveImClient
(
ImClient
imClient
)
throws
Exception
;
boolean
saveImClient
(
ImClient
imClient
)
throws
Exception
;
/**
/**
* 添加或修改推送设备信息
*
* @param imClientDevice
* @return
*/
boolean
addDeviceInfo
(
ImClientDeviceInfoAdd
imClientDevice
);
/**
* 修改
* 修改
*
*
* @param imClient
* @param imClient
...
@@ -60,6 +69,11 @@ public interface ImClientService extends BaseService<ImClient> {
...
@@ -60,6 +69,11 @@ public interface ImClientService extends BaseService<ImClient> {
Paging
<
ImClientQueryVo
>
getImClientPageList
(
ImClientPageParam
imClientPageParam
)
throws
Exception
;
Paging
<
ImClientQueryVo
>
getImClientPageList
(
ImClientPageParam
imClientPageParam
)
throws
Exception
;
/**
* 获取当前请求的client
*
* @return
*/
ImClient
getClient
();
ImClient
getClient
();
}
}
common/src/main/java/com/wecloud/im/service/impl/ImClientServiceImpl.java
View file @
e3a4b34c
...
@@ -9,6 +9,7 @@ import com.wecloud.im.entity.ImClient;
...
@@ -9,6 +9,7 @@ import com.wecloud.im.entity.ImClient;
import
com.wecloud.im.mapper.ImClientMapper
;
import
com.wecloud.im.mapper.ImClientMapper
;
import
com.wecloud.im.param.ImClientPageParam
;
import
com.wecloud.im.param.ImClientPageParam
;
import
com.wecloud.im.param.ImClientQueryVo
;
import
com.wecloud.im.param.ImClientQueryVo
;
import
com.wecloud.im.param.add.ImClientDeviceInfoAdd
;
import
com.wecloud.im.service.ImApplicationService
;
import
com.wecloud.im.service.ImApplicationService
;
import
com.wecloud.im.service.ImClientService
;
import
com.wecloud.im.service.ImClientService
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
...
@@ -17,6 +18,7 @@ import io.geekidea.springbootplus.framework.core.pagination.Paging;
...
@@ -17,6 +18,7 @@ import io.geekidea.springbootplus.framework.core.pagination.Paging;
import
io.geekidea.springbootplus.framework.shiro.jwt.JwtToken
;
import
io.geekidea.springbootplus.framework.shiro.jwt.JwtToken
;
import
io.geekidea.springbootplus.framework.shiro.util.JwtUtil
;
import
io.geekidea.springbootplus.framework.shiro.util.JwtUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -42,6 +44,16 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
...
@@ -42,6 +44,16 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
return
super
.
save
(
imClient
);
return
super
.
save
(
imClient
);
}
}
@Override
public
boolean
addDeviceInfo
(
ImClientDeviceInfoAdd
imClientDevice
)
{
ImClient
client
=
getClient
();
ImClient
clientNew
=
new
ImClient
();
BeanUtils
.
copyProperties
(
imClientDevice
,
clientNew
);
clientNew
.
setId
(
client
.
getId
());
return
this
.
saveOrUpdate
(
clientNew
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
boolean
updateImClient
(
ImClient
imClient
)
throws
Exception
{
public
boolean
updateImClient
(
ImClient
imClient
)
throws
Exception
{
...
@@ -69,6 +81,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
...
@@ -69,6 +81,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
@Override
public
ImClient
getClient
()
{
public
ImClient
getClient
()
{
// shiro线程中获取当前token
JwtToken
curentJwtToken
=
JwtUtil
.
getCurentJwtToken
();
JwtToken
curentJwtToken
=
JwtUtil
.
getCurentJwtToken
();
// 根据appKey查询appid
// 根据appKey查询appid
...
...
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