modify tl lib
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
@@ -88,13 +90,14 @@ class MainService : Service() {
|
||||
shareType = it.eventType
|
||||
fromType = it.fromType
|
||||
mainInfoId = 0 //TODO
|
||||
|
||||
Log.d(TAG, "onStartCommand shareType = $shareType")
|
||||
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 +134,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 +184,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 +253,7 @@ class MainService : Service() {
|
||||
}
|
||||
|
||||
if (videoType == 1) {
|
||||
takeVideo(10)
|
||||
takeVideo(DEFAULT_VIDEO_DURATION)
|
||||
} else if (videoType == 2) {
|
||||
postVideoAlarmTask(true)
|
||||
}
|
||||
@@ -278,7 +281,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 +300,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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user