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
4508a8b2
authored
Nov 29, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:工作台新增rtc返回
parent
1dfd429a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
32 deletions
server-common/src/main/java/com/makeit/shengwang/agora/service/ShengwangService.java
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmRecordServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/workstation/impl/WorkStationServiceImpl.java
server-service/src/main/java/com/makeit/vo/platform/elder/realtime/PlatElderRealTimeHeartRespiratoryVO.java
server-service/src/main/java/com/makeit/vo/platform/workstation/WorkStationHomeBedVO.java
server-service/src/main/java/com/makeit/vo/platform/workstation/WorkStationInstitutionBedVO.java
server-common/src/main/java/com/makeit/shengwang/agora/service/ShengwangService.java
View file @
4508a8b2
...
@@ -3,6 +3,7 @@ package com.makeit.shengwang.agora.service;
...
@@ -3,6 +3,7 @@ package com.makeit.shengwang.agora.service;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.makeit.config.ShengwangProperties
;
import
com.makeit.config.ShengwangProperties
;
import
com.makeit.shengwang.agora.dto.PlatCallingDeviceDTO
;
import
com.makeit.shengwang.agora.dto.PlatCallingDeviceDTO
;
import
com.makeit.shengwang.agora.media.RtcTokenBuilder2
;
import
com.makeit.shengwang.agora.rtm.RtmTokenBuilder2
;
import
com.makeit.shengwang.agora.rtm.RtmTokenBuilder2
;
import
com.makeit.shengwang.agora.vo.PlatAlarmCallDeviceVO
;
import
com.makeit.shengwang.agora.vo.PlatAlarmCallDeviceVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -43,4 +44,19 @@ public class ShengwangService {
...
@@ -43,4 +44,19 @@ public class ShengwangService {
shengwangProperties
.
getTokenExpirationInSeconds
(),
TimeUnit
.
SECONDS
);
shengwangProperties
.
getTokenExpirationInSeconds
(),
TimeUnit
.
SECONDS
);
return
platAlarmCallDeviceVO
;
return
platAlarmCallDeviceVO
;
}
}
public
PlatAlarmCallDeviceVO
callingDeviceAuthIgnoreRtc
(
String
deviceId
)
{
PlatAlarmCallDeviceVO
platAlarmCallDeviceVO
=
new
PlatAlarmCallDeviceVO
();
platAlarmCallDeviceVO
.
setDeviceId
(
deviceId
);
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
;
}
}
}
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmRecordServiceImpl.java
View file @
4508a8b2
...
@@ -586,7 +586,6 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
...
@@ -586,7 +586,6 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
@Override
@Override
public
PlatAlarmCallDeviceVO
callingDevice
(
PlatCallingDeviceDTO
dto
)
{
public
PlatAlarmCallDeviceVO
callingDevice
(
PlatCallingDeviceDTO
dto
)
{
PlatAlarmCallDeviceVO
platAlarmCallDeviceVO
=
new
PlatAlarmCallDeviceVO
();
PlatAlarmRecord
platAlarmRecord
=
getById
(
dto
.
getId
());
PlatAlarmRecord
platAlarmRecord
=
getById
(
dto
.
getId
());
if
(
platAlarmRecord
==
null
)
{
if
(
platAlarmRecord
==
null
)
{
throw
new
RuntimeException
(
"告警记录为空:"
+
dto
.
getId
());
throw
new
RuntimeException
(
"告警记录为空:"
+
dto
.
getId
());
...
@@ -596,17 +595,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
...
@@ -596,17 +595,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
if
(
platDevice
==
null
)
{
if
(
platDevice
==
null
)
{
throw
new
RuntimeException
(
"找不到告警关联的设备,设备已解绑"
+
deviceId
);
throw
new
RuntimeException
(
"找不到告警关联的设备,设备已解绑"
+
deviceId
);
}
}
platAlarmCallDeviceVO
.
setDeviceId
(
platDevice
.
getOriDeviceId
());
return
shengwangService
.
callingDeviceAuthIgnoreRtc
(
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
@Override
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
View file @
4508a8b2
...
@@ -375,7 +375,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -375,7 +375,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
if
(
platDevice
==
null
)
{
if
(
platDevice
==
null
)
{
return
vo
;
return
vo
;
}
}
vo
.
setDeviceId
(
platDevice
.
getOriDeviceId
());
String
result
=
redisTemplate
.
opsForValue
().
get
(
DEVICE_BR_DATA
+
platDevice
.
getOriDeviceId
());
String
result
=
redisTemplate
.
opsForValue
().
get
(
DEVICE_BR_DATA
+
platDevice
.
getOriDeviceId
());
log
.
info
(
"实时获取设备呼吸数据:{}"
,
result
);
log
.
info
(
"实时获取设备呼吸数据:{}"
,
result
);
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
...
...
server-service/src/main/java/com/makeit/service/platform/workstation/impl/WorkStationServiceImpl.java
View file @
4508a8b2
...
@@ -38,6 +38,8 @@ import com.makeit.service.platform.space.PlatSpaceService;
...
@@ -38,6 +38,8 @@ import com.makeit.service.platform.space.PlatSpaceService;
import
com.makeit.service.platform.workstation.WorkStationService
;
import
com.makeit.service.platform.workstation.WorkStationService
;
import
com.makeit.service.saas.SaasModelManageService
;
import
com.makeit.service.saas.SaasModelManageService
;
import
com.makeit.service.saas.SaasSleepAnalysisModelService
;
import
com.makeit.service.saas.SaasSleepAnalysisModelService
;
import
com.makeit.shengwang.agora.service.ShengwangService
;
import
com.makeit.shengwang.agora.vo.PlatAlarmCallDeviceVO
;
import
com.makeit.utils.StandardDeviationUtil
;
import
com.makeit.utils.StandardDeviationUtil
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.StreamUtil
;
import
com.makeit.utils.data.convert.StreamUtil
;
...
@@ -88,6 +90,8 @@ public class WorkStationServiceImpl implements WorkStationService {
...
@@ -88,6 +90,8 @@ public class WorkStationServiceImpl implements WorkStationService {
private
PlatElderDayReportDayService
platElderDayReportDayService
;
private
PlatElderDayReportDayService
platElderDayReportDayService
;
@Autowired
@Autowired
private
IotProductDeviceService
iotProductDeviceService
;
private
IotProductDeviceService
iotProductDeviceService
;
@Autowired
private
ShengwangService
shengwangService
;
@Override
@Override
public
WorkStationInstitutionStatisticsVO
institutionStatistics
(
WorkStationQueryDTO
dto
)
{
public
WorkStationInstitutionStatisticsVO
institutionStatistics
(
WorkStationQueryDTO
dto
)
{
...
@@ -266,28 +270,14 @@ public class WorkStationServiceImpl implements WorkStationService {
...
@@ -266,28 +270,14 @@ public class WorkStationServiceImpl implements WorkStationService {
if
(
elderAlarmTypeMap
.
containsKey
(
r
.
getElderId
())){
if
(
elderAlarmTypeMap
.
containsKey
(
r
.
getElderId
())){
r
.
setAlarmTypeMap
(
elderAlarmTypeMap
.
get
(
r
.
getElderId
()));
r
.
setAlarmTypeMap
(
elderAlarmTypeMap
.
get
(
r
.
getElderId
()));
}
}
PlatElderIdDTO
platElderIdDTO
=
new
PlatElderIdDTO
();
PlatElderIdDTO
platElderIdDTO
=
new
PlatElderIdDTO
();
platElderIdDTO
.
setElderId
(
r
.
getElderId
());
platElderIdDTO
.
setElderId
(
r
.
getElderId
());
PlatElderRealTimeHeartRespiratoryVO
heartRespiratoryVO
=
platElderRealTimeService
.
heartRespiratory
(
platElderIdDTO
);
PlatElderRealTimeHeartRespiratoryVO
heartRespiratoryVO
=
platElderRealTimeService
.
heartRespiratory
(
platElderIdDTO
);
r
.
setElderStatus
(
heartRespiratoryVO
.
getStatus
());
r
.
setElderStatus
(
heartRespiratoryVO
.
getStatus
());
/* PlatElderRealTimeNowVO nowStatus = platElderRealTimeService.nowStatus(platElderIdDTO);
if
(
StringUtil
.
isNotEmpty
(
heartRespiratoryVO
.
getDeviceId
()))
{
if(nowStatus.getStatus()!=null){
PlatAlarmCallDeviceVO
platAlarmCallDeviceVO
=
shengwangService
.
callingDeviceAuthIgnoreRtc
(
heartRespiratoryVO
.
getDeviceId
());
DeviceInfoContentBreathe deviceInfoContentBreathe = getNowDataBreathe(platElderIdDTO.getElderId(), platElderIdDTO.getDeviceId());
r
.
setPlatAlarmCallDeviceVO
(
platAlarmCallDeviceVO
);
//离床:雷达状态上报无人
}
//翻身:雷达上报的数据符合IOT平台睡眠质量分析模型中配置的翻身规则
//睡眠:雷达上报的数据符合IOT平台睡眠质量分析模型中的入睡时间,状态变更为睡眠
//静息:雷达上报有人,且非睡眠
if(DeviceInfoContentBreatheEnum.PersonStateEnum.NOBODY.getValue().equals(nowStatus.getStatus())){
r.setElderStatus(WorkStationStatusEnum.NowStatus.OUT.getValue());
}else if(nowStatus.getBodyMove()!=null && nowStatus.getBodyMove() > turnedThreshold){
r.setElderStatus(WorkStationStatusEnum.NowStatus.TURNED.getValue());
}else {
List<PlatElderCoordinateVO> coordinateList = platElderDayReportDayService.coordinateList(platElderIdDTO.getElderId(), platElderIdDTO.getDeviceId(), start, now);
nowStatusRest(r, platElderIdDTO, deviceInfoContentBreathe, coordinateList);
nowStatusSleep(r, platElderIdDTO, deviceInfoContentBreathe);
}
}*/
}
}
}
}
...
@@ -564,6 +554,10 @@ public class WorkStationServiceImpl implements WorkStationService {
...
@@ -564,6 +554,10 @@ public class WorkStationServiceImpl implements WorkStationService {
PlatElderIdDTO
platElderIdDTO
=
new
PlatElderIdDTO
();
PlatElderIdDTO
platElderIdDTO
=
new
PlatElderIdDTO
();
platElderIdDTO
.
setElderId
(
vo
.
getElderId
());
platElderIdDTO
.
setElderId
(
vo
.
getElderId
());
PlatElderRealTimeHeartRespiratoryVO
respiratoryVO
=
platElderRealTimeService
.
heartRespiratory
(
platElderIdDTO
);
PlatElderRealTimeHeartRespiratoryVO
respiratoryVO
=
platElderRealTimeService
.
heartRespiratory
(
platElderIdDTO
);
if
(
StringUtil
.
isNotEmpty
(
respiratoryVO
.
getDeviceId
()))
{
PlatAlarmCallDeviceVO
platAlarmCallDeviceVO
=
shengwangService
.
callingDeviceAuthIgnoreRtc
(
respiratoryVO
.
getDeviceId
());
vo
.
setPlatAlarmCallDeviceVO
(
platAlarmCallDeviceVO
);
}
vo
.
setElderStatus
(
respiratoryVO
.
getStatus
());
vo
.
setElderStatus
(
respiratoryVO
.
getStatus
());
vo
.
setHeartRate
(
respiratoryVO
.
getHeartRate
());
vo
.
setHeartRate
(
respiratoryVO
.
getHeartRate
());
vo
.
setRespiratoryRate
(
respiratoryVO
.
getRespiratoryRate
());
vo
.
setRespiratoryRate
(
respiratoryVO
.
getRespiratoryRate
());
...
...
server-service/src/main/java/com/makeit/vo/platform/elder/realtime/PlatElderRealTimeHeartRespiratoryVO.java
View file @
4508a8b2
...
@@ -23,5 +23,7 @@ public class PlatElderRealTimeHeartRespiratoryVO {
...
@@ -23,5 +23,7 @@ public class PlatElderRealTimeHeartRespiratoryVO {
@ApiModelProperty
(
"状态"
)
@ApiModelProperty
(
"状态"
)
private
String
status
;
private
String
status
;
@ApiModelProperty
(
"设备id"
)
private
String
deviceId
;
}
}
server-service/src/main/java/com/makeit/vo/platform/workstation/WorkStationHomeBedVO.java
View file @
4508a8b2
package
com
.
makeit
.
vo
.
platform
.
workstation
;
package
com
.
makeit
.
vo
.
platform
.
workstation
;
import
com.makeit.shengwang.agora.vo.PlatAlarmCallDeviceVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -64,6 +65,8 @@ public class WorkStationHomeBedVO {
...
@@ -64,6 +65,8 @@ public class WorkStationHomeBedVO {
@ApiModelProperty
(
"呼吸率"
)
@ApiModelProperty
(
"呼吸率"
)
private
Integer
respiratoryRate
;
private
Integer
respiratoryRate
;
@ApiModelProperty
(
"设备呼叫信息"
)
private
PlatAlarmCallDeviceVO
platAlarmCallDeviceVO
;
@ApiModelProperty
(
value
=
"告警类型"
)
@ApiModelProperty
(
value
=
"告警类型"
)
private
Map
<
String
,
String
>
alarmTypeMap
;
private
Map
<
String
,
String
>
alarmTypeMap
;
...
...
server-service/src/main/java/com/makeit/vo/platform/workstation/WorkStationInstitutionBedVO.java
View file @
4508a8b2
package
com
.
makeit
.
vo
.
platform
.
workstation
;
package
com
.
makeit
.
vo
.
platform
.
workstation
;
import
com.makeit.shengwang.agora.vo.PlatAlarmCallDeviceVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -43,7 +44,8 @@ public class WorkStationInstitutionBedVO {
...
@@ -43,7 +44,8 @@ public class WorkStationInstitutionBedVO {
@ApiModelProperty
(
value
=
"长者状态"
)
@ApiModelProperty
(
value
=
"长者状态"
)
private
String
elderStatus
;
private
String
elderStatus
;
@ApiModelProperty
(
"设备呼叫信息"
)
private
PlatAlarmCallDeviceVO
platAlarmCallDeviceVO
;
@ApiModelProperty
(
value
=
"告警类型"
)
@ApiModelProperty
(
value
=
"告警类型"
)
private
Map
<
String
,
String
>
alarmTypeMap
;
private
Map
<
String
,
String
>
alarmTypeMap
;
}
}
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