Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangcongtao
2020-11-10 20:34:47 +08:00
34 changed files with 158 additions and 68 deletions

View File

@@ -19,6 +19,7 @@ import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.getStrateg
import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.getStrategyMinSpeed
import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.getStrategyType
import java.io.File
import kotlin.math.abs
/**
* @description 记录仪相关操作
@@ -175,16 +176,16 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// TANLU_ROAD_WORK
// )
// ) {
taskAsync(1_500) {
try {
// taskAsync(1_500) {
// try {
// VoiceController.speakVoice("上报失败")
// if (isCustom) {
// sendGetInfoFailedReceiver(mType)
// }
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
}
// } catch (e: java.lang.Exception) {
// e.printStackTrace()
// }
// }
//获取图片失败也上报,图片不打点
if (isCustom) {
@@ -222,19 +223,19 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
return
}
var minSpeedPic =
val minSpeedPic =
getStrategyMinSpeed(
AbsMogoApplication.getApp().applicationContext,
"pic",
getStrategyType("pic")
)
var maxSpeedPic =
val maxSpeedPic =
getStrategyMaxSpeed(
AbsMogoApplication.getApp().applicationContext,
"pic",
getStrategyType("pic")
)
var speed = LocationUtil.getInstance().getSpeed()
val speed = LocationUtil.getInstance().getSpeed()
if (!TextUtils.isEmpty(mType)) {
Log.d(TAG, "onTakePhotoSuccess mType != null")
@@ -247,8 +248,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
"onTakePhotoSuccess maxSpeedPic = $maxSpeedPic ---> speed = $speed ---->minSpeedPic= $minSpeedPic"
)
if (maxSpeedPic == -1) {
if (speed >= (Math.abs(minSpeedPic) / 3.6f)) {
Log.d(TAG, "onTakePhotoSuccess abs =" + (Math.abs(minSpeedPic) / 3.6f))
if (speed >= (abs(minSpeedPic) / 3.6f)) {
Log.d(TAG, "onTakePhotoSuccess abs =" + (abs(minSpeedPic) / 3.6f))
CosStatusController().uploadFile(
mutableListOf(photoPath as String),
entity,
@@ -283,9 +284,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
//获取视频成功
override fun onTakeVideoSuccess(camera: Int, videoPath: String?) {
var thumbnailPath =
val thumbnailPath =
AbsMogoApplication.getApp().applicationContext.filesDir.parent + File.separator + "Thumbnail${System.currentTimeMillis()}.jpg"
var isSuccess = getVideoThumbnail(videoPath!!, thumbnailPath)
val isSuccess = getVideoThumbnail(videoPath!!, thumbnailPath)
Log.d(
TAG,
"getVideo onTakeVideoSuccess===$videoPath -----> isSuccess= $isSuccess ----> mType = $mType --- mainInfoId = $mainInfoId"
@@ -300,39 +301,39 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
}
if (isSuccess) {
var minSpeedVideo = getStrategyMinSpeed(
val minSpeedVideo = getStrategyMinSpeed(
AbsMogoApplication.getApp().applicationContext, "video",
getStrategyType("video")
)
var maxSpeedVideo = getStrategyMaxSpeed(
val maxSpeedVideo = getStrategyMaxSpeed(
AbsMogoApplication.getApp().applicationContext, "video",
getStrategyType("video")
)
var speed = LocationUtil.getInstance().getSpeed()
val speed = LocationUtil.getInstance().getSpeed()
entity?.let {
if (entity.isCustom) {
compressVideo(videoPath, thumbnailPath, entity)
if (it.isCustom) {
compressVideo(videoPath, thumbnailPath, it)
}else if (entity.fromType in STRATEGY_UPLOAD_TYPE_ARRAY) {
// 属于策略上报
compressVideo(videoPath, thumbnailPath, entity)
compressVideo(videoPath, thumbnailPath, it)
} else {
Log.d(
TAG,
"onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo"
)
if (maxSpeedVideo == -1) {
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (Math.abs(minSpeedVideo) / 3.6f))
if (speed >= (Math.abs(minSpeedVideo) / 3.6f)) {
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (abs(minSpeedVideo) / 3.6f))
if (speed >= (abs(minSpeedVideo) / 3.6f)) {
//获取视频以及缩略图成功,开始上报
compressVideo(videoPath, thumbnailPath, entity)
compressVideo(videoPath, thumbnailPath, it)
}
}
if (minSpeedVideo > 0 && maxSpeedVideo > 0) {
Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed")
if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) {
compressVideo(videoPath, thumbnailPath, entity)
compressVideo(videoPath, thumbnailPath, it)
}
}
}
@@ -342,7 +343,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
}
}
var videoAndThumbMap: MutableMap<String, String> = mutableMapOf()
private var videoAndThumbMap: MutableMap<String, String> = mutableMapOf()
//获取视频失败
override fun onTakeVideoFail(camera: Int) {
@@ -387,12 +388,12 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
/**
* 压缩视频并且上传
*/
fun compressVideo(videoPath: String, thumbnailPath: String, entity: TakeEntity) {
private fun compressVideo(videoPath: String, thumbnailPath: String, entity: TakeEntity) {
Log.d(
TAG,
"outputVideoPath = " + outputVideoPath + ">> videoPath=" + videoPath + " isCustom = ${entity?.isCustom}"
"outputVideoPath = " + outputVideoPath + ">> videoPath=" + videoPath + " isCustom = ${entity.isCustom}"
)
var startTime = System.currentTimeMillis()
val startTime = System.currentTimeMillis()
Thread(Runnable {
try {
VideoProcessor.processor(AbsMogoApplication.getApp().applicationContext)

View File

@@ -44,7 +44,7 @@ object InformationUploadController {
it.cosParameter = cosParameter
it.isCustomSend = isCustomSend
it.callback = callback
tryUploadInformation(it)
// tryUploadInformation(it)
}
}
@@ -71,7 +71,7 @@ object InformationUploadController {
it.informationType = informationType
it.newsType = newsType
it.operType = operType
tryUploadInformation(it)
// tryUploadInformation(it)
}
}