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
36655ce1
authored
Dec 16, 2023
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:回退代码
parent
1a9a479c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
server-web/src/test/java/com/makeit/iotapi/IotDeviceInfoContentFall.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
View file @
36655ce1
...
@@ -96,7 +96,6 @@ public class OffBedAlarm implements IAlarm {
...
@@ -96,7 +96,6 @@ public class OffBedAlarm implements IAlarm {
return
;
return
;
}
}
log
.
info
(
"离床预警时间范围,begin:{},end:{}"
,
startTime
,
endTime
);
log
.
info
(
"离床预警时间范围,begin:{},end:{}"
,
startTime
,
endTime
);
String
personState
=
Convert
.
toStr
(
properties
.
get
(
"person"
));
String
personState
=
Convert
.
toStr
(
properties
.
get
(
"person"
));
boolean
isOffBed
=
"0"
.
equals
(
personState
);
boolean
isOffBed
=
"0"
.
equals
(
personState
);
// 1-有人 0-无人
// 1-有人 0-无人
...
@@ -199,7 +198,6 @@ public class OffBedAlarm implements IAlarm {
...
@@ -199,7 +198,6 @@ public class OffBedAlarm implements IAlarm {
LocalTime
startTime
=
ruleConfig
.
getOffBedStart
();
LocalTime
startTime
=
ruleConfig
.
getOffBedStart
();
LocalDateTime
startLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
startTime
);
LocalDateTime
startLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
startTime
);
LocalTime
endTime
=
ruleConfig
.
getOffBedEnd
();
LocalTime
endTime
=
ruleConfig
.
getOffBedEnd
();
LocalDateTime
endLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
endTime
);
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
...
@@ -207,11 +205,6 @@ public class OffBedAlarm implements IAlarm {
...
@@ -207,11 +205,6 @@ public class OffBedAlarm implements IAlarm {
LocalDateTime
firstOffBedTime
=
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
firstOffBedLong
),
ZoneOffset
.
of
(
"+8"
));
LocalDateTime
firstOffBedTime
=
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
firstOffBedLong
),
ZoneOffset
.
of
(
"+8"
));
LocalTime
firstTime
=
firstOffBedTime
.
toLocalTime
();
LocalTime
firstTime
=
firstOffBedTime
.
toLocalTime
();
if
(
firstTime
.
isAfter
(
endTime
))
{
log
.
info
(
"handleUnCrossDay第一次离床时间:{},在时间范围外 config:{}"
,
firstTime
,
config
.
getRuleConfig
());
return
;
}
boolean
isInTime
=
firstTime
.
isAfter
(
startTime
)
&&
firstTime
.
isBefore
(
endTime
);
boolean
isInTime
=
firstTime
.
isAfter
(
startTime
)
&&
firstTime
.
isBefore
(
endTime
);
LocalTime
endTimeLimit
=
endTime
.
plusMinutes
(-
duration
);
LocalTime
endTimeLimit
=
endTime
.
plusMinutes
(-
duration
);
...
@@ -229,7 +222,7 @@ public class OffBedAlarm implements IAlarm {
...
@@ -229,7 +222,7 @@ public class OffBedAlarm implements IAlarm {
}
}
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
if
(!
isInTime
&&
now
.
isAfter
(
startLocalDteTime
)
&&
now
.
isBefore
(
endLocalDteTime
)
)
{
if
(!
isInTime
&&
now
.
isAfter
(
startLocalDteTime
))
{
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
boolean
noInOverTime
=
mills
>=
duration
*
60
;
boolean
noInOverTime
=
mills
>=
duration
*
60
;
if
(
noInOverTime
)
{
if
(
noInOverTime
)
{
...
...
server-web/src/test/java/com/makeit/iotapi/IotDeviceInfoContentFall.java
View file @
36655ce1
package
com
.
makeit
.
iotapi
;
package
com
.
makeit
.
iotapi
;
import
com.makeit.dto.platform.alarm.PlatAlarmCheckDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.module.admin.vo.plat.PlatTenantVO
;
import
com.makeit.module.admin.vo.plat.PlatTenantVO
;
import
com.makeit.module.iot.service.IotOrgService
;
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.service.IotTokenService
;
import
com.makeit.module.iot.service.IotTokenService
;
import
com.makeit.service.platform.alarm.alarmStrategy.OffBedAlarm
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
@@ -17,6 +20,8 @@ public class IotDeviceInfoContentFall {
...
@@ -17,6 +20,8 @@ public class IotDeviceInfoContentFall {
private
IotOrgService
iotOrgService
;
private
IotOrgService
iotOrgService
;
@Autowired
@Autowired
private
IotProductDeviceService
iotProductDeviceService
;
private
IotProductDeviceService
iotProductDeviceService
;
@Autowired
private
OffBedAlarm
offBedAlarm
;
@Test
@Test
...
@@ -76,4 +81,14 @@ public class IotDeviceInfoContentFall {
...
@@ -76,4 +81,14 @@ public class IotDeviceInfoContentFall {
void
updateIotOrgInfo
()
{
void
updateIotOrgInfo
()
{
iotOrgService
.
updateIotOrgInfo
(
"1698964909267415040"
,
"lxl2234"
);
iotOrgService
.
updateIotOrgInfo
(
"1698964909267415040"
,
"lxl2234"
);
}
}
@Test
void
offBedAlarm
()
{
PlatAlarmCheckDTO
platAlarmCheckDTO
=
new
PlatAlarmCheckDTO
();
PlatDevice
platDevice
=
new
PlatDevice
();
platDevice
.
setOrgId
(
"1712384736845950978"
);
platDevice
.
setId
(
"1732609639364812811"
);
platAlarmCheckDTO
.
setPlatDevice
(
platDevice
);
offBedAlarm
.
checkConfig
(
platAlarmCheckDTO
);
}
}
}
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