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
d976788e
authored
Sep 26, 2023
by
李小龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
02e960da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
9 deletions
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/BehaviorAlarm.java
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatRoleServiceImpl.java
server-service/src/main/java/com/makeit/utils/DayDurationUtil.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/BehaviorAlarm.java
View file @
d976788e
...
@@ -75,13 +75,21 @@ public class BehaviorAlarm implements IAlarm {
...
@@ -75,13 +75,21 @@ public class BehaviorAlarm implements IAlarm {
PlatAlarmConfigBehaviorDTOVO
ruleConfig
=
JsonUtil
.
toObj
(
ruleConfigStr
,
PlatAlarmConfigBehaviorDTOVO
.
class
);
PlatAlarmConfigBehaviorDTOVO
ruleConfig
=
JsonUtil
.
toObj
(
ruleConfigStr
,
PlatAlarmConfigBehaviorDTOVO
.
class
);
Integer
duration
=
ruleConfig
.
getDuration
();
//分钟
Integer
duration
=
ruleConfig
.
getDuration
();
//分钟
PlatDayDurationRecord
platDayDurationRecord
=
dayDurationUtil
.
get
(
platDevice
.
getOriDeviceId
());
PlatDayDurationRecord
platDayDurationRecord
=
dayDurationUtil
.
get
(
platDevice
.
getOriDeviceId
());
if
(
platDayDurationRecord
==
null
)
{
// if (platDayDurationRecord == null) {
log
.
error
(
"行为告警未找到行为异常平均时长,设备plat_id:"
+
platDevice
.
getId
());
// log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId());
return
;
// return;
// }
Integer
duration1
=
0
;
if
(
platDayDurationRecord
!=
null
){
duration1
=
Math
.
toIntExact
(
platDayDurationRecord
.
getDuration
());
}
}
Long
duration1
=
platDayDurationRecord
.
getDuration
();
duration
=
duration
*
60
+
(
int
)
(
duration1
/
1000
);
//duration+平均停留时长
//duration+平均停留时长
if
(
duration
==
null
){
duration
=
0
;
}
else
{
duration
=
duration
*
60
+
(
duration1
/
1000
);
}
List
<
String
>
personStateList
=
Arrays
.
asList
(
"0"
);
List
<
String
>
personStateList
=
Arrays
.
asList
(
"0"
);
//有人
//有人
//计数
//计数
...
@@ -104,9 +112,11 @@ public class BehaviorAlarm implements IAlarm {
...
@@ -104,9 +112,11 @@ public class BehaviorAlarm implements IAlarm {
}
}
long
count
=
endLong
-
startLong
;
long
count
=
endLong
-
startLong
;
//进入空间时间满足告警时长,判断是否已经告警过了
//进入空间时间满足告警时长,判断是否已经告警过了
if
(
count
/
1000
>=
duration
&&
StringUtils
.
equals
(
alarmRedisDTO
.
getAlarm
(),
CommonEnum
.
NO
.
getValue
()))
{
if
(
duration
!=
0
&&
count
/
1000
>=
duration
&&
StringUtils
.
equals
(
alarmRedisDTO
.
getAlarm
(),
CommonEnum
.
NO
.
getValue
()))
{
log
.
error
(
"空间雷达发出告警,设备plat_id:"
+
platDevice
.
getId
());
log
.
error
(
"空间雷达发出告警,设备plat_id:"
+
platDevice
.
getId
());
notice
(
platAlarmCheckDTO
);
if
(
duration1
!=
0
)
{
notice
(
platAlarmCheckDTO
);
}
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
);
...
...
server-service/src/main/java/com/makeit/service/platform/auth/impl/PlatRoleServiceImpl.java
View file @
d976788e
...
@@ -126,7 +126,8 @@ implements PlatRoleService {
...
@@ -126,7 +126,8 @@ implements PlatRoleService {
}
}
old
=
WrapperUtil
.
getOne
(
this
,
new
QueryWrapper
<
PlatRole
>().
lambda
()
old
=
WrapperUtil
.
getOne
(
this
,
new
QueryWrapper
<
PlatRole
>().
lambda
()
.
eq
(
PlatRole:
:
getOrgId
,
dto
.
getOrgId
()))
.
eq
(
PlatRole:
:
getOrgId
,
dto
.
getOrgId
())
.
eq
(
PlatRole:
:
getCode
,
dto
.
getCode
()))
;
;
if
(
old
!=
null
&&
!
old
.
getId
().
equals
(
dto
.
getId
()))
{
if
(
old
!=
null
&&
!
old
.
getId
().
equals
(
dto
.
getId
()))
{
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_CODE_DUPLICATE
);
throw
new
BusinessException
(
CodeMessageEnum
.
SYSTEM_ERROR_CODE_DUPLICATE
);
...
...
server-service/src/main/java/com/makeit/utils/DayDurationUtil.java
View file @
d976788e
...
@@ -59,7 +59,7 @@ public class DayDurationUtil implements ApplicationRunner {
...
@@ -59,7 +59,7 @@ public class DayDurationUtil implements ApplicationRunner {
public
PlatDayDurationRecord
get
(
String
oriDeviceId
)
{
public
PlatDayDurationRecord
get
(
String
oriDeviceId
)
{
PlatDayDurationRecord
platDayDurationRecord
=
RedisUtil
.
get
(
RedisConst
.
ELDER_DAY_DURATION_PREFIX
+
oriDeviceId
);
PlatDayDurationRecord
platDayDurationRecord
=
RedisUtil
.
get
(
RedisConst
.
ELDER_DAY_DURATION_PREFIX
+
oriDeviceId
);
if
(
platDayDurationRecord
==
null
){
if
(
platDayDurationRecord
==
null
){
getAll
();
//
getAll();
}
}
return
RedisUtil
.
get
(
RedisConst
.
ELDER_DAY_DURATION_PREFIX
+
oriDeviceId
);
return
RedisUtil
.
get
(
RedisConst
.
ELDER_DAY_DURATION_PREFIX
+
oriDeviceId
);
}
}
...
...
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