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
8f174669
authored
Jan 04, 2024
by
罗志长
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat: 跌倒告警上报第三方限制组织
parent
707c3172
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
9 deletions
db/上线后sql/update.sql
server-service/src/main/java/com/makeit/entity/saas/PlatTenant.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/FallAlarm.java
db/上线后sql/update.sql
View file @
8f174669
ALTER
TABLE
`plat_device_other`
ALTER
TABLE
`plat_device_other`
...
@@ -123,4 +123,6 @@ alter table plat_elder_sleep_analysis add column `ori_device_id` varchar(64) de
...
@@ -123,4 +123,6 @@ alter table plat_elder_sleep_analysis add column `ori_device_id` varchar(64) de
alter
table
plat_elder_breathe_analysis
add
column
`ori_device_id`
varchar
(
64
)
default
NULL
COMMENT
'iot设备id'
;
alter
table
plat_elder_breathe_analysis
add
column
`ori_device_id`
varchar
(
64
)
default
NULL
COMMENT
'iot设备id'
;
alter
table
plat_elder_children_info
add
column
weChat_openid
varchar
(
64
)
default
null
comment
'公众号openid'
;
alter
table
plat_elder_children_info
add
column
weChat_openid
varchar
(
64
)
default
null
comment
'公众号openid'
;
\ No newline at end of file
alter
table
plat_tenant
add
column
report_org_ids
varchar
(
255
)
default
null
comment
'主动上报机构ids'
;
\ No newline at end of file
server-service/src/main/java/com/makeit/entity/saas/PlatTenant.java
View file @
8f174669
...
@@ -67,6 +67,11 @@ public class PlatTenant extends BaseEntity {
...
@@ -67,6 +67,11 @@ public class PlatTenant extends BaseEntity {
private
String
secret
;
private
String
secret
;
private
String
openApiUrl
;
private
String
openApiUrl
;
/**
* 租户标识
*/
private
String
reportOrgIds
;
}
}
\ No newline at end of file
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/FallAlarm.java
View file @
8f174669
...
@@ -102,12 +102,14 @@ public class FallAlarm implements IAlarm {
...
@@ -102,12 +102,14 @@ public class FallAlarm implements IAlarm {
// 跌倒了设备需要发送告警到第三方平台
// 跌倒了设备需要发送告警到第三方平台
PlatTenant
platTenant
=
platTenantService
.
getById
(
platDevice
.
getTenantId
());
PlatTenant
platTenant
=
platTenantService
.
getById
(
platDevice
.
getTenantId
());
if
(
platTenant
!=
null
)
{
if
(
platTenant
!=
null
)
{
OpenApiBaseStrategy
strategyFactoryHandler
=
openApiBaseStrategyFactory
.
getHandler
(
platTenant
.
getCode
());
if
(
isSupportAlarm
(
platTenant
,
platDevice
))
{
if
(
strategyFactoryHandler
!=
null
)
{
OpenApiBaseStrategy
strategyFactoryHandler
=
openApiBaseStrategyFactory
.
getHandler
(
platTenant
.
getCode
());
try
{
if
(
strategyFactoryHandler
!=
null
)
{
strategyFactoryHandler
.
alarm
(
platTenant
,
platDevice
.
getOriDeviceId
(),
properties
);
try
{
}
catch
(
Exception
e
)
{
strategyFactoryHandler
.
alarm
(
platTenant
,
platDevice
.
getOriDeviceId
(),
properties
);
log
.
error
(
"调用openapi告警接口失败:{}"
,
e
.
getMessage
(),
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用openapi告警接口失败:{}"
,
e
.
getMessage
(),
e
);
}
}
}
}
}
}
}
...
@@ -120,6 +122,15 @@ public class FallAlarm implements IAlarm {
...
@@ -120,6 +122,15 @@ public class FallAlarm implements IAlarm {
}
}
}
}
private
boolean
isSupportAlarm
(
PlatTenant
platTenant
,
PlatDevice
platDevice
)
{
String
reportOrgIds
=
platTenant
.
getReportOrgIds
();
if
(
StringUtils
.
isBlank
(
reportOrgIds
))
{
return
false
;
}
List
<
String
>
orgIds
=
Arrays
.
asList
(
StringUtils
.
split
(
reportOrgIds
,
","
));
return
orgIds
.
contains
(
platDevice
.
getOrgId
());
}
private
void
recordDuration
(
PlatAlarmCheckDTO
platAlarmCheckDTO
)
{
private
void
recordDuration
(
PlatAlarmCheckDTO
platAlarmCheckDTO
)
{
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
PlatAlarmConfig
config
=
alarmConfigCacheUtil
.
get
(
platDevice
.
getOrgId
(),
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
BEHAVIOR
.
getValue
());
PlatAlarmConfig
config
=
alarmConfigCacheUtil
.
get
(
platDevice
.
getOrgId
(),
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
BEHAVIOR
.
getValue
());
...
...
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