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
44d77a2e
authored
Dec 18, 2023
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:模拟测试夜间时间
parent
e199c0f3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
server-module/src/main/java/com/makeit/module/controller/wechat/alarm/PlatAlarmRecordWechatController.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
server-module/src/main/java/com/makeit/module/controller/wechat/alarm/PlatAlarmRecordWechatController.java
View file @
44d77a2e
...
...
@@ -10,8 +10,8 @@ import com.makeit.common.response.ApiResponseEntity;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO
;
import
com.makeit.enums.report.PlatformTypeEnum
;
import
com.makeit.global.annotation.AuthIgnore
;
import
com.makeit.service.platform.alarm.PlatAlarmRecordService
;
import
com.makeit.utils.user.common.CommonUserUtil
;
import
com.makeit.vo.platform.alarm.PlatAlarmRecordVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -33,10 +33,10 @@ public class PlatAlarmRecordWechatController {
@ApiOperation
(
"列表"
)
@PostMapping
(
"page"
)
//
@AuthIgnore
@AuthIgnore
public
ApiResponseEntity
<
Map
<
String
,
Object
>>
page
(
@RequestBody
PageReqDTO
<
PlatAlarmRecordQueryDTO
>
dto
)
{
//小程序告警记录只看到发给自己的告警
String
userId
=
CommonUserUtil
.
getUserId
()
;
String
userId
=
"1700085146788667394"
;
PlatAlarmRecordQueryDTO
data
=
dto
.
getData
();
data
.
setNotifyUser
(
userId
);
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
View file @
44d77a2e
...
...
@@ -150,6 +150,9 @@ public class OffBedAlarm implements IAlarm {
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
// 模拟时间
LocalDateTime
nowTest
=
LocalDateTime
.
now
().
plusHours
(
12
).
plusMinutes
(
40
);
currentTimeMillis
=
nowTest
.
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
boolean
isOverTime
=
(
currentTimeMillis
-
firstOffBedLong
)
/
1000
>=
duration
*
60
;
LocalDateTime
firstOffBedTime
=
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
firstOffBedLong
),
ZoneOffset
.
of
(
"+8"
));
LocalTime
firstTime
=
firstOffBedTime
.
toLocalTime
();
...
...
@@ -165,7 +168,7 @@ public class OffBedAlarm implements IAlarm {
noticeAlarm
(
alarmRedisDTO
,
platAlarmCheckDTO
,
deviceId
);
return
;
}
LocalDateTime
now
=
LocalDateTime
.
now
().
plusHours
(
12
).
plusMinutes
(
5
0
);
LocalDateTime
now
=
LocalDateTime
.
now
().
plusHours
(
12
).
plusMinutes
(
4
0
);
LocalDateTime
startLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
startTime
);
if
(!
isInTime
)
{
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
...
...
@@ -198,6 +201,8 @@ public class OffBedAlarm implements IAlarm {
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
LocalDateTime
nowTest
=
LocalDateTime
.
now
().
plusHours
(
12
).
plusMinutes
(
40
);
currentTimeMillis
=
nowTest
.
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
boolean
isOverTime
=
(
currentTimeMillis
-
firstOffBedLong
)
/
1000
>=
duration
*
60
;
LocalDateTime
firstOffBedTime
=
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
firstOffBedLong
),
ZoneOffset
.
of
(
"+8"
));
LocalTime
firstTime
=
firstOffBedTime
.
toLocalTime
();
...
...
@@ -218,7 +223,7 @@ public class OffBedAlarm implements IAlarm {
return
;
}
LocalDateTime
now
=
LocalDateTime
.
now
().
plusHours
(
12
).
plusMinutes
(
5
0
);
LocalDateTime
now
=
LocalDateTime
.
now
().
plusHours
(
12
).
plusMinutes
(
4
0
);
LocalTime
localTime
=
LocalTime
.
now
();
if
(!
isInTime
&&
localTime
.
isAfter
(
startTime
)
&&
localTime
.
isBefore
(
endTime
))
{
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
...
...
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