opt
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2021/1/21
|
||||
*/
|
||||
public class UploadManager {
|
||||
private static UploadManager sInstance;
|
||||
private Context mContext;
|
||||
|
||||
private UploadManager (Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static UploadManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (UploadManager.class) {
|
||||
sInstance = new UploadManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sn
|
||||
* @param informationBody
|
||||
* @param callback
|
||||
*/
|
||||
public void loadUpload(String sn, InformationBody informationBody, ITanluUploadCallback callback) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.cloud.impl;
|
||||
|
||||
import com.mogo.cloud.api.ILoadUpload;
|
||||
import com.mogo.cloud.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 请求上报
|
||||
* @since 2021/1/20
|
||||
*/
|
||||
public class LoadUploadImpl {
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.mogo.cloud.tanlu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.commons.network.RetrofitFactory;
|
||||
import com.mogo.cloud.tanlu.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.tanlu.bean.InformationBody;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.net.TanluApiService;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2021/1/21
|
||||
*/
|
||||
public class UploadManager {
|
||||
private static final String TAG = "UploadManager";
|
||||
private static UploadManager sInstance;
|
||||
private Context mContext;
|
||||
private TanluApiService apiService;
|
||||
|
||||
|
||||
private UploadManager (Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static UploadManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (UploadManager.class) {
|
||||
sInstance = new UploadManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param informationBody
|
||||
* @param callback
|
||||
*
|
||||
*/
|
||||
public void loadUpload(InformationBody informationBody, ITanluUploadCallback callback) {
|
||||
apiService = RetrofitFactory.INSTANCE.getInstance("http://dzt-test.zhidaozhixing.com")
|
||||
.create(TanluApiService.class);
|
||||
|
||||
Gson gson = new Gson();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
// map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn()); //TODO
|
||||
// map.put("data", gson.toJson(informationBody));
|
||||
|
||||
map.put("sn", "F803EB2046PZD00228");
|
||||
map.put("data", "{\"addr\":\"北京市东城区小黄庄北街2号靠近中国银行(北京安贞桥支行)\",\"areaCode\":\"110101\",\"areaName\":\"东城区\",\"cityCode\":\"010\",\"cityName\":\"北京市\",\"data\":\"[{\\\"thumbnail\\\":\\\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/F803EB2046PZD00228/F803EB2046PZD00228_20210121165329/Thumbnail1611219200669.jpg\\\",\\\"url\\\":\\\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/F803EB2046PZD00228/F803EB2046PZD00228_20210121165329/compress_video_20210121165307.mp4\\\"}]\",\"direction\":0.0,\"fromType\":\"2\",\"generateTime\":1611219213616,\"infoTimeout\":240,\"infoType\":1,\"isShare\":false,\"lat\":39.968317,\"lon\":116.410892,\"mainInfoId\":0,\"poiType\":\"10008\",\"provinceName\":\"北京市\",\"sn\":\"F803EB2046PZD00228\",\"speed\":0.0,\"street\":\"小黄庄北街\",\"trafficInfoType\":\"\",\"type\":1,\"uid\":0}");
|
||||
|
||||
Log.d(TAG, "sn = " + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
|
||||
apiService.uploadInformation(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<UploadResult>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.d(TAG, "onSubscribe -----> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(UploadResult result) {
|
||||
Log.d(TAG, "onNext -----> ");
|
||||
callback.onSuccess(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG, "onError -----> e " + e);
|
||||
callback.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.d(TAG, "onComplete -----> ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
import com.mogo.cloud.tanlu.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
import com.mogo.cloud.bean.RoadInfos;
|
||||
import com.mogo.cloud.tanlu.bean.RoadInfos;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -10,4 +10,5 @@ import com.mogo.cloud.bean.RoadInfos;
|
||||
public interface IRoadInfoSearchCallback {
|
||||
void onSuccess(RoadInfos result);
|
||||
void onFailure(int code);
|
||||
void onError(Throwable e);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
import com.mogo.cloud.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -10,4 +10,5 @@ import com.mogo.cloud.bean.UploadResult;
|
||||
public interface ITanluUploadCallback {
|
||||
void onSuccess(UploadResult result);
|
||||
void onFailure(int code);
|
||||
void onError(Throwable e);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.bean.location.MarkerLocation;
|
||||
import com.mogo.cloud.tanlu.bean.location.MarkerLocation;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import com.mogo.cloud.bean.location.Location;
|
||||
import com.mogo.cloud.tanlu.bean.location.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.constant;
|
||||
package com.mogo.cloud.tanlu.constant;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.net;
|
||||
package com.mogo.cloud.tanlu.net;
|
||||
|
||||
import com.mogo.cloud.bean.RoadInfos;
|
||||
import com.mogo.cloud.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.bean.RoadInfos;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
Reference in New Issue
Block a user