This commit is contained in:
lixiaopeng
2021-02-04 12:03:47 +08:00
parent 638d30d0bd
commit 931f64047a
5 changed files with 32 additions and 24 deletions

1
.idea/gradle.xml generated
View File

@@ -23,6 +23,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -7,6 +7,7 @@ import android.util.Log;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.mogo.cloud.network.BaseData;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.tanlu.api.ITanluUploadCallback;
import com.mogo.cloud.tanlu.bean.InformationBody;
import com.mogo.cloud.tanlu.bean.UploadInfo;
@@ -65,21 +66,23 @@ public class CosUpload implements CosStatusCallback {
public void uploadInfo(UploadInfo info, ITanluUploadCallback callback) {
mCallback = callback;
mUploadInfo = info;
Log.d(HttpConstant.TANLU, "videoPath = " + info.getFilePath());
if (!TextUtils.isEmpty(info.getFilePath())) { //不传路径
if (isVideo(info.getFilePath())) {
videoCoverImage = getVideoPicPath();
Log.d(HttpConstant.TANLU, "videoCoverImage = " + videoCoverImage);
boolean isSuccess = getVideoThumbnail(info.getFilePath(), videoCoverImage);
Log.d(HttpConstant.TANLU, "isSuccess = " + isSuccess);
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "isSuccess = " + isSuccess + "--videoCoverImage = " + videoCoverImage);
}
filePath.add(info.getFilePath());
filePath.add(videoCoverImage);
} else {
videoCoverImage = null;
filePath.add(info.getFilePath());
}
Log.e(HttpConstant.TANLU, "filePath.size() = " + filePath.size());
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "filePath.size() = " + filePath.size());
}
CosUploadManagerImpl.getInstance(mContext.getApplicationContext())
.upload(filePath, mPicEventId, DbPriorityConfig.PRIORITY_HIGH);
} else {
@@ -90,21 +93,24 @@ public class CosUpload implements CosStatusCallback {
@Override
public void onStartUpload(String eventId, String localPath) {
Log.d(HttpConstant.TANLU, "onStartUpload ----> ");
}
@Override
public void uploadCosCompleted(String cosPath, String eventId, String downloadUrl, String localPath) {
Log.d(HttpConstant.TANLU, "uploadCosCompleted ----> cosPath =" + cosPath + "--eventId =" + eventId);
Log.d(HttpConstant.TANLU, "uploadCosCompleted ----> downloadUrl =" + downloadUrl + "--localPath =" + localPath);
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "uploadCosCompleted ----> cosPath =" + cosPath + "--eventId =" + eventId);
Log.d(HttpConstant.TANLU, "uploadCosCompleted ----> downloadUrl =" + downloadUrl + "--localPath =" + localPath);
}
if (filePath.size() == 2) {
if (isVideo(localPath)) { //如果是视频 localPath
mCosVideoUrl = downloadUrl;
} else {
mCosPicUrl = downloadUrl;
}
Log.d(HttpConstant.TANLU, "mCosVideoUrl = " + mCosVideoUrl + " >>>mCosPicUrl = " + mCosPicUrl);
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "mCosVideoUrl = " + mCosVideoUrl + " >>>mCosPicUrl = " + mCosPicUrl);
}
if (mCosPicUrl != null && mCosVideoUrl != null) {
sendInformation();
}
@@ -116,7 +122,9 @@ public class CosUpload implements CosStatusCallback {
@Override
public void uploadCosFailed(String cosPath, String eventId, String localPath) {
Log.e(HttpConstant.TANLU, "uploadCosFailed ----> cosPath = " + cosPath + "--eventId =" + eventId + "--localPath =" + localPath);
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.e(HttpConstant.TANLU, "uploadCosFailed ----> cosPath = " + cosPath + "--eventId =" + eventId + "--localPath =" + localPath);
}
sendInformation();
}
@@ -140,20 +148,20 @@ public class CosUpload implements CosStatusCallback {
@Override
public void onSuccess(BaseData<UploadResult> result) {
if (result != null && result.getResult() != null) {
Log.d(HttpConstant.TANLU, "uploadRoadInfo result.id = " + result.getResult().id);
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "uploadRoadInfo result.id = " + result.getResult().id);
}
}
mCallback.onSuccess(result);
}
@Override
public void onFailure(int code) {
Log.d(HttpConstant.TANLU, " uploadRoadInfo code = " + code);
mCallback.onFailure(code);
}
@Override
public void onError(Throwable e) {
Log.d(HttpConstant.TANLU, "uploadRoadInfo onError e = " + e);
mCallback.onError(e);
}
});
@@ -166,7 +174,6 @@ public class CosUpload implements CosStatusCallback {
jsonObject.addProperty("thumbnail", mCosPicUrl);
jsonObject.addProperty("url", mCosVideoUrl);
jsonArray.add(jsonObject);
Log.d(HttpConstant.TANLU, "jsonArray.toString() = " + jsonArray.toString());
informationBody.setData(jsonArray.toString());
informationBody.setAddr(mUploadInfo.getAddr());

View File

@@ -23,6 +23,8 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import static android.content.ContentValues.TAG;
/**
* @author lixiaopeng
* @description 道路搜索
@@ -74,24 +76,27 @@ public class MogoRoadSearchManager {
.subscribe(new Observer<BaseData<RoadInfos>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onSubscribe ");
}
@Override
public void onNext(@NonNull BaseData<RoadInfos> roadInfos) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onNext roadInfos = " + roadInfos.getResult().getData());
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onNext roadInfos = " + roadInfos.getResult().getData());
}
callback.onSuccess(roadInfos);
}
@Override
public void onError(@NonNull Throwable e) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onError ");
callback.onError(e);
}
@Override
public void onComplete() {
Log.d(HttpConstant.TANLU, "queryRoadInfos onComplete ");
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onComplete ");
}
}
});
}

View File

@@ -62,8 +62,6 @@ public class UploadManager {
Map<String, String> map = new HashMap<>();
map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
map.put("data", gson.toJson(informationBody));
Log.d(HttpConstant.TANLU, "info = " + gson.toJson(informationBody));
Log.d(HttpConstant.TANLU, "sn = " + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
apiService.uploadInformation(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -74,13 +72,11 @@ public class UploadManager {
@Override
public void onNext(BaseData<UploadResult> result) {
Log.d(HttpConstant.TANLU, "onNext -----> ");
callback.onSuccess(result);
}
@Override
public void onError(Throwable e) {
Log.e(HttpConstant.TANLU, "onError -----> e " + e);
callback.onError(e);
}

View File

@@ -36,7 +36,6 @@ fun deletePicFile(filePath: String?): Boolean {
//删除某个目录下所有文件
fun deleteAllFile(file: File?) { //判断文件不为null或文件目录存在
if (file == null || !file.exists()) {
Log.e("liyz", "文件删除失败,请检查文件路径是否正确")
return
}
//取得这个目录下的所有子文件对象