Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-devicemonitor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 570d4f8e
authored
Oct 26, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复obd设备类型错误bug
1 parent
916085ac
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
19 deletions
src/main/java/cn/com/glsx/devicemonitor/modules/components/HdaoGpsComponent.java
src/main/java/cn/com/glsx/devicemonitor/modules/components/HdaoGpsComponent.java
View file @
570d4f8
...
...
@@ -19,6 +19,7 @@ import cn.com.glsx.devicemonitor.modules.entity.inner.DataGpsLocation;
import
cn.com.glsx.devicemonitor.modules.model.*
;
import
cn.com.glsx.devicemonitor.modules.utils.*
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
...
...
@@ -57,6 +58,7 @@ public class HdaoGpsComponent {
/**
* 调用ice 批量获取GPS or 基站 数据
*
* @param gpsBsLastBatchRequest
* @return
*/
...
...
@@ -100,6 +102,7 @@ public class HdaoGpsComponent {
/**
* 位置信息转换地址
*
* @param lat
* @param lng
* @return
...
...
@@ -118,12 +121,12 @@ public class HdaoGpsComponent {
return
resultAddress
;
}
int
geoRes
=
ipoiSearchNearPrx
.
ReverseGeocoding2
(
ptCenterGeopoint
,
poiSearchHolder
);
if
(
geoRes
!=
0
)
{
if
(
geoRes
!=
0
)
{
// 结果为 0 表示调用成功
return
resultAddress
;
}
if
(
poiSearchHolder
.
value
==
null
if
(
poiSearchHolder
.
value
==
null
||
StringUtils
.
isEmpty
(
poiSearchHolder
.
value
))
{
return
resultAddress
;
}
...
...
@@ -140,6 +143,7 @@ public class HdaoGpsComponent {
/**
* 获取设备 最新基站位置数据
*
* @param sn
* @param deviceTypeRelationEnum
* @return
...
...
@@ -147,7 +151,7 @@ public class HdaoGpsComponent {
public
DataBsLocation
getDeviceLastBsInfo
(
String
sn
,
DeviceTypeRelationEnum
deviceTypeRelationEnum
)
{
DataBsLocation
dataBsLocation
=
null
;
try
{
if
(
daoGpsServicePrx
==
null
)
{
if
(
daoGpsServicePrx
==
null
)
{
log
.
info
(
"getDeviceLastBsInfo daoGpsServicePrx iceServer exception"
);
return
dataBsLocation
;
}
...
...
@@ -157,14 +161,14 @@ public class HdaoGpsComponent {
boolean
ret
=
false
;
LatestBsGetRequest
req
=
new
LatestBsGetRequest
(
Long
.
parseLong
(
sn
),
deviceTypeRelationEnum
.
getDataDeviceType
());
ret
=
daoGpsServicePrx
.
getLatestBsRecord
(
req
,
res
);
if
(
ret
)
{
if
(
ret
)
{
dataBsLocation
=
new
DataBsLocation
();
dataBsLocation
.
setSn
(
sn
);
dataBsLocation
.
setMcc
(
String
.
valueOf
(
res
.
value
.
record
.
mcc
));
dataBsLocation
.
setMnc
(
String
.
valueOf
(
res
.
value
.
record
.
mnc
));
BsInfo
[]
bsInfos
=
res
.
value
.
record
.
bsInfos
;
if
(
bsInfos
!=
null
&&
bsInfos
.
length
>
0
)
{
if
(
bsInfos
!=
null
&&
bsInfos
.
length
>
0
)
{
log
.
info
(
"基站位置信息:{}"
,
JSON
.
toJSONString
(
bsInfos
));
for
(
int
i
=
0
;
i
<
bsInfos
.
length
;
i
++)
{
BsInfo
bsInfo
=
bsInfos
[
i
];
...
...
@@ -189,6 +193,7 @@ public class HdaoGpsComponent {
/**
* 获取设备 最新GPS位置数据
*
* @param sn
* @param deviceTypeRelationEnum
* @return
...
...
@@ -196,7 +201,7 @@ public class HdaoGpsComponent {
public
DataGpsLocation
getDeviceLastGpsInfo
(
String
sn
,
DeviceTypeRelationEnum
deviceTypeRelationEnum
)
{
DataGpsLocation
dataGpsLocation
=
null
;
try
{
if
(
daoGpsServicePrx
==
null
)
{
if
(
daoGpsServicePrx
==
null
)
{
log
.
info
(
"getDeviceLastGpsInfo daoGpsServicePrx iceServer exception"
);
return
dataGpsLocation
;
}
...
...
@@ -206,7 +211,7 @@ public class HdaoGpsComponent {
boolean
ret
=
false
;
LatestGpsGetRequest
req
=
new
LatestGpsGetRequest
(
Long
.
parseLong
(
sn
),
deviceTypeRelationEnum
.
getDataDeviceType
(),
GeoCoordinateEnum
.
GOOGLE_BAIDU
.
getCoordType
());
ret
=
daoGpsServicePrx
.
getLatestGpsRecord
(
req
,
res
);
if
(
ret
)
{
if
(
ret
)
{
dataGpsLocation
=
new
DataGpsLocation
();
dataGpsLocation
.
setSn
(
sn
);
...
...
@@ -238,13 +243,14 @@ public class HdaoGpsComponent {
/**
* 获取位置信息 并构建地址信息
*
* @param sn
* @param deviceTypeRelationEnum
* @return
*/
public
DataGpsLocation
getDeviceLastGpsInfoFull
(
String
sn
,
DeviceTypeRelationEnum
deviceTypeRelationEnum
)
{
DataGpsLocation
dataGpsLocation
=
getDeviceLastGpsInfo
(
sn
,
deviceTypeRelationEnum
);
if
(
dataGpsLocation
==
null
if
(
dataGpsLocation
==
null
||
StringUtils
.
isEmpty
(
dataGpsLocation
.
getLng
())
||
StringUtils
.
isEmpty
(
dataGpsLocation
.
getLat
()))
{
return
dataGpsLocation
;
...
...
@@ -258,6 +264,7 @@ public class HdaoGpsComponent {
/**
* 通过基站获取到的位置信息,并构建地址信息
*
* @param sn
* @param deviceTypeRelationEnum
* @return
...
...
@@ -266,7 +273,7 @@ public class HdaoGpsComponent {
DataGpsLocation
dataGpsLocation
=
null
;
// 1、获取基站
DataBsLocation
dataBsLocation
=
getDeviceLastBsInfo
(
sn
,
deviceTypeRelationEnum
);
if
(
dataBsLocation
==
null
)
{
if
(
dataBsLocation
==
null
)
{
return
dataGpsLocation
;
}
...
...
@@ -277,6 +284,7 @@ public class HdaoGpsComponent {
/**
* 通过基站获取位置信息
*
* @param dataBsLocation
* @return
*/
...
...
@@ -287,7 +295,7 @@ public class HdaoGpsComponent {
BsDataRespHolder
resp
=
new
BsDataRespHolder
();
try
{
boolean
ret
=
baseStationServicePrx
.
GetGpsByBs
(
req
,
resp
);
if
(
ret
&&
resp
.
value
.
gps
!=
null
&&
resp
.
value
.
ret
==
0
)
{
if
(
ret
&&
resp
.
value
.
gps
!=
null
&&
resp
.
value
.
ret
==
0
)
{
dataGpsLocation
=
new
DataGpsLocation
();
dataGpsLocation
.
setSn
(
dataBsLocation
.
getSn
());
...
...
@@ -316,6 +324,7 @@ public class HdaoGpsComponent {
/**
* 获取设备某一个时间段的轨迹数据
*
* @param sn
* @param deviceTypeRelationEnum
* @param startTime
...
...
@@ -329,7 +338,7 @@ public class HdaoGpsComponent {
int
loopSize
=
1
;
do
{
List
<
DataGpsLocation
>
loopDataList
=
getDeviceLocationTimeScope
(
sn
,
deviceTypeRelationEnum
,
startTime
,
endTime
);
if
(
loopDataList
.
size
()
<
iceProperties
.
getLocationHistoryCount
().
intValue
())
{
if
(
loopDataList
.
size
()
<
iceProperties
.
getLocationHistoryCount
().
intValue
())
{
loopFlag
=
false
;
}
...
...
@@ -347,6 +356,7 @@ public class HdaoGpsComponent {
/**
* 获取基站数据点
*
* @param sn
* @param dataDeviceType
* @param startTime
...
...
@@ -384,6 +394,7 @@ public class HdaoGpsComponent {
/**
* 调用ice服务获取基站基础数据
*
* @param sn
* @param dataDeviceType
* @param fromDate
...
...
@@ -442,6 +453,7 @@ public class HdaoGpsComponent {
/**
* 通过基站中的参数解析出数据 主要是解析经度和纬度数据
*
* @param lac
* @param cell
* @param mnc
...
...
@@ -487,6 +499,7 @@ public class HdaoGpsComponent {
/**
* 数字转经纬度
*
* @param value
* @param value
* @return
...
...
@@ -559,6 +572,7 @@ public class HdaoGpsComponent {
/**
* 获取设备 指定时间段的位置信息
*
* @param sn
* @param deviceTypeRelationEnum
* @param startTime
...
...
@@ -572,21 +586,22 @@ public class HdaoGpsComponent {
return
null
;
}
GpsGetResponseHolder
res
=
new
GpsGetResponseHolder
(
new
GpsGetResponse
());
GpsGetResponseHolder
res
=
new
GpsGetResponseHolder
(
new
GpsGetResponse
());
GpsGetRequest
req
=
new
GpsGetRequest
();
req
.
apType
=
deviceTypeRelationEnum
.
getDataDeviceType
();
req
.
startTime
=
new
Long
(
fromDate
.
getTime
()
/
1000
).
intValue
();
req
.
endTime
=
new
Long
(
endDate
.
getTime
()
/
1000
).
intValue
();
req
.
extraMapReq
=
1
;
req
.
startTime
=
new
Long
(
fromDate
.
getTime
()
/
1000
).
intValue
();
req
.
endTime
=
new
Long
(
endDate
.
getTime
()
/
1000
).
intValue
();
req
.
extraMapReq
=
1
;
req
.
reqCount
=
iceProperties
.
getLocationHistoryCount
();
req
.
userID
=
Long
.
parseLong
(
sn
);
List
<
DataGpsLocation
>
dataGpsLocationList
=
new
ArrayList
<
DataGpsLocation
>();
log
.
info
(
"getGpsRecords params is {}"
,
JSONUtil
.
toJsonStr
(
req
));
List
<
DataGpsLocation
>
dataGpsLocationList
=
new
ArrayList
<>();
try
{
boolean
ret
=
daoGpsServicePrx
.
getGpsRecords
(
req
,
res
);
if
(
ret
&&
res
.
value
!=
null
&&
res
.
value
.
oprResult
==
0
)
{
log
.
info
(
"getGpsRecords return is {}"
,
JSONUtil
.
toJsonStr
(
res
));
if
(
ret
&&
res
.
value
!=
null
&&
res
.
value
.
oprResult
==
0
)
{
GpsRecord
[]
r
=
res
.
value
.
records
;
for
(
int
i
=
0
;
i
<
r
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
r
.
length
;
i
++)
{
GpsRecord
rec
=
r
[
i
];
DataGpsLocation
dataGpsLocation
=
new
DataGpsLocation
();
dataGpsLocation
.
setLat
(
LocationUtil
.
latlng
(
rec
.
lat
));
...
...
@@ -614,6 +629,7 @@ public class HdaoGpsComponent {
/**
* 获取设备的mac地址串
*
* @param sn
* @param apType
* @return
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment