Merge remote-tracking branch 'origin/qa_1.1.5_2' into qa_1.1.5_2

This commit is contained in:
wangcongtao
2020-09-11 14:43:10 +08:00
7 changed files with 81 additions and 55 deletions

View File

@@ -190,7 +190,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
mainInfoId,
mLongitude,
mLatitude
);
)
}
// }
}

View File

@@ -4,6 +4,7 @@ import android.content.Intent
import android.util.Log
import com.google.gson.Gson
import com.mogo.commons.AbsMogoApplication
import com.mogo.utils.TipToast
import com.zhidao.cosupload.DbPriorityConfig
import com.zhidao.cosupload.callback.CosStatusCallback
import com.zhidao.cosupload.manager.CosUploadManagerImpl
@@ -12,10 +13,7 @@ import com.zhidao.roadcondition.event.GetImageSuccessEvent
import com.zhidao.roadcondition.event.LatLngStickyEventBus
import com.zhidao.roadcondition.model.proxy.INFO_TYPE_IMG
import com.zhidao.roadcondition.model.proxy.INFO_TYPE_VIDEO
import com.zhidao.roadcondition.util.CarNet_Cos_Upload
import com.zhidao.roadcondition.util.LocationUtil
import com.zhidao.roadcondition.util.deletePicFile
import com.zhidao.roadcondition.util.trackNormalEvent
import com.zhidao.roadcondition.util.*
/**
* @description cos上传操作
@@ -25,8 +23,10 @@ import com.zhidao.roadcondition.util.trackNormalEvent
*/
class CosStatusController : CosStatusCallback {
val TAG: String = this.javaClass.simpleName
//存储单次请求的视频和缩略图url
var videoAndThumbMap: MutableMap<String, String> = mutableMapOf()
//图片上传的eventId
lateinit var mPicEventId: String
private var isRetry = false //是否重试上传过图片
@@ -90,29 +90,32 @@ class CosStatusController : CosStatusCallback {
// ) || CarCorderController.mType.equals(TANLU_ROAD_WORK)
// ) {
// VoiceController.speakVoice("cos上报失败")
Log.d(TAG, "uploadCosFailed mType = $mType")
if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
sendGetInfoFailedReceiver("100")
}
// }
Log.d(TAG, "uploadCosFailed mType = $mType")
if (!isRetry) {
isRetry = true
// taskAsync(30_000) { //去掉重试
// try {
// uploadFile(mutableListOf(localPath as String), entity, mType)
// } catch (e: Exception) {
// e.printStackTrace()
// }
// }
taskAsync(5_000) {
//去掉重试
try {
uploadFile(mutableListOf(localPath as String), entity, mType, mainInfoId, mFromType, mLongitude, mLatitude)
} catch (e: Exception) {
e.printStackTrace()
}
}
} else {
//重试一次,如果还失败就提示
if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
sendGetInfoFailedReceiver("100")
}
if (localPath!!.endsWith("mp4") || localPath!!.contains("Thumbnail")) {
CosCallbackMapController.uploadFailed?.invoke()
}
CosCallbackMapController.unregisterCallback(localPath)
InformationUploadController.release(entity?.id)
// deletePicFile(localPath)
deletePicFile(localPath)
}
}
override fun uploadCosCompleted(
@@ -142,25 +145,23 @@ class CosStatusController : CosStatusCallback {
val locationStr: String = Gson().toJson(locationInfo)
Log.d(TAG, "locationStr = " + locationStr)
//如果失败,需要提示失败弹框
if (locationInfo.address.isNullOrEmpty() || locationInfo.cityName.isNullOrEmpty() || locationInfo.cityCode.isNullOrEmpty()
|| locationInfo.latitude == 0.0 || locationInfo.areaName.isNullOrEmpty() || locationInfo.street.isNullOrEmpty()
|| locationInfo.areaCode.isNullOrEmpty() || locationInfo.provinceName.isNullOrEmpty()
) {
if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
sendGetInfoFailedReceiver("100")
}
} else {
//分享成功并打点如果是上报拥堵需要takeVideo
LatLngStickyEventBus.getInstance()
.postSticky(GetImageSuccessEvent(downloadUrl, mType))
//上传录像以及缩略图成功
sendInformation(INFO_TYPE_VIDEO, videoAndThumbMap)
}
// if (locationInfo.address.isNullOrEmpty() || locationInfo.cityName.isNullOrEmpty() || locationInfo.cityCode.isNullOrEmpty()
// || locationInfo.latitude == 0.0 || locationInfo.areaName.isNullOrEmpty() || locationInfo.street.isNullOrEmpty()
// || locationInfo.areaCode.isNullOrEmpty() || locationInfo.provinceName.isNullOrEmpty()
// ) {
// if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
// sendGetInfoFailedReceiver("100")
// }
// } else {
//上传录像以及缩略图成功
sendInformation(INFO_TYPE_VIDEO, videoAndThumbMap)
// }
} else {
trackUploadCos(5)
}
} else {
//上传图片成功, 如果是上报路况,直接上传TODO
//上传图片成功, 如果是上报路况,直接上传
Log.d(TAG, "uploadCosCompleted 分享成功 ---- mType = $mType")
sendInformationDirectly(
INFO_TYPE_IMG,
@@ -204,20 +205,36 @@ class CosStatusController : CosStatusCallback {
//开始上传
entity?.isCustom?.let {
mainServiceHttpModel.sendInformationMessage(
type = type,
url = map,
isCustom = it,
poiType = poiType,
mainInfoId = mainInfoId,
longitude = longitude,
latitude = latitude
) { success ->
CosCallbackMapController.unregisterCallbacks(map)
CosCallbackMapController.mainService?.let {
CosCallbackMapController.mainService?.sendCustomResult(success)
type = type,
url = map,
isCustom = it,
poiType = poiType,
mainInfoId = mainInfoId,
longitude = longitude,
latitude = latitude
) { success ->
CosCallbackMapController.unregisterCallbacks(map)
CosCallbackMapController.mainService?.let {
CosCallbackMapController.mainService?.sendCustomResult(success)
}
Log.d(TAG, "type = $type ----success = $success")
if (success) {
//分享成功并打点如果是上报拥堵需要takeVideo
if (type == INFO_TYPE_VIDEO) {
try {
LatLngStickyEventBus.getInstance()
.postSticky(GetImageSuccessEvent("", poiType))
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
}
} else {
if (type == INFO_TYPE_VIDEO) {
TipToast.shortTip("分享失败,请检查网络")
}
}
}
}
}
}
override fun onProgress(localPath: String?, progress: Float) {
@@ -230,6 +247,5 @@ class CosStatusController : CosStatusCallback {
AbsMogoApplication.getApp().applicationContext
)
}
}

View File

@@ -80,7 +80,7 @@ class MainService : Service() {
Analytics.getInstance().start(this)
//参数说明appKey: app唯一标识比如包名
CosUploadManagerImpl.getInstance(AbsMogoApplication.getApp().applicationContext)
.init(BuildConfig.APPLICATION_ID, 2)
.init(BuildConfig.APPLICATION_ID, 0)
//初始化语音
VoiceController.initVoice()

View File

@@ -2,7 +2,10 @@ package com.zhidao.roadcondition.service
import android.util.Log
import com.mogo.commons.AbsMogoApplication
import com.zhidao.roadcondition.event.GetImageSuccessEvent
import com.zhidao.roadcondition.event.LatLngStickyEventBus
import com.zhidao.roadcondition.model.*
import com.zhidao.roadcondition.model.proxy.INFO_TYPE_VIDEO
import com.zhidao.roadcondition.net.request
import com.zhidao.roadcondition.util.*
import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.setStrategyFrequency
@@ -272,9 +275,13 @@ class MainServiceController {
//转换失败的情况下再重试一次
geoRetryed = if (!geoRetryed) {
geoLocation(type, url, locationInfo, isCustom, trafficInfoType, isShare, customSend, poiType,mainInfoId,longitude,latitude)
true
} else {
//如果两次都失败,直接上报服务端
postInformationMessage(
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude),
customSend
)
false
}
@@ -296,7 +303,6 @@ class MainServiceController {
trackUploadServer(1)
// CosStatusController().videoAndThumbMap.clear()
customSend?.invoke(true)
}
onError {
Log.i(TAG, "$it upload message ${it.message}")

View File

@@ -28,7 +28,7 @@ const val CarNet_Get_Strategy:String = "CarNet_Get_Strategy" //策略拉取成
const val CarNet_Create_Task:String = "CarNet_Create_Task" //创建定时任务
const val CarNet_Get_Picture:String = "CarNet_Get_Picture" //获取图片,type=1 调用, type=2 成功, type=3 失败
const val CarNet_Get_Video:String = "CarNet_Get_Video" //获取视频,type=1 调用,type=2 成功,type=3 失败
const val CarNet_Cos_Upload:String = "CarNet_Cos_Upload" //上传COS, type=1 成功, type=2 失败, type=3 开始, type=4 成功返回视频和缩略图type=5 成功没有返回全视频和缩略图
const val CarNet_Cos_Upload:String = "CarNet_Cos_Upload" //上传COS, type=1 成功, type=2 失败, type=3 开始, type=4 成功返回视频和缩略图type=5 成功没有返回全视频和缩略图
const val CarNet_Servers_Upload:String = "CarNet_Servers_Upload" //上传服务端, type=1 成功,type=2 失败, type=3 开始
const val CarNet_Voice_Search:String = "CarNet_Voice_Search" //语音搜索路况,type=1 成功,type=2 失败
const val CarNet_USER_SHOW:String = "CarNet_user_show" //情报展示时长,showtime 加载列表时长

View File

@@ -5,6 +5,7 @@ import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.debug.DebugConfig
import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.location.IMogoLocationListener
import com.mogo.map.marker.IMogoMarkerClickListener
@@ -56,11 +57,12 @@ class MogoGuideProvider : IMogoModuleProvider {
}
override fun init(context: Context?) {
if (isDeviceOfD()) {
GuideBizManager.init()
} else {
Logger.d("MogoGuideProvider", "device type is not D")
}
Logger.d("MogoGuideProvider", "init====")
// if (DebugConfig.isLoadGuideModule()) {
GuideBizManager.init()
// } else {
// Logger.d("MogoGuideProvider", "device type is not D")
// }
}

View File

@@ -49,6 +49,7 @@ import com.mogo.utils.storage.SharedPrefsMgr;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -483,6 +484,7 @@ public class ShareControl implements IMogoShareManager, IMogoIntentListener,
config = GsonUtil.jsonFromObject(btnList);
Logger.d(TAG, "获取分享框成功:" + config);
} else {
config = GsonUtil.jsonFromObject(new ArrayList<FixableButton>());
Logger.d(TAG, "获取分享框成功但是data没有内容");
}
} else {