Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
TDLCloud
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WitCloud
TDLCloud
Commits
e4eccda8
Commit
e4eccda8
authored
Oct 12, 2023
by
Carit Zhu
🎱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在addAlarmLog接口中添加判断,当告警时间戳大于当前时间则使用当前时间。
parent
c3ec2aec
Pipeline
#2413
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
AlarmNoVo.java
src/main/java/com/example/tdl/domain/vo/AlarmNoVo.java
+3
-1
AlarmLogController.java
src/main/java/com/example/tdl/web/AlarmLogController.java
+21
-9
No files found.
src/main/java/com/example/tdl/domain/vo/AlarmNoVo.java
View file @
e4eccda8
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
AlarmNoVo
{
/**
* 使用场景: 1 = 运输线路, 2 = 仓库
*/
private
Integer
mode
;
private
String
transportationNo
;
...
...
src/main/java/com/example/tdl/web/AlarmLogController.java
View file @
e4eccda8
...
...
@@ -220,6 +220,20 @@ public class AlarmLogController {
return
gson
.
toJson
(
new
MqttUser
(
userName
,
password
,
userRedisVo
.
getCompanyNo
()));
}
private
Long
checkTimestamp
(
Long
ts
)
{
long
currentTs
=
System
.
currentTimeMillis
();
if
(
ts
==
null
)
{
return
currentTs
;
}
if
(
ts
.
toString
().
length
()
==
10
){
ts
*=
1000
;
// 转换成毫秒单位
}
// 如果时间戳大于当前时间则使用当前时间
if
(
ts
>
currentTs
)
{
return
currentTs
;
}
return
ts
;
}
//新增报警消息
@ApiOperation
(
value
=
"增加报警"
,
notes
=
"增加报警"
)
...
...
@@ -248,10 +262,8 @@ public class AlarmLogController {
//网关离线报警
String
desp
=
"Gateway("
+
addAlarmLogVo
.
getGsn
()
+
")"
+
AlarmLogUtil
.
getDescription
(
addAlarmLogVo
.
getAlarmno
());
String
classify
=
"6"
;
Long
time
=
addAlarmLogVo
.
getTs
();
if
(
time
.
toString
().
length
()
==
10
){
time
=
time
*
1000
;
}
Long
time
=
addAlarmLogVo
.
getTs
();
time
=
checkTimestamp
(
time
);
AlarmLog
alarmLog
=
new
AlarmLog
(
alarmNoVo
.
getTransportationNo
(),
resultCircuitVo
.
getStartCity
(),
resultCircuitVo
.
getEndCity
(),
null
,
desp
,
null
,
time
,
classify
,
"offline"
,
addAlarmLogVo
.
getAlarmno
());
alarmLogServcie
.
addAlarmLog
(
alarmLog
);
}
...
...
@@ -299,16 +311,16 @@ public class AlarmLogController {
String
desp
=
"Gateway("
+
addAlarmLogVo
.
getGsn
()
+
")"
+
AlarmLogUtil
.
getDescription
(
addAlarmLogVo
.
getAlarmno
());
String
classify
=
"6"
;
Long
time
=
addAlarmLogVo
.
getTs
();
if
(
time
.
toString
().
length
()
==
10
){
time
=
time
*
1000
;
}
time
=
checkTimestamp
(
time
);
//发送短信邮件
Integer
delState
=
0
;
int
delState
=
0
;
if
(
alarmTime
==
null
||
(
time
-
alarmTime
)
>
alarmIntervalTime
){
sendMessage
(
alarmNoVo
.
getWarehouseName
(),
desp
,
userList
);
delState
=
1
;
}
WarehouseAlarmLog
alarmLog
=
new
WarehouseAlarmLog
(
alarmNoVo
.
getWarehouseNo
(),
addAlarmLogVo
.
getGsn
(),
addAlarmLogVo
.
getGtype
(),
null
,
desp
,
null
,
time
,
"offline"
,
addAlarmLogVo
.
getAlarmno
(),
classify
,
delState
);
WarehouseAlarmLog
alarmLog
=
new
WarehouseAlarmLog
(
alarmNoVo
.
getWarehouseNo
(),
addAlarmLogVo
.
getGsn
(),
addAlarmLogVo
.
getGtype
(),
null
,
desp
,
null
,
time
,
"offline"
,
addAlarmLogVo
.
getAlarmno
(),
classify
,
delState
);
warehouseAlarmLogService
.
add
(
alarmLog
);
}
if
(
addAlarmLogVo
.
getAlarm
()
!=
null
&&
addAlarmLogVo
.
getAlarm
().
size
()>
0
){
...
...
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