merge code
This commit is contained in:
parent
2e732faa38
commit
9f8349506a
@ -111,12 +111,13 @@ class TaskUploadScope(
|
|||||||
|
|
||||||
val bodyList: MutableList<EvaluationInfo> = ArrayList()
|
val bodyList: MutableList<EvaluationInfo> = ArrayList()
|
||||||
|
|
||||||
|
if (taskBean.syncStatus == FileUploadStatus.WAITING){
|
||||||
|
change(FileUploadStatus.UPLOADING)
|
||||||
|
}
|
||||||
|
|
||||||
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
|
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
|
||||||
val objects = realm.where(QsRecordBean::class.java)
|
val objects = realm.where(QsRecordBean::class.java)
|
||||||
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
||||||
if (taskBean.syncStatus == FileUploadStatus.WAITING){
|
|
||||||
change(FileUploadStatus.UPLOADING)
|
|
||||||
}
|
|
||||||
if (objects != null&&objects.size>0) {
|
if (objects != null&&objects.size>0) {
|
||||||
val copyList = realm.copyFromRealm(objects)
|
val copyList = realm.copyFromRealm(objects)
|
||||||
copyList.forEach {
|
copyList.forEach {
|
||||||
@ -142,21 +143,24 @@ class TaskUploadScope(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = uploadManager.netApi.postRequest(bodyList)// .enqueue(object :
|
if(bodyList.size>0){
|
||||||
|
val result = uploadManager.netApi.postRequest(bodyList)// .enqueue(object :
|
||||||
// Callback<ResponseBody> {
|
// Callback<ResponseBody> {
|
||||||
if (result.isSuccessful) {
|
if (result.isSuccessful) {
|
||||||
if (result.code() == 200) {
|
if (result.code() == 200) {
|
||||||
taskBean.syncStatus = FileUploadStatus.DONE
|
taskBean.syncStatus = FileUploadStatus.DONE
|
||||||
// handle the response
|
// handle the response
|
||||||
change(FileUploadStatus.DONE)
|
change(FileUploadStatus.DONE)
|
||||||
|
} else {
|
||||||
|
// handle the failure
|
||||||
|
change(FileUploadStatus.ERROR)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// handle the failure
|
|
||||||
change(FileUploadStatus.ERROR)
|
change(FileUploadStatus.ERROR)
|
||||||
}
|
}
|
||||||
} else {
|
}else{
|
||||||
change(FileUploadStatus.ERROR)
|
change(FileUploadStatus.NONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
change(FileUploadStatus.ERROR)
|
change(FileUploadStatus.ERROR)
|
||||||
Log.e("jingo", "数据上传出错 ${e.message}")
|
Log.e("jingo", "数据上传出错 ${e.message}")
|
||||||
|
@ -124,6 +124,9 @@ class TaskListAdapter(
|
|||||||
FileUploadStatus.WAITING -> {
|
FileUploadStatus.WAITING -> {
|
||||||
binding.taskUploadBtn.text = "等待同步"
|
binding.taskUploadBtn.text = "等待同步"
|
||||||
}
|
}
|
||||||
|
FileUploadStatus.UPLOADING -> {
|
||||||
|
binding.taskUploadBtn.text = "同步中"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user