Commit 4cc666f4 by 杨林龙

Merge branch 'master' of http://192.168.3.233:8090/eshiled-new/ne-shield-devicemonitor into feature

 Conflicts:
	src/main/java/cn/com/glsx/devicemonitor/modules/service/impl/DeviceServiceImpl.java
2 parents cb940650 5b609416
Showing 44 changed files with 2469 additions and 9 deletions
...@@ -61,4 +61,9 @@ public class IceProperties { ...@@ -61,4 +61,9 @@ public class IceProperties {
*/ */
private Integer maxMessageSize; private Integer maxMessageSize;
/**
* 停留点服务地址
*/
private String fspServer;
} }
...@@ -8,6 +8,8 @@ import cn.com.glsx.devicemonitor.iceprotocol.mile.DaoMileServicePrx; ...@@ -8,6 +8,8 @@ import cn.com.glsx.devicemonitor.iceprotocol.mile.DaoMileServicePrx;
import cn.com.glsx.devicemonitor.iceprotocol.mile.DaoMileServicePrxHelper; import cn.com.glsx.devicemonitor.iceprotocol.mile.DaoMileServicePrxHelper;
import cn.com.glsx.devicemonitor.iceprotocol.poisearch.IPOISearchNearPrx; import cn.com.glsx.devicemonitor.iceprotocol.poisearch.IPOISearchNearPrx;
import cn.com.glsx.devicemonitor.iceprotocol.poisearch.IPOISearchNearPrxHelper; import cn.com.glsx.devicemonitor.iceprotocol.poisearch.IPOISearchNearPrxHelper;
import cn.com.glsx.devicemonitor.iceprotocol.resident.FspServicePrx;
import cn.com.glsx.devicemonitor.iceprotocol.resident.FspServicePrxHelper;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -100,4 +102,17 @@ public class IceServerConfig { ...@@ -100,4 +102,17 @@ public class IceServerConfig {
return prx; return prx;
} }
@Bean
public FspServicePrx fspServicePrx() {
String url = iceProperties.getFspServer();
Ice.Communicator ic = Ice.Util.initialize();
Ice.ObjectPrx base = ic.stringToProxy(url).ice_timeout(iceProperties.getIceLowTimeout());
FspServicePrx prx = FspServicePrxHelper.checkedCast(base);
log.info("ICE init fspServicePrx server:" + url + " success!");
return prx;
}
} }
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public abstract class Callback_FspService_GetFsp extends Ice.TwowayCallback
{
public abstract void response(int __ret, FspResp resp);
public final void __completed(Ice.AsyncResult __result)
{
FspServicePrx __proxy = (FspServicePrx)__result.getProxy();
int __ret = 0;
FspRespHolder resp = new FspRespHolder();
try
{
__ret = __proxy.end_GetFsp(resp, __result);
}
catch(Ice.LocalException __ex)
{
exception(__ex);
return;
}
response(__ret, resp.value);
}
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public class FspReq implements Cloneable, java.io.Serializable
{
public String userId;
public int apType;
public int beginTime;
public int endTime;
public int locInfoType;
public int perType;
public int extraMapReq;
public FspReq()
{
}
public FspReq(String userId, int apType, int beginTime, int endTime, int locInfoType, int perType, int extraMapReq)
{
this.userId = userId;
this.apType = apType;
this.beginTime = beginTime;
this.endTime = endTime;
this.locInfoType = locInfoType;
this.perType = perType;
this.extraMapReq = extraMapReq;
}
public boolean
equals(Object rhs)
{
if(this == rhs)
{
return true;
}
FspReq _r = null;
if(rhs instanceof FspReq)
{
_r = (FspReq)rhs;
}
if(_r != null)
{
if(userId != _r.userId)
{
if(userId == null || _r.userId == null || !userId.equals(_r.userId))
{
return false;
}
}
if(apType != _r.apType)
{
return false;
}
if(beginTime != _r.beginTime)
{
return false;
}
if(endTime != _r.endTime)
{
return false;
}
if(locInfoType != _r.locInfoType)
{
return false;
}
if(perType != _r.perType)
{
return false;
}
if(extraMapReq != _r.extraMapReq)
{
return false;
}
return true;
}
return false;
}
public int
hashCode()
{
int __h = 5381;
__h = IceInternal.HashUtil.hashAdd(__h, "::FspOnline::FspReq");
__h = IceInternal.HashUtil.hashAdd(__h, userId);
__h = IceInternal.HashUtil.hashAdd(__h, apType);
__h = IceInternal.HashUtil.hashAdd(__h, beginTime);
__h = IceInternal.HashUtil.hashAdd(__h, endTime);
__h = IceInternal.HashUtil.hashAdd(__h, locInfoType);
__h = IceInternal.HashUtil.hashAdd(__h, perType);
__h = IceInternal.HashUtil.hashAdd(__h, extraMapReq);
return __h;
}
public Object
clone()
{
Object o = null;
try
{
o = super.clone();
}
catch(CloneNotSupportedException ex)
{
assert false; // impossible
}
return o;
}
public void
__write(IceInternal.BasicStream __os)
{
__os.writeString(userId);
__os.writeInt(apType);
__os.writeInt(beginTime);
__os.writeInt(endTime);
__os.writeInt(locInfoType);
__os.writeInt(perType);
__os.writeInt(extraMapReq);
}
public void
__read(IceInternal.BasicStream __is)
{
userId = __is.readString();
apType = __is.readInt();
beginTime = __is.readInt();
endTime = __is.readInt();
locInfoType = __is.readInt();
perType = __is.readInt();
extraMapReq = __is.readInt();
}
public static final long serialVersionUID = -4208471757254030703L;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class FspReqHolder
{
public
FspReqHolder()
{
}
public
FspReqHolder(FspReq value)
{
this.value = value;
}
public FspReq value;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public class FspResp implements Cloneable, java.io.Serializable
{
public int ret;
public ResideBaseInfo[] baseInfos;
public FspResp()
{
}
public FspResp(int ret, ResideBaseInfo[] baseInfos)
{
this.ret = ret;
this.baseInfos = baseInfos;
}
public boolean
equals(Object rhs)
{
if(this == rhs)
{
return true;
}
FspResp _r = null;
if(rhs instanceof FspResp)
{
_r = (FspResp)rhs;
}
if(_r != null)
{
if(ret != _r.ret)
{
return false;
}
if(!java.util.Arrays.equals(baseInfos, _r.baseInfos))
{
return false;
}
return true;
}
return false;
}
public int
hashCode()
{
int __h = 5381;
__h = IceInternal.HashUtil.hashAdd(__h, "::FspOnline::FspResp");
__h = IceInternal.HashUtil.hashAdd(__h, ret);
__h = IceInternal.HashUtil.hashAdd(__h, baseInfos);
return __h;
}
public Object
clone()
{
Object o = null;
try
{
o = super.clone();
}
catch(CloneNotSupportedException ex)
{
assert false; // impossible
}
return o;
}
public void
__write(IceInternal.BasicStream __os)
{
__os.writeInt(ret);
ResideBaseInfosHelper.write(__os, baseInfos);
}
public void
__read(IceInternal.BasicStream __is)
{
ret = __is.readInt();
baseInfos = ResideBaseInfosHelper.read(__is);
}
public static final long serialVersionUID = 4447756455579930363L;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class FspRespHolder
{
public
FspRespHolder()
{
}
public
FspRespHolder(FspResp value)
{
this.value = value;
}
public FspResp value;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public interface FspService extends Ice.Object,
_FspServiceOperations, _FspServiceOperationsNC
{
public static final long serialVersionUID = -8525174583466358961L;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class FspServiceHolder extends Ice.ObjectHolderBase<FspService>
{
public
FspServiceHolder()
{
}
public
FspServiceHolder(FspService value)
{
this.value = value;
}
public void
patch(Ice.Object v)
{
if(v == null || v instanceof FspService)
{
value = (FspService)v;
}
else
{
IceInternal.Ex.throwUOE(type(), v);
}
}
public String
type()
{
return _FspServiceDisp.ice_staticId();
}
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public interface FspServicePrx extends Ice.ObjectPrx
{
public int GetFsp(FspReq req, FspRespHolder resp);
public int GetFsp(FspReq req, FspRespHolder resp, java.util.Map<String, String> __ctx);
public Ice.AsyncResult begin_GetFsp(FspReq req);
public Ice.AsyncResult begin_GetFsp(FspReq req, java.util.Map<String, String> __ctx);
public Ice.AsyncResult begin_GetFsp(FspReq req, Ice.Callback __cb);
public Ice.AsyncResult begin_GetFsp(FspReq req, java.util.Map<String, String> __ctx, Ice.Callback __cb);
public Ice.AsyncResult begin_GetFsp(FspReq req, Callback_FspService_GetFsp __cb);
public Ice.AsyncResult begin_GetFsp(FspReq req, java.util.Map<String, String> __ctx, Callback_FspService_GetFsp __cb);
public int end_GetFsp(FspRespHolder resp, Ice.AsyncResult __result);
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class FspServicePrxHelper extends Ice.ObjectPrxHelperBase implements FspServicePrx
{
private static final String __GetFsp_name = "GetFsp";
public int GetFsp(FspReq req, FspRespHolder resp)
{
return GetFsp(req, resp, null, false);
}
public int GetFsp(FspReq req, FspRespHolder resp, java.util.Map<String, String> __ctx)
{
return GetFsp(req, resp, __ctx, true);
}
private int GetFsp(FspReq req, FspRespHolder resp, java.util.Map<String, String> __ctx, boolean __explicitCtx)
{
if(__explicitCtx && __ctx == null)
{
__ctx = _emptyContext;
}
final Ice.Instrumentation.InvocationObserver __observer = IceInternal.ObserverHelper.get(this, "GetFsp", __ctx);
int __cnt = 0;
try
{
while(true)
{
Ice._ObjectDel __delBase = null;
try
{
__checkTwowayOnly("GetFsp");
__delBase = __getDelegate(false);
_FspServiceDel __del = (_FspServiceDel)__delBase;
return __del.GetFsp(req, resp, __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_GetFsp(FspReq req)
{
return begin_GetFsp(req, null, false, null);
}
public Ice.AsyncResult begin_GetFsp(FspReq req, java.util.Map<String, String> __ctx)
{
return begin_GetFsp(req, __ctx, true, null);
}
public Ice.AsyncResult begin_GetFsp(FspReq req, Ice.Callback __cb)
{
return begin_GetFsp(req, null, false, __cb);
}
public Ice.AsyncResult begin_GetFsp(FspReq req, java.util.Map<String, String> __ctx, Ice.Callback __cb)
{
return begin_GetFsp(req, __ctx, true, __cb);
}
public Ice.AsyncResult begin_GetFsp(FspReq req, Callback_FspService_GetFsp __cb)
{
return begin_GetFsp(req, null, false, __cb);
}
public Ice.AsyncResult begin_GetFsp(FspReq req, java.util.Map<String, String> __ctx, Callback_FspService_GetFsp __cb)
{
return begin_GetFsp(req, __ctx, true, __cb);
}
private Ice.AsyncResult begin_GetFsp(FspReq req, java.util.Map<String, String> __ctx, boolean __explicitCtx, IceInternal.CallbackBase __cb)
{
__checkAsyncTwowayOnly(__GetFsp_name);
IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __GetFsp_name, __cb);
try
{
__result.__prepare(__GetFsp_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 int end_GetFsp(FspRespHolder resp, Ice.AsyncResult __result)
{
Ice.AsyncResult.__check(__result, this, __GetFsp_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();
resp.value = new FspResp();
resp.value.__read(__is);
int __ret;
__ret = __is.readInt();
__result.__endReadParams();
return __ret;
}
catch(Ice.LocalException ex)
{
Ice.Instrumentation.InvocationObserver __obsv = __result.__getObserver();
if(__obsv != null)
{
__obsv.failed(ex.ice_name());
}
throw ex;
}
}
public static FspServicePrx checkedCast(Ice.ObjectPrx __obj)
{
FspServicePrx __d = null;
if(__obj != null)
{
if(__obj instanceof FspServicePrx)
{
__d = (FspServicePrx)__obj;
}
else
{
if(__obj.ice_isA(ice_staticId()))
{
FspServicePrxHelper __h = new FspServicePrxHelper();
__h.__copyFrom(__obj);
__d = __h;
}
}
}
return __d;
}
public static FspServicePrx checkedCast(Ice.ObjectPrx __obj, java.util.Map<String, String> __ctx)
{
FspServicePrx __d = null;
if(__obj != null)
{
if(__obj instanceof FspServicePrx)
{
__d = (FspServicePrx)__obj;
}
else
{
if(__obj.ice_isA(ice_staticId(), __ctx))
{
FspServicePrxHelper __h = new FspServicePrxHelper();
__h.__copyFrom(__obj);
__d = __h;
}
}
}
return __d;
}
public static FspServicePrx checkedCast(Ice.ObjectPrx __obj, String __facet)
{
FspServicePrx __d = null;
if(__obj != null)
{
Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
try
{
if(__bb.ice_isA(ice_staticId()))
{
FspServicePrxHelper __h = new FspServicePrxHelper();
__h.__copyFrom(__bb);
__d = __h;
}
}
catch(Ice.FacetNotExistException ex)
{
}
}
return __d;
}
public static FspServicePrx checkedCast(Ice.ObjectPrx __obj, String __facet, java.util.Map<String, String> __ctx)
{
FspServicePrx __d = null;
if(__obj != null)
{
Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
try
{
if(__bb.ice_isA(ice_staticId(), __ctx))
{
FspServicePrxHelper __h = new FspServicePrxHelper();
__h.__copyFrom(__bb);
__d = __h;
}
}
catch(Ice.FacetNotExistException ex)
{
}
}
return __d;
}
public static FspServicePrx uncheckedCast(Ice.ObjectPrx __obj)
{
FspServicePrx __d = null;
if(__obj != null)
{
if(__obj instanceof FspServicePrx)
{
__d = (FspServicePrx)__obj;
}
else
{
FspServicePrxHelper __h = new FspServicePrxHelper();
__h.__copyFrom(__obj);
__d = __h;
}
}
return __d;
}
public static FspServicePrx uncheckedCast(Ice.ObjectPrx __obj, String __facet)
{
FspServicePrx __d = null;
if(__obj != null)
{
Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
FspServicePrxHelper __h = new FspServicePrxHelper();
__h.__copyFrom(__bb);
__d = __h;
}
return __d;
}
public static final String[] __ids =
{
"::FspOnline::FspService",
"::Ice::Object"
};
public static String ice_staticId()
{
return __ids[0];
}
protected Ice._ObjectDelM __createDelegateM()
{
return new _FspServiceDelM();
}
protected Ice._ObjectDelD __createDelegateD()
{
return new _FspServiceDelD();
}
public static void __write(IceInternal.BasicStream __os, FspServicePrx v)
{
__os.writeProxy(v);
}
public static FspServicePrx __read(IceInternal.BasicStream __is)
{
Ice.ObjectPrx proxy = __is.readProxy();
if(proxy != null)
{
FspServicePrxHelper result = new FspServicePrxHelper();
result.__copyFrom(proxy);
return result;
}
return null;
}
public static final long serialVersionUID = 0L;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class FspServicePrxHolder
{
public
FspServicePrxHolder()
{
}
public
FspServicePrxHolder(FspServicePrx value)
{
this.value = value;
}
public FspServicePrx value;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public class GpsLoc implements Cloneable, java.io.Serializable
{
public double longitude;
public double latitude;
public double glng;
public double glat;
public double blng;
public double blat;
public GpsLoc()
{
}
public GpsLoc(double longitude, double latitude, double glng, double glat, double blng, double blat)
{
this.longitude = longitude;
this.latitude = latitude;
this.glng = glng;
this.glat = glat;
this.blng = blng;
this.blat = blat;
}
public boolean
equals(Object rhs)
{
if(this == rhs)
{
return true;
}
GpsLoc _r = null;
if(rhs instanceof GpsLoc)
{
_r = (GpsLoc)rhs;
}
if(_r != null)
{
if(longitude != _r.longitude)
{
return false;
}
if(latitude != _r.latitude)
{
return false;
}
if(glng != _r.glng)
{
return false;
}
if(glat != _r.glat)
{
return false;
}
if(blng != _r.blng)
{
return false;
}
if(blat != _r.blat)
{
return false;
}
return true;
}
return false;
}
public int
hashCode()
{
int __h = 5381;
__h = IceInternal.HashUtil.hashAdd(__h, "::FspOnline::GpsLoc");
__h = IceInternal.HashUtil.hashAdd(__h, longitude);
__h = IceInternal.HashUtil.hashAdd(__h, latitude);
__h = IceInternal.HashUtil.hashAdd(__h, glng);
__h = IceInternal.HashUtil.hashAdd(__h, glat);
__h = IceInternal.HashUtil.hashAdd(__h, blng);
__h = IceInternal.HashUtil.hashAdd(__h, blat);
return __h;
}
public Object
clone()
{
Object o = null;
try
{
o = super.clone();
}
catch(CloneNotSupportedException ex)
{
assert false; // impossible
}
return o;
}
public void
__write(IceInternal.BasicStream __os)
{
__os.writeDouble(longitude);
__os.writeDouble(latitude);
__os.writeDouble(glng);
__os.writeDouble(glat);
__os.writeDouble(blng);
__os.writeDouble(blat);
}
public void
__read(IceInternal.BasicStream __is)
{
longitude = __is.readDouble();
latitude = __is.readDouble();
glng = __is.readDouble();
glat = __is.readDouble();
blng = __is.readDouble();
blat = __is.readDouble();
}
public static final long serialVersionUID = -2724732159169601674L;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class GpsLocHolder
{
public
GpsLocHolder()
{
}
public
GpsLocHolder(GpsLoc value)
{
this.value = value;
}
public GpsLoc value;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public enum PeriodType implements java.io.Serializable
{
Morning(1),
Afternoon(2),
Night(4);
public int
value()
{
return __value;
}
public static PeriodType
valueOf(int __v)
{
switch(__v)
{
case 1:
return Morning;
case 2:
return Afternoon;
case 4:
return Night;
}
return null;
}
private
PeriodType(int __v)
{
__value = __v;
}
public void
__write(IceInternal.BasicStream __os)
{
__os.writeEnum(value(), 4);
}
public static PeriodType
__read(IceInternal.BasicStream __is)
{
int __v = __is.readEnum(4);
return __validate(__v);
}
private static PeriodType
__validate(int __v)
{
final PeriodType __e = valueOf(__v);
if(__e == null)
{
throw new Ice.MarshalException("enumerator value " + __v + " is out of range");
}
return __e;
}
private final int __value;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class PeriodTypeHolder
{
public
PeriodTypeHolder()
{
}
public
PeriodTypeHolder(PeriodType value)
{
this.value = value;
}
public PeriodType value;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public class ResideBaseInfo implements Cloneable, java.io.Serializable
{
public String userId;
public int apType;
public int totalDuration;
public int totalTimes;
public GpsLoc gps;
public ResideBaseInfo()
{
}
public ResideBaseInfo(String userId, int apType, int totalDuration, int totalTimes, GpsLoc gps)
{
this.userId = userId;
this.apType = apType;
this.totalDuration = totalDuration;
this.totalTimes = totalTimes;
this.gps = gps;
}
public boolean
equals(Object rhs)
{
if(this == rhs)
{
return true;
}
ResideBaseInfo _r = null;
if(rhs instanceof ResideBaseInfo)
{
_r = (ResideBaseInfo)rhs;
}
if(_r != null)
{
if(userId != _r.userId)
{
if(userId == null || _r.userId == null || !userId.equals(_r.userId))
{
return false;
}
}
if(apType != _r.apType)
{
return false;
}
if(totalDuration != _r.totalDuration)
{
return false;
}
if(totalTimes != _r.totalTimes)
{
return false;
}
if(gps != _r.gps)
{
if(gps == null || _r.gps == null || !gps.equals(_r.gps))
{
return false;
}
}
return true;
}
return false;
}
public int
hashCode()
{
int __h = 5381;
__h = IceInternal.HashUtil.hashAdd(__h, "::FspOnline::ResideBaseInfo");
__h = IceInternal.HashUtil.hashAdd(__h, userId);
__h = IceInternal.HashUtil.hashAdd(__h, apType);
__h = IceInternal.HashUtil.hashAdd(__h, totalDuration);
__h = IceInternal.HashUtil.hashAdd(__h, totalTimes);
__h = IceInternal.HashUtil.hashAdd(__h, gps);
return __h;
}
public Object
clone()
{
Object o = null;
try
{
o = super.clone();
}
catch(CloneNotSupportedException ex)
{
assert false; // impossible
}
return o;
}
public void
__write(IceInternal.BasicStream __os)
{
__os.writeString(userId);
__os.writeInt(apType);
__os.writeInt(totalDuration);
__os.writeInt(totalTimes);
gps.__write(__os);
}
public void
__read(IceInternal.BasicStream __is)
{
userId = __is.readString();
apType = __is.readInt();
totalDuration = __is.readInt();
totalTimes = __is.readInt();
gps = new GpsLoc();
gps.__read(__is);
}
public static final long serialVersionUID = -7035780298078512264L;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class ResideBaseInfoHolder
{
public
ResideBaseInfoHolder()
{
}
public
ResideBaseInfoHolder(ResideBaseInfo value)
{
this.value = value;
}
public ResideBaseInfo value;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class ResideBaseInfosHelper
{
public static void
write(IceInternal.BasicStream __os, ResideBaseInfo[] __v)
{
if(__v == null)
{
__os.writeSize(0);
}
else
{
__os.writeSize(__v.length);
for(int __i0 = 0; __i0 < __v.length; __i0++)
{
__v[__i0].__write(__os);
}
}
}
public static ResideBaseInfo[]
read(IceInternal.BasicStream __is)
{
ResideBaseInfo[] __v;
final int __len0 = __is.readAndCheckSeqSize(61);
__v = new ResideBaseInfo[__len0];
for(int __i0 = 0; __i0 < __len0; __i0++)
{
__v[__i0] = new ResideBaseInfo();
__v[__i0].__read(__is);
}
return __v;
}
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class ResideBaseInfosHolder
{
public
ResideBaseInfosHolder()
{
}
public
ResideBaseInfosHolder(ResideBaseInfo[] value)
{
this.value = value;
}
public ResideBaseInfo[] value;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public interface _FspServiceDel extends Ice._ObjectDel
{
int GetFsp(FspReq req, FspRespHolder resp, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __obsv)
throws IceInternal.LocalExceptionWrapper;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class _FspServiceDelD extends Ice._ObjectDelD implements _FspServiceDel
{
public int GetFsp(final FspReq req, final FspRespHolder resp, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __observer)
throws IceInternal.LocalExceptionWrapper
{
final Ice.Current __current = new Ice.Current();
__initCurrent(__current, "GetFsp", Ice.OperationMode.Normal, __ctx);
final Ice.IntHolder __result = new Ice.IntHolder();
IceInternal.Direct __direct = null;
try
{
__direct = new IceInternal.Direct(__current)
{
public Ice.DispatchStatus run(Ice.Object __obj)
{
FspService __servant = null;
if(__obj == null || __obj instanceof FspService)
{
__servant = (FspService)__obj;
}
else
{
throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);
}
__result.value = __servant.GetFsp(req, resp, __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;
}
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public final class _FspServiceDelM extends Ice._ObjectDelM implements _FspServiceDel
{
public int
GetFsp(FspReq req, FspRespHolder resp, java.util.Map<String, String> __ctx, Ice.Instrumentation.InvocationObserver __observer)
throws IceInternal.LocalExceptionWrapper
{
IceInternal.Outgoing __og = __handler.getOutgoing("GetFsp", 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();
resp.value = new FspResp();
resp.value.__read(__is);
int __ret;
__ret = __is.readInt();
__og.endReadParams();
return __ret;
}
catch(Ice.LocalException __ex)
{
throw new IceInternal.LocalExceptionWrapper(__ex, false);
}
}
finally
{
__handler.reclaimOutgoing(__og);
}
}
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public abstract class _FspServiceDisp extends Ice.ObjectImpl implements FspService
{
protected void
ice_copyStateFrom(Ice.Object __obj)
throws CloneNotSupportedException
{
throw new CloneNotSupportedException();
}
public static final String[] __ids =
{
"::FspOnline::FspService",
"::Ice::Object"
};
public boolean ice_isA(String s)
{
return java.util.Arrays.binarySearch(__ids, s) >= 0;
}
public boolean ice_isA(String s, Ice.Current __current)
{
return java.util.Arrays.binarySearch(__ids, s) >= 0;
}
public String[] ice_ids()
{
return __ids;
}
public String[] ice_ids(Ice.Current __current)
{
return __ids;
}
public String ice_id()
{
return __ids[0];
}
public String ice_id(Ice.Current __current)
{
return __ids[0];
}
public static String ice_staticId()
{
return __ids[0];
}
public final int GetFsp(FspReq req, FspRespHolder resp)
{
return GetFsp(req, resp, null);
}
public static Ice.DispatchStatus ___GetFsp(FspService __obj, IceInternal.Incoming __inS, Ice.Current __current)
{
__checkMode(Ice.OperationMode.Normal, __current.mode);
IceInternal.BasicStream __is = __inS.startReadParams();
FspReq req;
req = new FspReq();
req.__read(__is);
__inS.endReadParams();
FspRespHolder resp = new FspRespHolder();
int __ret = __obj.GetFsp(req, resp, __current);
IceInternal.BasicStream __os = __inS.__startWriteParams(Ice.FormatType.DefaultFormat);
resp.value.__write(__os);
__os.writeInt(__ret);
__inS.__endWriteParams(true);
return Ice.DispatchStatus.DispatchOK;
}
private final static String[] __all =
{
"GetFsp",
"ice_id",
"ice_ids",
"ice_isA",
"ice_ping"
};
public Ice.DispatchStatus __dispatch(IceInternal.Incoming in, Ice.Current __current)
{
int pos = java.util.Arrays.binarySearch(__all, __current.operation);
if(pos < 0)
{
throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);
}
switch(pos)
{
case 0:
{
return ___GetFsp(this, in, __current);
}
case 1:
{
return ___ice_id(this, in, __current);
}
case 2:
{
return ___ice_ids(this, in, __current);
}
case 3:
{
return ___ice_isA(this, in, __current);
}
case 4:
{
return ___ice_ping(this, in, __current);
}
}
assert(false);
throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);
}
protected void __writeImpl(IceInternal.BasicStream __os)
{
__os.startWriteSlice(ice_staticId(), -1, true);
__os.endWriteSlice();
}
protected void __readImpl(IceInternal.BasicStream __is)
{
__is.startReadSlice();
__is.endReadSlice();
}
public static final long serialVersionUID = 0L;
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public interface _FspServiceOperations
{
int GetFsp(FspReq req, FspRespHolder resp, Ice.Current __current);
}
// **********************************************************************
//
// 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 `fsp_online.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package cn.com.glsx.devicemonitor.iceprotocol.resident;
public interface _FspServiceOperationsNC
{
int GetFsp(FspReq req, FspRespHolder resp);
}
...@@ -2,10 +2,12 @@ package cn.com.glsx.devicemonitor.modules.api; ...@@ -2,10 +2,12 @@ package cn.com.glsx.devicemonitor.modules.api;
import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationRequest; import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationRequest;
import cn.com.glsx.devicemonitor.api.dto.request.GpsBsFirstBatchRequest; import cn.com.glsx.devicemonitor.api.dto.request.GpsBsFirstBatchRequest;
import cn.com.glsx.devicemonitor.api.dto.LngLatDTO;
import cn.com.glsx.devicemonitor.api.dto.request.LocationHistoryRequest; import cn.com.glsx.devicemonitor.api.dto.request.LocationHistoryRequest;
import cn.com.glsx.devicemonitor.api.dto.response.DeviceLocationDTO; import cn.com.glsx.devicemonitor.api.dto.response.DeviceLocationDTO;
import cn.com.glsx.devicemonitor.api.dto.response.GpsBsData; import cn.com.glsx.devicemonitor.api.dto.response.GpsBsData;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation; import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
import cn.com.glsx.devicemonitor.api.dto.response.LngLatAddressDTO;
import cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum; import cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum;
import cn.com.glsx.devicemonitor.api.feign.GpsBsFeignService; import cn.com.glsx.devicemonitor.api.feign.GpsBsFeignService;
import cn.com.glsx.devicemonitor.common.constants.ConstantsDevice; import cn.com.glsx.devicemonitor.common.constants.ConstantsDevice;
...@@ -17,6 +19,7 @@ import com.glsx.plat.core.web.R; ...@@ -17,6 +19,7 @@ import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -139,6 +142,14 @@ public class FeignGpsBsController implements GpsBsFeignService { ...@@ -139,6 +142,14 @@ public class FeignGpsBsController implements GpsBsFeignService {
return R.ok().data(address); return R.ok().data(address);
} }
@PostMapping("/getAddressMap")
@ResponseBody
@Override
public R<LngLatAddressDTO> getAddressMap(@RequestBody List<LngLatDTO> lngLats) {
Map<String, String> addressMap = gpsBsLocationService.getAddressMap(lngLats);
return R.ok().data(new LngLatAddressDTO(addressMap));
}
/** /**
* 根据设备号和报警时间获取报警时间的定位 * 根据设备号和报警时间获取报警时间的定位
* *
......
package cn.com.glsx.devicemonitor.modules.api;
import cn.com.glsx.devicemonitor.api.dto.request.StayPointRequest;
import cn.com.glsx.devicemonitor.api.dto.response.StayPointRecordDTO;
import cn.com.glsx.devicemonitor.api.feign.StayPointFeignService;
import cn.com.glsx.devicemonitor.modules.service.StayPointService;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author xiangyanlin
* @date 2022/5/7
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/api/stayPoint")
@Api(value = "stayPoint", tags = "停留点服务")
public class FeignStayPointController implements StayPointFeignService {
@Autowired
private StayPointService stayPointService;
@GetMapping("/queryList")
@Override
public R<List<StayPointRecordDTO>> getStayPointRecord(@SpringQueryMap StayPointRequest stayPointRequest) {
List<StayPointRecordDTO> list = stayPointService.getStayPointRecord(stayPointRequest);
return R.ok().data(list);
}
}
package cn.com.glsx.devicemonitor.modules.api;
import cn.com.glsx.devicemonitor.api.dto.request.ResidentRequest;
import cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO;
import cn.com.glsx.devicemonitor.api.feign.ResidentFeignService;
import cn.com.glsx.devicemonitor.modules.service.ResidentService;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author xiangyanlin
* @date 2022/5/9
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/api/resident")
@Api(value = "resident", tags = "常驻地服务")
public class ResidentController implements ResidentFeignService {
@Autowired
private ResidentService residentService;
@GetMapping("/queryList")
@Override
public R<List<ResidentDTO>> getResidentList(@SpringQueryMap ResidentRequest request) {
List<ResidentDTO> residentList = residentService.getResidentList(request);
return R.ok().data(residentList);
}
}
package cn.com.glsx.devicemonitor.modules.components;
import cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO;
import cn.com.glsx.devicemonitor.api.enums.ResidentTimesEnum;
import cn.com.glsx.devicemonitor.iceprotocol.resident.FspReq;
import cn.com.glsx.devicemonitor.iceprotocol.resident.FspResp;
import cn.com.glsx.devicemonitor.iceprotocol.resident.FspRespHolder;
import cn.com.glsx.devicemonitor.iceprotocol.resident.FspServicePrx;
import cn.com.glsx.devicemonitor.iceprotocol.resident.ResideBaseInfo;
import cn.com.glsx.devicemonitor.modules.utils.DateUtils;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* ICE
*
* @author xiangyanlin
* @date 2022/5/9
*/
@Slf4j
@Component
public class FspComponent {
@Autowired
private FspServicePrx fspServicePrx;
/**
* @param sn 设备号
* @param beginTime 开始时间
* @param endTime 结束时间
* @param times 时间范围 1:上午(6:00~12:00)2:下午(12:00~21:00)3:夜晚(21:00~6:00)4:全天 当当前是基站查询时该字段为0
* @param locInfoType 1.gps 2.基站
* @return
*/
public List<ResidentDTO> getResidentByRealTime(String sn, String beginTime, String endTime, Integer times, Integer locInfoType) {
long begin = System.currentTimeMillis();
List<ResidentDTO> list = Lists.newArrayList();
// 协议中定义perType 1 上午 ;2 下午 ; 4 夜晚 所以全天是1+2+4 =7 当前是基站查询时该字段为0
int perType = times;
try {
ResidentTimesEnum residentTimesEnum = ResidentTimesEnum.getByCode(times);
if (Objects.nonNull(residentTimesEnum)) {
switch (residentTimesEnum) {
case NIGHT:
perType = 4;
break;
case ALL_DAY:
perType = 7;
break;
default:
}
}
int beginTimestamp = DateUtils.getEpochSecond(beginTime).intValue();
int endTimestamp = DateUtils.getEpochSecond(endTime).intValue();
FspReq fspReq = new FspReq(sn, 5, beginTimestamp, endTimestamp, locInfoType, perType, 2);
FspResp fspResp = new FspResp();
FspRespHolder fspRespHolder = new FspRespHolder(fspResp);
fspServicePrx.GetFsp(fspReq, fspRespHolder);
if (fspRespHolder.value.ret != 0) {
return list;
}
if (fspRespHolder.value.baseInfos.length <= 0) {
return list;
}
list = Arrays.stream(fspRespHolder.value.baseInfos).map(this::buildResidentDTO).collect(Collectors.toList());
long end = System.currentTimeMillis();
log.info("getResidentByRealTime by sn=" + sn + " , beginTime=" + beginTime + ",endTime=" + endTime + ",locInfoType=" + locInfoType + ",perType=" + perType + ",result size:" + list.size() + ",speed:" + (end - begin));
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return list;
}
/**
* 构建
*/
private ResidentDTO buildResidentDTO(ResideBaseInfo resideBaseInfo) {
ResidentDTO resident = new ResidentDTO();
resident.setTotalDuration(resideBaseInfo.totalDuration);
resident.setTotalTimes(resideBaseInfo.totalTimes);
resident.setLatitude(String.valueOf(resideBaseInfo.gps.latitude));
resident.setLongitude(String.valueOf(resideBaseInfo.gps.longitude));
resident.setBlat(String.valueOf(resideBaseInfo.gps.blat));
resident.setBlng(String.valueOf(resideBaseInfo.gps.blat));
resident.setElat(String.valueOf(resideBaseInfo.gps.glat));
resident.setElng(String.valueOf(resideBaseInfo.gps.glng));
return resident;
}
}
...@@ -12,10 +12,12 @@ import org.apache.commons.lang.math.NumberUtils; ...@@ -12,10 +12,12 @@ import org.apache.commons.lang.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional;
/** /**
* @program: ne-shield-devicemonitor * @program: ne-shield-devicemonitor
...@@ -77,6 +79,41 @@ public class HDaoMileComponent { ...@@ -77,6 +79,41 @@ public class HDaoMileComponent {
} }
/** /**
* 停留点数据查询
*
*/
public List<StayPointRecord> listStayPointQuery(String sn, Date beginTime, Date endTime, Integer periodType, Integer min, Integer max) {
List<StayPointRecord> resultList = Lists.newArrayList();
cn.com.glsx.devicemonitor.iceprotocol.mile.Date beginDate = javaDate2CustomerDate(beginTime);
cn.com.glsx.devicemonitor.iceprotocol.mile.Date endDate = javaDate2CustomerDate(endTime);
//最大最小值没有时默认-1,有值时转换为秒
min = Optional.ofNullable(min).map(e -> e * 60).orElse(Integer.MIN_VALUE);
max = Optional.ofNullable(max).map(e -> e * 60).orElse(Integer.MAX_VALUE);
GetStayPointRecordsReq getStayPointRecordsReq = new GetStayPointRecordsReq(NumberUtils.toLong(sn), 5, beginDate, endDate, periodType, min, max, 1);
GetStayPointRecordsResHolder getStayPointRecordsResHolder = new GetStayPointRecordsResHolder();
try {
if (daoMileServicePrx == null) {
throw new ConnectionRefusedException();
}
boolean result = daoMileServicePrx.getStayPointRecords(getStayPointRecordsReq, getStayPointRecordsResHolder);
if (result) {
GetStayPointRecordsRes stayPointRecordsRes = getStayPointRecordsResHolder.value;
StayPointRecord[] stayPointRecords = stayPointRecordsRes.stayPoints;
if (stayPointRecords == null || stayPointRecords.length == 0) {
return resultList;
}
resultList = Lists.newArrayList(stayPointRecords);
}
} catch (Exception e) {
log.error("停留点服务异常:" + e.getMessage(), e);
log.error(e.getMessage(), e);
}
return resultList;
}
/**
* java 日期转需要的日期格式 * java 日期转需要的日期格式
* *
* @param date jav 日期格式 * @param date jav 日期格式
......
...@@ -101,9 +101,9 @@ public class HdaoGpsComponent { ...@@ -101,9 +101,9 @@ public class HdaoGpsComponent {
* @return * @return
*/ */
public DataGpsLocation getDevicesFirstGpsInfo(String sn, String activeDate) { public DataGpsLocation getDevicesFirstGpsInfo(String sn, String activeDate) {
DataGpsLocation gpsLocation = new DataGpsLocation(); DataGpsLocation gpsLocation = null;
if (StringUtils.isEmpty(sn) || StringUtils.isEmpty(activeDate)) { if (StringUtils.isEmpty(sn) || StringUtils.isEmpty(activeDate)) {
return gpsLocation; return null;
} }
try { try {
Date date = DateUtils.parseDate(activeDate, parsePattern); Date date = DateUtils.parseDate(activeDate, parsePattern);
...@@ -116,6 +116,7 @@ public class HdaoGpsComponent { ...@@ -116,6 +116,7 @@ public class HdaoGpsComponent {
log.info("getDevicesFirstGpsInfo invoker ice getGpsRecords result:" + res.value.oprResult + " reqSn:" + sn); log.info("getDevicesFirstGpsInfo invoker ice getGpsRecords result:" + res.value.oprResult + " reqSn:" + sn);
if (res.value.records != null && res.value.records.length > 0) { if (res.value.records != null && res.value.records.length > 0) {
GpsRecord gps = res.value.records[0]; GpsRecord gps = res.value.records[0];
gpsLocation = new DataGpsLocation();
gpsLocation.setSn(sn); gpsLocation.setSn(sn);
gpsLocation.setDateTime(timeStampSec2DateStr(String.valueOf(gps.gpsTime))); gpsLocation.setDateTime(timeStampSec2DateStr(String.valueOf(gps.gpsTime)));
gpsLocation.setLat(String.valueOf(this.latlng(gps.lat))); gpsLocation.setLat(String.valueOf(this.latlng(gps.lat)));
...@@ -195,7 +196,11 @@ public class HdaoGpsComponent { ...@@ -195,7 +196,11 @@ public class HdaoGpsComponent {
* @return * @return
*/ */
public DataGpsLocation getDevicesFirstBsInfo(String sn, String activeDate) { public DataGpsLocation getDevicesFirstBsInfo(String sn, String activeDate) {
DataBsLocation bsLocation = new DataBsLocation(); DataBsLocation bsLocation = null;
if (StringUtils.isEmpty(sn) || StringUtils.isEmpty(activeDate)) {
return null;
}
try { try {
Date date = DateUtils.parseDate(activeDate, parsePattern); Date date = DateUtils.parseDate(activeDate, parsePattern);
Date startTime = calcDayStartTime(date); Date startTime = calcDayStartTime(date);
...@@ -232,7 +237,11 @@ public class HdaoGpsComponent { ...@@ -232,7 +237,11 @@ public class HdaoGpsComponent {
log.error("getDevicesFirstGpsInfo invoker ice getGpsRecords sn:" + sn + " exception: " + e.getMessage(), e); log.error("getDevicesFirstGpsInfo invoker ice getGpsRecords sn:" + sn + " exception: " + e.getMessage(), e);
} }
// 2、通过基站获取位置(无需转换地址,通过基站获取位置已经有地址信息) // 2、通过基站获取位置(无需转换地址,通过基站获取位置已经有地址信息)
return mapGeoBsConvert(bsLocation); DataGpsLocation dataGpsLocation = null;
if (bsLocation != null) {
dataGpsLocation = mapGeoBsConvert(bsLocation);
}
return dataGpsLocation;
} }
/** /**
......
package cn.com.glsx.devicemonitor.modules.converter;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
import cn.com.glsx.devicemonitor.api.dto.response.StayPointRecordDTO;
import cn.com.glsx.devicemonitor.iceprotocol.mile.StayPointRecord;
import cn.com.glsx.devicemonitor.modules.utils.DateUtils;
import cn.com.glsx.devicemonitor.modules.utils.LocationUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.mapstruct.Mapper;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author xiangyanlin
* @date 2022/5/7
*/
public class StayPointConvert {
public static List<StayPointRecordDTO> convertTo(List<StayPointRecord> stayPointRecord) {
if (CollectionUtils.isEmpty(stayPointRecord)) {
return Lists.newArrayList();
}
return stayPointRecord.stream().map(StayPointConvert::convertTo).collect(Collectors.toList());
}
public static StayPointRecordDTO convertTo(StayPointRecord stayPointRecord) {
if (Objects.isNull(stayPointRecord)) {
return null;
}
StayPointRecordDTO stayPointRecordDTO = new StayPointRecordDTO();
Optional.of(stayPointRecord.bgnTime)
.map(bgnTime -> new Date((long) stayPointRecord.bgnTime * 1000))
.map(DateUtils::formatNormal)
.ifPresent(stayPointRecordDTO::setBeginTime);
Optional.of(stayPointRecord.endTime)
.map(bgnTime -> new Date((long) stayPointRecord.endTime * 1000))
.map(DateUtils::formatNormal)
.ifPresent(stayPointRecordDTO::setEndTime);
stayPointRecordDTO.setDuration(stayPointRecord.duration);
GpsLocation gpsLocation = new GpsLocation();
Optional.ofNullable(stayPointRecord.stayGps)
.map(e -> e.lat)
.map(LocationUtil::latlng)
.ifPresent(gpsLocation::setLat);
Optional.ofNullable(stayPointRecord.stayGps)
.map(e -> e.lng)
.map(LocationUtil::latlng)
.ifPresent(gpsLocation::setLng);
Optional.ofNullable(stayPointRecord.stayGps)
.map(e -> e.blat)
.map(LocationUtil::latlng)
.ifPresent(gpsLocation::setBlat);
Optional.ofNullable(stayPointRecord.stayGps)
.map(e -> e.blng)
.map(LocationUtil::latlng)
.ifPresent(gpsLocation::setBlat);
Optional.ofNullable(stayPointRecord.stayGps)
.map(e -> e.glat)
.map(LocationUtil::latlng)
.ifPresent(gpsLocation::setElat);
Optional.ofNullable(stayPointRecord.stayGps)
.map(e -> e.glng)
.map(LocationUtil::latlng)
.ifPresent(gpsLocation::setElng);
stayPointRecordDTO.setStayGps(gpsLocation);
return stayPointRecordDTO;
}
}
package cn.com.glsx.devicemonitor.modules.service; package cn.com.glsx.devicemonitor.modules.service;
import cn.com.glsx.devicemonitor.api.dto.LngLatDTO;
import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationRequest; import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationRequest;
import cn.com.glsx.devicemonitor.api.dto.request.GpsBsFirstBatchRequest; 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.GpsBsData;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation; import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
import cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum; import cn.com.glsx.devicemonitor.api.enums.DeviceTypeRelationEnum;
import org.apache.commons.lang3.tuple.ImmutablePair;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -90,6 +92,13 @@ public interface GpsBsLocationService { ...@@ -90,6 +92,13 @@ public interface GpsBsLocationService {
String getAddressBylngAndLat(String lng, String lat); String getAddressBylngAndLat(String lng, String lat);
/** /**
* 通过经纬度获取地址
* @param lngLats 经纬度集合
* @return 经纬度对应的地址
*/
Map<String, String> getAddressMap(List<LngLatDTO> lngLats);
/**
* 根据设备号和报警时间获取报警时间的定位 * 根据设备号和报警时间获取报警时间的定位
* *
* @param sn 设备号 * @param sn 设备号
......
package cn.com.glsx.devicemonitor.modules.service;
import cn.com.glsx.devicemonitor.api.dto.request.ResidentRequest;
import cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO;
import com.glsx.plat.core.web.R;
import org.springframework.cloud.openfeign.SpringQueryMap;
import java.util.List;
/**
* @author xiangyanlin
* @date 2022/5/9
*/
public interface ResidentService {
/**
* 常驻地列表
* @param request 请求参数
* @return 返回集合
*/
List<ResidentDTO> getResidentList(ResidentRequest request);
}
package cn.com.glsx.devicemonitor.modules.service;
import cn.com.glsx.devicemonitor.api.dto.request.StayPointRequest;
import cn.com.glsx.devicemonitor.api.dto.response.StayPointRecordDTO;
import java.util.List;
/**
* 停留点服务
* @author xiangyanlin
* @date 2022/5/7
*/
public interface StayPointService {
/**
* 停留点列表
* @param stayPointRequest 查询参数
* @return 实例集合
*/
List<StayPointRecordDTO> getStayPointRecord(StayPointRequest stayPointRequest);
}
...@@ -16,6 +16,7 @@ import cn.com.glsx.devicemonitor.modules.model.TrackInfoDTO; ...@@ -16,6 +16,7 @@ import cn.com.glsx.devicemonitor.modules.model.TrackInfoDTO;
import cn.com.glsx.devicemonitor.modules.service.DeviceService; import cn.com.glsx.devicemonitor.modules.service.DeviceService;
import cn.com.glsx.devicemonitor.modules.utils.DeviceUtils; import cn.com.glsx.devicemonitor.modules.utils.DeviceUtils;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.StopWatch;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.common.utils.StringUtils;
...@@ -76,7 +77,11 @@ public class DeviceServiceImpl implements DeviceService { ...@@ -76,7 +77,11 @@ public class DeviceServiceImpl implements DeviceService {
@Override @Override
public DeviceDTO getDeviceDTOBySn(String sn, Boolean storeIfNotExists) { public DeviceDTO getDeviceDTOBySn(String sn, Boolean storeIfNotExists) {
StopWatch sw = new StopWatch();
sw.start("getDeviceOrRemote");
Device device = getDeviceOrRemote(sn, storeIfNotExists); Device device = getDeviceOrRemote(sn, storeIfNotExists);
sw.stop();
log.info(sw.getLastTaskName() + "耗时:" + sw.getTotalTimeSeconds());
if (device == null) { if (device == null) {
return null; return null;
} }
......
package cn.com.glsx.devicemonitor.modules.service.impl; package cn.com.glsx.devicemonitor.modules.service.impl;
import cn.com.glsx.devicemonitor.api.dto.LngLatDTO;
import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationItem; import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationItem;
import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationRequest; import cn.com.glsx.devicemonitor.api.dto.request.DeviceLocationRequest;
import cn.com.glsx.devicemonitor.api.dto.request.GpsBsFirstBatchRequest; import cn.com.glsx.devicemonitor.api.dto.request.GpsBsFirstBatchRequest;
...@@ -25,6 +26,7 @@ import com.glsx.plat.common.utils.HttpUtils; ...@@ -25,6 +26,7 @@ import com.glsx.plat.common.utils.HttpUtils;
import com.glsx.plat.context.utils.PropertiesUtils; import com.glsx.plat.context.utils.PropertiesUtils;
import com.glsx.plat.exception.BusinessException; import com.glsx.plat.exception.BusinessException;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -109,17 +111,14 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService { ...@@ -109,17 +111,14 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService {
List<GpsBsData> gpsBsDataList = Lists.newArrayList(); List<GpsBsData> gpsBsDataList = Lists.newArrayList();
// 遍历设备 激活时间集合 分别获取定位信息 // 遍历设备 激活时间集合 分别获取定位信息
for (GpsBsFirstBatchRequest gpsBsFirstBatchRequest : gpsBsFirstBatchRequestList) { for (GpsBsFirstBatchRequest gpsBsFirstBatchRequest : gpsBsFirstBatchRequestList) {
// 1、调用ICE批量获取数据 // 1、调用ICE批量获取GPS数据
DataGpsLocation dataGpsLocation = hdaoGpsComponent.getDevicesFirstGpsInfo(gpsBsFirstBatchRequest.getSn(), gpsBsFirstBatchRequest.getActiveDate()); DataGpsLocation dataGpsLocation = hdaoGpsComponent.getDevicesFirstGpsInfo(gpsBsFirstBatchRequest.getSn(), gpsBsFirstBatchRequest.getActiveDate());
GpsBsData gpsBsData = new GpsBsData(); GpsBsData gpsBsData = new GpsBsData();
gpsBsData.setSn(gpsBsFirstBatchRequest.getSn()); gpsBsData.setSn(gpsBsFirstBatchRequest.getSn());
gpsBsData.setGpsLocation(DataLocationConvert.convertDataToGpsLocation(dataGpsLocation)); gpsBsData.setGpsLocation(DataLocationConvert.convertDataToGpsLocation(dataGpsLocation));
if (GeoLocationEnum.GPS.equals(dataGpsLocation.getGeoLocationEnum())) { // 2、补充基站的数据
gpsBsData.setGpsLocation(DataLocationConvert.convertDataToGpsLocation(dataGpsLocation));
// 2.1 如果是GPS,则补充获取基站的数据
DataGpsLocation bsLocation = hdaoGpsComponent.getDevicesFirstBsInfo(gpsBsFirstBatchRequest.getSn(), gpsBsFirstBatchRequest.getActiveDate()); DataGpsLocation bsLocation = hdaoGpsComponent.getDevicesFirstBsInfo(gpsBsFirstBatchRequest.getSn(), gpsBsFirstBatchRequest.getActiveDate());
gpsBsData.setBsLocation(DataLocationConvert.convertDataToGpsLocation(bsLocation)); gpsBsData.setBsLocation(DataLocationConvert.convertDataToGpsLocation(bsLocation));
}
gpsBsDataList.add(gpsBsData); gpsBsDataList.add(gpsBsData);
} }
...@@ -434,6 +433,22 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService { ...@@ -434,6 +433,22 @@ public class GpsBsLocationServiceImpl implements GpsBsLocationService {
} }
/** /**
* 获取经纬度对应的地址
*/
@Override
public Map<String, String> getAddressMap(List<LngLatDTO> lngLats) {
Map<String, String> result = Maps.newHashMap();
if (CollectionUtils.isEmpty(lngLats)) {
return result;
}
lngLats.forEach(e -> {
String address = getAddressBylngAndLat(e.getLat(), e.getLng());
result.put(e.getLat() + e.getLng(), address);
});
return result;
}
/**
* 根据设备号和报警时间获取报警时间的定位 * 根据设备号和报警时间获取报警时间的定位
* *
* @param sn 设备号 * @param sn 设备号
......
package cn.com.glsx.devicemonitor.modules.service.impl;
import cn.com.glsx.devicemonitor.api.dto.request.ResidentRequest;
import cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO;
import cn.com.glsx.devicemonitor.modules.components.FspComponent;
import cn.com.glsx.devicemonitor.modules.service.ResidentService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author xiangyanlin
* @date 2022/5/9
*/
@Slf4j
@Service
public class ResidentServiceImpl implements ResidentService {
@Autowired
private FspComponent fspComponent;
@Override
public List<ResidentDTO> getResidentList(ResidentRequest request) {
List<ResidentDTO> residentList = fspComponent.getResidentByRealTime(request.getSn(), request.getBeginTime(), request.getEndTime(),
request.getTimes(), request.getLocInfoType());
if(CollectionUtils.isEmpty(residentList)) {
return Lists.newArrayList();
}
return residentList;
}
}
package cn.com.glsx.devicemonitor.modules.service.impl;
import cn.com.glsx.devicemonitor.api.dto.request.StayPointRequest;
import cn.com.glsx.devicemonitor.api.dto.response.StayPointRecordDTO;
import cn.com.glsx.devicemonitor.iceprotocol.mile.StayPointRecord;
import cn.com.glsx.devicemonitor.modules.components.HDaoMileComponent;
import cn.com.glsx.devicemonitor.modules.converter.StayPointConvert;
import cn.com.glsx.devicemonitor.modules.service.StayPointService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 停留点服务
* @author xiangyanlin
* @date 2022/5/7
*/
@Slf4j
@Service
public class StayPointServiceImpl implements StayPointService {
@Autowired
private HDaoMileComponent hDaoMileComponent;
@Override
public List<StayPointRecordDTO> getStayPointRecord(StayPointRequest stayPointRequest) {
List<StayPointRecord> stayPointRecords = hDaoMileComponent.listStayPointQuery(stayPointRequest.getSn(),
stayPointRequest.getBeginTime(), stayPointRequest.getEndTime(),
stayPointRequest.getPeriodType(), stayPointRequest.getMin(), stayPointRequest.getMax());
if(CollectionUtils.isEmpty(stayPointRecords)) {
return Lists.newArrayList();
}
return StayPointConvert.convertTo(stayPointRecords);
}
}
package cn.com.glsx.devicemonitor.modules.utils; package cn.com.glsx.devicemonitor.modules.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -67,4 +72,21 @@ public class DateUtils extends com.glsx.plat.common.utils.DateUtils { ...@@ -67,4 +72,21 @@ public class DateUtils extends com.glsx.plat.common.utils.DateUtils {
return value; return value;
} }
} }
/**
* 将字符串转为unix时间戳(秒级)
*
* @param dateString 2016-04-12 13:46:03
* @return he seconds from the epoch of 1970-01-01T00:00:00Z
*/
public static Long getEpochSecond(String dateString) {
LocalDateTime localDateTime = LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
long timestamp = localDateTime.toInstant(ZoneOffset.of("+8")).getEpochSecond();
return timestamp;
}
public static String getNowDateTimeFormat() {
LocalDateTime now = LocalDateTime.now();
return now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
} }
package cn.com.glsx.devicemonitor.modules.service.impl;
import cn.com.glsx.Application;
import cn.com.glsx.devicemonitor.api.dto.request.ResidentRequest;
import cn.com.glsx.devicemonitor.api.dto.response.ResidentDTO;
import cn.com.glsx.devicemonitor.modules.service.ResidentService;
import cn.com.glsx.devicemonitor.modules.utils.DateUtils;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
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.*;
/**
* @author xiangyanlin
* @date 2022/5/9
*/
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class ResidentServiceImplTest {
@Autowired
private ResidentService residentService;
@Test
public void GetResidentList() {
ResidentRequest request = new ResidentRequest();
request.setSn("60907150063");
request.setBeginTime("2012-01-01 00:00:00");
request.setEndTime(DateUtils.getNowDateTimeFormat());
request.setTimes(4);
request.setLocInfoType(1);
List<ResidentDTO> residentList = residentService.getResidentList(request);
System.out.println(JSON.toJSONString(residentList));
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.devicemonitor.modules.service.impl;
import cn.com.glsx.Application;
import cn.com.glsx.devicemonitor.api.dto.request.StayPointRequest;
import cn.com.glsx.devicemonitor.api.dto.response.StayPointRecordDTO;
import cn.com.glsx.devicemonitor.modules.service.StayPointService;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.Date;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author xiangyanlin
* @date 2022/5/7
*/
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class StayPointServiceImplTest {
@Autowired
private StayPointService stayPointService;
@Test
public void testGetStayPointRecord() {
StayPointRequest request = new StayPointRequest();
request.setSn("60907150063");
request.setBeginTime(new Date(1640966400000L));
request.setEndTime(new Date(1652716800000L));
request.setPeriodType(0);
List<StayPointRecordDTO> stayPointRecord = stayPointService.getStayPointRecord(request);
System.out.println(JSON.toJSONString(stayPointRecord));
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.test;
import Ice.ObjectPrx;
import cn.com.glsx.devicemonitor.iceprotocol.resident.FspServicePrx;
import cn.com.glsx.devicemonitor.iceprotocol.resident.FspServicePrxHelper;
import lombok.extern.slf4j.Slf4j;
/**
* @author Yanglinlong
* @date 2022/1/15 17:09
*/
@Slf4j
public class ICETest {
public static void main(String[] args) {
boolean init = false;
try {
String host = "192.168.3.101";
String port = "30060";
String arrayHost[] = {host, port};
Ice.Communicator ic = Ice.Util.initialize(arrayHost);
String lbsPxyStr = "FspService:default -h " + host + " -p " + port;
log.info("常驻地调用地址1:" + lbsPxyStr);
ObjectPrx base = ic.stringToProxy(lbsPxyStr);
log.info("常驻地调用地址2:" + lbsPxyStr);
FspServicePrx fspServicePrx = FspServicePrxHelper.checkedCast(base);
if (null == fspServicePrx) {
log.info("Invalid proxy");
} else {
init = true;
log.info("Query Resident Ice Init Success!");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("init = " + init);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!