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
00d3aa41
authored
Sep 26, 2023
by
杨伟程
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev' of
http://git.xmmakeit.com/huangjiay/iot-platform-server
into dev
parents
60f91638
70b3e0e0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
12 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/service/saas/SaasModelManageService.java
server-service/src/main/java/com/makeit/service/saas/impl/SaasDiseaseModelServiceImpl.java
server-service/src/main/java/com/makeit/service/saas/impl/SaasSleepAnalysisModelServiceImpl.java
server-service/src/main/java/com/makeit/task/IotSyncTask.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 @
00d3aa41
...
@@ -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 @
00d3aa41
...
@@ -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/service/saas/SaasModelManageService.java
View file @
00d3aa41
...
@@ -13,5 +13,5 @@ import com.makeit.entity.saas.analysis.SaasModelManage;
...
@@ -13,5 +13,5 @@ import com.makeit.entity.saas.analysis.SaasModelManage;
*/
*/
public
interface
SaasModelManageService
extends
IService
<
SaasModelManage
>
{
public
interface
SaasModelManageService
extends
IService
<
SaasModelManage
>
{
void
updateEntity
(
String
id
,
String
sleep
);
void
updateEntity
(
String
id
,
String
type
);
}
}
server-service/src/main/java/com/makeit/service/saas/impl/SaasDiseaseModelServiceImpl.java
View file @
00d3aa41
...
@@ -51,6 +51,6 @@ public class SaasDiseaseModelServiceImpl extends ServiceImpl<SaasDiseaseModelMap
...
@@ -51,6 +51,6 @@ public class SaasDiseaseModelServiceImpl extends ServiceImpl<SaasDiseaseModelMap
BeanUtils
.
copyProperties
(
dto
,
entity
);
BeanUtils
.
copyProperties
(
dto
,
entity
);
saveOrUpdate
(
entity
);
saveOrUpdate
(
entity
);
saasModelManageService
.
updateEntity
(
dto
.
getId
(),
"
sleep
"
);
saasModelManageService
.
updateEntity
(
dto
.
getId
(),
"
disease
"
);
}
}
}
}
server-service/src/main/java/com/makeit/service/saas/impl/SaasSleepAnalysisModelServiceImpl.java
View file @
00d3aa41
...
@@ -52,7 +52,7 @@ public class SaasSleepAnalysisModelServiceImpl extends ServiceImpl<SaasSleepAnal
...
@@ -52,7 +52,7 @@ public class SaasSleepAnalysisModelServiceImpl extends ServiceImpl<SaasSleepAnal
BeanUtils
.
copyProperties
(
dto
,
entity
);
BeanUtils
.
copyProperties
(
dto
,
entity
);
saveOrUpdate
(
entity
);
saveOrUpdate
(
entity
);
saasModelManageService
.
updateEntity
(
dto
.
getId
(),
"
disease
"
);
saasModelManageService
.
updateEntity
(
dto
.
getId
(),
"
sleep
"
);
}
}
}
}
server-service/src/main/java/com/makeit/task/IotSyncTask.java
View file @
00d3aa41
...
@@ -107,6 +107,7 @@ public class IotSyncTask {
...
@@ -107,6 +107,7 @@ public class IotSyncTask {
}
}
platDevice
.
setOriDeviceId
(
iotDevice
.
getId
());
platDevice
.
setOriDeviceId
(
iotDevice
.
getId
());
platDevice
.
setName
(
iotDevice
.
getName
());
platDevice
.
setName
(
iotDevice
.
getName
());
platDevice
.
setOrgId
(
tenantId
);
String
productName
=
iotDevice
.
getProductName
();
String
productName
=
iotDevice
.
getProductName
();
platDevice
.
setProductName
(
productName
);
platDevice
.
setProductName
(
productName
);
platDevice
.
setProductId
(
iotDevice
.
getProductId
());
platDevice
.
setProductId
(
iotDevice
.
getProductId
());
...
...
server-service/src/main/java/com/makeit/utils/DayDurationUtil.java
View file @
00d3aa41
...
@@ -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