Merge branch 'dev' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into dev

This commit is contained in:
wangcongtao
2020-08-17 16:21:17 +08:00
26 changed files with 271 additions and 66 deletions

View File

@@ -75,6 +75,7 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME ) );
MogoModulePaths.addBaseModule(new MogoModule( MogoServicePaths.PATH_STRATEGY_SHARE,"StrategyShare"));
MogoModulePaths.addModule( new MogoModule( V2XConst.PATH_EVENT_PANEL, V2XConst.MODULE_NAME_EVENT_PANEL ) );
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );

View File

@@ -42,7 +42,8 @@ public class MogoTanluApiProvider implements IMogoTanluProvider {
properties.put("from", params.getFromType());
AnalyticsUtils.track("v2x_share_type", properties);
MainService.Companion.launchService(context, new UploadParams(params.getEventType(),
params.getFromType(), params.getDuration()));
params.getFromType(), params.getDuration(), params.getParentId(),
params.getLocation().lat, params.getLocation().lon));
}else{
throw new IllegalArgumentException("TanluUploadParams 不允许为空");
}

View File

@@ -34,6 +34,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
var mType: String = "" //1 上报拥堵, 2 封路和查车
var mainInfoId: Long = 0
var mFromType: String = ""
private var mLongitude: Double = 0.0
private var mLatitude: Double = 0.0
private var getVideoFailed: (() -> Unit)? = null
private var interceptors: ArrayList<TakePhotoInterceptor> = ArrayList(1)
@@ -69,12 +71,16 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
isCustom: Boolean = false,
type: String,
mainInfoId: Long,
fromType: String
fromType: String,
longitude: Double,
latitude: Double
) {
Log.d(TAG, "takePhoto ---------- type = $type --- mType = $mType ---fromType = $fromType")
this.mType = type
this.mainInfoId = mainInfoId
this.mFromType = fromType
this.mLongitude = longitude
this.mLatitude = latitude
CustomStatusHandler.offerPhotoStatus(isCustom)
zdCarCoderController.takePhoto(photoType, cameraId, haveVoice)
trackGetPhoto(1)
@@ -91,13 +97,16 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
id: Long = 0L,
type: String,
mainInfoId: Long,
fromType: String
fromType: String,
longitude: Double,
latitude: Double
) {
Log.d(TAG, "takeVideo -------- type = $type")
Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType")
Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type" )
this.mType = type
this.mainInfoId = mainInfoId
this.mFromType = fromType
this.mLongitude = longitude
this.mLatitude = latitude
if (DebugConfig.getCarMachineType() == 0) { //自研车机
outputVideoPath = getCompressVideoPath()
CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id))
@@ -118,7 +127,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
videoAndThumbMap,
mType,
entity,
mainInfoId
mainInfoId,
mLongitude,
mLatitude
)
//地图上打点
@@ -177,7 +188,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
mutableMapOf("pic" to "" as String),
mType,
entity,
mainInfoId
mainInfoId,
mLongitude,
mLatitude
);
}
}
@@ -219,7 +232,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
if (!TextUtils.isEmpty(mType)) {
Log.d(TAG, "onTakePhotoSuccess mType != null")
CosStatusController().uploadFile(mutableListOf(photoPath as String), entity, mType, mainInfoId, mFromType)
CosStatusController().uploadFile(mutableListOf(photoPath as String), entity, mType, mainInfoId, mFromType, mLongitude,
mLatitude)
} else {
Log.d(TAG, "onTakePhotoSuccess mType == null")
Log.d(
@@ -234,7 +248,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
entity,
mType,
mainInfoId,
mFromType
mFromType,
mLongitude,
mLatitude
)
}
}
@@ -247,7 +263,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
entity,
mType,
mainInfoId,
mFromType
mFromType,
mLongitude,
mLatitude
)
}
}
@@ -336,7 +354,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
videoAndThumbMap,
mType,
entity,
mainInfoId
mainInfoId,
mLongitude,
mLatitude
)
//地图上打点
@@ -375,7 +395,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
entity,
mType,
mainInfoId,
mFromType
mFromType,
mLongitude,
mLatitude
)
//删除压缩前的视频
deletePicFile(videoPath)

View File

@@ -38,16 +38,21 @@ class CosStatusController : CosStatusCallback {
private var mType: String = ""
private var mainInfoId: Long = 0
private var mFromType: String = ""
private var mLongitude: Double = 0.0
private var mLatitude: Double = 0.0
//上传文件
fun uploadFile(picPath: MutableList<String>, entity: TakeEntity, type: String, mainInfoId: Long, fromType: String) {
fun uploadFile(picPath: MutableList<String>, entity: TakeEntity, type: String, mainInfoId: Long,
fromType: String, longitude: Double, latitude: Double) {
CosCallbackMapController.registerCallback(picPath, this)
// CosLogger.setLogStatus(true)
this.entity = entity
this.mType = type
this.mainInfoId = mainInfoId
this.mFromType = fromType;
this.mFromType = fromType
this.mLongitude = longitude
this.mLatitude = latitude
Log.d(TAG, "uploadFile type===$type ---- mainInfoId =$mainInfoId ----mFromType = $mFromType ---- picPath = $picPath ")
trackUploadCos(3)
if (picPath.contains("backPic")) return
@@ -161,7 +166,9 @@ class CosStatusController : CosStatusCallback {
mutableMapOf("pic" to downloadUrl as String),
mType,
entity,
mainInfoId
mainInfoId,
mLongitude,
mLatitude
)
// }
}
@@ -177,7 +184,7 @@ class CosStatusController : CosStatusCallback {
// CosCallbackMapController.mainService?.sendCustomResult(it)
// }
// } else {
sendInformationDirectly(type, map, mType, entity, mainInfoId)
sendInformationDirectly(type, map, mType, entity, mainInfoId, mLongitude, mLatitude)
// }
}
@@ -189,7 +196,9 @@ class CosStatusController : CosStatusCallback {
map: Map<String, String>,
poiType: String,
entity: TakeEntity,
mainInfoId: Long
mainInfoId: Long,
longitude: Double,
latitude: Double
) {
Log.d(TAG, "sendInformationDirectly isCustomSend = ${entity?.isCustom}")
Log.d(TAG, "sendInformationDirectly poiType= $poiType ---- mainInfoId= $mainInfoId")
@@ -198,7 +207,9 @@ class CosStatusController : CosStatusCallback {
url = map,
isCustom = entity?.isCustom,
poiType = poiType,
mainInfoId = mainInfoId
mainInfoId = mainInfoId,
longitude = longitude,
latitude = latitude
) { success ->
CosCallbackMapController.unregisterCallbacks(map)
CosCallbackMapController.mainService?.let {

View File

@@ -62,6 +62,8 @@ class MainService : Service() {
var params: UploadParams? = null
var mainInfoId: Long = 0
private var mLongitude: Double = 0.0
private var mLatitude: Double = 0.0
//发送主动上报结果广播给外部
fun sendCustomResult(result: Boolean) {
@@ -87,14 +89,16 @@ class MainService : Service() {
params?.let {
shareType = it.eventType
fromType = it.fromType
mainInfoId = 0 //TODO
Log.d(TAG, "onStartCommand shareType = $shareType")
mainInfoId = it.parentId.toLong()
mLongitude = it.lon
mLatitude = it.lat
Log.d(TAG, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ")
if (shareType == TANLU_ROAD_CONGESTION || shareType == TANLU_TRAFFIC_CHECK || shareType == TANLU_ROAD_CLOSURE || shareType == TANLU_ROAD_CURRENT
|| shareType == TANLU_ROAD_PONDING || shareType == TANLU_ROAD_ICING || shareType == TANLU_ROAD_HEAVY_FOG
|| shareType == TANLU_ROAD_ACCIDENT || shareType == TANLU_ROAD_WORK
) {
// takePhoto(1, false, true)
if (!fromType.equals(UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO)) { // 是策略触发,不提示
if (fromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) { // 是策略触发,不提示
takeVideo(it.duration, isCustom = true, id = id)
} else {
takeVideo(it.duration)
@@ -131,7 +135,7 @@ class MainService : Service() {
override fun onReceive(p0: Context?, p1: Intent) {
val id = p1.getLongExtra("id", 0L)
if (p1.action == sendInformationAction) {
takeVideo(10, isCustom = true, id = id)
takeVideo(DEFAULT_VIDEO_DURATION, isCustom = true, id = id)
}
}
}
@@ -181,7 +185,7 @@ class MainService : Service() {
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 98)
fun getImageEvent(getImageSuccessEvent: GetImageSuccessEvent) {
var info = LocationUtil.getInstance().getLocationInfo()
Log.e("MainService", "getImageEvent long = ${info.longitude} ----> lat= ${info.latitude}")
Log.d("MainService", "getImageEvent long = ${info.longitude} ----> lat= ${info.latitude}")
Log.d(
"MainService",
"getImageEvent url = " + getImageSuccessEvent.getImageUrl() + ">>>>type =" + getImageSuccessEvent.getType()
@@ -250,7 +254,7 @@ class MainService : Service() {
}
if (videoType == 1) {
takeVideo(10)
takeVideo(DEFAULT_VIDEO_DURATION)
} else if (videoType == 2) {
postVideoAlarmTask(true)
}
@@ -278,7 +282,7 @@ class MainService : Service() {
Observable.intervalRange(0, 1, 0, 2_000, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType)
CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude)
})
// }
@@ -297,7 +301,7 @@ class MainService : Service() {
Log.d("MainService", "takeVideo --------1---->")
// if (isAuthorization(BaseApplication.getAppContext())) {
// log(TAG, "takeVideo --------2---->")
CarCorderController.takeVideo(1, duration, isCustom, id, if (isCustom) shareType else TANLU_ROAD_CURRENT, mainInfoId, fromType)
CarCorderController.takeVideo(1, duration, isCustom, id, if (isCustom) shareType else TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude)
// }
postVideoAlarmTask(isInterval)

View File

@@ -227,16 +227,18 @@ class MainServiceController {
isShare:Boolean = false,
poiType:String,
mainInfoId:Long,
longitude: Double,
latitude: Double,
customSend: ((Boolean) -> Unit)? = null
) {
Log.d(TAG, " sendInformationMessage poiType = $poiType");
//删除测试数据
var locationInfo = LocationUtil.getInstance().getLocationInfo();
if (locationInfo.address.isNullOrEmpty()) {
geoLocation(type, url, locationInfo, isCustom,trafficInfoType, isShare, customSend,poiType,mainInfoId)
geoLocation(type, url, locationInfo, isCustom,trafficInfoType, isShare, customSend,poiType,mainInfoId,longitude,latitude)
} else {
postInformationMessage(
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare,poiType,mainInfoId),
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare,poiType,mainInfoId,longitude,latitude),
customSend
)
}
@@ -253,19 +255,21 @@ class MainServiceController {
isShare: Boolean,
customSend: ((Boolean) -> Unit)? = null,
poiType: String,
mainInfoId: Long
mainInfoId: Long,
longitude: Double,
latitude: Double
) {
Log.d(TAG, " geoLocation -- poiType = $poiType");
LocationUtil.getInstance()
.geoCodeLocation(locationInfo.toLatLngPoint(), { locInfo: LocationInfo ->
postInformationMessage(
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId),
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude),
customSend
)
}, {
//转换失败的情况下再重试一次
geoRetryed = if (!geoRetryed) {
geoLocation(type, url, locationInfo, isCustom, trafficInfoType, isShare, customSend, poiType,mainInfoId)
geoLocation(type, url, locationInfo, isCustom, trafficInfoType, isShare, customSend, poiType,mainInfoId,longitude,latitude)
true
} else {
false

View File

@@ -2,29 +2,37 @@ package com.zhidao.roadcondition.service
import android.os.Parcel
import android.os.Parcelable
import com.mogo.map.MogoLatLng
class UploadParams(val eventType:String,val fromType:String,val duration:Int) : Parcelable {
class UploadParams(val eventType: String, val fromType: String, val duration: Int, val parentId: String, val lat: Double, val lon: Double) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString()!!,
parcel.readString()!!,
parcel.readInt())
parcel.readInt(),
parcel.readString()!!,
parcel.readDouble(),
parcel.readDouble()
)
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(eventType)
parcel.writeString(fromType)
parcel.writeInt(duration)
parcel.writeString(parentId)
parcel.writeDouble(lat)
parcel.writeDouble(lon)
}
override fun describeContents(): Int {
return 0
}
override fun toString(): String {
return "UploadParams(eventType='$eventType', fromType='$fromType', duration=$duration)"
return "UploadParams(eventType='$eventType', fromType='$fromType', duration=$duration, parentId='$parentId', lat=$lat, lon=$lon)"
}
companion object CREATOR : Parcelable.Creator<UploadParams> {
override fun createFromParcel(parcel: Parcel): UploadParams {
return UploadParams(parcel)

View File

@@ -4,6 +4,7 @@ import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.network.Utils
import com.zhidao.roadcondition.constant.TANLU_ROAD_CURRENT
import com.zhidao.roadcondition.model.InformationBody
import com.zhidao.roadcondition.model.LocationInfo
import com.zhidao.roadcondition.model.proxy.INFO_TYPE_IMG
@@ -29,7 +30,9 @@ fun getInformationBody(
trafficInfoType:String = "",
isShare:Boolean,
poiType: String,
mainInfoId: Long
mainInfoId: Long,
latitude: Double,
longitude: Double
): InformationBody {
var jsonArray = JsonArray()
var type: Int
@@ -54,8 +57,8 @@ fun getInformationBody(
locationInfo.cityCode,
locationInfo.cityName,
System.currentTimeMillis(),
locationInfo.latitude,
locationInfo.longitude,
if (latitude == 0.0) locationInfo.latitude else latitude,
if (longitude == 0.0) locationInfo.longitude else longitude,
locationInfo.provinceName,
Utils.getSn(),
locationInfo.street,

View File

@@ -22,7 +22,7 @@ const val PARAM_ACTIVE_STATUS = "PARAM_ACTIVE_STATUS"
const val LAST_ENTER_TIME = "LAST_ENTER_TIME"
const val PIC_NUMBER = "PIC_NUMBER" //图片拍摄张数
const val VIDEO_DURATION_DEFAULT = 15_000L //视频拍摄时长
const val VIDEO_DURATION_DEFAULT = 10_000L //视频拍摄时长
const val PIC_NUMBER_DEFAULT = 1L //图片拍摄张数
const val TIME_QUANTUM = "time_quantum" //时间段

View File

@@ -5,6 +5,7 @@
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimAmount">0.85</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:fullBright">@android:color/transparent</item>

View File

@@ -1,6 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.alibaba.arouter'
android {
@@ -38,7 +39,7 @@ dependencies {
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid

View File

@@ -32,6 +32,8 @@ import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.intent.IMogoIntentManager;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.share.IMogoShareManager;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.service.tanlu.IMogoTanluProvider;
import com.mogo.service.tanlu.TanluUploadParams;
import com.mogo.utils.TipToast;
@@ -209,29 +211,16 @@ public class ShareControl implements IMogoShareManager, IMogoIntentListener, IMo
AIAssist.getInstance(context).registerUnWakeupCommand(UNWAKE_UPLOAD_ROAD_CONSTRUCTION,
UPLOAD_ROAD_CONSTRUCTION, this);
}
// ServiceApisManager.serviceApis.getRegisterCenterApi().registerObuDataListener("share", new IMogoObuDataChangedListener() {
// @Override
// public void showCarLocationInfo(CarLocationInfo info) {
// Logger.d(TAG, "获取到car location info: " + info.carId);
// }
//
// @Override
// public void showOtherInfo(String info) {
// Logger.d(TAG, "获取到other info: " + info);
// }
//
// @Override
// public void showTrafficLightInfo(TrafficLightInfo info) {
// Logger.d(TAG, "获取到traffic light info: " + info.id);
// }
//
// @Override
// public void showCarEventInfo(CarEventInfo info) {
// Logger.d(TAG, "获取到car event info: " + info.describe);
// }
// });
if(!DebugConfig.isLauncher()) {
ServiceApisManager.serviceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() {
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (!isTrue) {
dismissShareDialog();
}
}
});
}
Logger.d(TAG,"init over====");
}

View File

@@ -0,0 +1,27 @@
package com.mogo.module.share
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.template.IProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.module.share.constant.ACCIDENT_STRATEGY_SHARE_PUSH_TYPE
import com.mogo.module.share.constant.S_TAG
import com.mogo.module.share.strategyreceiver.AccidentStrategyReceiver
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
import com.mogo.utils.logger.Logger
/**
* 策略上报入口服务端策略上报Push的接收地接收后再调用tanlu相关接口进行视频抓取
*
* @author tongchenfei
*/
@Route(path = MogoServicePaths.PATH_STRATEGY_SHARE)
class StrategyShareProvider : IProvider {
override fun init(context: Context?) {
Logger.d(S_TAG, "策略上报Provider初始化====")
val apis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
// 注册事故
apis.getSocketManagerApi(context).registerOnMessageListener(ACCIDENT_STRATEGY_SHARE_PUSH_TYPE, AccidentStrategyReceiver(apis))
}
}

View File

@@ -0,0 +1,4 @@
package com.mogo.module.share.constant
const val S_TAG = "StrategyShare"
const val ACCIDENT_STRATEGY_SHARE_PUSH_TYPE = 401013

View File

@@ -6,6 +6,7 @@ import android.view.WindowManager;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.dialog.BaseFloatDialog;
import com.mogo.module.share.R;
import com.mogo.module.share.manager.ISeekHelpListener;
@@ -193,4 +194,21 @@ public class LaucherShareDialog extends BaseFloatDialog implements View.OnClickL
UploadHelper.INSTANCE.upload(mContext, params,true);
}
@Override
public void show() {
Logger.d(TAG,"onShow====");
if(!DebugConfig.isLauncher()) {
mApis.getAdasControllerApi().closeADAS();
}
super.show();
}
@Override
public void dismiss() {
Logger.d(TAG,"onDismiss=====");
if (!DebugConfig.isLauncher()&&mApis.getStatusManagerApi().isMainPageOnResume()) {
mApis.getAdasControllerApi().showADAS();
}
super.dismiss();
}
}

View File

@@ -4,6 +4,8 @@ import android.content.Context
import android.content.Intent
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.voice.AIAssist
import com.mogo.map.MogoLatLng
import com.mogo.map.location.MogoLocation
import com.mogo.module.share.ShareControl
import com.mogo.module.share.dialog.LaucherShareDialog
import com.mogo.service.tanlu.TanluUploadParams
@@ -23,6 +25,9 @@ object UploadHelper {
if(DebugConfig.getAIType() == DebugConfig.AI_TYPE_TXZ||forcePlayVoice) {
AIAssist.getInstance(context).speakTTSVoice("感谢分享,正在上传")
}
val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation
val latLon = MogoLatLng(location.latitude, location.longitude)
type.location = latLon
Logger.d("UploadHelper", "upload ----> $type")
ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type)
// val intent = Intent()

View File

@@ -0,0 +1,11 @@
package com.mogo.module.share.strategyreceiver
data class AccidentStrategyPushWrapper(
/**
* 策略类型1代表事故
*/
val type: Int,
/**
* 触发点的poiType
*/
val id: String, val lat: Double, val lon: Double)

View File

@@ -0,0 +1,25 @@
package com.mogo.module.share.strategyreceiver
import com.mogo.map.MogoLatLng
import com.mogo.module.share.constant.S_TAG
import com.mogo.service.IMogoServiceApis
import com.mogo.service.connection.IMogoOnMessageListener
import com.mogo.service.tanlu.IMogoTanluProvider
import com.mogo.service.tanlu.TanluUploadParams
import com.mogo.utils.logger.Logger
/**
* 车辆经过事故事件,上报视频
* @author tong
*/
class AccidentStrategyReceiver(private val apis: IMogoServiceApis):IMogoOnMessageListener<AccidentStrategyPushWrapper> {
override fun target(): Class<AccidentStrategyPushWrapper> = AccidentStrategyPushWrapper::class.java
override fun onMsgReceived(obj: AccidentStrategyPushWrapper?) {
obj?.let {
Logger.d(S_TAG, "Accident strategy share onMessageReceived: $obj")
// 调用探路接口上报现在只接入了事故事件上报这一种策略上报所以poiType固定为TypeAccident
apis.tanluApi.uploadRoadCondition(TanluUploadParams(IMogoTanluProvider.TYPE_ACCIDENT, IMogoTanluProvider.UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO, it.id, MogoLatLng(it.lat, it.lon)))
}
}
}

View File

@@ -60,6 +60,7 @@ public class V2XConst {
public static final String V2X_ROAD_SHOW = "v2x_road_show";
public static final String V2X_ROAD_EVET = "v2x_road_event";
public static final String V2X_ROAD_EVET_HISTORY_BUTTON = "V2X_button_click";
public static final String V2X_ROAD_PRODUCE = "v2x_road_produce";
/**
* V2X 道路事件操作类型
*/

View File

@@ -31,7 +31,6 @@ import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkWindow;
import com.mogo.module.v2x.utils.FatigueDrivingUtils;
import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.module.IMogoModuleLifecycle;
@@ -156,8 +155,6 @@ public class V2XModuleProvider implements
}
// 刷新配置文件
refreshStrategyConfig();
// 清除V2X事件数据库中过期的数据数据有效期为24小时
V2XSQLiteUtils.clearYesterdayScenarioHistoryData();
}
/**

View File

@@ -19,6 +19,7 @@ import com.mogo.module.v2x.manager.IMoGoV2XStatusChangedListener;
import com.mogo.module.v2x.manager.V2XStatusDescriptor;
import com.mogo.module.v2x.presenter.ScenarioHistoryPresenter;
import com.mogo.module.v2x.utils.ThreadUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.view.V2XListEmptyView;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
@@ -130,6 +131,8 @@ public class V2XScenarioHistoryFragment
@Override
public void onResume() {
super.onResume();
// 清除V2X事件数据库中过期的数据数据有效期为24小时
V2XSQLiteUtils.clearYesterdayScenarioHistoryData();
mPresenter.loadHistory();
}

View File

@@ -26,6 +26,7 @@ import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.module.v2x.utils.MarkerUtils;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
@@ -157,6 +158,7 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
);
// Logger.w(MODULE_NAME, "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance());
// 触发展示操作
TrackUtils.trackV2xRoadProduceEvent(1);
V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity = new V2XMessageEntity<>();
v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
v2XMessageEntity.setContent(v2XRoadEventEntity);

View File

@@ -17,6 +17,7 @@ import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.alarm.V2XAlarmServer;
import com.mogo.module.v2x.utils.TimeConstants;
import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.utils.logger.Logger;
@@ -42,6 +43,7 @@ public class V2XMessageListener_401012 implements IMogoOnMessageListener<MarkerC
public void onMsgReceived(MarkerCardResult response) {
Logger.d(MODULE_NAME, "V2XMessageListener_401012==V2X服务端下发\n"
+ GsonUtil.jsonFromObject(response));
TrackUtils.trackV2xRoadProduceEvent(2);
try {
long timeSpan = TimeUtils.getTimeSpan(TimeUtils.getNowMills(), response.getMessageTime(), TimeConstants.MIN);
// 三分钟以内的消息才会提示用户

View File

@@ -62,4 +62,19 @@ public class TrackUtils {
e.printStackTrace();
}
}
/**
* @param type type=1 短距离角度匹配
* type=2 历史轨迹匹配
*/
public static void trackV2xRoadProduceEvent(int type) {
try {
Map<String, Object> properties = new HashMap<>();
properties.put("type", type);
V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_PRODUCE, properties);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -238,4 +238,10 @@ public class MogoServicePaths {
*/
@Deprecated
public static final String PATH_TANLU_API = "/tanlulib/api";
/**
* 策略上报
*/
@Deprecated
public static final String PATH_STRATEGY_SHARE = "/share/strategy";
}

View File

@@ -1,5 +1,7 @@
package com.mogo.service.tanlu;
import com.mogo.map.MogoLatLng;
/**
* 探路事件上报参数封装
* @author tongchenfei
@@ -22,6 +24,15 @@ public class TanluUploadParams {
*/
private int duration = IMogoTanluProvider.DEFAULT_VIDEO_DURATION;
/**
* 针对策略上报新增字段用于车辆经过事故事件上报时记录经过的事故事件id
*/
private String parentId = "";
/**
* 针对策略上报新增字段,用于车辆经过事故事件上报时,记录触发围栏时的经纬度坐标
*/
private MogoLatLng location = new MogoLatLng(0, 0);
public TanluUploadParams(String eventType){
this(eventType, IMogoTanluProvider.UPLOAD_FROM_USER);
}
@@ -37,6 +48,21 @@ public class TanluUploadParams {
this.fromType = fromType;
}
/**
* 针对策略上报新增构造方法方便传入parentId和location
* @param eventType 事件类型
* @param fromType 触发类型,是手动还是被动
* @param parentId 经过事件id
* @param location 触发围栏的坐标
*/
public TanluUploadParams(String eventType, String fromType, String parentId,
MogoLatLng location) {
this.eventType = eventType;
this.fromType = fromType;
this.parentId = parentId;
this.location = location;
}
public String getEventType() {
return eventType;
}
@@ -61,12 +87,30 @@ public class TanluUploadParams {
this.duration = duration;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public MogoLatLng getLocation() {
return location;
}
public void setLocation(MogoLatLng location) {
this.location = location;
}
@Override
public String toString() {
return "TanluUploadParams{" +
"eventType='" + eventType + '\'' +
", fromType='" + fromType + '\'' +
", duration=" + duration +
", parentId='" + parentId + '\'' +
", location=" + location +
'}';
}
}