diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/bean/newlj/InvoiceBean.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/bean/newlj/InvoiceBean.java new file mode 100644 index 0000000..c80a7c4 --- /dev/null +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/bean/newlj/InvoiceBean.java @@ -0,0 +1,40 @@ +package com.arpa.hndahesudintocctmsdriver.request.bean.newlj; + +import java.io.Serializable; + +/** + * @ClassName InvoiceBean + * @Author john + * @Date 2024/11/25 17:06 + * @Description TODO + */ +public class InvoiceBean implements Serializable { + private String driverIdentification; + private String driverInvoiceCode; + private String enterpriseCode; + + + public String getDriverIdentification() { + return driverIdentification; + } + + public void setDriverIdentification(String driverIdentification) { + this.driverIdentification = driverIdentification; + } + + public String getDriverInvoiceCode() { + return driverInvoiceCode; + } + + public void setDriverInvoiceCode(String driverInvoiceCode) { + this.driverInvoiceCode = driverInvoiceCode; + } + + public String getEnterpriseCode() { + return enterpriseCode; + } + + public void setEnterpriseCode(String enterpriseCode) { + this.enterpriseCode = enterpriseCode; + } +} diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/bean/newlj/ShipmentStatusBean.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/bean/newlj/ShipmentStatusBean.java new file mode 100644 index 0000000..5c15b11 --- /dev/null +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/bean/newlj/ShipmentStatusBean.java @@ -0,0 +1,31 @@ +package com.arpa.hndahesudintocctmsdriver.request.bean.newlj; + +import java.io.Serializable; + +/** + * @ClassName ShipmentStatusBean + * @Author john + * @Date 2024/11/25 17:16 + * @Description TODO + */ +public class ShipmentStatusBean implements Serializable { + private String shipmentCode; + private String enterpriseCode; + + + 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; + } +} diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/net/Api.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/net/Api.java index 359049b..64d8582 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/net/Api.java +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/net/Api.java @@ -4,14 +4,17 @@ 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.InvoiceBean; import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean; import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.PickupBean; +import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.ShipmentStatusBean; import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.UpimgBean; import com.dahe.mylibrary.net.CommonResponseBean; import io.reactivex.rxjava3.core.Observable; import retrofit2.http.Body; import retrofit2.http.POST; +import retrofit2.http.PUT; import retrofit2.http.Query; /** @@ -94,5 +97,23 @@ public interface Api { */ @POST(BASE_URL+"openapi/shipments/uploadPODImage") Observable uploadPODImage(@Body UpimgBean bean); + + + /** + * 同意发票申请 + * @param bean + * @return + */ + @PUT(BASE_URL+"openapi/confirmInvoice") + Observable confirmInvoice(@Body InvoiceBean bean); + + + /** + * 获取运单状态 + * @param bean + * @return + */ + @POST(BASE_URL+"/openapi/getShipmentStatus") + Observable getShipmentStatus(@Body ShipmentStatusBean bean); } diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/util/NewLJUtils.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/util/NewLJUtils.java index 5e7c232..6f200d7 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/util/NewLJUtils.java +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/util/NewLJUtils.java @@ -6,8 +6,11 @@ import android.content.Context; import android.text.TextUtils; import com.arpa.hndahesudintocctmsdriver.constant.NewLJConstant; +import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.InvoiceBean; import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean; import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.PickupBean; +import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.ShipmentStatusBean; +import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.UpimgBean; import com.arpa.hndahesudintocctmsdriver.request.net.BaseObserver; import com.arpa.hndahesudintocctmsdriver.request.net.DataManager; import com.arpa.hndahesudintocctmsdriver.request.net.RxHttpCallBack; @@ -53,7 +56,7 @@ public class NewLJUtils { @Override public void onSuccess(CommonResponseBean t) { super.onSuccess(t); - SPUtils.put(ctx,NEW_LJ_TOKEN,t.getToken()); + SPUtils.put(ctx, NEW_LJ_TOKEN, t.getToken()); } })); } @@ -61,18 +64,19 @@ public class NewLJUtils { /** * 运单提货 + * * @param ctx * @param shipmentCode * @param location */ - public void pickUp(Context ctx, String shipmentCode, PickupBean.LocationDTO location){ - if (TextUtils.isEmpty(shipmentCode)){ - ToastUtils.showToast(ctx,"运单号不能为空"); + public void pickUp(Context ctx, String shipmentCode, PickupBean.LocationDTO location) { + if (TextUtils.isEmpty(shipmentCode)) { + ToastUtils.showToast(ctx, "运单号不能为空"); return; } - if (Double.isNaN(location.getBaiduLatitude())||Double.isNaN(location.getBaiduLongitude())){ - ToastUtils.showToast(ctx,"经纬度不能为空"); + if (Double.isNaN(location.getBaiduLatitude()) || Double.isNaN(location.getBaiduLongitude())) { + ToastUtils.showToast(ctx, "经纬度不能为空"); return; } location.setTime(TimeUtil.getNowString(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()))); @@ -93,4 +97,257 @@ public class NewLJUtils { } + /** + * 运单卸货 + * + * @param ctx + * @param shipmentCode + * @param location + */ + public void unload(Context ctx, String shipmentCode, PickupBean.LocationDTO location) { + if (TextUtils.isEmpty(shipmentCode)) { + ToastUtils.showToast(ctx, "运单号不能为空"); + return; + } + + if (Double.isNaN(location.getBaiduLatitude()) || Double.isNaN(location.getBaiduLongitude())) { + ToastUtils.showToast(ctx, "经纬度不能为空"); + return; + } + location.setTime(TimeUtil.getNowString(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()))); + + PickupBean pickupBean = new PickupBean(); + pickupBean.setShipmentCode(shipmentCode); + pickupBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE); + pickupBean.setLocation(location); + DataManager.getInstance().unload(pickupBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver(ctx, new RxHttpCallBack() { + @Override + public void onSuccess(CommonResponseBean t) { + super.onSuccess(t); + + } + })); + } + + + /** + * 运单签收 + * @param ctx + * @param shipmentCode + * @param location + */ + public void sign(Context ctx, String shipmentCode, PickupBean.LocationDTO location) { + if (TextUtils.isEmpty(shipmentCode)) { + ToastUtils.showToast(ctx, "运单号不能为空"); + return; + } + + if (Double.isNaN(location.getBaiduLatitude()) || Double.isNaN(location.getBaiduLongitude())) { + ToastUtils.showToast(ctx, "经纬度不能为空"); + return; + } + location.setTime(TimeUtil.getNowString(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()))); + + PickupBean pickupBean = new PickupBean(); + pickupBean.setShipmentCode(shipmentCode); + pickupBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE); + pickupBean.setLocation(location); + DataManager.getInstance().sign(pickupBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver(ctx, new RxHttpCallBack() { + @Override + public void onSuccess(CommonResponseBean t) { + super.onSuccess(t); + + } + })); + } + + + /** + * 运单回单 + * @param ctx + * @param shipmentCode + * @param location + */ + public void pod(Context ctx, String shipmentCode, PickupBean.LocationDTO location) { + if (TextUtils.isEmpty(shipmentCode)) { + ToastUtils.showToast(ctx, "运单号不能为空"); + return; + } + + if (Double.isNaN(location.getBaiduLatitude()) || Double.isNaN(location.getBaiduLongitude())) { + ToastUtils.showToast(ctx, "经纬度不能为空"); + return; + } + location.setTime(TimeUtil.getNowString(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()))); + + PickupBean pickupBean = new PickupBean(); + pickupBean.setShipmentCode(shipmentCode); + pickupBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE); + pickupBean.setLocation(location); + DataManager.getInstance().pod(pickupBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver(ctx, new RxHttpCallBack() { + @Override + public void onSuccess(CommonResponseBean t) { + super.onSuccess(t); + + } + })); + } + + + /** + * 运单提货照片上传 + * @param ctx + * @param shipmentCode + * @param imageDTO + */ + public void uploadPickupImage(Context ctx, String shipmentCode, UpimgBean.ImageDTO imageDTO) { + if (TextUtils.isEmpty(shipmentCode)) { + ToastUtils.showToast(ctx, "运单号不能为空"); + return; + } + + if (TextUtils.isEmpty(imageDTO.getFileName())) { + ToastUtils.showToast(ctx, "照片不能为空"); + return; + } + imageDTO.setTime(TimeUtil.getNowString(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()))); + + UpimgBean pickupBean = new UpimgBean(); + pickupBean.setShipmentCode(shipmentCode); + pickupBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE); + pickupBean.setImage(imageDTO); + DataManager.getInstance().uploadPickupImage(pickupBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver(ctx, new RxHttpCallBack() { + @Override + public void onSuccess(CommonResponseBean t) { + super.onSuccess(t); + + } + })); + } + + + /** + * 运单卸货照片上传 + * @param ctx + * @param shipmentCode + * @param imageDTO + */ + public void uploadUnloadImage(Context ctx, String shipmentCode, UpimgBean.ImageDTO imageDTO) { + if (TextUtils.isEmpty(shipmentCode)) { + ToastUtils.showToast(ctx, "运单号不能为空"); + return; + } + + if (TextUtils.isEmpty(imageDTO.getFileName())) { + ToastUtils.showToast(ctx, "照片不能为空"); + return; + } + imageDTO.setTime(TimeUtil.getNowString(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()))); + + UpimgBean pickupBean = new UpimgBean(); + pickupBean.setShipmentCode(shipmentCode); + pickupBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE); + pickupBean.setImage(imageDTO); + DataManager.getInstance().uploadUnloadImage(pickupBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver(ctx, new RxHttpCallBack() { + @Override + public void onSuccess(CommonResponseBean t) { + super.onSuccess(t); + + } + })); + } + + + /** + * 运单回单照片上传 + * @param ctx + * @param shipmentCode + * @param imageDTO + */ + public void uploadPODImage(Context ctx, String shipmentCode, UpimgBean.ImageDTO imageDTO) { + if (TextUtils.isEmpty(shipmentCode)) { + ToastUtils.showToast(ctx, "运单号不能为空"); + return; + } + + if (TextUtils.isEmpty(imageDTO.getFileName())) { + ToastUtils.showToast(ctx, "照片不能为空"); + return; + } + imageDTO.setTime(TimeUtil.getNowString(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()))); + + UpimgBean pickupBean = new UpimgBean(); + pickupBean.setShipmentCode(shipmentCode); + pickupBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE); + pickupBean.setImage(imageDTO); + DataManager.getInstance().uploadPODImage(pickupBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver(ctx, new RxHttpCallBack() { + @Override + public void onSuccess(CommonResponseBean t) { + super.onSuccess(t); + + } + })); + } + + + /** + * 同意发票申请 + * @param ctx + * @param shipmentCode + * @param invoiceBean + */ + public void confirmInvoice(Context ctx, String shipmentCode, InvoiceBean invoiceBean) { + + DataManager.getInstance().confirmInvoice(invoiceBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver(ctx, new RxHttpCallBack() { + @Override + public void onSuccess(CommonResponseBean t) { + super.onSuccess(t); + + } + })); + } + + + + /** + * 运单状态查询 + * @param ctx + * @param shipmentCode + * @param shipmentStatusBean + */ + public void getShipmentStatus(Context ctx, String shipmentCode, ShipmentStatusBean shipmentStatusBean) { + + DataManager.getInstance().getShipmentStatus(shipmentStatusBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new BaseObserver(ctx, new RxHttpCallBack() { + @Override + public void onSuccess(CommonResponseBean t) { + super.onSuccess(t); + + } + })); + } + }