同意开发票
This commit is contained in:
parent
c5f16d7d17
commit
f648050328
@ -12,7 +12,10 @@ import com.arpa.hndahesudintocctmsdriver.App;
|
|||||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig;
|
import com.arpa.hndahesudintocctmsdriver.BuildConfig;
|
||||||
import com.arpa.hndahesudintocctmsdriver.parts.AuthParts;
|
import com.arpa.hndahesudintocctmsdriver.parts.AuthParts;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.NewLJUtils;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.msg.MsgUtil;
|
import com.arpa.hndahesudintocctmsdriver.util.msg.MsgUtil;
|
||||||
|
import com.dahe.mylibrary.callback.OnGDDownloadResultListener;
|
||||||
|
import com.dahe.mylibrary.callback.OnGDResultListener;
|
||||||
import com.dahe.mylibrary.utils.ToastUtils;
|
import com.dahe.mylibrary.utils.ToastUtils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.DriverAuthDataBean;
|
import com.arpa.hndahesudintocctmsdriver.bean.DriverAuthDataBean;
|
||||||
@ -70,6 +73,28 @@ public class ALProcess {
|
|||||||
new MessageUtils().showCenMessage(con,s1);
|
new MessageUtils().showCenMessage(con,s1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
NewLJUtils.getInstance().getToken(con, new OnGDResultListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
NewLJUtils.getInstance().confirmInvoice(con, new OnGDResultListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String var1, String var2) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String var1, String var2) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getFq(Context con){
|
public static void getFq(Context con){
|
||||||
|
@ -0,0 +1,135 @@
|
|||||||
|
package com.arpa.hndahesudintocctmsdriver.request.bean.newlj;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName InvoicesBean
|
||||||
|
* @Author john
|
||||||
|
* @Date 2024/11/29 13:08
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
public class InvoicesBean implements Serializable {
|
||||||
|
private String totalPage;
|
||||||
|
private String totalCount;
|
||||||
|
private String pageSize;
|
||||||
|
private String currentPage;
|
||||||
|
private String sortField;
|
||||||
|
private String sortDirection;
|
||||||
|
private List<DataDTO> driverInvoices;
|
||||||
|
|
||||||
|
public String getTotalPage() {
|
||||||
|
return totalPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalPage(String totalPage) {
|
||||||
|
this.totalPage = totalPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotalCount() {
|
||||||
|
return totalCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalCount(String totalCount) {
|
||||||
|
this.totalCount = totalCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPageSize() {
|
||||||
|
return pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPageSize(String pageSize) {
|
||||||
|
this.pageSize = pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentPage() {
|
||||||
|
return currentPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentPage(String currentPage) {
|
||||||
|
this.currentPage = currentPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSortField() {
|
||||||
|
return sortField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortField(String sortField) {
|
||||||
|
this.sortField = sortField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSortDirection() {
|
||||||
|
return sortDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortDirection(String sortDirection) {
|
||||||
|
this.sortDirection = sortDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DataDTO> getDriverInvoices() {
|
||||||
|
return driverInvoices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriverInvoices(List<DataDTO> driverInvoices) {
|
||||||
|
this.driverInvoices = driverInvoices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DataDTO{
|
||||||
|
|
||||||
|
private String taxAmount;
|
||||||
|
private String totalAmount;
|
||||||
|
private String invoiceReceiverName;
|
||||||
|
private String totalAmountIncludeTax;
|
||||||
|
private String driverInvoiceCode;
|
||||||
|
private String taxRate;
|
||||||
|
|
||||||
|
|
||||||
|
public String getTaxAmount() {
|
||||||
|
return taxAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxAmount(String taxAmount) {
|
||||||
|
this.taxAmount = taxAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotalAmount() {
|
||||||
|
return totalAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalAmount(String totalAmount) {
|
||||||
|
this.totalAmount = totalAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInvoiceReceiverName() {
|
||||||
|
return invoiceReceiverName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvoiceReceiverName(String invoiceReceiverName) {
|
||||||
|
this.invoiceReceiverName = invoiceReceiverName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotalAmountIncludeTax() {
|
||||||
|
return totalAmountIncludeTax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalAmountIncludeTax(String totalAmountIncludeTax) {
|
||||||
|
this.totalAmountIncludeTax = totalAmountIncludeTax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDriverInvoiceCode() {
|
||||||
|
return driverInvoiceCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriverInvoiceCode(String driverInvoiceCode) {
|
||||||
|
this.driverInvoiceCode = driverInvoiceCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxRate() {
|
||||||
|
return taxRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxRate(String taxRate) {
|
||||||
|
this.taxRate = taxRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ import com.arpa.hndahesudintocctmsdriver.BuildConfig;
|
|||||||
import com.arpa.hndahesudintocctmsdriver.bean.UserBean;
|
import com.arpa.hndahesudintocctmsdriver.bean.UserBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.LoginRegInputBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.LoginRegInputBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.InvoiceBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.InvoiceBean;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.InvoicesBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.PickupBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.PickupBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.ShipmentStatusBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.ShipmentStatusBean;
|
||||||
@ -16,6 +17,7 @@ import retrofit2.http.Body;
|
|||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
import retrofit2.http.PUT;
|
import retrofit2.http.PUT;
|
||||||
|
import retrofit2.http.Path;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,6 +39,13 @@ public interface Api {
|
|||||||
Observable<CommonResponseBean> getToken(@Body LjTokenBean bean);
|
Observable<CommonResponseBean> getToken(@Body LjTokenBean bean);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@POST(BASE_URL+"openapi/enterprises/refresh-token/{refreshToken}")
|
||||||
|
Observable<CommonResponseBean> refreshToken(@Path("refreshToken") String refreshToken);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运单提货
|
* 运单提货
|
||||||
* @param bean
|
* @param bean
|
||||||
@ -108,6 +117,20 @@ public interface Api {
|
|||||||
@PUT(BASE_URL+"openapi/confirmInvoice")
|
@PUT(BASE_URL+"openapi/confirmInvoice")
|
||||||
Observable<CommonResponseBean> confirmInvoice(@Body InvoiceBean bean);
|
Observable<CommonResponseBean> confirmInvoice(@Body InvoiceBean bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待同意发票列表获取
|
||||||
|
* @param enterpriseCodeParam
|
||||||
|
* @param driverIdentification
|
||||||
|
* @param currentPage
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET(BASE_URL+"openapi/getInvoices")
|
||||||
|
Observable<CommonResponseBean<InvoicesBean>> getInvoices(@Query("enterpriseCodeParam") String enterpriseCodeParam,
|
||||||
|
@Query("driverIdentification") String driverIdentification,
|
||||||
|
@Query("currentPage") int currentPage,
|
||||||
|
@Query("pageSize") int pageSize);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取运单状态
|
* 获取运单状态
|
||||||
|
@ -2,7 +2,6 @@ package com.arpa.hndahesudintocctmsdriver.request.net;
|
|||||||
|
|
||||||
|
|
||||||
import com.dahe.mylibrary.CommonBaseLibrary;
|
import com.dahe.mylibrary.CommonBaseLibrary;
|
||||||
import com.dahe.mylibrary.net.JsonInterceptor;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.arpa.hndahesudintocctmsdriver.request.net;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.App;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.NewLJUtils;
|
||||||
|
import com.dahe.mylibrary.net.ResultException;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
import okio.Buffer;
|
||||||
|
import okio.BufferedSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json的Interceptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class JsonInterceptor implements Interceptor {
|
||||||
|
private static final String TAG = "JsonInterceptor";
|
||||||
|
|
||||||
|
public JsonInterceptor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response intercept(Chain chain) throws IOException {
|
||||||
|
Request request = chain.request();
|
||||||
|
Response response = chain.proceed(request);
|
||||||
|
ResponseBody responseBody = response.body();
|
||||||
|
//为了不消耗buffer,我们这里使用source先获得buffer对象,然后clone()后使用
|
||||||
|
BufferedSource source = responseBody.source();
|
||||||
|
source.request(Long.MAX_VALUE); // Buffer the entire body.
|
||||||
|
//获得返回的数据
|
||||||
|
Buffer buffer = source.buffer();
|
||||||
|
//使用前clone()下,避免直接消耗
|
||||||
|
String responseBodyStr = buffer.clone().readString(Charset.forName("UTF-8"));
|
||||||
|
Log.i(TAG, "result-body= " + responseBodyStr);
|
||||||
|
try {
|
||||||
|
|
||||||
|
// if (401==response.code()){
|
||||||
|
// NewLJUtils.getInstance().refreshToken(App.getApp());
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject(responseBodyStr);
|
||||||
|
String str = jsonObject.optString("data");
|
||||||
|
int code = jsonObject.optInt("code");
|
||||||
|
if (-1 == code) {
|
||||||
|
jsonObject.put("data", new JSONObject());
|
||||||
|
throw new ResultException();
|
||||||
|
} else {
|
||||||
|
if (TextUtils.isEmpty(str)) {
|
||||||
|
jsonObject.put("data", new JSONObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String data = jsonObject.toString();
|
||||||
|
responseBody = ResponseBody.create(MediaType.parse("application/json; charset=utf-8"), data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
response = response.newBuilder().body(responseBody).build();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
@ -88,7 +88,7 @@ public abstract class RxHttpCallBack<T> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if ("401".equals(t.getCode())) {
|
if ("401".equals(t.getCode())) {
|
||||||
NewLJUtils.getInstance().getToken(mContext);
|
NewLJUtils.getInstance().refreshToken(mContext);
|
||||||
// UiAuxiliary.delLogin(mContext);
|
// UiAuxiliary.delLogin(mContext);
|
||||||
// Intent intent = new Intent(mContext, MainActivity.class);
|
// Intent intent = new Intent(mContext, MainActivity.class);
|
||||||
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
@ -10,12 +10,16 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.App;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.bean.DriverAuthDataBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.GDImage;
|
import com.arpa.hndahesudintocctmsdriver.bean.GDImage;
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.GDLocation;
|
import com.arpa.hndahesudintocctmsdriver.bean.GDLocation;
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.IsAuthCardBean;
|
import com.arpa.hndahesudintocctmsdriver.bean.IsAuthCardBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.constant.NewLJConstant;
|
import com.arpa.hndahesudintocctmsdriver.constant.NewLJConstant;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.parts.AuthParts;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.AuthRequest;
|
import com.arpa.hndahesudintocctmsdriver.request.AuthRequest;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.InvoiceBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.InvoiceBean;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.InvoicesBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.PickupBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.PickupBean;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.ShipmentStatusBean;
|
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.ShipmentStatusBean;
|
||||||
@ -73,11 +77,30 @@ public class NewLJUtils {
|
|||||||
public void onSuccess(CommonResponseBean t) {
|
public void onSuccess(CommonResponseBean t) {
|
||||||
super.onSuccess(t);
|
super.onSuccess(t);
|
||||||
SPUtils.put(ctx, NEW_LJ_TOKEN, t.getToken());
|
SPUtils.put(ctx, NEW_LJ_TOKEN, t.getToken());
|
||||||
|
refreshToken(ctx);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getToken(Context ctx,OnGDResultListener listener) {
|
|
||||||
|
/**
|
||||||
|
* 刷新token
|
||||||
|
* @param ctx
|
||||||
|
*/
|
||||||
|
public void refreshToken(Context ctx){
|
||||||
|
String token = SPUtils.get(ctx, NEW_LJ_TOKEN, "").toString();
|
||||||
|
DataManager.getInstance().refreshToken(token)
|
||||||
|
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new BaseObserver(ctx, new RxHttpCallBack<CommonResponseBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(CommonResponseBean<CommonResponseBean> t) {
|
||||||
|
super.onSuccess(t);
|
||||||
|
SPUtils.put(ctx, NEW_LJ_TOKEN, t.getToken());
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getToken(Context ctx, OnGDResultListener listener) {
|
||||||
LjTokenBean ljTokenBean = new LjTokenBean();
|
LjTokenBean ljTokenBean = new LjTokenBean();
|
||||||
ljTokenBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE);
|
ljTokenBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE);
|
||||||
ljTokenBean.setEnterpriseIdentity(NewLJConstant.ENTER_PRISE_IDENTITY);
|
ljTokenBean.setEnterpriseIdentity(NewLJConstant.ENTER_PRISE_IDENTITY);
|
||||||
@ -90,7 +113,8 @@ public class NewLJUtils {
|
|||||||
public void onSuccess(CommonResponseBean t) {
|
public void onSuccess(CommonResponseBean t) {
|
||||||
super.onSuccess(t);
|
super.onSuccess(t);
|
||||||
SPUtils.put(ctx, NEW_LJ_TOKEN, t.getToken());
|
SPUtils.put(ctx, NEW_LJ_TOKEN, t.getToken());
|
||||||
if (listener!=null)
|
refreshToken(ctx);
|
||||||
|
if (listener != null)
|
||||||
listener.onSuccess();
|
listener.onSuccess();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@ -410,35 +434,158 @@ public class NewLJUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取发票列表
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void getInvoices(Context ctx, OnGDResultListener listener) {
|
||||||
|
DriverAuthDataBean auth = AuthParts.getAuth(ctx);
|
||||||
|
if (auth == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataManager.getInstance().getInvoices(NewLJConstant.ENTER_PRISE_CODE, auth.getData().getIdcard(), 1, 100)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new BaseObserver(ctx, new RxHttpCallBack<CommonResponseBean<InvoicesBean>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(CommonResponseBean<CommonResponseBean<InvoicesBean>> t) {
|
||||||
|
super.onSuccess(t);
|
||||||
|
if (t.getData().getData().getDriverInvoices().size() > 0) {
|
||||||
|
confirmInvoice(ctx, new OnGDResultListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String var1, String var2) {
|
||||||
|
Log.e("NewLJUtils", var1 + var2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCodeError(Context mContext, CommonResponseBean<CommonResponseBean<InvoicesBean>> t) {
|
||||||
|
super.onCodeError(mContext, t);
|
||||||
|
Log.e("NewLJUtils", t.getMessage());
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同意发票申请
|
* 同意发票申请
|
||||||
*
|
*
|
||||||
* @param ctx
|
* @param ctx
|
||||||
* @param shipmentCode
|
|
||||||
* @param invoiceBean
|
|
||||||
*/
|
*/
|
||||||
public void confirmInvoice(Context ctx, String shipmentCode, InvoiceBean invoiceBean, OnGDResultListener listener) {
|
public void confirmInvoice(Context ctx, OnGDResultListener listener) {
|
||||||
|
DriverAuthDataBean auth = AuthParts.getAuth(ctx);
|
||||||
|
if (auth == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
searchDriver(ctx, auth.getData().getIdcard(), new OnGDDownloadResultListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String var1) {
|
||||||
|
InvoiceBean invoiceBean = new InvoiceBean();
|
||||||
|
invoiceBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE);
|
||||||
|
invoiceBean.setDriverInvoiceCode(var1);
|
||||||
|
invoiceBean.setDriverIdentification(auth.getData().getIdcard());
|
||||||
|
DataManager.getInstance().confirmInvoice(invoiceBean)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new BaseObserver(ctx, new RxHttpCallBack<CommonResponseBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(CommonResponseBean t) {
|
||||||
|
super.onSuccess(t);
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCodeError(Context mContext, CommonResponseBean<CommonResponseBean> t) {
|
||||||
|
super.onCodeError(mContext, t);
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onFailure(t.getCode() + "", t.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String var1, String var2) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//查询身份证信息
|
||||||
|
// new AuthRequest().getCard(ctx, new Handler(msg -> {
|
||||||
|
// switch (msg.what) {
|
||||||
|
// case RequsetCodeConstants.ERROR:
|
||||||
|
// Toast.makeText(ctx, RequsetCodeConstants.FEEDBACK_TEXT, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case RequsetCodeConstants.UNKONWN:
|
||||||
|
// Toast.makeText(ctx, RequsetCodeConstants.UNKONWN_TEXT, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case RequsetCodeConstants.SERVER_ERROR:
|
||||||
|
// Toast.makeText(ctx, RequsetCodeConstants.SERVER_ERROR_TEXT, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case RequsetCodeConstants.GATEWAY_ERROR:
|
||||||
|
// Toast.makeText(ctx, RequsetCodeConstants.GATEWAY_ERROR_TEXT, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case RequsetCodeConstants.SUCCESS:
|
||||||
|
// IsAuthCardBean iacb = new Gson().fromJson(CacheGroup.cacheList.get(CertificatesActivity.ISAUTH), IsAuthCardBean.class);
|
||||||
|
// if (iacb != null || iacb.getData() != null || !TextUtils.isEmpty(iacb.getData().getIdcard())) {
|
||||||
|
// //根据身份证号查询路交司机信息
|
||||||
|
// searchDriver(ctx, iacb.getData().getIdcard(), new OnGDDownloadResultListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(String var1) {
|
||||||
|
// InvoiceBean invoiceBean = new InvoiceBean();
|
||||||
|
// invoiceBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE);
|
||||||
|
// invoiceBean.setDriverInvoiceCode(var1);
|
||||||
|
// invoiceBean.setDriverIdentification(iacb.getData().getIdcard());
|
||||||
|
// DataManager.getInstance().confirmInvoice(invoiceBean)
|
||||||
|
// .subscribeOn(Schedulers.io())
|
||||||
|
// .observeOn(AndroidSchedulers.mainThread())
|
||||||
|
// .subscribe(new BaseObserver(ctx, new RxHttpCallBack<CommonResponseBean>() {
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(CommonResponseBean t) {
|
||||||
|
// super.onSuccess(t);
|
||||||
|
// if (listener != null) {
|
||||||
|
// listener.onSuccess();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onCodeError(Context mContext, CommonResponseBean<CommonResponseBean> t) {
|
||||||
|
// super.onCodeError(mContext, t);
|
||||||
|
// if (listener != null) {
|
||||||
|
// listener.onFailure(t.getCode() + "", t.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure(String var1, String var2) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// Toast.makeText(ctx, "缺少身份证信息", Toast.LENGTH_SHORT).show();
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }));
|
||||||
|
|
||||||
DataManager.getInstance().confirmInvoice(invoiceBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new BaseObserver(ctx, new RxHttpCallBack<CommonResponseBean>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(CommonResponseBean t) {
|
|
||||||
super.onSuccess(t);
|
|
||||||
if (listener != null) {
|
|
||||||
listener.onSuccess();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCodeError(Context mContext, CommonResponseBean<CommonResponseBean> t) {
|
|
||||||
super.onCodeError(mContext, t);
|
|
||||||
if (listener != null) {
|
|
||||||
listener.onFailure(t.getCode() + "", t.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -502,51 +649,76 @@ public class NewLJUtils {
|
|||||||
* @param act
|
* @param act
|
||||||
*/
|
*/
|
||||||
public void startLocationService(AppCompatActivity act) {
|
public void startLocationService(AppCompatActivity act) {
|
||||||
//查询身份证信息
|
DriverAuthDataBean auth = AuthParts.getAuth(act);
|
||||||
new AuthRequest().getCard(act, new Handler(msg -> {
|
if (auth == null) {
|
||||||
switch (msg.what) {
|
return;
|
||||||
case RequsetCodeConstants.ERROR:
|
}
|
||||||
Toast.makeText(act, RequsetCodeConstants.FEEDBACK_TEXT, Toast.LENGTH_SHORT).show();
|
searchDriver(act, auth.getData().getIdcard(), new OnGDDownloadResultListener() {
|
||||||
break;
|
@Override
|
||||||
case RequsetCodeConstants.UNKONWN:
|
public void onSuccess(String var1) {
|
||||||
Toast.makeText(act, RequsetCodeConstants.UNKONWN_TEXT, Toast.LENGTH_SHORT).show();
|
try {
|
||||||
break;
|
//开启定位服务
|
||||||
case RequsetCodeConstants.SERVER_ERROR:
|
Api.setBaseUrl("https://kehui56.cn/api", "https://api.kehui56.cn/api");
|
||||||
Toast.makeText(act, RequsetCodeConstants.SERVER_ERROR_TEXT, Toast.LENGTH_SHORT).show();
|
String result = Api.startLocationService(act, var1, s -> {
|
||||||
break;
|
Log.e("位置上报", s);
|
||||||
case RequsetCodeConstants.GATEWAY_ERROR:
|
});
|
||||||
Toast.makeText(act, RequsetCodeConstants.GATEWAY_ERROR_TEXT, Toast.LENGTH_SHORT).show();
|
} catch (Exception e) {
|
||||||
break;
|
throw new RuntimeException(e);
|
||||||
case RequsetCodeConstants.SUCCESS:
|
}
|
||||||
IsAuthCardBean iacb = new Gson().fromJson(CacheGroup.cacheList.get(CertificatesActivity.ISAUTH), IsAuthCardBean.class);
|
|
||||||
if (iacb != null || iacb.getData() != null || !TextUtils.isEmpty(iacb.getData().getIdcard())) {
|
|
||||||
//根据身份证号查询路交司机信息
|
|
||||||
searchDriver(act,iacb.getData().getIdcard(), new OnGDDownloadResultListener() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String var1) {
|
|
||||||
try {
|
|
||||||
//开启定位服务
|
|
||||||
Api.setBaseUrl("https://kehui56.cn/api", "https://api.kehui56.cn/api");
|
|
||||||
String result = Api.startLocationService(act, var1, s -> {
|
|
||||||
Log.e("位置上报", s);
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(String var1, String var2) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Toast.makeText(act, "缺少身份证信息", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}));
|
@Override
|
||||||
|
public void onFailure(String var1, String var2) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//查询身份证信息
|
||||||
|
// new AuthRequest().getCard(act, new Handler(msg -> {
|
||||||
|
// switch (msg.what) {
|
||||||
|
// case RequsetCodeConstants.ERROR:
|
||||||
|
// Toast.makeText(act, RequsetCodeConstants.FEEDBACK_TEXT, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case RequsetCodeConstants.UNKONWN:
|
||||||
|
// Toast.makeText(act, RequsetCodeConstants.UNKONWN_TEXT, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case RequsetCodeConstants.SERVER_ERROR:
|
||||||
|
// Toast.makeText(act, RequsetCodeConstants.SERVER_ERROR_TEXT, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case RequsetCodeConstants.GATEWAY_ERROR:
|
||||||
|
// Toast.makeText(act, RequsetCodeConstants.GATEWAY_ERROR_TEXT, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case RequsetCodeConstants.SUCCESS:
|
||||||
|
// IsAuthCardBean iacb = new Gson().fromJson(CacheGroup.cacheList.get(CertificatesActivity.ISAUTH), IsAuthCardBean.class);
|
||||||
|
// if (iacb != null || iacb.getData() != null || !TextUtils.isEmpty(iacb.getData().getIdcard())) {
|
||||||
|
// //根据身份证号查询路交司机信息
|
||||||
|
// searchDriver(act,iacb.getData().getIdcard(), new OnGDDownloadResultListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(String var1) {
|
||||||
|
// try {
|
||||||
|
// //开启定位服务
|
||||||
|
// Api.setBaseUrl("https://kehui56.cn/api", "https://api.kehui56.cn/api");
|
||||||
|
// String result = Api.startLocationService(act, var1, s -> {
|
||||||
|
// Log.e("位置上报", s);
|
||||||
|
// });
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure(String var1, String var2) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// Toast.makeText(act, "缺少身份证信息", Toast.LENGTH_SHORT).show();
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -562,7 +734,7 @@ public class NewLJUtils {
|
|||||||
/**
|
/**
|
||||||
* 查询司机
|
* 查询司机
|
||||||
*/
|
*/
|
||||||
public void searchDriver(Context ctx,String idCard, OnGDDownloadResultListener listener) {
|
public void searchDriver(Context ctx, String idCard, OnGDDownloadResultListener listener) {
|
||||||
DataManager.getInstance().searchDriver(idCard)
|
DataManager.getInstance().searchDriver(idCard)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
@ -580,8 +752,8 @@ public class NewLJUtils {
|
|||||||
@Override
|
@Override
|
||||||
public void onCodeError(Context mContext, CommonResponseBean<CommonResponseBean> t) {
|
public void onCodeError(Context mContext, CommonResponseBean<CommonResponseBean> t) {
|
||||||
super.onCodeError(mContext, t);
|
super.onCodeError(mContext, t);
|
||||||
if (listener!=null)
|
if (listener != null)
|
||||||
listener.onFailure(t.getCode(),t.getMessage());
|
listener.onFailure(t.getCode(), t.getMessage());
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user