Commit 8f174669 by 罗志长

feat: 跌倒告警上报第三方限制组织

parent 707c3172
ALTER TABLE `plat_device_other`
ALTER TABLE `plat_device_other`
......@@ -124,3 +124,5 @@ 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_children_info add column weChat_openid varchar(64) default null comment '公众号openid';
alter table plat_tenant add column report_org_ids varchar(255) default null comment '主动上报机构ids';
\ No newline at end of file
......@@ -67,6 +67,11 @@ public class PlatTenant extends BaseEntity {
private String secret;
private String openApiUrl;
/**
* 租户标识
*/
private String reportOrgIds;
}
\ No newline at end of file
......@@ -102,6 +102,7 @@ public class FallAlarm implements IAlarm {
// 跌倒了设备需要发送告警到第三方平台
PlatTenant platTenant = platTenantService.getById(platDevice.getTenantId());
if (platTenant != null) {
if (isSupportAlarm(platTenant, platDevice)) {
OpenApiBaseStrategy strategyFactoryHandler = openApiBaseStrategyFactory.getHandler(platTenant.getCode());
if (strategyFactoryHandler != null) {
try {
......@@ -111,6 +112,7 @@ public class FallAlarm implements IAlarm {
}
}
}
}
} else {
if (StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.YES.getValue())) {
......@@ -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) {
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
PlatAlarmConfig config = alarmConfigCacheUtil.get(platDevice.getOrgId(), PlatAlarmConfigEnum.AlarmTypeEnum.BEHAVIOR.getValue());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment