[6.2.0]被动录包修改
This commit is contained in:
@@ -129,6 +129,10 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
private val mIatResults: HashMap<String, String> = LinkedHashMap()
|
||||
|
||||
private var reasonDetail: String ?= null //语音转写
|
||||
private var uploadReasonTotal: String = ""
|
||||
|
||||
private var isUploadCos = false //是否在上传Cos操作
|
||||
private var isLoadData = false //是否已经加载数据
|
||||
|
||||
init {
|
||||
initFloatWindow()
|
||||
@@ -198,6 +202,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
TipToast.shortTip("请选择至少一个Case")
|
||||
return@setOnClickListener
|
||||
}
|
||||
tvPassiveReport.text = "上报中..."
|
||||
if(audioStatus){
|
||||
audioStatus = !audioStatus
|
||||
setAudio(audioStatus)
|
||||
@@ -205,6 +210,13 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
uploadAudio()
|
||||
},1000)
|
||||
}else{
|
||||
//停止语音听写
|
||||
mIat?.stopListening()
|
||||
//结束倒计时
|
||||
countDownTimer?.cancel()
|
||||
countDownTimer?.onFinish()
|
||||
//将倒计时置空
|
||||
countDownTimer = null
|
||||
uploadAudio()
|
||||
}
|
||||
//删除记录
|
||||
@@ -321,8 +333,8 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
RecordManager.getInstance().start(audioFileName)
|
||||
//开始录音,展示放大缩小动效
|
||||
val scaleAnimation = ScaleAnimation(
|
||||
1.0f, 0.9f, 1.0f, 0.9f,
|
||||
Animation.RELATIVE_TO_SELF, 0.9f, Animation.RELATIVE_TO_SELF, 0.9f
|
||||
1.0f, 0.8f, 1.0f, 0.8f,
|
||||
Animation.RELATIVE_TO_SELF, 0.8f, Animation.RELATIVE_TO_SELF, 0.8f
|
||||
)
|
||||
scaleAnimation.duration = 1000
|
||||
scaleAnimation.repeatCount = -1
|
||||
@@ -363,17 +375,19 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
val singlePath = "/mnt/sdcard/mogo/DataCollection/${audioFileName}.wav"
|
||||
val file = File(singlePath)
|
||||
if(file.exists()){
|
||||
isUploadCos = true
|
||||
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext, DebugConfig.isDebug(),
|
||||
TAG, MoGoAiCloudClientConfig.getInstance().sn,singlePath,
|
||||
object : OnUploadListener {
|
||||
override fun onUploadSuccess(key: String, filePath: String, downloadUrl: String) {
|
||||
CallerLogger.d("$M_DEVA$TAG", "语音文件上传成功:downloadUrl=$downloadUrl")
|
||||
//将语音文件上传Cos监听移除
|
||||
removeUploadListener(singlePath)
|
||||
//上传到服务器
|
||||
upload(downloadUrl)
|
||||
if(key == TAG){
|
||||
FileUtil.deleteFile(File(filePath))
|
||||
if(downloadUrl.isNotBlank() && downloadUrl.contains(".wav")){
|
||||
CallerDevaToolsNetManager.invokeUploadCosSuccess(downloadUrl)
|
||||
//将语音文件上传Cos监听移除
|
||||
removeUploadListener(singlePath)
|
||||
if(key == TAG){
|
||||
FileUtil.deleteFile(File(filePath))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,16 +422,17 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
*/
|
||||
private fun upload(downloadUrl: String?){
|
||||
GlobalScope.launch{
|
||||
uploadReasonTotal = if(reasonDetail.isNullOrEmpty()){
|
||||
uploadReason.toString()
|
||||
}else{
|
||||
"$uploadReason 语音内容:$reasonDetail"
|
||||
}
|
||||
val uploadResult = presenter.upload(mutableMapOf<String, String>().also { itx ->
|
||||
itx["carLicense"] = AppConfigInfo.plateNumber //车牌号
|
||||
itx["filename"] = recordFileName?:"" //bag包文件地址
|
||||
itx["filesize"] = "0" //bag包文件大小
|
||||
itx["key"] = recordKey?:"" //key
|
||||
if(reasonDetail.isNullOrEmpty()){
|
||||
itx["reason"] = uploadReason.toString()
|
||||
}else{
|
||||
itx["reason"] = "$uploadReason 语音内容:$reasonDetail" //采集原因
|
||||
}
|
||||
itx["reason"] = uploadReasonTotal //采集原因
|
||||
itx["duration"] = BadCaseConfig.totalDuration.toString() //采集时长,固定为20S
|
||||
itx["startTime"] = System.currentTimeMillis().toString() //上报时间(时间戳格式)
|
||||
itx["channel"] = "0" //渠道
|
||||
@@ -447,13 +462,13 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
BadCaseAnalyticsManager.bagRecordUpload(recordKey?:"",recordFileName?:"",receiveTime?:System.currentTimeMillis().toString(),
|
||||
stat,AppConfigInfo.plateNumber,BadCaseConfig.totalDuration.toString(),MoGoAiCloudClientConfig.getInstance().sn,
|
||||
BadCaseConfig.dockerVersion ?:"",AppUtils.getAppVersionName(),loc.latitude.toString(),loc.longitude.toString(),
|
||||
BadCaseConfig.identity,downloadUrl?:"",uploadReason.toString(),System.currentTimeMillis().toString(),"0")
|
||||
BadCaseConfig.identity,downloadUrl?:"",uploadReasonTotal,System.currentTimeMillis().toString(),"0")
|
||||
//日志
|
||||
CallerLogger.i("$M_DEVA$TAG", "BadCase Passive Analytics="+"key="+recordKey+" filename="+recordFileName+
|
||||
" receiveTime="+receiveTime+" stat="+"100"+" plateNumber="+AppConfigInfo.plateNumber+
|
||||
" totalDuration="+ BadCaseConfig.totalDuration +" carSn="+MoGoAiCloudClientConfig.getInstance().sn+" mapVersion="+BadCaseConfig.dockerVersion+
|
||||
" eyeVersion="+AppUtils.getAppVersionName()+" latitude="+ loc.latitude +" longitude="+ loc.longitude+
|
||||
" identity="+BadCaseConfig.identity + " downloadUrl="+downloadUrl +" uploadReason="+uploadReason+
|
||||
" identity="+BadCaseConfig.identity + " downloadUrl="+downloadUrl +" uploadReason="+uploadReasonTotal+
|
||||
" uploadTime="+System.currentTimeMillis()+" channel="+"0")
|
||||
BadCaseConfig.windowNum--
|
||||
clickListener?.closeWindow()
|
||||
@@ -541,13 +556,14 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
|
||||
override fun onPassiveResponse(list: List<RecordOptionEntity>) {
|
||||
if(list.isNotEmpty()){
|
||||
if(!isLoadData && list.isNotEmpty()){
|
||||
badReasonListAdapter?.setData(list)
|
||||
isLoadData = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPassiveError() {
|
||||
if(BadCaseReasonStore.getPassiveDataRecord().isNotEmpty()){
|
||||
if(!isLoadData && BadCaseReasonStore.getPassiveDataRecord().isNotEmpty()){
|
||||
val list = ArrayList<RecordOptionEntity>()
|
||||
val result = JSONArray(BadCaseReasonStore.getPassiveDataRecord())
|
||||
if(result.length() > 0){
|
||||
@@ -576,6 +592,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
}
|
||||
if(list.isNotEmpty()){
|
||||
isLoadData = true
|
||||
badReasonListAdapter?.setData(list)
|
||||
}
|
||||
}else{
|
||||
@@ -583,4 +600,11 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUploadCosSuccess(cosUrl: String) {
|
||||
if(isUploadCos){
|
||||
//上传到服务器
|
||||
upload(cosUrl)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user