Commit 570d4f8e by 刘宇峰

修复obd设备类型错误bug

1 parent 916085ac
...@@ -19,6 +19,7 @@ import cn.com.glsx.devicemonitor.modules.entity.inner.DataGpsLocation; ...@@ -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.model.*;
import cn.com.glsx.devicemonitor.modules.utils.*; import cn.com.glsx.devicemonitor.modules.utils.*;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
...@@ -57,6 +58,7 @@ public class HdaoGpsComponent { ...@@ -57,6 +58,7 @@ public class HdaoGpsComponent {
/** /**
* 调用ice 批量获取GPS or 基站 数据 * 调用ice 批量获取GPS or 基站 数据
*
* @param gpsBsLastBatchRequest * @param gpsBsLastBatchRequest
* @return * @return
*/ */
...@@ -100,6 +102,7 @@ public class HdaoGpsComponent { ...@@ -100,6 +102,7 @@ public class HdaoGpsComponent {
/** /**
* 位置信息转换地址 * 位置信息转换地址
*
* @param lat * @param lat
* @param lng * @param lng
* @return * @return
...@@ -118,12 +121,12 @@ public class HdaoGpsComponent { ...@@ -118,12 +121,12 @@ public class HdaoGpsComponent {
return resultAddress; return resultAddress;
} }
int geoRes = ipoiSearchNearPrx.ReverseGeocoding2(ptCenterGeopoint, poiSearchHolder); int geoRes = ipoiSearchNearPrx.ReverseGeocoding2(ptCenterGeopoint, poiSearchHolder);
if(geoRes != 0) { if (geoRes != 0) {
// 结果为 0 表示调用成功 // 结果为 0 表示调用成功
return resultAddress; return resultAddress;
} }
if (poiSearchHolder.value==null if (poiSearchHolder.value == null
|| StringUtils.isEmpty(poiSearchHolder.value)) { || StringUtils.isEmpty(poiSearchHolder.value)) {
return resultAddress; return resultAddress;
} }
...@@ -140,6 +143,7 @@ public class HdaoGpsComponent { ...@@ -140,6 +143,7 @@ public class HdaoGpsComponent {
/** /**
* 获取设备 最新基站位置数据 * 获取设备 最新基站位置数据
*
* @param sn * @param sn
* @param deviceTypeRelationEnum * @param deviceTypeRelationEnum
* @return * @return
...@@ -147,7 +151,7 @@ public class HdaoGpsComponent { ...@@ -147,7 +151,7 @@ public class HdaoGpsComponent {
public DataBsLocation getDeviceLastBsInfo(String sn, DeviceTypeRelationEnum deviceTypeRelationEnum) { public DataBsLocation getDeviceLastBsInfo(String sn, DeviceTypeRelationEnum deviceTypeRelationEnum) {
DataBsLocation dataBsLocation = null; DataBsLocation dataBsLocation = null;
try { try {
if (daoGpsServicePrx==null) { if (daoGpsServicePrx == null) {
log.info("getDeviceLastBsInfo daoGpsServicePrx iceServer exception"); log.info("getDeviceLastBsInfo daoGpsServicePrx iceServer exception");
return dataBsLocation; return dataBsLocation;
} }
...@@ -157,14 +161,14 @@ public class HdaoGpsComponent { ...@@ -157,14 +161,14 @@ public class HdaoGpsComponent {
boolean ret = false; boolean ret = false;
LatestBsGetRequest req = new LatestBsGetRequest(Long.parseLong(sn), deviceTypeRelationEnum.getDataDeviceType()); LatestBsGetRequest req = new LatestBsGetRequest(Long.parseLong(sn), deviceTypeRelationEnum.getDataDeviceType());
ret = daoGpsServicePrx.getLatestBsRecord(req, res); ret = daoGpsServicePrx.getLatestBsRecord(req, res);
if(ret) { if (ret) {
dataBsLocation = new DataBsLocation(); dataBsLocation = new DataBsLocation();
dataBsLocation.setSn(sn); dataBsLocation.setSn(sn);
dataBsLocation.setMcc(String.valueOf(res.value.record.mcc)); dataBsLocation.setMcc(String.valueOf(res.value.record.mcc));
dataBsLocation.setMnc(String.valueOf(res.value.record.mnc)); dataBsLocation.setMnc(String.valueOf(res.value.record.mnc));
BsInfo[] bsInfos = res.value.record.bsInfos; BsInfo[] bsInfos = res.value.record.bsInfos;
if (bsInfos!=null && bsInfos.length>0) { if (bsInfos != null && bsInfos.length > 0) {
log.info("基站位置信息:{}", JSON.toJSONString(bsInfos)); log.info("基站位置信息:{}", JSON.toJSONString(bsInfos));
for (int i = 0; i < bsInfos.length; i++) { for (int i = 0; i < bsInfos.length; i++) {
BsInfo bsInfo = bsInfos[i]; BsInfo bsInfo = bsInfos[i];
...@@ -189,6 +193,7 @@ public class HdaoGpsComponent { ...@@ -189,6 +193,7 @@ public class HdaoGpsComponent {
/** /**
* 获取设备 最新GPS位置数据 * 获取设备 最新GPS位置数据
*
* @param sn * @param sn
* @param deviceTypeRelationEnum * @param deviceTypeRelationEnum
* @return * @return
...@@ -196,7 +201,7 @@ public class HdaoGpsComponent { ...@@ -196,7 +201,7 @@ public class HdaoGpsComponent {
public DataGpsLocation getDeviceLastGpsInfo(String sn, DeviceTypeRelationEnum deviceTypeRelationEnum) { public DataGpsLocation getDeviceLastGpsInfo(String sn, DeviceTypeRelationEnum deviceTypeRelationEnum) {
DataGpsLocation dataGpsLocation = null; DataGpsLocation dataGpsLocation = null;
try { try {
if (daoGpsServicePrx==null) { if (daoGpsServicePrx == null) {
log.info("getDeviceLastGpsInfo daoGpsServicePrx iceServer exception"); log.info("getDeviceLastGpsInfo daoGpsServicePrx iceServer exception");
return dataGpsLocation; return dataGpsLocation;
} }
...@@ -206,7 +211,7 @@ public class HdaoGpsComponent { ...@@ -206,7 +211,7 @@ public class HdaoGpsComponent {
boolean ret = false; boolean ret = false;
LatestGpsGetRequest req = new LatestGpsGetRequest(Long.parseLong(sn), deviceTypeRelationEnum.getDataDeviceType(), GeoCoordinateEnum.GOOGLE_BAIDU.getCoordType()); LatestGpsGetRequest req = new LatestGpsGetRequest(Long.parseLong(sn), deviceTypeRelationEnum.getDataDeviceType(), GeoCoordinateEnum.GOOGLE_BAIDU.getCoordType());
ret = daoGpsServicePrx.getLatestGpsRecord(req, res); ret = daoGpsServicePrx.getLatestGpsRecord(req, res);
if(ret) { if (ret) {
dataGpsLocation = new DataGpsLocation(); dataGpsLocation = new DataGpsLocation();
dataGpsLocation.setSn(sn); dataGpsLocation.setSn(sn);
...@@ -238,13 +243,14 @@ public class HdaoGpsComponent { ...@@ -238,13 +243,14 @@ public class HdaoGpsComponent {
/** /**
* 获取位置信息 并构建地址信息 * 获取位置信息 并构建地址信息
*
* @param sn * @param sn
* @param deviceTypeRelationEnum * @param deviceTypeRelationEnum
* @return * @return
*/ */
public DataGpsLocation getDeviceLastGpsInfoFull(String sn, DeviceTypeRelationEnum deviceTypeRelationEnum) { public DataGpsLocation getDeviceLastGpsInfoFull(String sn, DeviceTypeRelationEnum deviceTypeRelationEnum) {
DataGpsLocation dataGpsLocation = getDeviceLastGpsInfo(sn, deviceTypeRelationEnum); DataGpsLocation dataGpsLocation = getDeviceLastGpsInfo(sn, deviceTypeRelationEnum);
if (dataGpsLocation==null if (dataGpsLocation == null
|| StringUtils.isEmpty(dataGpsLocation.getLng()) || StringUtils.isEmpty(dataGpsLocation.getLng())
|| StringUtils.isEmpty(dataGpsLocation.getLat())) { || StringUtils.isEmpty(dataGpsLocation.getLat())) {
return dataGpsLocation; return dataGpsLocation;
...@@ -258,6 +264,7 @@ public class HdaoGpsComponent { ...@@ -258,6 +264,7 @@ public class HdaoGpsComponent {
/** /**
* 通过基站获取到的位置信息,并构建地址信息 * 通过基站获取到的位置信息,并构建地址信息
*
* @param sn * @param sn
* @param deviceTypeRelationEnum * @param deviceTypeRelationEnum
* @return * @return
...@@ -266,7 +273,7 @@ public class HdaoGpsComponent { ...@@ -266,7 +273,7 @@ public class HdaoGpsComponent {
DataGpsLocation dataGpsLocation = null; DataGpsLocation dataGpsLocation = null;
// 1、获取基站 // 1、获取基站
DataBsLocation dataBsLocation = getDeviceLastBsInfo(sn, deviceTypeRelationEnum); DataBsLocation dataBsLocation = getDeviceLastBsInfo(sn, deviceTypeRelationEnum);
if (dataBsLocation==null) { if (dataBsLocation == null) {
return dataGpsLocation; return dataGpsLocation;
} }
...@@ -277,6 +284,7 @@ public class HdaoGpsComponent { ...@@ -277,6 +284,7 @@ public class HdaoGpsComponent {
/** /**
* 通过基站获取位置信息 * 通过基站获取位置信息
*
* @param dataBsLocation * @param dataBsLocation
* @return * @return
*/ */
...@@ -287,7 +295,7 @@ public class HdaoGpsComponent { ...@@ -287,7 +295,7 @@ public class HdaoGpsComponent {
BsDataRespHolder resp = new BsDataRespHolder(); BsDataRespHolder resp = new BsDataRespHolder();
try { try {
boolean ret = baseStationServicePrx.GetGpsByBs(req, resp); 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 = new DataGpsLocation();
dataGpsLocation.setSn(dataBsLocation.getSn()); dataGpsLocation.setSn(dataBsLocation.getSn());
...@@ -316,6 +324,7 @@ public class HdaoGpsComponent { ...@@ -316,6 +324,7 @@ public class HdaoGpsComponent {
/** /**
* 获取设备某一个时间段的轨迹数据 * 获取设备某一个时间段的轨迹数据
*
* @param sn * @param sn
* @param deviceTypeRelationEnum * @param deviceTypeRelationEnum
* @param startTime * @param startTime
...@@ -329,7 +338,7 @@ public class HdaoGpsComponent { ...@@ -329,7 +338,7 @@ public class HdaoGpsComponent {
int loopSize = 1; int loopSize = 1;
do { do {
List<DataGpsLocation> loopDataList = getDeviceLocationTimeScope(sn, deviceTypeRelationEnum, startTime, endTime); List<DataGpsLocation> loopDataList = getDeviceLocationTimeScope(sn, deviceTypeRelationEnum, startTime, endTime);
if (loopDataList.size()<iceProperties.getLocationHistoryCount().intValue()) { if (loopDataList.size() < iceProperties.getLocationHistoryCount().intValue()) {
loopFlag = false; loopFlag = false;
} }
...@@ -347,6 +356,7 @@ public class HdaoGpsComponent { ...@@ -347,6 +356,7 @@ public class HdaoGpsComponent {
/** /**
* 获取基站数据点 * 获取基站数据点
*
* @param sn * @param sn
* @param dataDeviceType * @param dataDeviceType
* @param startTime * @param startTime
...@@ -384,6 +394,7 @@ public class HdaoGpsComponent { ...@@ -384,6 +394,7 @@ public class HdaoGpsComponent {
/** /**
* 调用ice服务获取基站基础数据 * 调用ice服务获取基站基础数据
*
* @param sn * @param sn
* @param dataDeviceType * @param dataDeviceType
* @param fromDate * @param fromDate
...@@ -442,6 +453,7 @@ public class HdaoGpsComponent { ...@@ -442,6 +453,7 @@ public class HdaoGpsComponent {
/** /**
* 通过基站中的参数解析出数据 主要是解析经度和纬度数据 * 通过基站中的参数解析出数据 主要是解析经度和纬度数据
*
* @param lac * @param lac
* @param cell * @param cell
* @param mnc * @param mnc
...@@ -487,6 +499,7 @@ public class HdaoGpsComponent { ...@@ -487,6 +499,7 @@ public class HdaoGpsComponent {
/** /**
* 数字转经纬度 * 数字转经纬度
*
* @param value * @param value
* @param value * @param value
* @return * @return
...@@ -559,6 +572,7 @@ public class HdaoGpsComponent { ...@@ -559,6 +572,7 @@ public class HdaoGpsComponent {
/** /**
* 获取设备 指定时间段的位置信息 * 获取设备 指定时间段的位置信息
*
* @param sn * @param sn
* @param deviceTypeRelationEnum * @param deviceTypeRelationEnum
* @param startTime * @param startTime
...@@ -572,21 +586,22 @@ public class HdaoGpsComponent { ...@@ -572,21 +586,22 @@ public class HdaoGpsComponent {
return null; return null;
} }
GpsGetResponseHolder res=new GpsGetResponseHolder(new GpsGetResponse()); GpsGetResponseHolder res = new GpsGetResponseHolder(new GpsGetResponse());
GpsGetRequest req = new GpsGetRequest(); GpsGetRequest req = new GpsGetRequest();
req.apType = deviceTypeRelationEnum.getDataDeviceType(); req.apType = deviceTypeRelationEnum.getDataDeviceType();
req.startTime = new Long(fromDate.getTime()/1000).intValue(); req.startTime = new Long(fromDate.getTime() / 1000).intValue();
req.endTime = new Long(endDate.getTime()/1000).intValue(); req.endTime = new Long(endDate.getTime() / 1000).intValue();
req.extraMapReq=1; req.extraMapReq = 1;
req.reqCount = iceProperties.getLocationHistoryCount(); req.reqCount = iceProperties.getLocationHistoryCount();
req.userID = Long.parseLong(sn); req.userID = Long.parseLong(sn);
log.info("getGpsRecords params is {}", JSONUtil.toJsonStr(req));
List<DataGpsLocation> dataGpsLocationList = new ArrayList<DataGpsLocation>(); List<DataGpsLocation> dataGpsLocationList = new ArrayList<>();
try { try {
boolean ret = daoGpsServicePrx.getGpsRecords(req, res); 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; 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]; GpsRecord rec = r[i];
DataGpsLocation dataGpsLocation = new DataGpsLocation(); DataGpsLocation dataGpsLocation = new DataGpsLocation();
dataGpsLocation.setLat(LocationUtil.latlng(rec.lat)); dataGpsLocation.setLat(LocationUtil.latlng(rec.lat));
...@@ -614,6 +629,7 @@ public class HdaoGpsComponent { ...@@ -614,6 +629,7 @@ public class HdaoGpsComponent {
/** /**
* 获取设备的mac地址串 * 获取设备的mac地址串
*
* @param sn * @param sn
* @param apType * @param apType
* @return * @return
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!