|
|
@@ -13,6 +13,8 @@ import android.widget.LinearLayout; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.huntersun.vky.obublelib.box.BoxManagers; |
|
|
|
import com.huntersun.vky.obublelib.util.ToastUtil; |
|
|
|
import com.huntersun.vkyes.etcopencard.project.api.MyRetrofit; |
|
|
|
import com.huntersun.vkyes.etcopencard.project.api.bean.IFCode; |
|
|
|
import com.huntersun.vkyes.etcopencard.project.api.bean.ResultBean; |
|
|
|
import com.huntersun.vkyes.etcopencard.project.bluetooth.BluetoothDialog; |
|
|
|
import com.huntersun.vkyes.etcopencard.project.copapply.ApplyRequst; |
|
|
@@ -30,6 +32,10 @@ import com.huntersun.vkyes.etcopencard.project.ui.activity.after.ReplaceEtcStep2 |
|
|
|
import com.huntersun.vkyes.etcopencard.project.ui.activity.mail.FormDeliveryActivity; |
|
|
|
import com.huntersun.vkyes.etcopencard.project.utils.Constants; |
|
|
|
import com.huntersun.vkyes.etcopencard.project.utils.FunHelper; |
|
|
|
import com.huntersun.vkyes.etcopencard.src.aop.SingleClick; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* Date :2023-03-15 |
|
|
@@ -59,11 +65,11 @@ public class OrderUtils { |
|
|
|
private ResultBean.BizContent orderData; //订单数据 |
|
|
|
private boolean isFromList; //是否来自订单列表 |
|
|
|
|
|
|
|
public OrderUtils(Activity context,ResultBean.BizContent orderData,boolean isFromList,LinearLayout LLBtns,Button btnFinish, |
|
|
|
Button btnLogistics,Button btnReturnGoods,Button btnExGoods, |
|
|
|
Button btnCancelOrder,Button btnEditAddr,Button btnAudit,Button btnDeliver, |
|
|
|
Button btnActive,Button btnAgainActive,Button btnReceiveGoods, |
|
|
|
Button btnUserInfoUpload, Button btnCarInfoUpload,Button btnConfirmInfo,Button btnPay) { |
|
|
|
public OrderUtils(Activity context, ResultBean.BizContent orderData, boolean isFromList, LinearLayout LLBtns, Button btnFinish, |
|
|
|
Button btnLogistics, Button btnReturnGoods, Button btnExGoods, |
|
|
|
Button btnCancelOrder, Button btnEditAddr, Button btnAudit, Button btnDeliver, |
|
|
|
Button btnActive, Button btnAgainActive, Button btnReceiveGoods, |
|
|
|
Button btnUserInfoUpload, Button btnCarInfoUpload, Button btnConfirmInfo, Button btnPay) { |
|
|
|
this.context = context; |
|
|
|
this.orderData = orderData; |
|
|
|
this.isFromList = isFromList; |
|
|
@@ -91,7 +97,7 @@ public class OrderUtils { |
|
|
|
/** |
|
|
|
* 设置按钮的显示和隐藏 |
|
|
|
*/ |
|
|
|
private void setBtnViewVisibleOrHide(){ |
|
|
|
private void setBtnViewVisibleOrHide() { |
|
|
|
LLBtns.setVisibility(View.GONE); |
|
|
|
btnFinish.setVisibility(View.GONE); |
|
|
|
btnLogistics.setVisibility(View.GONE); |
|
|
@@ -109,12 +115,12 @@ public class OrderUtils { |
|
|
|
btnConfirmInfo.setVisibility(View.GONE); |
|
|
|
btnPay.setVisibility(View.GONE); |
|
|
|
|
|
|
|
if(FunHelper.isEmpty(orderData.getOrderStep())){ |
|
|
|
if (FunHelper.isEmpty(orderData.getOrderStep())) { |
|
|
|
orderData.setOrderStep("0"); |
|
|
|
} |
|
|
|
|
|
|
|
if (!orderData.getOrderStatus().equals(String.valueOf(Constants.ORDER_STATUS_CANCEL))){ |
|
|
|
switch (Integer.parseInt(orderData.getOrderStep())){ |
|
|
|
if (!orderData.getOrderStatus().equals(String.valueOf(Constants.ORDER_STATUS_CANCEL))) { |
|
|
|
switch (Integer.parseInt(orderData.getOrderStep())) { |
|
|
|
case Constants.ORDER_STATUS_BASE://完成填写基本信息 |
|
|
|
LLBtns.setVisibility(View.VISIBLE); |
|
|
|
btnCancelOrder.setVisibility(View.VISIBLE); |
|
|
@@ -177,10 +183,11 @@ public class OrderUtils { |
|
|
|
/** |
|
|
|
* 设置点击事件 |
|
|
|
*/ |
|
|
|
private void initBtnClick(){ |
|
|
|
private void initBtnClick() { |
|
|
|
//身份证信息上传 |
|
|
|
btnUserInfoUpload.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(IdentityInformationUploadActivity.class); |
|
|
|
} |
|
|
@@ -189,6 +196,7 @@ public class OrderUtils { |
|
|
|
//车辆信息上传 |
|
|
|
btnCarInfoUpload.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(VehicleInformationActivity.class); |
|
|
|
} |
|
|
@@ -197,6 +205,7 @@ public class OrderUtils { |
|
|
|
//信息确认 |
|
|
|
btnConfirmInfo.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(InformationConfirmedActivity.class); |
|
|
|
} |
|
|
@@ -205,6 +214,7 @@ public class OrderUtils { |
|
|
|
//支付 |
|
|
|
btnPay.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
ResultBean.BizContent productBean = new ResultBean.BizContent(); |
|
|
|
productBean.setId(orderData.productId); |
|
|
@@ -227,27 +237,30 @@ public class OrderUtils { |
|
|
|
//结束订单 |
|
|
|
btnFinish.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
new ConfirmDialog.Builder(context) .setMsg("确定是否结束订单?").onClick(new ConfirmDialog.Result() { |
|
|
|
@Override |
|
|
|
public void confirm() { |
|
|
|
ToastUtil.showS(context,"结束订单"); |
|
|
|
} |
|
|
|
}).show(); |
|
|
|
new ConfirmDialog.Builder(context).setMsg("确定是否结束订单?").onClick(new ConfirmDialog.Result() { |
|
|
|
@Override |
|
|
|
public void confirm() { |
|
|
|
ToastUtil.showS(context, "结束订单"); |
|
|
|
} |
|
|
|
}).show(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//查看物流 |
|
|
|
btnLogistics.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(OrderLogisticsActivity.class); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//退货 |
|
|
|
btnReturnGoods.setOnClickListener( new View.OnClickListener() { |
|
|
|
btnReturnGoods.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(ApplyReturnGoodsStep1Activity.class); |
|
|
|
} |
|
|
@@ -256,6 +269,7 @@ public class OrderUtils { |
|
|
|
//换货 |
|
|
|
btnExGoods.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(ApplyExGoodsStep1Activity.class); |
|
|
|
} |
|
|
@@ -264,6 +278,7 @@ public class OrderUtils { |
|
|
|
//取消订单 |
|
|
|
btnCancelOrder.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(CancelOrderStep1Activity.class); |
|
|
|
} |
|
|
@@ -272,6 +287,7 @@ public class OrderUtils { |
|
|
|
//修改地址 |
|
|
|
btnEditAddr.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(EditOrderAddrActivity.class); |
|
|
|
} |
|
|
@@ -280,6 +296,7 @@ public class OrderUtils { |
|
|
|
//审核 |
|
|
|
btnAudit.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(AuditingStep1Activity.class); |
|
|
|
} |
|
|
@@ -288,8 +305,9 @@ public class OrderUtils { |
|
|
|
//发货 |
|
|
|
btnDeliver.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
ToastUtil.showS(context,"发货"); |
|
|
|
ToastUtil.showS(context, "发货"); |
|
|
|
startActivity(FormDeliveryActivity.class); |
|
|
|
} |
|
|
|
}); |
|
|
@@ -297,19 +315,28 @@ public class OrderUtils { |
|
|
|
//激活 |
|
|
|
btnActive.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
releaseActivation(orderData); |
|
|
|
Map<String, String> params = new HashMap<>(); |
|
|
|
params.put("id", orderData.getId() + ""); |
|
|
|
MyRetrofit.newInstance(IFCode.IFCODE9, params, new MyRetrofit.ReturnResult() { |
|
|
|
@Override |
|
|
|
public void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent) { |
|
|
|
releaseActivation(bizContent); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//再次唤起 |
|
|
|
btnAgainActive.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
new ConfirmDialog.Builder(context) .setMsg("确定是否再次唤醒订单?").onClick(new ConfirmDialog.Result() { |
|
|
|
new ConfirmDialog.Builder(context).setMsg("确定是否再次唤醒订单?").onClick(new ConfirmDialog.Result() { |
|
|
|
@Override |
|
|
|
public void confirm() { |
|
|
|
ToastUtil.showS(context,"再次唤起"); |
|
|
|
ToastUtil.showS(context, "再次唤起"); |
|
|
|
} |
|
|
|
}).show(); |
|
|
|
} |
|
|
@@ -318,6 +345,7 @@ public class OrderUtils { |
|
|
|
//确认完成 |
|
|
|
btnReceiveGoods.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
@SingleClick |
|
|
|
public void onClick(View view) { |
|
|
|
startActivity(ConfirmReceiveGoodsStep1Activity.class); |
|
|
|
} |
|
|
@@ -326,7 +354,7 @@ public class OrderUtils { |
|
|
|
|
|
|
|
//激活 |
|
|
|
public void releaseActivation(ResultBean.BizContent bizContent1) { |
|
|
|
new BluetoothDialog.Builder(context) .setResult(new BluetoothDialog.Builder.OnResult() { |
|
|
|
new BluetoothDialog.Builder(context).setResult(new BluetoothDialog.Builder.OnResult() { |
|
|
|
/** |
|
|
|
* 未打开的蓝牙 |
|
|
|
*/ |
|
|
@@ -403,7 +431,7 @@ public class OrderUtils { |
|
|
|
*/ |
|
|
|
public void openingApplication(ResultBean.BizContent bizContent1) { |
|
|
|
//开签完以后走激活 |
|
|
|
new OBURequest(BoxManagers.mDecryptVehicleApduBean, bizContent1,context) |
|
|
|
new OBURequest(BoxManagers.mDecryptVehicleApduBean, bizContent1, context) |
|
|
|
.obuPublishRequest(new OBURequest.CallBack() { |
|
|
|
@Override |
|
|
|
public void onSuccess() { |
|
|
@@ -417,7 +445,7 @@ public class OrderUtils { |
|
|
|
*/ |
|
|
|
public void deviceActivation(ResultBean.BizContent content) { |
|
|
|
//设备激活 |
|
|
|
new ObuActivation(BoxManagers.mDecryptVehicleApduBean,context).start(bizContent -> { |
|
|
|
new ObuActivation(BoxManagers.mDecryptVehicleApduBean, context).start(bizContent -> { |
|
|
|
bizContent.setOrderId(content.getOrderId()); |
|
|
|
//激活步骤 |
|
|
|
new ObuActivateRequester().start(bizContent, context); |
|
|
@@ -427,20 +455,21 @@ public class OrderUtils { |
|
|
|
|
|
|
|
/** |
|
|
|
* 跳转 |
|
|
|
* |
|
|
|
* @param activityClass |
|
|
|
*/ |
|
|
|
private void startActivity(Class<?> activityClass){ |
|
|
|
private void startActivity(Class<?> activityClass) { |
|
|
|
Bundle bundle = new Bundle(); |
|
|
|
bundle.putString("id",FunHelper.isEmpty(orderData.getId()) ? "" : orderData.getId()); |
|
|
|
bundle.putString("orderId",FunHelper.isEmpty(orderData.getOrderId()) ? "" : orderData.getOrderId()); |
|
|
|
bundle.putString("vehiclePlate",FunHelper.isEmpty(orderData.getVehiclePlate()) ? "" : orderData.getVehiclePlate()); |
|
|
|
bundle.putString("vehiclePlateColor",FunHelper.isEmpty(orderData.getVehiclePlateColor()) ? "" : orderData.getVehiclePlateColor()); |
|
|
|
bundle.putString("amount",FunHelper.isEmpty(orderData.getAmount()) ? "0" : orderData.getAmount()); |
|
|
|
bundle.putString("orderStep",FunHelper.isEmpty(orderData.getOrderStep()) ? "" : orderData.getOrderStep()); |
|
|
|
bundle.putString("cardId",FunHelper.isEmpty(orderData.getCardId()) ? "" : orderData.getCardId()); |
|
|
|
bundle.putString("obuId",FunHelper.isEmpty(orderData.getObuId()) ? "" : orderData.getObuId()); |
|
|
|
bundle.putString("type",FunHelper.isEmpty(orderData.getTowing()) ? "" : orderData.getTowing()); |
|
|
|
bundle.putString("isValueCard",FunHelper.isEmpty(orderData.getIsValueCard()) ? "" : orderData.getIsValueCard()); |
|
|
|
bundle.putString("id", FunHelper.isEmpty(orderData.getId()) ? "" : orderData.getId()); |
|
|
|
bundle.putString("orderId", FunHelper.isEmpty(orderData.getOrderId()) ? "" : orderData.getOrderId()); |
|
|
|
bundle.putString("vehiclePlate", FunHelper.isEmpty(orderData.getVehiclePlate()) ? "" : orderData.getVehiclePlate()); |
|
|
|
bundle.putString("vehiclePlateColor", FunHelper.isEmpty(orderData.getVehiclePlateColor()) ? "" : orderData.getVehiclePlateColor()); |
|
|
|
bundle.putString("amount", FunHelper.isEmpty(orderData.getAmount()) ? "0" : orderData.getAmount()); |
|
|
|
bundle.putString("orderStep", FunHelper.isEmpty(orderData.getOrderStep()) ? "" : orderData.getOrderStep()); |
|
|
|
bundle.putString("cardId", FunHelper.isEmpty(orderData.getCardId()) ? "" : orderData.getCardId()); |
|
|
|
bundle.putString("obuId", FunHelper.isEmpty(orderData.getObuId()) ? "" : orderData.getObuId()); |
|
|
|
bundle.putString("type", FunHelper.isEmpty(orderData.getTowing()) ? "" : orderData.getTowing()); |
|
|
|
bundle.putString("isValueCard", FunHelper.isEmpty(orderData.getIsValueCard()) ? "" : orderData.getIsValueCard()); |
|
|
|
|
|
|
|
Intent intent = new Intent(); |
|
|
|
intent.setClass(context, activityClass); |