Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
9dce97e6
Commit
9dce97e6
authored
Apr 19, 2024
by
litengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中心检测问题处理
parent
2f8eb8c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
71 deletions
+15
-71
XmlBuilder.java
...java/com/yeejoin/equipmanage/common/utils/XmlBuilder.java
+1
-18
ICarLonAndLatDataService.java
...yeejoin/equipmanage/service/ICarLonAndLatDataService.java
+13
-13
CarLonAndLatDataServiceImpl.java
...equipmanage/service/impl/CarLonAndLatDataServiceImpl.java
+1
-40
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/XmlBuilder.java
View file @
9dce97e6
package
com
.
yeejoin
.
equipmanage
.
common
.
utils
;
package
com
.
yeejoin
.
equipmanage
.
common
.
utils
;
import
org.apache.tika.io.FilenameUtils
;
import
javax.xml.bind.JAXBContext
;
import
javax.xml.bind.Unmarshaller
;
import
java.io.Reader
;
import
java.io.StringReader
;
/**
/**
* @author keyong
* @author keyong
...
@@ -17,18 +12,6 @@ import java.io.StringReader;
...
@@ -17,18 +12,6 @@ import java.io.StringReader;
*/
*/
public
class
XmlBuilder
{
public
class
XmlBuilder
{
public
static
Object
xmlStrToObject
(
Class
<?>
clazz
,
String
xmlStr
)
throws
Exception
{
Object
obj
=
null
;
StringReader
reader
=
null
;
JAXBContext
context
=
JAXBContext
.
newInstance
(
clazz
);
Unmarshaller
un
=
context
.
createUnmarshaller
();
un
.
setProperty
(
"com.sun.xml.bind.v2.runtime.property.DisableExternalEntities"
,
true
);
// 禁用外部实体解析
reader
=
new
StringReader
(
FilenameUtils
.
normalize
(
xmlStr
));
obj
=
un
.
unmarshal
(
reader
);
if
(
null
!=
reader
)
{
reader
.
close
();
}
return
obj
;
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/ICarLonAndLatDataService.java
View file @
9dce97e6
...
@@ -15,17 +15,17 @@ import java.util.List;
...
@@ -15,17 +15,17 @@ import java.util.List;
*/
*/
public
interface
ICarLonAndLatDataService
{
public
interface
ICarLonAndLatDataService
{
/**
//
/**
* 获取经纬list
//
* 获取经纬list
* @return
//
* @return
* @throws Exception
//
* @throws Exception
*/
//
*/
List
<
LonAndLatEntityVo
>
listCarLonAndLat
()
throws
Exception
;
//
List<LonAndLatEntityVo> listCarLonAndLat() throws Exception;
//
/**
//
/**
* 获取车辆速度和路线
//
* 获取车辆速度和路线
* @return
//
* @return
* @throws Exception
//
* @throws Exception
*/
//
*/
List
<
SpeedAndTimeEntityVo
>
listCarSpeedAndGround
()
throws
Exception
;
//
List<SpeedAndTimeEntityVo> listCarSpeedAndGround() throws Exception;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/CarLonAndLatDataServiceImpl.java
View file @
9dce97e6
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
com.yeejoin.equipmanage.common.utils.XmlBuilder
;
import
com.yeejoin.equipmanage.common.vo.LonAndLatEntityVo
;
import
com.yeejoin.equipmanage.common.vo.LonAndLatList
;
import
com.yeejoin.equipmanage.common.vo.SpeedAndTimeEntityVo
;
import
com.yeejoin.equipmanage.common.vo.SpeedAndTimeList
;
import
com.yeejoin.equipmanage.service.ICarLonAndLatDataService
;
import
com.yeejoin.equipmanage.service.ICarLonAndLatDataService
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
...
@@ -27,40 +23,5 @@ import java.util.List;
...
@@ -27,40 +23,5 @@ import java.util.List;
@Service
@Service
public
class
CarLonAndLatDataServiceImpl
implements
ICarLonAndLatDataService
{
public
class
CarLonAndLatDataServiceImpl
implements
ICarLonAndLatDataService
{
@Override
public
List
<
LonAndLatEntityVo
>
listCarLonAndLat
()
throws
Exception
{
Resource
resource
=
new
ClassPathResource
(
"car-history-track-data.xml"
);
try
(
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
resource
.
getInputStream
());
BufferedReader
br
=
new
BufferedReader
(
inputStreamReader
);)
{
StringBuffer
buffer
=
new
StringBuffer
();
String
line
=
""
;
while
((
line
=
br
.
readLine
())!=
null
)
{
buffer
.
append
(
line
);
}
LonAndLatList
list
=
(
LonAndLatList
)
XmlBuilder
.
xmlStrToObject
(
LonAndLatList
.
class
,
buffer
.
toString
());
return
list
.
getDataList
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
new
ArrayList
<>();
}
@Override
public
List
<
SpeedAndTimeEntityVo
>
listCarSpeedAndGround
()
throws
Exception
{
Resource
resource
=
new
ClassPathResource
(
"car-history-trend-data.xml"
);
try
(
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
resource
.
getInputStream
());
BufferedReader
br
=
new
BufferedReader
(
inputStreamReader
);)
{
StringBuffer
buffer
=
new
StringBuffer
();
String
line
=
""
;
while
((
line
=
br
.
readLine
())
!=
null
)
{
buffer
.
append
(
line
);
}
SpeedAndTimeList
list
=
(
SpeedAndTimeList
)
XmlBuilder
.
xmlStrToObject
(
SpeedAndTimeList
.
class
,
buffer
.
toString
());
return
list
.
getDataList
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
new
ArrayList
<>();
}
}
}
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