fix: 处理异常上传问题

This commit is contained in:
xiaoyan-5800X 2022-12-16 16:31:46 +08:00
parent 60bc4a2569
commit 36a65da786
5 changed files with 19 additions and 16 deletions

View File

@ -12,8 +12,8 @@ android {
applicationId "com.navinfo.outdoor"
minSdkVersion 23
targetSdkVersion 30
versionCode 38
versionName "8.221214"
versionCode 39
versionName "8.221216"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {

View File

@ -1301,7 +1301,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", chargingPileEntity.getBodyId());
Response execute = OkGoBuilder.getInstance()
.time(0)
.time(600)
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
@ -1345,7 +1345,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", poiEntity.getBodyId());
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
.time(0)
.time(600)
.Builder(getActivity())
.url(HttpInterface.C_TASK_UP_LOAD_PIC)
.cls(PoiUploadBean.class)

View File

@ -1001,7 +1001,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", body);
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
.time(0)
.time(600)
.Builder(getActivity())
.url(HttpInterface.POI_TASK_UPLOAD_PIC)
.cls(OtherUploadPicBean.class)

View File

@ -110,14 +110,12 @@ public class PoiSaveUtils {
poiEntity.setChecked(false);
poiEntity.setWork_type(0);
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
sendUploadMessage(poiEntityList.size(), anInt, bInt);
}
}else {
bInt++;
poiEntity.setChecked(false);
poiEntity.setWork_type(0);
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
sendUploadMessage(poiEntityList.size(), anInt, bInt);
}
} else {
bInt++;
@ -125,10 +123,10 @@ public class PoiSaveUtils {
poiEntity.setWork_type(0);
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
Constant.submitIdSet.remove(poiEntity.getId());
sendUploadMessage(poiEntityList.size(), anInt, bInt);
}
}
});
})
.onErrorResumeNext(Observable.empty());
// 处理普通数据
Observable otherObserable = Observable.fromIterable(otherPoiEntityList)
.subscribeOn(Schedulers.io())
@ -143,10 +141,10 @@ public class PoiSaveUtils {
poiEntity.setChecked(false);
poiEntity.setWork_type(0);
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
sendUploadMessage(poiEntityList.size(), anInt, bInt);
}
}
});
})
.onErrorResumeNext(Observable.empty());
// 处理需要分包上传数据的POI录像和道路数据
Observable spliteFileObserable = Observable.fromIterable(spliteFilePoiEntityList)
.subscribeOn(Schedulers.io())
@ -169,7 +167,6 @@ public class PoiSaveUtils {
poiEntity.setChecked(false);
poiEntity.setWork_type(0);
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
sendUploadMessage(poiEntityList.size(), anInt, bInt);
}
}
})
@ -177,6 +174,10 @@ public class PoiSaveUtils {
@Override
public ObservableSource<?> apply(PoiEntity poiEntity) throws Exception {
List<File> photoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
if (photoFileList == null||photoFileList.isEmpty()) {
bInt++;
return Observable.empty();
}
return DataSaveUtils.getInstance().getUploadSpliteFilesObservble(mContext, poiEntity, photoFileList)
.toObservable();
}
@ -192,11 +193,13 @@ public class PoiSaveUtils {
public void accept(Throwable throwable) throws Exception {
bInt++;
}
});
})
.onErrorResumeNext(Observable.empty());
Observable.concat(
otherObserable, spliteFileObserable, chargePoiObserable
).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.onErrorResumeNext(Observable.empty())
.subscribe(new Observer() {
@Override
public void onSubscribe(Disposable d) {
@ -530,7 +533,7 @@ public class PoiSaveUtils {
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", poiEntity.getBodyId());
Response execute = OkGoBuilder.getInstance()
.time(0)
.time(600)
.Builder(mContext)
.url(url)
.params(httpParams)
@ -718,7 +721,7 @@ public class PoiSaveUtils {
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", chargingPileEntity.getBodyId());
Response execute = OkGoBuilder.getInstance()
.time(0)
.time(600)
.Builder(mContext)
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
.token(Constant.ACCESS_TOKEN)

View File

@ -525,7 +525,7 @@ public class UploadUtils {
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", chargingPileEntity.getBodyId());
Response execute = OkGoBuilder.getInstance()
.time(0)
.time(600)
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
.params(httpParams)
.token(Constant.ACCESS_TOKEN)