Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c5e9c399
authored
Nov 23, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat:设备列表呼叫设备
parent
e22e676e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
View file @
c5e9c399
...
@@ -108,6 +108,12 @@ public class PlatDeviceController {
...
@@ -108,6 +108,12 @@ public class PlatDeviceController {
return
ApiResponseUtils
.
success
();
return
ApiResponseUtils
.
success
();
}
}
@ApiOperation
(
"设备呼叫设备"
)
@PostMapping
(
"callingDevice"
)
public
ApiResponseEntity
<
PlatAlarmCallDeviceVO
>
callingDevice
(
@RequestBody
PlatCallingDeviceDTO
dto
)
{
return
ApiResponseUtils
.
success
(
platDeviceService
.
callingDevice
(
dto
));
}
@ApiOperation
(
"设备获取登录RTMtoken"
)
@ApiOperation
(
"设备获取登录RTMtoken"
)
@PostMapping
(
"getDeviceRtmToken"
)
@PostMapping
(
"getDeviceRtmToken"
)
...
...
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
View file @
c5e9c399
...
@@ -86,4 +86,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
...
@@ -86,4 +86,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
void
active
(
BaseIdDTO
dto
);
void
active
(
BaseIdDTO
dto
);
PlatAlarmCallDeviceVO
getDeviceRtmToken
(
PlatCallingDeviceDTO
dto
);
PlatAlarmCallDeviceVO
getDeviceRtmToken
(
PlatCallingDeviceDTO
dto
);
PlatAlarmCallDeviceVO
callingDevice
(
PlatCallingDeviceDTO
dto
);
}
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
c5e9c399
...
@@ -55,6 +55,7 @@ import com.makeit.service.platform.space.PlatSpaceService;
...
@@ -55,6 +55,7 @@ import com.makeit.service.platform.space.PlatSpaceService;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.shengwang.agora.dto.PlatCallingDeviceDTO
;
import
com.makeit.shengwang.agora.dto.PlatCallingDeviceDTO
;
import
com.makeit.shengwang.agora.http.ShengwangHttpUtil
;
import
com.makeit.shengwang.agora.http.ShengwangHttpUtil
;
import
com.makeit.shengwang.agora.media.RtcTokenBuilder2
;
import
com.makeit.shengwang.agora.service.ShengwangService
;
import
com.makeit.shengwang.agora.service.ShengwangService
;
import
com.makeit.shengwang.agora.vo.PlatAlarmCallDeviceVO
;
import
com.makeit.shengwang.agora.vo.PlatAlarmCallDeviceVO
;
import
com.makeit.utils.DeviceCacheUtil
;
import
com.makeit.utils.DeviceCacheUtil
;
...
@@ -79,6 +80,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -79,6 +80,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneOffset
;
import
java.time.ZoneOffset
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
...
@@ -767,6 +769,23 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -767,6 +769,23 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
}
}
@Override
@Override
public
PlatAlarmCallDeviceVO
callingDevice
(
PlatCallingDeviceDTO
dto
)
{
PlatAlarmCallDeviceVO
platAlarmCallDeviceVO
=
new
PlatAlarmCallDeviceVO
();
PlatDevice
platDevice
=
getById
(
dto
.
getId
());
platAlarmCallDeviceVO
.
setDeviceId
(
platDevice
.
getOriDeviceId
());
platAlarmCallDeviceVO
.
setAppId
(
shengwangProperties
.
getAppId
());
LocalDateTime
now
=
LocalDateTime
.
now
();
DateTimeFormatter
dateTimeFormatter
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
String
channelName
=
String
.
format
(
"%s:%s"
,
"RTC"
,
now
.
format
(
dateTimeFormatter
));
RtcTokenBuilder2
token
=
new
RtcTokenBuilder2
();
String
result
=
token
.
buildTokenWithUid
(
shengwangProperties
.
getAppId
(),
shengwangProperties
.
getAppCertificate
(),
channelName
,
0
,
RtcTokenBuilder2
.
Role
.
ROLE_SUBSCRIBER
,
shengwangProperties
.
getTokenExpirationInSeconds
(),
shengwangProperties
.
getPrivilegeExpirationInSeconds
());
platAlarmCallDeviceVO
.
setAccessToken
(
result
);
platAlarmCallDeviceVO
.
setChannelName
(
channelName
);
return
platAlarmCallDeviceVO
;
}
@Override
public
PlatAlarmCallDeviceVO
getDeviceRtmToken
(
PlatCallingDeviceDTO
dto
)
{
public
PlatAlarmCallDeviceVO
getDeviceRtmToken
(
PlatCallingDeviceDTO
dto
)
{
return
shengwangService
.
callingDeviceAuthIgnoreRtm
(
dto
);
return
shengwangService
.
callingDeviceAuthIgnoreRtm
(
dto
);
}
}
...
...
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