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
4d7339b2
authored
Oct 25, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 机构类型区分居家还是养老,告警配置开关,设备同步定时器逻辑修改
parent
d765a710
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
189 additions
and
42 deletions
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
server-service/src/main/java/com/makeit/dto/platform/alarm/PlatAlarmRecordQueryDTO.java
server-service/src/main/java/com/makeit/dto/platform/space/PlatBedPanoramaDTO.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/BehaviorAlarm.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/BreathAlarm.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/FallAlarm.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/HeartAlarm.java
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmRecordServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatDayDurationRecordServiceImpl.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-service/src/main/java/com/makeit/service/platform/space/impl/PlatBedServiceImpl.java
server-service/src/main/java/com/makeit/utils/AlarmConfigCacheUtil.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
View file @
4d7339b2
...
@@ -69,7 +69,7 @@ public class PlatDeviceController {
...
@@ -69,7 +69,7 @@ public class PlatDeviceController {
@AuthIgnore
@AuthIgnore
@TenantIdIgnore
@TenantIdIgnore
public
ApiResponseEntity
<
Void
>
iotSyncTask
(
@RequestBody
BaseIdDTO
baseIdDTO
)
{
public
ApiResponseEntity
<
Void
>
iotSyncTask
(
@RequestBody
BaseIdDTO
baseIdDTO
)
{
iotSyncTask
.
savePlatDevice
();
//
iotSyncTask.savePlatDevice();
return
ApiResponseUtils
.
success
();
return
ApiResponseUtils
.
success
();
}
}
...
...
server-service/src/main/java/com/makeit/dto/platform/alarm/PlatAlarmRecordQueryDTO.java
View file @
4d7339b2
...
@@ -52,6 +52,11 @@ public class PlatAlarmRecordQueryDTO extends BaseTenantDTO {
...
@@ -52,6 +52,11 @@ public class PlatAlarmRecordQueryDTO extends BaseTenantDTO {
@ApiModelProperty
(
value
=
"告警类型 数据字典 1 长者跌倒 2 呼吸异常 3 心率异常 4 行为异常"
)
@ApiModelProperty
(
value
=
"告警类型 数据字典 1 长者跌倒 2 呼吸异常 3 心率异常 4 行为异常"
)
private
String
alarmType
;
private
String
alarmType
;
@ApiModelProperty
(
value
=
"不同类型的机构集合"
)
private
List
<
String
>
orgIdList
;
@ApiModelProperty
(
value
=
"类型 1-居家 2-机构养老"
)
private
String
type
;
//告警接收人id
//告警接收人id
private
String
notifyUser
;
private
String
notifyUser
;
...
...
server-service/src/main/java/com/makeit/dto/platform/space/PlatBedPanoramaDTO.java
View file @
4d7339b2
...
@@ -29,6 +29,9 @@ public class PlatBedPanoramaDTO {
...
@@ -29,6 +29,9 @@ public class PlatBedPanoramaDTO {
@ApiModelProperty
(
"机构id集合"
)
@ApiModelProperty
(
"机构id集合"
)
private
List
<
String
>
orgIdList
;
private
List
<
String
>
orgIdList
;
@ApiModelProperty
(
value
=
"类型 1-居家 2-机构养老"
)
private
String
orgType
;
@DictEnum
(
em
=
PlatBedStatusEnum
.
BedStatusEnum
.
class
,
message
=
"状态可选值为{m}"
)
@DictEnum
(
em
=
PlatBedStatusEnum
.
BedStatusEnum
.
class
,
message
=
"状态可选值为{m}"
)
@ApiModelProperty
(
"状态 1-空闲 0-已入住"
)
@ApiModelProperty
(
"状态 1-空闲 0-已入住"
)
private
String
status
;
private
String
status
;
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/BehaviorAlarm.java
View file @
4d7339b2
...
@@ -64,10 +64,6 @@ public class BehaviorAlarm implements IAlarm {
...
@@ -64,10 +64,6 @@ public class BehaviorAlarm implements IAlarm {
JSONObject
properties
=
platAlarmCheckDTO
.
getProperties
();
JSONObject
properties
=
platAlarmCheckDTO
.
getProperties
();
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
String
deviceId
=
platDevice
.
getId
();
String
deviceId
=
platDevice
.
getId
();
if
(
StringUtils
.
isBlank
(
ruleConfigStr
))
{
log
.
error
(
"行为告警配置未配置,告警配置id:"
+
config
.
getId
());
return
;
}
String
personState
=
Convert
.
toStr
(
properties
.
get
(
"personState"
));
String
personState
=
Convert
.
toStr
(
properties
.
get
(
"personState"
));
PlatAlarmConfigBehaviorDTOVO
ruleConfig
=
JsonUtil
.
toObj
(
ruleConfigStr
,
PlatAlarmConfigBehaviorDTOVO
.
class
);
PlatAlarmConfigBehaviorDTOVO
ruleConfig
=
JsonUtil
.
toObj
(
ruleConfigStr
,
PlatAlarmConfigBehaviorDTOVO
.
class
);
Integer
duration
=
ruleConfig
.
getAverageDuration
();
//分钟
Integer
duration
=
ruleConfig
.
getAverageDuration
();
//分钟
...
@@ -115,8 +111,6 @@ public class BehaviorAlarm implements IAlarm {
...
@@ -115,8 +111,6 @@ public class BehaviorAlarm implements IAlarm {
alarmRedisDTO
.
setAlarm
(
CommonEnum
.
YES
.
getValue
());
alarmRedisDTO
.
setAlarm
(
CommonEnum
.
YES
.
getValue
());
RedisUtil
.
set
(
RedisConst
.
ALARM_DEVICE_BEHAVIOR_ID
+
deviceId
,
alarmRedisDTO
);
RedisUtil
.
set
(
RedisConst
.
ALARM_DEVICE_BEHAVIOR_ID
+
deviceId
,
alarmRedisDTO
);
notice
(
platAlarmCheckDTO
);
notice
(
platAlarmCheckDTO
);
}
else
{
return
;
}
}
}
}
...
@@ -136,6 +130,15 @@ public class BehaviorAlarm implements IAlarm {
...
@@ -136,6 +130,15 @@ public class BehaviorAlarm implements IAlarm {
@Override
@Override
public
void
notice
(
PlatAlarmCheckDTO
platAlarmCheckDTO
)
{
public
void
notice
(
PlatAlarmCheckDTO
platAlarmCheckDTO
)
{
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
PlatAlarmConfig
config
=
platAlarmCheckDTO
.
getPlatAlarmConfig
();
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
config
.
getStatus
()))
{
log
.
error
(
"告警配置为禁用,告警配置id:"
+
config
.
getId
());
return
;
}
if
(
StringUtils
.
isBlank
(
config
.
getRuleConfig
()))
{
log
.
error
(
"行为告警配置未配置,告警配置id:"
+
config
.
getId
());
return
;
}
//获取长者 空间信息
//获取长者 空间信息
platAlarmRecordService
.
getElderListByDeviceId
(
platAlarmCheckDTO
);
platAlarmRecordService
.
getElderListByDeviceId
(
platAlarmCheckDTO
);
List
<
PlatElder
>
platElderList
=
platAlarmCheckDTO
.
getPlatElderList
();
List
<
PlatElder
>
platElderList
=
platAlarmCheckDTO
.
getPlatElderList
();
...
@@ -143,6 +146,7 @@ public class BehaviorAlarm implements IAlarm {
...
@@ -143,6 +146,7 @@ public class BehaviorAlarm implements IAlarm {
log
.
error
(
"未关联长者,设备id:"
+
platAlarmCheckDTO
.
getPlatDevice
().
getId
());
log
.
error
(
"未关联长者,设备id:"
+
platAlarmCheckDTO
.
getPlatDevice
().
getId
());
return
;
return
;
}
}
PlatRoom
platRoom
=
platAlarmCheckDTO
.
getPlatRoom
();
PlatRoom
platRoom
=
platAlarmCheckDTO
.
getPlatRoom
();
for
(
PlatElder
platElder
:
platElderList
)
{
for
(
PlatElder
platElder
:
platElderList
)
{
//判断是否已入住七天
//判断是否已入住七天
...
@@ -161,7 +165,7 @@ public class BehaviorAlarm implements IAlarm {
...
@@ -161,7 +165,7 @@ public class BehaviorAlarm implements IAlarm {
PlatAlarmRecord
platAlarmRecord
=
platAlarmRecordService
.
convertToPlatAlarmRecord
(
platAlarmCheckDTO
,
platElder
);
PlatAlarmRecord
platAlarmRecord
=
platAlarmRecordService
.
convertToPlatAlarmRecord
(
platAlarmCheckDTO
,
platElder
);
platAlarmRecord
.
setElderIds
(
platElder
.
getId
());
platAlarmRecord
.
setElderIds
(
platElder
.
getId
());
platAlarmRecord
.
setElderName
(
platElder
.
getName
());
platAlarmRecord
.
setElderName
(
platElder
.
getName
());
platAlarmRecordService
.
noticeDeviceAlarm
(
platAlarmCheckDTO
.
getPlatAlarmConfig
()
,
platAlarmRecord
);
platAlarmRecordService
.
noticeDeviceAlarm
(
config
,
platAlarmRecord
);
log
.
error
(
"长者行为异常,发出告警,设备id:"
+
platDevice
.
getId
()+
", 长者名称:"
+
platElder
.
getName
());
log
.
error
(
"长者行为异常,发出告警,设备id:"
+
platDevice
.
getId
()+
", 长者名称:"
+
platElder
.
getName
());
}
}
}
}
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/BreathAlarm.java
View file @
4d7339b2
...
@@ -61,26 +61,23 @@ public class BreathAlarm implements IAlarm {
...
@@ -61,26 +61,23 @@ public class BreathAlarm implements IAlarm {
log
.
error
(
"呼吸设备未关联长者,设备plat_id:"
+
platAlarmCheckDTO
.
getPlatDevice
().
getId
());
log
.
error
(
"呼吸设备未关联长者,设备plat_id:"
+
platAlarmCheckDTO
.
getPlatDevice
().
getId
());
return
;
return
;
}
}
PlatAlarmConfig
config
=
platAlarmCheckDTO
.
getPlatAlarmConfig
();
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
config
.
getStatus
()))
{
log
.
error
(
"呼吸告警配置为禁用,告警配置id:"
+
config
.
getId
());
return
;
}
PlatElder
platElder
=
platElderList
.
get
(
0
);
PlatElder
platElder
=
platElderList
.
get
(
0
);
PlatHealthConfigDTO
platHealthConfigDTO
=
personalConfigCacheUtil
.
get
(
platElder
.
getId
());
PlatHealthConfigDTO
platHealthConfigDTO
=
personalConfigCacheUtil
.
get
(
platElder
.
getId
());
PlatAlarmConfigRespiratoryDTOVO
ruleConfig
;
PlatAlarmConfigRespiratoryDTOVO
ruleConfig
;
if
(
platHealthConfigDTO
!=
null
&&
platHealthConfigDTO
.
isBreathConfig
())
{
if
(
platHealthConfigDTO
!=
null
&&
platHealthConfigDTO
.
isBreathConfig
())
{
ruleConfig
=
platHealthConfigDTO
.
getAlarmConfigRespiratoryDTOVO
();
ruleConfig
=
platHealthConfigDTO
.
getAlarmConfigRespiratoryDTOVO
();
}
else
{
}
else
{
PlatAlarmConfig
config
=
platAlarmCheckDTO
.
getPlatAlarmConfig
();
String
ruleConfigStr
=
config
.
getRuleConfig
();
String
ruleConfigStr
=
config
.
getRuleConfig
();
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
config
.
getStatus
()))
{
log
.
error
(
"呼吸告警配置为警用,告警配置id:"
+
config
.
getId
());
return
;
}
if
(
StringUtils
.
isBlank
(
ruleConfigStr
))
{
if
(
StringUtils
.
isBlank
(
ruleConfigStr
))
{
log
.
error
(
"呼吸告警配置未配置,告警配置id:"
+
config
.
getId
());
log
.
error
(
"呼吸告警配置未配置,告警配置id:"
+
config
.
getId
());
return
;
return
;
}
}
ruleConfig
=
JsonUtil
.
toObj
(
ruleConfigStr
,
PlatAlarmConfigRespiratoryDTOVO
.
class
);
ruleConfig
=
JsonUtil
.
toObj
(
ruleConfigStr
,
PlatAlarmConfigRespiratoryDTOVO
.
class
);
}
}
Integer
start
=
ruleConfig
.
getRespiratoryRateStart
();
Integer
start
=
ruleConfig
.
getRespiratoryRateStart
();
...
@@ -92,7 +89,7 @@ public class BreathAlarm implements IAlarm {
...
@@ -92,7 +89,7 @@ public class BreathAlarm implements IAlarm {
String
personState
=
Convert
.
toStr
(
properties
.
get
(
"personState"
));
String
personState
=
Convert
.
toStr
(
properties
.
get
(
"personState"
));
int
hasPerson
=
(
int
)
properties
.
get
(
"person"
);
int
hasPerson
=
(
int
)
properties
.
get
(
"person"
);
if
(
"0"
.
equals
(
hasPerson
)
)
{
if
(
0
==
hasPerson
)
{
log
.
info
(
"当前上报数据无人,不需要告警"
);
log
.
info
(
"当前上报数据无人,不需要告警"
);
return
;
return
;
}
}
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/FallAlarm.java
View file @
4d7339b2
...
@@ -175,6 +175,15 @@ public class FallAlarm implements IAlarm {
...
@@ -175,6 +175,15 @@ public class FallAlarm implements IAlarm {
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
platAlarmRecordService
.
getElderListByDeviceId
(
platAlarmCheckDTO
);
platAlarmRecordService
.
getElderListByDeviceId
(
platAlarmCheckDTO
);
List
<
PlatElder
>
platElderList
=
platAlarmCheckDTO
.
getPlatElderList
();
List
<
PlatElder
>
platElderList
=
platAlarmCheckDTO
.
getPlatElderList
();
PlatAlarmConfig
config
=
platAlarmCheckDTO
.
getPlatAlarmConfig
();
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
config
.
getStatus
()))
{
log
.
error
(
"告警配置为禁用,告警配置id:"
+
config
.
getId
());
return
;
}
if
(
StringUtils
.
isBlank
(
config
.
getRuleConfig
()))
{
log
.
error
(
"行为告警配置未配置,告警配置id:"
+
config
.
getId
());
return
;
}
if
(
CollectionUtils
.
isEmpty
(
platElderList
))
{
if
(
CollectionUtils
.
isEmpty
(
platElderList
))
{
log
.
error
(
"跌倒设备未关联长者,设备plat_id:"
+
platDevice
.
getId
());
log
.
error
(
"跌倒设备未关联长者,设备plat_id:"
+
platDevice
.
getId
());
return
;
return
;
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/HeartAlarm.java
View file @
4d7339b2
...
@@ -53,13 +53,17 @@ public class HeartAlarm implements IAlarm {
...
@@ -53,13 +53,17 @@ public class HeartAlarm implements IAlarm {
log
.
error
(
"心率设备未关联长者,设备plat_id:"
+
platAlarmCheckDTO
.
getPlatDevice
().
getId
());
log
.
error
(
"心率设备未关联长者,设备plat_id:"
+
platAlarmCheckDTO
.
getPlatDevice
().
getId
());
return
;
return
;
}
}
PlatAlarmConfig
config
=
platAlarmCheckDTO
.
getPlatAlarmConfig
();
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
config
.
getStatus
()))
{
log
.
error
(
"呼吸告警配置为禁用,告警配置id:"
+
config
.
getId
());
return
;
}
PlatElder
platElder
=
platElderList
.
get
(
0
);
PlatElder
platElder
=
platElderList
.
get
(
0
);
PlatHealthConfigDTO
platHealthConfigDTO
=
personalConfigCacheUtil
.
get
(
platElder
.
getId
());
PlatHealthConfigDTO
platHealthConfigDTO
=
personalConfigCacheUtil
.
get
(
platElder
.
getId
());
PlatAlarmConfigHeartDTOVO
ruleConfig
;
PlatAlarmConfigHeartDTOVO
ruleConfig
;
if
(
platHealthConfigDTO
!=
null
&&
platHealthConfigDTO
.
isHeartConfig
()){
if
(
platHealthConfigDTO
!=
null
&&
platHealthConfigDTO
.
isHeartConfig
()){
ruleConfig
=
platHealthConfigDTO
.
getAlarmConfigHeartDTO
();
ruleConfig
=
platHealthConfigDTO
.
getAlarmConfigHeartDTO
();
}
else
{
}
else
{
PlatAlarmConfig
config
=
platAlarmCheckDTO
.
getPlatAlarmConfig
();
String
ruleConfigStr
=
config
.
getRuleConfig
();
String
ruleConfigStr
=
config
.
getRuleConfig
();
if
(
StringUtils
.
isBlank
(
ruleConfigStr
))
{
if
(
StringUtils
.
isBlank
(
ruleConfigStr
))
{
log
.
error
(
"心率告警配置未配置,告警配置id:"
+
config
.
getId
());
log
.
error
(
"心率告警配置未配置,告警配置id:"
+
config
.
getId
());
...
@@ -88,6 +92,11 @@ public class HeartAlarm implements IAlarm {
...
@@ -88,6 +92,11 @@ public class HeartAlarm implements IAlarm {
return
;
return
;
}
}
int
hasPerson
=
(
int
)
properties
.
get
(
"person"
);
if
(
0
==
hasPerson
)
{
log
.
info
(
"当前上报数据无人,不需要告警"
);
return
;
}
if
((
hr
>
end
||
hr
<
start
))
{
if
((
hr
>
end
||
hr
<
start
))
{
if
(
alarmRedisDTO
==
null
){
if
(
alarmRedisDTO
==
null
){
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmRecordServiceImpl.java
View file @
4d7339b2
...
@@ -2,6 +2,7 @@ package com.makeit.service.platform.alarm.impl;
...
@@ -2,6 +2,7 @@ package com.makeit.service.platform.alarm.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
@@ -16,6 +17,7 @@ import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
...
@@ -16,6 +17,7 @@ import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
import
com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO
;
import
com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO
;
import
com.makeit.entity.platform.alarm.PlatAlarmConfig
;
import
com.makeit.entity.platform.alarm.PlatAlarmConfig
;
import
com.makeit.entity.platform.alarm.PlatAlarmRecord
;
import
com.makeit.entity.platform.alarm.PlatAlarmRecord
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.auth.PlatUser
;
import
com.makeit.entity.platform.auth.PlatUser
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.elder.PlatElder
;
import
com.makeit.entity.platform.elder.PlatElder
;
...
@@ -30,6 +32,7 @@ import com.makeit.global.aspect.tenant.TenantIdIgnore;
...
@@ -30,6 +32,7 @@ import com.makeit.global.aspect.tenant.TenantIdIgnore;
import
com.makeit.mapper.platform.alarm.PlatAlarmRecordMapper
;
import
com.makeit.mapper.platform.alarm.PlatAlarmRecordMapper
;
import
com.makeit.service.platform.alarm.PlatAlarmConfigService
;
import
com.makeit.service.platform.alarm.PlatAlarmConfigService
;
import
com.makeit.service.platform.alarm.PlatAlarmRecordService
;
import
com.makeit.service.platform.alarm.PlatAlarmRecordService
;
import
com.makeit.service.platform.auth.PlatOrgService
;
import
com.makeit.service.platform.auth.PlatUserService
;
import
com.makeit.service.platform.auth.PlatUserService
;
import
com.makeit.service.platform.elder.PlatElderChildrenInfoService
;
import
com.makeit.service.platform.elder.PlatElderChildrenInfoService
;
import
com.makeit.service.platform.elder.PlatElderService
;
import
com.makeit.service.platform.elder.PlatElderService
;
...
@@ -39,6 +42,7 @@ import com.makeit.service.platform.space.PlatRoomService;
...
@@ -39,6 +42,7 @@ import com.makeit.service.platform.space.PlatRoomService;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
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.msg.MsgSendUtil
;
import
com.makeit.utils.msg.MsgSendUtil
;
import
com.makeit.utils.msg.SendTypeEnum
;
import
com.makeit.utils.msg.SendTypeEnum
;
import
com.makeit.utils.msg.dto.MsgSendDTO
;
import
com.makeit.utils.msg.dto.MsgSendDTO
;
...
@@ -95,6 +99,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
...
@@ -95,6 +99,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
private
PlatRegionSettingService
platRegionSettingService
;
private
PlatRegionSettingService
platRegionSettingService
;
@Autowired
@Autowired
private
PlatTenantService
platTenantService
;
private
PlatTenantService
platTenantService
;
@Autowired
private
PlatOrgService
platOrgService
;
@Override
@Override
...
@@ -137,6 +143,10 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
...
@@ -137,6 +143,10 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
private
LambdaQueryWrapper
<
PlatAlarmRecord
>
getLambdaQueryWrapper
(
PlatAlarmRecordQueryDTO
param
)
{
private
LambdaQueryWrapper
<
PlatAlarmRecord
>
getLambdaQueryWrapper
(
PlatAlarmRecordQueryDTO
param
)
{
List
<
String
>
orgIdList
=
Lists
.
newArrayList
();
List
<
String
>
orgIdList
=
Lists
.
newArrayList
();
if
(
StringUtils
.
isNotEmpty
(
param
.
getType
()))
{
List
<
PlatOrg
>
platOrgList
=
platOrgService
.
list
(
new
QueryWrapper
<
PlatOrg
>().
lambda
().
eq
(
PlatOrg:
:
getType
,
param
.
getType
()));
orgIdList
=
StreamUtil
.
map
(
platOrgList
,
BaseEntity:
:
getId
);
}
if
(
StringUtils
.
isNotEmpty
(
param
.
getOrgId
()))
{
if
(
StringUtils
.
isNotEmpty
(
param
.
getOrgId
()))
{
orgIdList
=
Lists
.
newArrayList
(
param
.
getOrgId
().
split
(
","
));
orgIdList
=
Lists
.
newArrayList
(
param
.
getOrgId
().
split
(
","
));
}
}
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatDayDurationRecordServiceImpl.java
View file @
4d7339b2
...
@@ -47,7 +47,6 @@ implements PlatDayDurationRecordService {
...
@@ -47,7 +47,6 @@ implements PlatDayDurationRecordService {
*/
*/
@Override
@Override
public
void
saveDayDurationRecord
(
PlatAlarmCheckDTO
platAlarmCheckDTO
,
AlarmRedisDTO
alarmRedisDTO
)
{
public
void
saveDayDurationRecord
(
PlatAlarmCheckDTO
platAlarmCheckDTO
,
AlarmRedisDTO
alarmRedisDTO
)
{
PlatAlarmConfig
config
=
platAlarmCheckDTO
.
getPlatAlarmConfig
();
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
...
@@ -62,10 +61,6 @@ implements PlatDayDurationRecordService {
...
@@ -62,10 +61,6 @@ implements PlatDayDurationRecordService {
}
}
List
<
PlatElder
>
platElderList
=
platAlarmCheckDTO
.
getPlatElderList
();
List
<
PlatElder
>
platElderList
=
platAlarmCheckDTO
.
getPlatElderList
();
// if(CollectionUtils.isNotEmpty(platElderList)){
// platAlarmRecordService.getElderListByDeviceId(platAlarmCheckDTO);
// platElderList = platAlarmCheckDTO.getPlatElderList();
// }
for
(
PlatElder
platElder
:
platElderList
)
{
for
(
PlatElder
platElder
:
platElderList
)
{
if
(
StringUtils
.
isBlank
(
platElder
.
getRegionName
())){
if
(
StringUtils
.
isBlank
(
platElder
.
getRegionName
())){
continue
;
continue
;
...
@@ -78,7 +73,7 @@ implements PlatDayDurationRecordService {
...
@@ -78,7 +73,7 @@ implements PlatDayDurationRecordService {
durationRecord
.
setDay
(
alarmRedisDTO
.
getStart
());
durationRecord
.
setDay
(
alarmRedisDTO
.
getStart
());
durationRecord
.
setStartDate
(
alarmRedisDTO
.
getStart
());
durationRecord
.
setStartDate
(
alarmRedisDTO
.
getStart
());
durationRecord
.
setEndDate
(
now
);
durationRecord
.
setEndDate
(
now
);
durationRecord
.
setTenantId
(
config
.
getTenantId
());
durationRecord
.
setTenantId
(
platDevice
.
getTenantId
());
durationRecord
.
setRoomId
(
platElder
.
getRoomId
());
durationRecord
.
setRoomId
(
platElder
.
getRoomId
());
durationRecord
.
setDeviceId
(
platDevice
.
getId
());
durationRecord
.
setDeviceId
(
platDevice
.
getId
());
this
.
saveOrUpdate
(
durationRecord
);
this
.
saveOrUpdate
(
durationRecord
);
...
...
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
View file @
4d7339b2
...
@@ -66,4 +66,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
...
@@ -66,4 +66,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
List
<
PlatDevice
>
productList
(
PlatDeviceQueryDTO
dto
);
List
<
PlatDevice
>
productList
(
PlatDeviceQueryDTO
dto
);
Page
<
PlatDeviceListVO
>
getDevices
(
PlatDataScreenQueryDTO
dto
,
Page
<
PlatDevice
>
p
);
Page
<
PlatDeviceListVO
>
getDevices
(
PlatDataScreenQueryDTO
dto
,
Page
<
PlatDevice
>
p
);
void
savePlatDevice
();
}
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
4d7339b2
package
com
.
makeit
.
service
.
platform
.
device
.
impl
;
package
com
.
makeit
.
service
.
platform
.
device
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Sets
;
import
com.makeit.common.dto.BaseTenantDTO
;
import
com.makeit.common.dto.BaseTenantDTO
;
import
com.makeit.common.entity.BaseBusEntity
;
import
com.makeit.common.entity.BaseBusEntity
;
import
com.makeit.common.entity.BaseEntity
;
import
com.makeit.common.entity.BaseEntity
;
...
@@ -23,17 +25,27 @@ import com.makeit.entity.platform.auth.PlatOrg;
...
@@ -23,17 +25,27 @@ import com.makeit.entity.platform.auth.PlatOrg;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
com.makeit.entity.platform.device.PlatDeviceOther
;
import
com.makeit.entity.platform.space.PlatRegionSetting
;
import
com.makeit.entity.platform.space.PlatRegionSetting
;
import
com.makeit.entity.platform.space.PlatRoomBedDevice
;
import
com.makeit.entity.platform.space.PlatSpace
;
import
com.makeit.entity.platform.space.PlatSpace
;
import
com.makeit.entity.saas.PlatTenant
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.report.DeviceNameEnum
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.mapper.platform.device.PlatDeviceMapper
;
import
com.makeit.mapper.platform.device.PlatDeviceMapper
;
import
com.makeit.module.iot.service.IotDevicePropertiesOperateService
;
import
com.makeit.module.iot.service.IotDevicePropertiesOperateService
;
import
com.makeit.module.iot.service.IotOrgService
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.vo.DeviceInstanceEntity
;
import
com.makeit.module.iot.vo.DeviceProperties
;
import
com.makeit.module.iot.vo.DeviceProperties
;
import
com.makeit.module.iot.vo.DeviceState
;
import
com.makeit.module.system.service.SysDictionaryCategoryService
;
import
com.makeit.module.system.vo.DictionaryVo
;
import
com.makeit.service.platform.auth.PlatOrgService
;
import
com.makeit.service.platform.auth.PlatOrgService
;
import
com.makeit.service.platform.device.PlatDeviceOtherService
;
import
com.makeit.service.platform.device.PlatDeviceOtherService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.service.platform.space.PlatRoomBedDeviceService
;
import
com.makeit.service.platform.space.PlatSpaceService
;
import
com.makeit.service.platform.space.PlatSpaceService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.utils.DeviceCacheUtil
;
import
com.makeit.utils.DeviceCacheUtil
;
...
@@ -45,15 +57,16 @@ import com.makeit.utils.old.StringUtils;
...
@@ -45,15 +57,16 @@ import com.makeit.utils.old.StringUtils;
import
com.makeit.utils.sql.join.JoinUtil
;
import
com.makeit.utils.sql.join.JoinUtil
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
import
com.makeit.vo.platform.device.PlatDeviceViewVO
;
import
com.makeit.vo.platform.device.PlatDeviceViewVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
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
;
import
java.
util.List
;
import
java.
time.LocalDateTime
;
import
java.
util.Map
;
import
java.
time.ZoneOffset
;
import
java.util.
Optional
;
import
java.util.
*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
...
@@ -66,6 +79,7 @@ import java.util.stream.Stream;
...
@@ -66,6 +79,7 @@ import java.util.stream.Stream;
* @since 2023-09-05
* @since 2023-09-05
*/
*/
@Service
@Service
@Slf4j
public
class
PlatDeviceServiceImpl
extends
ServiceImpl
<
PlatDeviceMapper
,
PlatDevice
>
implements
PlatDeviceService
{
public
class
PlatDeviceServiceImpl
extends
ServiceImpl
<
PlatDeviceMapper
,
PlatDevice
>
implements
PlatDeviceService
{
@Autowired
@Autowired
...
@@ -86,6 +100,13 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -86,6 +100,13 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
@Autowired
@Autowired
private
PlatSpaceService
platSpaceService
;
private
PlatSpaceService
platSpaceService
;
@Autowired
private
IotOrgService
iotOrgService
;
@Autowired
private
SysDictionaryCategoryService
sysDictionaryCategoryService
;
@Autowired
private
PlatRoomBedDeviceService
platRoomBedDeviceService
;
@Override
@Override
public
PageVO
<
PlatDeviceListVO
>
page
(
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
)
{
public
PageVO
<
PlatDeviceListVO
>
page
(
PageReqDTO
<
PlatDeviceQueryDTO
>
pageReqDTO
)
{
PlatDeviceQueryDTO
dto
=
pageReqDTO
.
getData
();
PlatDeviceQueryDTO
dto
=
pageReqDTO
.
getData
();
...
@@ -386,4 +407,94 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -386,4 +407,94 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
public
Page
<
PlatDeviceListVO
>
getDevices
(
PlatDataScreenQueryDTO
dto
,
Page
<
PlatDevice
>
page
)
{
public
Page
<
PlatDeviceListVO
>
getDevices
(
PlatDataScreenQueryDTO
dto
,
Page
<
PlatDevice
>
page
)
{
return
baseMapper
.
getDevices
(
dto
,
page
);
return
baseMapper
.
getDevices
(
dto
,
page
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
savePlatDevice
(){
log
.
info
(
"开始执行同步设备信息接口"
);
LambdaQueryWrapper
<
PlatTenant
>
tenantLambdaQueryWrapper
=
new
LambdaQueryWrapper
<
PlatTenant
>().
eq
(
PlatTenant:
:
getStatus
,
CommonEnum
.
YES
.
getValue
());
List
<
PlatTenant
>
platTenants
=
platTenantService
.
list
(
tenantLambdaQueryWrapper
);
List
<
DictionaryVo
>
dictionaryVos
=
sysDictionaryCategoryService
.
getByCategoryCode
(
"device.category"
);
Map
<
String
,
String
>
dicNameIdMap
=
dictionaryVos
.
stream
().
collect
(
Collectors
.
toMap
(
DictionaryVo:
:
getName
,
DictionaryVo:
:
getValue
,
(
v1
,
v2
)
->
v1
));
for
(
PlatTenant
platTenant
:
platTenants
)
{
String
iotOrgId
=
platTenant
.
getIotOrgId
();
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
iotOrgId
))
{
continue
;
}
//查询iot设备
List
<
DeviceInstanceEntity
>
iotDeviceList
=
iotOrgService
.
getOrgDevice
(
iotOrgId
);
//查询平台设备
Set
<
String
>
iotDeviceIdSet
=
iotDeviceList
.
stream
().
map
(
DeviceInstanceEntity:
:
getId
).
collect
(
Collectors
.
toSet
());
List
<
PlatDevice
>
platDeviceList
=
list
(
new
QueryWrapper
<
PlatDevice
>().
lambda
().
eq
(
BaseBusEntity:
:
getTenantId
,
platTenant
.
getId
()));
Set
<
String
>
platformDeviceIdList
=
platDeviceList
.
stream
().
map
(
PlatDevice:
:
getOriDeviceId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
newIotDeviceIdSet
=
Sets
.
newHashSet
(
iotDeviceIdSet
);
Set
<
String
>
newPlatformDeviceIdSet
=
Sets
.
newHashSet
(
platformDeviceIdList
);
newPlatformDeviceIdSet
.
removeAll
(
newIotDeviceIdSet
);
//iotDeviceIdSet.removeAll(platformDeviceIdList);
if
(
CollectionUtils
.
isNotEmpty
(
newPlatformDeviceIdSet
))
{
List
<
PlatDevice
>
platDevices
=
list
(
new
QueryWrapper
<
PlatDevice
>().
lambda
().
eq
(
BaseBusEntity:
:
getTenantId
,
platTenant
.
getId
())
.
in
(
PlatDevice:
:
getOriDeviceId
,
newPlatformDeviceIdSet
));
List
<
String
>
deviceIdList
=
StreamUtil
.
map
(
platDevices
,
BaseEntity:
:
getId
);
LambdaQueryWrapper
<
PlatDevice
>
removeQw
=
new
LambdaQueryWrapper
<
PlatDevice
>()
.
in
(
PlatDevice:
:
getId
,
deviceIdList
)
.
eq
(
BaseBusEntity:
:
getTenantId
,
platTenant
.
getId
());
remove
(
removeQw
);
// 同时删除关联的设备
platRoomBedDeviceService
.
remove
(
new
QueryWrapper
<
PlatRoomBedDevice
>().
lambda
()
.
in
(
PlatRoomBedDevice:
:
getDeviceId
,
deviceIdList
)
.
eq
(
BaseBusEntity:
:
getTenantId
,
platTenant
.
getId
()));
}
LambdaQueryWrapper
<
PlatDevice
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<
PlatDevice
>().
eq
(
BaseBusEntity:
:
getTenantId
,
platTenant
.
getId
())
.
in
(
PlatDevice:
:
getOriDeviceId
,
iotDeviceIdSet
);
iotDeviceIdSet
.
add
(
"-1"
);
List
<
PlatDevice
>
deviceList
=
list
(
deviceLambdaQueryWrapper
);
//更新平台设备
Collection
<
PlatDevice
>
platDevices
=
convertToPlatDevice
(
iotDeviceList
,
deviceList
,
platTenant
.
getId
(),
dicNameIdMap
);
saveOrUpdateBatch
(
platDevices
);
deviceCacheUtil
.
putAll
(
platDevices
);
}
log
.
info
(
"结束执行同步设备信息接口"
);
}
private
Collection
<
PlatDevice
>
convertToPlatDevice
(
List
<
DeviceInstanceEntity
>
iotDeviceList
,
List
<
PlatDevice
>
deviceList
,
String
tenantId
,
Map
<
String
,
String
>
dicNameIdMap
)
{
Map
<
String
,
PlatDevice
>
deviceMap
=
deviceList
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDevice:
:
getOriDeviceId
,
v
->
v
,
(
a
,
b
)
->
a
));
iotDeviceList
.
forEach
(
iotDevice
->
{
PlatDevice
platDevice
=
deviceMap
.
get
(
iotDevice
.
getId
());
if
(
platDevice
==
null
)
{
platDevice
=
new
PlatDevice
();
platDevice
.
setTenantId
(
tenantId
);
deviceMap
.
put
(
iotDevice
.
getId
(),
platDevice
);
}
platDevice
.
setOriDeviceId
(
iotDevice
.
getId
());
platDevice
.
setName
(
iotDevice
.
getName
());
platDevice
.
setOrgId
(
tenantId
);
String
productName
=
iotDevice
.
getProductName
();
platDevice
.
setProductName
(
productName
);
platDevice
.
setProductId
(
iotDevice
.
getProductId
());
if
(
iotDevice
.
getRegistryTime
()!=
null
)
{
LocalDateTime
registryTime
=
LocalDateTime
.
ofEpochSecond
(
iotDevice
.
getRegistryTime
()
/
1000
,
0
,
ZoneOffset
.
ofHours
(
8
));
platDevice
.
setRegistrationDate
(
registryTime
);
}
platDevice
.
setDescription
(
iotDevice
.
getDescribe
());
String
state
=
iotDevice
.
getState
();
DeviceState
deviceState
=
JSON
.
parseObject
(
state
,
DeviceState
.
class
);
platDevice
.
setStatus
(
deviceState
.
getValue
());
String
categoryName
=
DeviceNameEnum
.
getNameByPrefix
(
productName
);
platDevice
.
setCategory
(
dicNameIdMap
.
get
(
categoryName
));
});
return
deviceMap
.
values
();
}
}
}
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatBedServiceImpl.java
View file @
4d7339b2
package
com
.
makeit
.
service
.
platform
.
space
.
impl
;
package
com
.
makeit
.
service
.
platform
.
space
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.makeit.common.dto.StatusDTO
;
import
com.makeit.common.dto.StatusDTO
;
import
com.makeit.common.entity.BaseEntity
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.dto.platform.space.*
;
import
com.makeit.dto.platform.space.*
;
import
com.makeit.dto.platform.workstation.WorkStationQueryDTO
;
import
com.makeit.dto.platform.workstation.WorkStationQueryDTO
;
import
com.makeit.entity.platform.auth.PlatOrg
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatRoom
;
import
com.makeit.entity.platform.space.PlatRoom
;
import
com.makeit.entity.platform.space.PlatRoomBedDevice
;
import
com.makeit.entity.platform.space.PlatRoomBedDevice
;
...
@@ -17,15 +20,18 @@ import com.makeit.enums.CommonEnum;
...
@@ -17,15 +20,18 @@ import com.makeit.enums.CommonEnum;
import
com.makeit.enums.platform.auth.PlatOrgEnum
;
import
com.makeit.enums.platform.auth.PlatOrgEnum
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.mapper.platform.space.PlatBedMapper
;
import
com.makeit.mapper.platform.space.PlatBedMapper
;
import
com.makeit.service.platform.auth.PlatOrgService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatRoomBedDeviceService
;
import
com.makeit.service.platform.space.PlatRoomBedDeviceService
;
import
com.makeit.service.platform.space.PlatRoomService
;
import
com.makeit.service.platform.space.PlatRoomService
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.StreamUtil
;
import
com.makeit.vo.platform.space.PlatBedPanoramaVO
;
import
com.makeit.vo.platform.space.PlatBedPanoramaVO
;
import
com.makeit.vo.platform.space.PlatBedVo
;
import
com.makeit.vo.platform.space.PlatBedVo
;
import
com.makeit.vo.platform.workstation.WorkStationHomeBedVO
;
import
com.makeit.vo.platform.workstation.WorkStationHomeBedVO
;
import
com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO
;
import
com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO
;
import
jodd.util.StringUtil
;
import
jodd.util.StringUtil
;
import
org.apache.commons.lang3.StringUtils
;
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
;
...
@@ -43,6 +49,8 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl
...
@@ -43,6 +49,8 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl
@Autowired
@Autowired
private
PlatRoomService
platRoomService
;
private
PlatRoomService
platRoomService
;
@Autowired
private
PlatOrgService
platOrgService
;
@Autowired
@Autowired
private
PlatRoomBedDeviceService
platRoomBedDeviceService
;
private
PlatRoomBedDeviceService
platRoomBedDeviceService
;
...
@@ -153,6 +161,10 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl
...
@@ -153,6 +161,10 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl
@Override
@Override
public
Page
<
PlatBedPanoramaVO
>
selectBySpaceIdAndStatus
(
PageReqDTO
<
PlatBedPanoramaDTO
>
pageReqDTO
,
PlatBedPanoramaDTO
dto
)
{
public
Page
<
PlatBedPanoramaVO
>
selectBySpaceIdAndStatus
(
PageReqDTO
<
PlatBedPanoramaDTO
>
pageReqDTO
,
PlatBedPanoramaDTO
dto
)
{
List
<
String
>
orgIdList
=
Lists
.
newArrayList
();
List
<
String
>
orgIdList
=
Lists
.
newArrayList
();
if
(
StringUtils
.
isNotEmpty
(
dto
.
getOrgType
()))
{
List
<
PlatOrg
>
platOrgList
=
platOrgService
.
list
(
new
QueryWrapper
<
PlatOrg
>().
lambda
().
eq
(
PlatOrg:
:
getType
,
dto
.
getOrgType
()));
orgIdList
=
StreamUtil
.
map
(
platOrgList
,
BaseEntity:
:
getId
);
}
if
(
StringUtil
.
isNotEmpty
(
dto
.
getOrgId
()))
{
if
(
StringUtil
.
isNotEmpty
(
dto
.
getOrgId
()))
{
orgIdList
=
Lists
.
newArrayList
(
dto
.
getOrgId
().
split
(
","
));
orgIdList
=
Lists
.
newArrayList
(
dto
.
getOrgId
().
split
(
","
));
}
}
...
...
server-service/src/main/java/com/makeit/utils/AlarmConfigCacheUtil.java
View file @
4d7339b2
...
@@ -39,17 +39,11 @@ public class AlarmConfigCacheUtil implements ApplicationRunner {
...
@@ -39,17 +39,11 @@ public class AlarmConfigCacheUtil implements ApplicationRunner {
public
void
put
(
PlatAlarmConfig
alarmConfigVO
)
{
public
void
put
(
PlatAlarmConfig
alarmConfigVO
)
{
PlatAlarmConfig
alarmConfig
=
platAlarmConfigService
.
getById
(
alarmConfigVO
.
getId
());
PlatAlarmConfig
alarmConfig
=
platAlarmConfigService
.
getById
(
alarmConfigVO
.
getId
());
if
(
StringUtils
.
equals
(
CommonEnum
.
YES
.
getValue
(),
alarmConfig
.
getStatus
()))
{
RedisUtil
.
set
(
RedisConst
.
ALARM_CONFIG_ORG_ID
+
alarmConfig
.
getOrgId
()
+
":"
+
alarmConfig
.
getAlarmType
(),
alarmConfig
);
RedisUtil
.
set
(
RedisConst
.
ALARM_CONFIG_ORG_ID
+
alarmConfig
.
getOrgId
()
+
":"
+
alarmConfig
.
getAlarmType
(),
alarmConfig
);
}
else
{
RedisUtil
.
delete
(
RedisConst
.
ALARM_CONFIG_ORG_ID
+
alarmConfig
.
getOrgId
()
+
":"
+
alarmConfig
.
getAlarmType
());
}
}
}
public
void
putAll
(
List
<
PlatAlarmConfig
>
alarmConfigs
)
{
public
void
putAll
(
List
<
PlatAlarmConfig
>
alarmConfigs
)
{
alarmConfigs
.
forEach
(
vo
->
{
alarmConfigs
.
forEach
(
this
::
put
);
put
(
vo
);
});
}
}
public
PlatAlarmConfig
get
(
String
orgId
,
String
alarmType
)
{
public
PlatAlarmConfig
get
(
String
orgId
,
String
alarmType
)
{
...
...
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
4d7339b2
...
@@ -145,10 +145,6 @@ public class PushCallback implements MqttCallback {
...
@@ -145,10 +145,6 @@ public class PushCallback implements MqttCallback {
return
;
return
;
}
}
for
(
PlatAlarmConfig
config
:
deviceAlarmConfigList
)
{
for
(
PlatAlarmConfig
config
:
deviceAlarmConfigList
)
{
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
config
.
getStatus
()))
{
logger
.
error
(
"告警配置为禁用,告警配置id:"
+
config
.
getId
());
continue
;
}
String
alarmType
=
config
.
getAlarmType
();
String
alarmType
=
config
.
getAlarmType
();
for
(
IAlarm
alarm
:
alarmList
)
{
for
(
IAlarm
alarm
:
alarmList
)
{
...
...
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