登录接口
This commit is contained in:
parent
9388a6ac87
commit
88144de31c
@ -0,0 +1,17 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.constant;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2022/1/10 11:34
|
||||
* @description:交通厅参数
|
||||
*/
|
||||
public class NewLJConstant {
|
||||
|
||||
public final static String ENTER_PRISE_CODE ="E0019169";
|
||||
|
||||
public final static String JTT_DATA_JTTORDER_KEY="JTT_order_key";
|
||||
|
||||
public final static String JTT_DATA_ORDER_KEY="order_key";
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.request.bean.newlj;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName LjTokenBean
|
||||
* @Author john
|
||||
* @Date 2024/11/25 10:05
|
||||
* @Description TODO
|
||||
*/
|
||||
public class LjTokenBean implements Serializable {
|
||||
|
||||
|
||||
private String enterpriseCode;
|
||||
private String enterpriseIdentity;
|
||||
private String enterpriseKey;
|
||||
|
||||
public String getEnterpriseCode() {
|
||||
return enterpriseCode;
|
||||
}
|
||||
|
||||
public void setEnterpriseCode(String enterpriseCode) {
|
||||
this.enterpriseCode = enterpriseCode;
|
||||
}
|
||||
|
||||
public String getEnterpriseIdentity() {
|
||||
return enterpriseIdentity;
|
||||
}
|
||||
|
||||
public void setEnterpriseIdentity(String enterpriseIdentity) {
|
||||
this.enterpriseIdentity = enterpriseIdentity;
|
||||
}
|
||||
|
||||
public String getEnterpriseKey() {
|
||||
return enterpriseKey;
|
||||
}
|
||||
|
||||
public void setEnterpriseKey(String enterpriseKey) {
|
||||
this.enterpriseKey = enterpriseKey;
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.request.bean.newlj;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName PickupBean
|
||||
* @Author john
|
||||
* @Date 2024/11/25 10:19
|
||||
* @Description TODO
|
||||
*/
|
||||
public class PickupBean implements Serializable {
|
||||
|
||||
private String shipmentCode;
|
||||
private String enterpriseCode;
|
||||
private LocationDTO location;
|
||||
|
||||
public String getShipmentCode() {
|
||||
return shipmentCode;
|
||||
}
|
||||
|
||||
public void setShipmentCode(String shipmentCode) {
|
||||
this.shipmentCode = shipmentCode;
|
||||
}
|
||||
|
||||
public String getEnterpriseCode() {
|
||||
return enterpriseCode;
|
||||
}
|
||||
|
||||
public void setEnterpriseCode(String enterpriseCode) {
|
||||
this.enterpriseCode = enterpriseCode;
|
||||
}
|
||||
|
||||
public LocationDTO getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(LocationDTO location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public static class LocationDTO {
|
||||
private String time;
|
||||
private double baiduLatitude;
|
||||
private double baiduLongitude;
|
||||
private double altitude;
|
||||
private double speed;
|
||||
private double bearing;
|
||||
private String location;
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public double getBaiduLatitude() {
|
||||
return baiduLatitude;
|
||||
}
|
||||
|
||||
public void setBaiduLatitude(double baiduLatitude) {
|
||||
this.baiduLatitude = baiduLatitude;
|
||||
}
|
||||
|
||||
public double getBaiduLongitude() {
|
||||
return baiduLongitude;
|
||||
}
|
||||
|
||||
public void setBaiduLongitude(double baiduLongitude) {
|
||||
this.baiduLongitude = baiduLongitude;
|
||||
}
|
||||
|
||||
public double getAltitude() {
|
||||
return altitude;
|
||||
}
|
||||
|
||||
public void setAltitude(double altitude) {
|
||||
this.altitude = altitude;
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public double getBearing() {
|
||||
return bearing;
|
||||
}
|
||||
|
||||
public void setBearing(double bearing) {
|
||||
this.bearing = bearing;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@ package com.arpa.hndahesudintocctmsdriver.request.net;
|
||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.UserBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.LoginRegInputBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.PickupBean;
|
||||
import com.dahe.mylibrary.net.CommonResponseBean;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
@ -17,7 +19,7 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface Api {
|
||||
|
||||
String BASE_URL = BuildConfig.BASE_URL;
|
||||
String BASE_URL = "http://api.kehui56.cn/api/v1/";
|
||||
|
||||
|
||||
//获取版本
|
||||
@ -26,5 +28,17 @@ public interface Api {
|
||||
// @POST(BASE_URL+"/common/register")
|
||||
// Observable<CommonResponseBean> log(@Body LoginRegInputBean bean);
|
||||
|
||||
@POST(BASE_URL+"openapi/enterprises/login")
|
||||
Observable<CommonResponseBean> getToken(@Body LjTokenBean bean);
|
||||
|
||||
|
||||
/**
|
||||
* 运单提货
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@POST(BASE_URL+"openapi/shipments/pickup")
|
||||
Observable<CommonResponseBean> pickup(@Body PickupBean bean);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.request.net;
|
||||
|
||||
import static com.dahe.mylibrary.utils.BaseSPUtils.NEW_LJ_TOKEN;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
@ -27,9 +29,10 @@ public class RequestHeadInterceptor implements Interceptor {
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request.Builder builder = chain.request().newBuilder();
|
||||
if (!TextUtils.isEmpty(SPUtil.getSP(App.getApp(), LoginActivity.USER,LoginActivity.USER_TOKEN))) {
|
||||
String token = SPUtils.get(App.getApp(), NEW_LJ_TOKEN, "").toString();
|
||||
if (!TextUtils.isEmpty(token)) {
|
||||
// builder.addHeader("Authorization", SPUtils.getUserInfo(App.getApp()).getToken());
|
||||
builder.addHeader("Authorization", SPUtil.getSP(App.getApp(), LoginActivity.USER,LoginActivity.USER_TOKEN));
|
||||
builder.addHeader("token", token);
|
||||
}
|
||||
Request request = builder
|
||||
.addHeader("versionCode", AppUtils.getAppVersionCode() + "")
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui;
|
||||
|
||||
import static com.dahe.mylibrary.utils.BaseSPUtils.NEW_LJ_TOKEN;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.event.HomeEvent;
|
||||
@ -41,6 +43,7 @@ public class UiAuxiliary {
|
||||
public static void delLogin(Context con){
|
||||
// JPushInterface.deleteAlias(con,0);
|
||||
SPUtils.remove(con,"curWaybillId");
|
||||
SPUtils.remove(con,NEW_LJ_TOKEN);
|
||||
SPUtil.insSP(con,LoginActivity.USER,LoginActivity.USER_TOKEN,"");
|
||||
SPUtil.insSP(con,LoginActivity.USER,LoginActivity.USER_UNAME,"");
|
||||
SPUtil.insSP(con,LoginActivity.USER,LoginActivity.USER_RNAME,"");
|
||||
|
@ -1,5 +1,20 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.util;
|
||||
|
||||
import static com.dahe.mylibrary.utils.BaseSPUtils.NEW_LJ_TOKEN;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.constant.NewLJConstant;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.PickupBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.BaseObserver;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.DataManager;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.RxHttpCallBack;
|
||||
import com.dahe.mylibrary.net.CommonResponseBean;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @ClassName NewLJUtils
|
||||
* @Author john
|
||||
@ -20,5 +35,37 @@ public class NewLJUtils {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public void getToken(Context ctx) {
|
||||
LjTokenBean ljTokenBean = new LjTokenBean();
|
||||
ljTokenBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE);
|
||||
ljTokenBean.setEnterpriseIdentity("95033cc3492e420d83d7f09eea1400ac");
|
||||
ljTokenBean.setEnterpriseKey("e9844a9b0bba417e89cb8623489abd2f");
|
||||
|
||||
DataManager.getInstance().getToken(ljTokenBean)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver(ctx, new RxHttpCallBack<CommonResponseBean>() {
|
||||
@Override
|
||||
public void onSuccess(CommonResponseBean t) {
|
||||
super.onSuccess(t);
|
||||
SPUtils.put(ctx,NEW_LJ_TOKEN,t.getToken());
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public void pickUp(Context ctx,String shipmentCode){
|
||||
PickupBean pickupBean = new PickupBean();
|
||||
pickupBean.setShipmentCode(shipmentCode);
|
||||
pickupBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE);
|
||||
DataManager.getInstance().pickup(pickupBean)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver(ctx, new RxHttpCallBack<CommonResponseBean>() {
|
||||
@Override
|
||||
public void onSuccess(CommonResponseBean t) {
|
||||
super.onSuccess(t);
|
||||
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,8 +13,26 @@ public class CommonResponseBean<T> implements Serializable {
|
||||
private String msg;
|
||||
private String url;
|
||||
private String fileName;
|
||||
private String token;
|
||||
private String expiryIn;
|
||||
private boolean success;
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getExpiryIn() {
|
||||
return expiryIn;
|
||||
}
|
||||
|
||||
public void setExpiryIn(String expiryIn) {
|
||||
this.expiryIn = expiryIn;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ public class BaseSPUtils {
|
||||
public static final String USER_INFO_KEY = "user_info_key";
|
||||
public static final String NET_SERVICE_TEST = "net_service_test";
|
||||
public static final String SEARRH_CACHE = "search_cache";
|
||||
public static final String NEW_LJ_TOKEN = "NEW_LJ_TOKEN";
|
||||
public static final String NAVI_PH_EDIT_CACHE = "navi_ph_edit_cache";
|
||||
public static final String FIRST_OPEN = "first_open";
|
||||
public static final String KEY_PRIVACY_AGREEMENT = "privacy_agreement";
|
||||
|
Loading…
Reference in New Issue
Block a user