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
cfdda15b
Commit
cfdda15b
authored
Apr 24, 2024
by
yukang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据采集接收接口
parent
2d448aa8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
0 deletions
+100
-0
ServiceHPTCP001.java
...java/com/baosight/hpjx/hp/tc/service/ServiceHPTCP001.java
+100
-0
No files found.
src/main/java/com/baosight/hpjx/hp/tc/service/ServiceHPTCP001.java
0 → 100644
View file @
cfdda15b
package
com
.
baosight
.
hpjx
.
hp
.
tc
.
service
;
import
com.baosight.hpjx.common.HPConstants
;
import
com.baosight.hpjx.equipment.hp.domain.CutterbarStatus
;
import
com.baosight.hpjx.equipment.hp.domain.CutterbarTime
;
import
com.baosight.hpjx.equipment.hp.domain.CutterbarWarning
;
import
com.baosight.hpjx.equipment.hp.domain.CutterbarWarningBase
;
import
com.baosight.hpjx.hp.sb.domain.HPSB001
;
import
com.baosight.hpjx.hp.sb.domain.HPSB002
;
import
com.baosight.hpjx.hp.sb.domain.HPSB00A
;
import
com.baosight.hpjx.util.DateUtils
;
import
com.baosight.hpjx.util.StringUtils
;
import
com.baosight.hpjx.xml.XmlUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ServiceHPTCP001
extends
ServiceBase
{
public
EiInfo
logAnalysis
(
EiInfo
inInfo
)
{
HPSB002
hpsb002
=
new
HPSB002
();
HPSB001
hpsb001
=
new
HPSB001
();
List
<
HPSB002
>
hpsb002List
=
new
ArrayList
<>();
List
<
HPSB001
>
hpsb001List
=
new
ArrayList
<>();
EiInfo
outInfo
=
new
EiInfo
();
//TODO 根据TYPE来判断内容属于哪一种,然后再进行解析
//TODO TYPE = STARUS_TYPE --- 设备状态
//TODO TYPE = TIME_TYPE --- 开机时间
//TODO TYPE = WARNING_TYPE --- 报警内容
String
equipmentType
=
inInfo
.
getString
(
"equipmentType"
);
String
dataContent
=
inInfo
.
getString
(
"dataContent"
);
String
equipmentCode
=
inInfo
.
getString
(
"equipmentCode"
);
HPSB00A
hpsb00A
=
new
HPSB00A
();
hpsb00A
.
setDataContent
(
dataContent
);
hpsb00A
.
setEquipmentType
(
equipmentType
);
hpsb00A
.
setEquipmentCode
(
equipmentCode
);
if
(
StringUtils
.
isNotEmpty
(
equipmentType
))
{
if
(
equipmentType
.
equals
(
HPConstants
.
STARUS_TYPE
))
{
//解析设备状态
List
<
CutterbarStatus
>
cutterbarStatusList
=
XmlUtils
.
readXml
(
hpsb00A
.
getDataContent
(),
CutterbarStatus
.
class
);
hpsb002
.
setId
(
StringUtils
.
uuid
());
hpsb002
.
setEquipmentCode
(
hpsb00A
.
getEquipmentCode
());
hpsb002
.
setEquipmentType
(
hpsb00A
.
getEquipmentType
());
hpsb002
.
setLogValue
(
cutterbarStatusList
.
get
(
0
).
getStatus
().
toString
());
hpsb002
.
setCreatedBy
(
"自动化中转程序"
);
hpsb002
.
setCreatedTime
(
DateUtils
.
shortDateTime
());
this
.
dao
.
insert
(
"HPSB002.insert"
,
hpsb002
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
outInfo
.
getMsg
());
return
inInfo
;
}
if
(
equipmentType
.
equals
(
HPConstants
.
TIME_TYPE
))
{
//解析开机时间
List
<
CutterbarTime
>
cutterbarTimeList
=
XmlUtils
.
readXml
(
hpsb00A
.
getDataContent
(),
CutterbarTime
.
class
);
hpsb002
.
setId
(
StringUtils
.
uuid
());
hpsb002
.
setEquipmentCode
(
hpsb00A
.
getEquipmentCode
());
hpsb002
.
setEquipmentType
(
hpsb00A
.
getEquipmentType
());
hpsb002
.
setLogValue
(
cutterbarTimeList
.
get
(
0
).
getTime
());
hpsb002
.
setCreatedBy
(
"自动化中转程序"
);
hpsb002
.
setCreatedTime
(
DateUtils
.
shortDateTime
());
this
.
dao
.
insert
(
"HPSB002.insert"
,
hpsb002
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
outInfo
.
getMsg
());
return
inInfo
;
}
if
(
equipmentType
.
equals
(
HPConstants
.
WARNING_TYPE
))
{
//解析报警内容
List
<
CutterbarWarningBase
>
cutterbarWarningBaseList
=
XmlUtils
.
readXml
(
hpsb00A
.
getDataContent
(),
CutterbarWarningBase
.
class
);
CutterbarWarning
cutterbarWarning
=
new
CutterbarWarning
();
if
(
CollectionUtils
.
isNotEmpty
(
cutterbarWarningBaseList
))
{
cutterbarWarning
=
CutterbarWarning
.
convertBase
(
cutterbarWarningBaseList
.
get
(
0
));
}
hpsb001
.
setId
(
StringUtils
.
uuid
());
hpsb001
.
setErrorCode
(
cutterbarWarning
.
getErrorCode
());
hpsb001
.
setPrio
(
cutterbarWarning
.
getPrio
());
hpsb001
.
setProgramNo
(
cutterbarWarning
.
getProgramNo
());
hpsb001
.
setRowno
(
cutterbarWarning
.
getRowNo
());
hpsb001
.
setGotoRowNone
(
cutterbarWarning
.
getGotoRowNone
());
hpsb001
.
setFileName
(
cutterbarWarning
.
getFileName
());
hpsb001
.
setEquipmentCode
(
hpsb00A
.
getEquipmentCode
());
hpsb001
.
setEquipmentType
(
hpsb00A
.
getEquipmentType
());
hpsb001
.
setCreatedBy
(
"自动化中转程序"
);
hpsb001
.
setCreatedTime
(
DateUtils
.
shortDateTime
());
this
.
dao
.
insert
(
"HPSB001.insert"
,
hpsb002
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
outInfo
.
getMsg
());
return
inInfo
;
}
}
inInfo
.
setStatus
(
500
);
inInfo
.
setMsg
(
"未解析到数据类型"
);
return
inInfo
;
}
}
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