Commit fe3d148d by 杨林龙

开发1.13.0版本 补基站轨迹回放定位点

1 parent 770b0630
// **********************************************************************
//
// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
//
// Ice version 3.5.1
//
// <auto-generated>
//
// Generated from file `HDao_gps.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.hdao;
public abstract class Callback_DaoGpsService_getGpsByBsRecordsOfLatesBs extends Ice.TwowayCallback
{
public abstract void response(boolean __ret, DaoBsDataResp res);
public final void __completed(Ice.AsyncResult __result)
{
DaoGpsServicePrx __proxy = (DaoGpsServicePrx)__result.getProxy();
boolean __ret = false;
DaoBsDataRespHolder res = new DaoBsDataRespHolder();
try
{
__ret = __proxy.end_getGpsByBsRecordsOfLatesBs(res, __result);
}
catch(Ice.LocalException __ex)
{
exception(__ex);
return;
}
response(__ret, res.value);
}
}
......@@ -651,4 +651,22 @@ public interface DaoGpsServicePrx extends Ice.ObjectPrx
public Ice.AsyncResult begin_getGpsByLatestBsRecord(LatestBsGetRequest req, java.util.Map<String, String> __ctx, Callback_DaoGpsService_getGpsByLatestBsRecord __cb);
public boolean end_getGpsByLatestBsRecord(DaoBsDataRespHolder res, Ice.AsyncResult __result);
public boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res);
public boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res, java.util.Map<String, String> __ctx);
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req);
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, java.util.Map<String, String> __ctx);
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, Ice.Callback __cb);
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, java.util.Map<String, String> __ctx, Ice.Callback __cb);
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, Callback_DaoGpsService_getGpsByBsRecordsOfLatesBs __cb);
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, java.util.Map<String, String> __ctx, Callback_DaoGpsService_getGpsByBsRecordsOfLatesBs __cb);
public boolean end_getGpsByBsRecordsOfLatesBs(DaoBsDataRespHolder res, Ice.AsyncResult __result);
}
......@@ -1518,6 +1518,142 @@ public final class DaoGpsServicePrxHelper extends Ice.ObjectPrxHelperBase implem
}
}
private static final String __getGpsByBsRecordsOfLatesBs_name = "getGpsByBsRecordsOfLatesBs";
public boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res)
{
return getGpsByBsRecordsOfLatesBs(req, res, null, false);
}
public boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res, java.util.Map<String, String> __ctx)
{
return getGpsByBsRecordsOfLatesBs(req, res, __ctx, true);
}
private boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res, java.util.Map<String, String> __ctx, boolean __explicitCtx)
{
if(__explicitCtx && __ctx == null)
{
__ctx = _emptyContext;
}
final Ice.Instrumentation.InvocationObserver __observer = IceInternal.ObserverHelper.get(this, "getGpsByBsRecordsOfLatesBs", __ctx);
int __cnt = 0;
try
{
while(true)
{
Ice._ObjectDel __delBase = null;
try
{
__checkTwowayOnly("getGpsByBsRecordsOfLatesBs");
__delBase = __getDelegate(false);
_DaoGpsServiceDel __del = (_DaoGpsServiceDel)__delBase;
return __del.getGpsByBsRecordsOfLatesBs(req, res, __ctx, __observer);
}
catch(IceInternal.LocalExceptionWrapper __ex)
{
__handleExceptionWrapper(__delBase, __ex, __observer);
}
catch(Ice.LocalException __ex)
{
__cnt = __handleException(__delBase, __ex, null, __cnt, __observer);
}
}
}
finally
{
if(__observer != null)
{
__observer.detach();
}
}
}
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req)
{
return begin_getGpsByBsRecordsOfLatesBs(req, null, false, null);
}
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, java.util.Map<String, String> __ctx)
{
return begin_getGpsByBsRecordsOfLatesBs(req, __ctx, true, null);
}
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, Ice.Callback __cb)
{
return begin_getGpsByBsRecordsOfLatesBs(req, null, false, __cb);
}
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, java.util.Map<String, String> __ctx, Ice.Callback __cb)
{
return begin_getGpsByBsRecordsOfLatesBs(req, __ctx, true, __cb);
}
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, Callback_DaoGpsService_getGpsByBsRecordsOfLatesBs __cb)
{
return begin_getGpsByBsRecordsOfLatesBs(req, null, false, __cb);
}
public Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, java.util.Map<String, String> __ctx, Callback_DaoGpsService_getGpsByBsRecordsOfLatesBs __cb)
{
return begin_getGpsByBsRecordsOfLatesBs(req, __ctx, true, __cb);
}
private Ice.AsyncResult begin_getGpsByBsRecordsOfLatesBs(BsGetRequest req, java.util.Map<String, String> __ctx, boolean __explicitCtx, IceInternal.CallbackBase __cb)
{
__checkAsyncTwowayOnly(__getGpsByBsRecordsOfLatesBs_name);
IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __getGpsByBsRecordsOfLatesBs_name, __cb);
try
{
__result.__prepare(__getGpsByBsRecordsOfLatesBs_name, Ice.OperationMode.Normal, __ctx, __explicitCtx);
IceInternal.BasicStream __os = __result.__startWriteParams(Ice.FormatType.DefaultFormat);
req.__write(__os);
__result.__endWriteParams();
__result.__send(true);
}
catch(Ice.LocalException __ex)
{
__result.__exceptionAsync(__ex);
}
return __result;
}
public boolean end_getGpsByBsRecordsOfLatesBs(DaoBsDataRespHolder res, Ice.AsyncResult __result)
{
Ice.AsyncResult.__check(__result, this, __getGpsByBsRecordsOfLatesBs_name);
boolean __ok = __result.__wait();
try
{
if(!__ok)
{
try
{
__result.__throwUserException();
}
catch(Ice.UserException __ex)
{
throw new Ice.UnknownUserException(__ex.ice_name(), __ex);
}
}
IceInternal.BasicStream __is = __result.__startReadParams();
res.value = new DaoBsDataResp();
res.value.__read(__is);
boolean __ret;
__ret = __is.readBool();
__result.__endReadParams();
return __ret;
}
catch(Ice.LocalException ex)
{
Ice.Instrumentation.InvocationObserver __obsv = __result.__getObserver();
if(__obsv != null)
{
__obsv.failed(ex.ice_name());
}
throw ex;
}
}
private static final String __getGpsByLatestBsRecord_name = "getGpsByLatestBsRecord";
public boolean getGpsByLatestBsRecord(LatestBsGetRequest req, DaoBsDataRespHolder res)
......
......@@ -126,4 +126,7 @@ public interface _DaoGpsServiceDel extends Ice._ObjectDel
boolean getGpsByLatestBsRecord(LatestBsGetRequest req, DaoBsDataRespHolder res, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __obsv)
throws IceInternal.LocalExceptionWrapper;
boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __obsv)
throws IceInternal.LocalExceptionWrapper;
}
......@@ -594,6 +594,58 @@ public final class _DaoGpsServiceDelD extends Ice._ObjectDelD implements _DaoGps
return __result.value;
}
public boolean getGpsByBsRecordsOfLatesBs(final BsGetRequest req, final DaoBsDataRespHolder res, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __observer)
throws IceInternal.LocalExceptionWrapper
{
final Ice.Current __current = new Ice.Current();
__initCurrent(__current, "getGpsByBsRecordsOfLatesBs", Ice.OperationMode.Normal, __ctx);
final Ice.BooleanHolder __result = new Ice.BooleanHolder();
IceInternal.Direct __direct = null;
try
{
__direct = new IceInternal.Direct(__current)
{
public Ice.DispatchStatus run(Ice.Object __obj)
{
DaoGpsService __servant = null;
if(__obj == null || __obj instanceof DaoGpsService)
{
__servant = (DaoGpsService)__obj;
}
else
{
throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);
}
__result.value = __servant.getGpsByBsRecordsOfLatesBs(req, res, __current);
return Ice.DispatchStatus.DispatchOK;
}
};
try
{
Ice.DispatchStatus __status = __direct.getServant().__collocDispatch(__direct);
if(__status == Ice.DispatchStatus.DispatchUserException)
{
__direct.throwUserException();
}
assert __status == Ice.DispatchStatus.DispatchOK;
return __result.value;
}
finally
{
__direct.destroy();
}
}
catch(Ice.SystemException __ex)
{
throw __ex;
}
catch(Throwable __ex)
{
IceInternal.LocalExceptionWrapper.throwWrapper(__ex);
}
return __result.value;
}
public boolean getGpsByLatestBsRecord(final LatestBsGetRequest req, final DaoBsDataRespHolder res, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __observer)
throws IceInternal.LocalExceptionWrapper
{
......
......@@ -573,6 +573,56 @@ public final class _DaoGpsServiceDelM extends Ice._ObjectDelM implements _DaoGps
}
public boolean
getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __observer)
throws IceInternal.LocalExceptionWrapper
{
IceInternal.Outgoing __og = __handler.getOutgoing("getGpsByBsRecordsOfLatesBs", Ice.OperationMode.Normal, __ctx, __observer);
try
{
try
{
IceInternal.BasicStream __os = __og.startWriteParams(Ice.FormatType.DefaultFormat);
req.__write(__os);
__og.endWriteParams();
}
catch(Ice.LocalException __ex)
{
__og.abort(__ex);
}
boolean __ok = __og.invoke();
try
{
if(!__ok)
{
try
{
__og.throwUserException();
}
catch(Ice.UserException __ex)
{
throw new Ice.UnknownUserException(__ex.ice_name(), __ex);
}
}
IceInternal.BasicStream __is = __og.startReadParams();
res.value = new DaoBsDataResp();
res.value.__read(__is);
boolean __ret;
__ret = __is.readBool();
__og.endReadParams();
return __ret;
}
catch(Ice.LocalException __ex)
{
throw new IceInternal.LocalExceptionWrapper(__ex, false);
}
}
finally
{
__handler.reclaimOutgoing(__og);
}
}
public boolean
getGpsByLatestBsRecord(LatestBsGetRequest req, DaoBsDataRespHolder res, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __observer)
throws IceInternal.LocalExceptionWrapper
{
......
......@@ -125,6 +125,11 @@ public abstract class _DaoGpsServiceDisp extends Ice.ObjectImpl implements DaoGp
return getGpsBsRecords(req, res, null);
}
public final boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res)
{
return getGpsByBsRecordsOfLatesBs(req, res, null);
}
public final boolean getGpsByLatestBsRecord(LatestBsGetRequest req, DaoBsDataRespHolder res)
{
return getGpsByLatestBsRecord(req, res, null);
......@@ -840,6 +845,23 @@ public abstract class _DaoGpsServiceDisp extends Ice.ObjectImpl implements DaoGp
return Ice.DispatchStatus.DispatchOK;
}
public static Ice.DispatchStatus ___getGpsByBsRecordsOfLatesBs(DaoGpsService __obj, IceInternal.Incoming __inS, Ice.Current __current)
{
__checkMode(Ice.OperationMode.Normal, __current.mode);
IceInternal.BasicStream __is = __inS.startReadParams();
BsGetRequest req;
req = new BsGetRequest();
req.__read(__is);
__inS.endReadParams();
DaoBsDataRespHolder res = new DaoBsDataRespHolder();
boolean __ret = __obj.getGpsByBsRecordsOfLatesBs(req, res, __current);
IceInternal.BasicStream __os = __inS.__startWriteParams(Ice.FormatType.DefaultFormat);
res.value.__write(__os);
__os.writeBool(__ret);
__inS.__endWriteParams(true);
return Ice.DispatchStatus.DispatchOK;
}
private final static String[] __all =
{
"convGeoGps",
......@@ -853,6 +875,7 @@ public abstract class _DaoGpsServiceDisp extends Ice.ObjectImpl implements DaoGp
"getFirstGpsBsRecord",
"getFirstGpsRecord",
"getGpsBsRecords",
"getGpsByBsRecordsOfLatesBs",
"getGpsByLatestBsRecord",
"getGpsRecords",
"getGpsRecordsByImei",
......@@ -939,114 +962,118 @@ public abstract class _DaoGpsServiceDisp extends Ice.ObjectImpl implements DaoGp
}
case 11:
{
return ___getGpsByLatestBsRecord(this, in, __current);
return ___getGpsByBsRecordsOfLatesBs(this, in, __current);
}
case 12:
{
return ___getGpsRecords(this, in, __current);
return ___getGpsByLatestBsRecord(this, in, __current);
}
case 13:
{
return ___getGpsRecordsByImei(this, in, __current);
return ___getGpsRecords(this, in, __current);
}
case 14:
{
return ___getGpsRecordsByMapSn(this, in, __current);
return ___getGpsRecordsByImei(this, in, __current);
}
case 15:
{
return ___getGpsRecordsEx(this, in, __current);
return ___getGpsRecordsByMapSn(this, in, __current);
}
case 16:
{
return ___getGpsWorkModeRecords(this, in, __current);
return ___getGpsRecordsEx(this, in, __current);
}
case 17:
{
return ___getLatestBatteryRecord(this, in, __current);
return ___getGpsWorkModeRecords(this, in, __current);
}
case 18:
{
return ___getLatestBsRecord(this, in, __current);
return ___getLatestBatteryRecord(this, in, __current);
}
case 19:
{
return ___getLatestGpsBsRecord(this, in, __current);
return ___getLatestBsRecord(this, in, __current);
}
case 20:
{
return ___getLatestGpsRecord(this, in, __current);
return ___getLatestGpsBsRecord(this, in, __current);
}
case 21:
{
return ___getLatestGpsRecordByImei(this, in, __current);
return ___getLatestGpsRecord(this, in, __current);
}
case 22:
{
return ___getLatestGpsRecordByMapSn(this, in, __current);
return ___getLatestGpsRecordByImei(this, in, __current);
}
case 23:
{
return ___getLatestGpsTime(this, in, __current);
return ___getLatestGpsRecordByMapSn(this, in, __current);
}
case 24:
{
return ___getLatestGpsWifiRecords(this, in, __current);
return ___getLatestGpsTime(this, in, __current);
}
case 25:
{
return ___getLatestLocationByLbsRecord(this, in, __current);
return ___getLatestGpsWifiRecords(this, in, __current);
}
case 26:
{
return ___getLatestRgpsRecord(this, in, __current);
return ___getLatestLocationByLbsRecord(this, in, __current);
}
case 27:
{
return ___getLatestVolRecord(this, in, __current);
return ___getLatestRgpsRecord(this, in, __current);
}
case 28:
{
return ___getMaxVolDiff(this, in, __current);
return ___getLatestVolRecord(this, in, __current);
}
case 29:
{
return ___getParadeCarAlarmRecords(this, in, __current);
return ___getMaxVolDiff(this, in, __current);
}
case 30:
{
return ___getParadeCarGpsRecords(this, in, __current);
return ___getParadeCarAlarmRecords(this, in, __current);
}
case 31:
{
return ___getRecentBsRecords(this, in, __current);
return ___getParadeCarGpsRecords(this, in, __current);
}
case 32:
{
return ___getRecentGpsRecords(this, in, __current);
return ___getRecentBsRecords(this, in, __current);
}
case 33:
{
return ___getSnMapRecords(this, in, __current);
return ___getRecentGpsRecords(this, in, __current);
}
case 34:
{
return ___getVoltageRecords(this, in, __current);
return ___getSnMapRecords(this, in, __current);
}
case 35:
{
return ___ice_id(this, in, __current);
return ___getVoltageRecords(this, in, __current);
}
case 36:
{
return ___ice_ids(this, in, __current);
return ___ice_id(this, in, __current);
}
case 37:
{
return ___ice_isA(this, in, __current);
return ___ice_ids(this, in, __current);
}
case 38:
{
return ___ice_isA(this, in, __current);
}
case 39:
{
return ___ice_ping(this, in, __current);
}
}
......
......@@ -91,4 +91,6 @@ public interface _DaoGpsServiceOperations
boolean getLatestGpsWifiRecords(GpsWifiRequest req, GpsWifiGetResponseHolder res, Ice.Current __current);
boolean getGpsByLatestBsRecord(LatestBsGetRequest req, DaoBsDataRespHolder res, Ice.Current __current);
boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res, Ice.Current __current);
}
......@@ -91,4 +91,6 @@ public interface _DaoGpsServiceOperationsNC
boolean getLatestGpsWifiRecords(GpsWifiRequest req, GpsWifiGetResponseHolder res);
boolean getGpsByLatestBsRecord(LatestBsGetRequest req, DaoBsDataRespHolder res);
boolean getGpsByBsRecordsOfLatesBs(BsGetRequest req, DaoBsDataRespHolder res);
}
package cn.com.glsx.devicemonitor.modules.components;
import Ice.StringHolder;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
import cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum;
import cn.com.glsx.devicemonitor.api.enums.GeoCoordinateEnum;
import cn.com.glsx.devicemonitor.api.enums.GeoLocationEnum;
......@@ -940,4 +941,75 @@ public class HdaoGpsComponent {
log.info("failed!!");
return null;
}
/**
* 通过基站查询时间段基站定位数据
*
* @param sn 设备号
* @param dataDeviceType 设备类型
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
public DataGpsLocation getGpsByBsRecordsOfLatesBs(String sn, Integer dataDeviceType, String startTime, String endTime) {
log.info(sn + "开始调用getGpsByBsRecordsOfLatesBs===");
Date fromDate = DateFormatUtil.toDate(startTime, DateFormatUtil.pattern01);
Date endDate = DateFormatUtil.toDate(endTime, DateFormatUtil.pattern01);
DataGpsLocation dataGpsLocation = null;
if (fromDate.after(endDate)) {
return null;
}
BsGetRequest req = new BsGetRequest();
req.apType = dataDeviceType;
req.startTime = new Long(fromDate.getTime() / 1000).intValue();
req.endTime = new Long(endDate.getTime() / 1000).intValue();
req.reqCount = iceProperties.getLocationHistoryCount();
req.userID = Long.parseLong(sn);
try {
DaoBsDataRespHolder res = new DaoBsDataRespHolder();
boolean ret = daoGpsServicePrx.getGpsByBsRecordsOfLatesBs(req, res);
if (ret) {
if (res.value.ret == 0) {
dataGpsLocation = new DataGpsLocation();
dataGpsLocation.setSn(sn);
String lat = LocationUtil.latlng(res.value.gps.lat);
String lng = LocationUtil.latlng(res.value.gps.lng);
dataGpsLocation.setLat(lat);
dataGpsLocation.setLng(lng);
double[] googleGps = GpsCorrect.gpsToGoogle(Double.parseDouble(lat), Double.parseDouble(lng));
String elat = LocationUtil.latlng(googleGps[0]);
String elng = LocationUtil.latlng(googleGps[1]);
dataGpsLocation.setElat(elat);
dataGpsLocation.setElng(elng);
double[] baiduGps = GpsCorrect.gpsToBaidu(Double.parseDouble(lat), Double.parseDouble(lng));
String blat = LocationUtil.latlng(baiduGps[0]);
String blng = LocationUtil.latlng(baiduGps[1]);
dataGpsLocation.setBlat(blat);
dataGpsLocation.setBlng(blng);
dataGpsLocation.setDateTime(DateFormatUtil.toStringFromTimestamp(res.value.gps.gpsTime, DateFormatUtil.pattern01));
dataGpsLocation.setStoreTime(DateFormatUtil.toStringFromTimestamp(res.value.gps.storeTime, DateFormatUtil.pattern01));
dataGpsLocation.setAddress(res.value.gps.addr);
return dataGpsLocation;
}
if (res.value.ret == 1) {
log.info("getGpsByBsRecordsOfLatesBs no recod!!");
return null;
}
}
} catch (Exception e) {
log.error("getGpsByBsRecordsOfLatesBs:Exception!!!!message:" + e.getMessage());
e.printStackTrace();
return null;
}
log.info("failed!!");
return null;
}
}
......@@ -93,6 +93,7 @@ public interface GpsBsLocationService {
/**
* 通过经纬度获取地址
*
* @param lngLats 经纬度集合
* @return 经纬度对应的地址
*/
......@@ -115,4 +116,15 @@ public interface GpsBsLocationService {
* @return 定位信息
*/
GpsBsData getLocationOfAlarmTime(String sn, DeviceTypeRelationEnum deviceTypeRelationEnum, String alarmStartTime, String alarmEndTime);
/**
* 通过设备号查询一段时间内的基站转Gps的点
*
* @param sn 设备号
* @param dtre 设备类型
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
GpsLocation getGpsByBsRecordsOfLatesBs(String sn, DeviceTypeRelationEnum dtre, String startTime, String endTime);
}
......@@ -99,7 +99,7 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService {
//补充获取wifi的定位
boolean hasWifi = isHasWifi(sn);
gpsBsData.setHasWifi(hasWifi);
if(!hasWifi) {
if (!hasWifi) {
continue;
}
DataGpsLocation wifiLocation = hdaoGpsComponent.getWifiLocation(sn);
......@@ -509,4 +509,20 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService {
}
return gpsBsData;
}
/**
* 通过基站查询时间段基站定位数据
*
* @param sn 设备号
* @param dtre 设备类型
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@Override
public GpsLocation getGpsByBsRecordsOfLatesBs(String sn, DeviceTypeRelationEnum dtre, String startTime, String endTime) {
DataGpsLocation bsLocation = hdaoGpsComponent.getGpsByBsRecordsOfLatesBs(sn, dtre.getDataDeviceType(), startTime, endTime);
log.info("bsLocation:" + JSONUtil.toJsonStr(bsLocation));
return DataLocationConvert.convertDataToGpsLocation(bsLocation);
}
}
......@@ -32,6 +32,7 @@ import cn.com.glsx.devicemonitor.modules.utils.DeviceUtils;
import cn.com.glsx.devicemonitor.modules.utils.JsonUtils;
import cn.com.glsx.devicemonitor.modules.utils.LocationUtil;
import cn.com.glsx.stdinterface.dto.DevicePowerDTO;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.glsx.plat.common.utils.DateUtils;
import com.glsx.plat.exception.BusinessException;
......@@ -136,16 +137,16 @@ public class MonitorServiceImpl implements MonitorService {
private Map<String, GpsBsData> getGpsBsMap(ArrayList<String> snList) {
List<GpsBsData> gpsBsBatch = gpsBsLocationService.getLastGpsBsBatch(snList);
if(CollectionUtils.isEmpty(gpsBsBatch)) {
if (CollectionUtils.isEmpty(gpsBsBatch)) {
return Maps.newHashMap();
}
return gpsBsBatch.stream()
return gpsBsBatch.stream()
.collect(Collectors.toMap(GpsBsData::getSn, Function.identity(), (o1, o2) -> o2));
}
private Map<String, DevicePowerDTO> getPowerMap(List<String> sn) {
private Map<String, DevicePowerDTO> getPowerMap(List<String> sn) {
List<DevicePowerDTO> devicePowerList = remoteBatteryService.getDevicePowerListBySn(sn);
if(CollectionUtils.isEmpty(devicePowerList)) {
if (CollectionUtils.isEmpty(devicePowerList)) {
return Maps.newHashMap();
}
return devicePowerList.stream()
......@@ -176,6 +177,11 @@ public class MonitorServiceImpl implements MonitorService {
gpsBsData = gpsBsLocationService.getLastGpsBsHistoryBySn(sn, dtre, startTime, endTime);
} else {
gpsBsData = gpsBsLocationService.getBaseStationPoint(sn, dtre, startTime, endTime);
// todo 补填添加最后一个定位点
GpsLocation latesBs = gpsBsLocationService.getGpsByBsRecordsOfLatesBs(sn, dtre, startTime, endTime);
if (ObjectUtil.isNotNull(latesBs)) {
gpsBsData.add(latesBs);
}
}
if (CollectionUtils.isEmpty(gpsBsData)) {
return resList;
......
......@@ -5,6 +5,7 @@ import cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum;
import cn.com.glsx.devicemonitor.modules.entity.inner.DataGpsLocation;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
......@@ -12,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
/**
......@@ -38,4 +41,10 @@ class HdaoGpsComponentTest {
System.out.println("gpsByLatestBsRecord = " + JSONUtil.toJsonStr(gpsByLatestBsRecord));
}
@Test
public void testGetDevicesGpsInfoBatch() {
List<DataGpsLocation> devicesGpsInfoBatch = hdaoGpsComponent.getDevicesGpsInfoBatch(Lists.newArrayList("1591127955"));
System.out.println("devicesGpsInfoBatch = " + JSONUtil.toJsonStr(devicesGpsInfoBatch));
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package cn.com.glsx.devicemonitor.modules.service.impl;
import cn.com.glsx.Application;
import cn.com.glsx.devicemonitor.api.dto.request.GpsBsFirstBatchRequest;
import cn.com.glsx.devicemonitor.api.dto.response.GpsBsData;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
import cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum;
import cn.com.glsx.devicemonitor.modules.service.GpsBsLocationService;
import cn.hutool.json.JSONUtil;
......@@ -60,4 +61,10 @@ public class GpsBsLocationServiceImplTest {
}
@Test
public void testGetGpsByBsRecordsOfLatesBs() {
GpsLocation bsRecordsOfLatesBs = gpsBsLocationService.getGpsByBsRecordsOfLatesBs("2192801101", DeviceTypeRelationEnum.GPS, "2022-11-07 10:40:32", "2022-11-07 16:40:32");
System.out.println("bsRecordsOfLatesBs = " + JSONUtil.toJsonStr(bsRecordsOfLatesBs));
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!