Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
Overview
Overview
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
platform
hp-smart
Commits
1cec0d24
Commit
1cec0d24
authored
Apr 16, 2024
by
TEEMO\xzh64
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改设备日志记录,添加定时任务,清除30天之前的日志
parent
803e53fd
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
5 deletions
+48
-5
LogInformationController.java
...om/baosight/hpjx/controller/LogInformationController.java
+20
-3
ServiceHPSB001.java
.../java/com/baosight/hpjx/hp/sb/service/ServiceHPSB001.java
+10
-2
ServiceHPSB002.java
.../java/com/baosight/hpjx/hp/sb/service/ServiceHPSB002.java
+8
-0
HPSB001.xml
src/main/java/com/baosight/hpjx/hp/sb/sql/HPSB001.xml
+5
-0
HPSB002.xml
src/main/java/com/baosight/hpjx/hp/sb/sql/HPSB002.xml
+5
-0
No files found.
src/main/java/com/baosight/hpjx/controller/LogInformationController.java
View file @
1cec0d24
...
...
@@ -30,13 +30,27 @@ public class LogInformationController extends ServiceBase {
HPSB001
hpsb001
=
new
HPSB001
();
//解析设备状态
List
<
CutterbarStatus
>
cutterbarStatusList
=
XmlUtils
.
readXml
(
hpsb00A
.
getEquipmentType
(),
CutterbarStatus
.
class
);
String
value
=
""
;
if
(
cutterbarStatusList
.
get
(
0
).
getStatus
()
==
1
){
value
=
"默认状态"
;
}
else
if
(
cutterbarStatusList
.
get
(
0
).
getStatus
()
==
2
){
value
=
"运行状态"
;
}
else
if
(
cutterbarStatusList
.
get
(
0
).
getStatus
()
==
3
){
value
=
"暂停状态"
;
}
else
if
(
cutterbarStatusList
.
get
(
0
).
getStatus
()
==
4
){
value
=
"复位状态"
;
}
else
if
(
cutterbarStatusList
.
get
(
0
).
getStatus
()
==
5
){
value
=
"一级报警状态"
;
}
else
if
(
cutterbarStatusList
.
get
(
0
).
getStatus
()
==
6
){
value
=
"二级报警状态"
;
}
//解析数据内容
List
<
CutterbarWarningBase
>
cutterbarWarningBaseList
=
XmlUtils
.
readXml
(
hpsb00A
.
getDataContent
(),
CutterbarWarningBase
.
class
);
CutterbarWarning
cutterbarWarning
=
new
CutterbarWarning
();
if
(
CollectionUtils
.
isNotEmpty
(
cutterbarWarningBaseList
))
{
cutterbarWarning
=
CutterbarWarning
.
convertBase
(
cutterbarWarningBaseList
.
get
(
0
));
}
if
(
cutterbarStatusList
.
get
(
0
).
getStatus
()
==
1
)
{
if
(
cutterbarStatusList
.
get
(
0
).
getStatus
()
>
2
)
{
hpsb001
.
setId
(
StringUtils
.
uuid
());
hpsb001
.
setErrorCode
(
cutterbarWarning
.
getErrorCode
());
hpsb001
.
setPrio
(
cutterbarWarning
.
getPrio
());
...
...
@@ -45,7 +59,7 @@ public class LogInformationController extends ServiceBase {
hpsb001
.
setGotoRowNone
(
cutterbarWarning
.
getGotoRowNone
());
hpsb001
.
setFileName
(
cutterbarWarning
.
getFileName
());
hpsb001
.
setEquipmentCode
(
hpsb00A
.
getEquipmentCode
());
hpsb001
.
setEquipmentType
(
cutterbarStatusList
.
get
(
0
).
getStatus
().
toString
()
);
hpsb001
.
setEquipmentType
(
value
);
DaoUtils
.
insert
(
"HPSB001.insert"
,
hpsb001
);
return
"设备异常日志记录成功"
;
}
...
...
@@ -57,9 +71,12 @@ public class LogInformationController extends ServiceBase {
hpsb002
.
setGotoRowNone
(
cutterbarWarning
.
getGotoRowNone
());
hpsb002
.
setFileName
(
cutterbarWarning
.
getFileName
());
hpsb002
.
setEquipmentCode
(
hpsb00A
.
getEquipmentCode
());
hpsb002
.
setEquipmentType
(
cutterbarStatusList
.
get
(
0
).
getStatus
().
toString
()
);
hpsb002
.
setEquipmentType
(
value
);
DaoUtils
.
insert
(
"HPSB002.insert"
,
hpsb002
);
return
"设备日志记录成功"
;
}
}
src/main/java/com/baosight/hpjx/hp/sb/service/ServiceHPSB001.java
View file @
1cec0d24
...
...
@@ -50,7 +50,7 @@ public class ServiceHPSB001 extends ServiceBase {
@OperationLogAnnotation
(
operModul
=
"设备异常日志"
,
operType
=
"新增"
,
operDesc
=
"新增"
)
@Override
public
EiInfo
insert
(
EiInfo
inInfo
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy
-MM-dd HH:mm:
ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy
MMddHHmm
ss"
);
try
{
HPSB001
hpsb001
=
new
HPSB001
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
);
...
...
@@ -82,7 +82,7 @@ public class ServiceHPSB001 extends ServiceBase {
*/
@OperationLogAnnotation
(
operModul
=
"设备异常日志"
,
operType
=
"修改"
,
operDesc
=
"修改"
)
public
EiInfo
update
(
EiInfo
inInfo
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy
-MM-dd HH:mm:
ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy
MMddHHmm
ss"
);
try
{
HPSB001
hpsb001
=
new
HPSB001
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
);
...
...
@@ -132,4 +132,12 @@ public class ServiceHPSB001 extends ServiceBase {
return
eiInfo
;
}
/**
* 定时删除操作.
*/
@OperationLogAnnotation
(
operModul
=
"设备异常日志"
,
operType
=
"删除"
,
operDesc
=
"删除30天之前的历史数据"
)
public
EiInfo
deleteHistory
(
EiInfo
inInfo
)
{
return
super
.
delete
(
inInfo
,
"HPSB001.deleteByCreatedTime"
);
}
}
src/main/java/com/baosight/hpjx/hp/sb/service/ServiceHPSB002.java
View file @
1cec0d24
...
...
@@ -132,4 +132,12 @@ public class ServiceHPSB002 extends ServiceBase {
return
eiInfo
;
}
/**
* 定时删除操作.
*/
@OperationLogAnnotation
(
operModul
=
"设备日志"
,
operType
=
"删除"
,
operDesc
=
"删除30天之前的历史数据"
)
public
EiInfo
deleteHistory
(
EiInfo
inInfo
)
{
return
super
.
delete
(
inInfo
,
"HPSB002.deleteByCreatedTime"
);
}
}
src/main/java/com/baosight/hpjx/hp/sb/sql/HPSB001.xml
View file @
1cec0d24
...
...
@@ -141,6 +141,11 @@
ID = #id#
</delete>
<delete
id=
"deleteByCreatedTime"
>
DELETE FROM hpjx.t_hpsb001 WHERE
SUBSTR(CREATED_TIME,1,8)
<
DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 day),'%Y%m%d')
</delete>
<update
id=
"update"
>
UPDATE hpjx.t_hpsb001
SET
...
...
src/main/java/com/baosight/hpjx/hp/sb/sql/HPSB002.xml
View file @
1cec0d24
...
...
@@ -141,6 +141,11 @@
ID = #id#
</delete>
<delete
id=
"deleteByCreatedTime"
>
DELETE FROM hpjx.t_hpsb002 WHERE
SUBSTR(CREATED_TIME,1,8)
<
DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 day),'%Y%m%d')
</delete>
<update
id=
"update"
>
UPDATE hpjx.t_hpsb002
SET
...
...
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