| @@ -1,6 +1,8 @@ | |||
| package com.huntersun.vkyes.etcopencard.project.api; | |||
| import android.annotation.SuppressLint; | |||
| import android.content.Context; | |||
| import android.text.TextUtils; | |||
| import com.google.gson.Gson; | |||
| import com.huntersun.vkyes.etcopencard.project.api.bean.IFCode; | |||
| @@ -47,27 +49,47 @@ public class MyRetrofit { | |||
| // private final String BaseUrl = "http://192.168.100.63:8087/ifzt/api/"; | |||
| // private final String BaseUrl = "http://58.16.58.161:19002/ifzt/api/"; | |||
| private final String BaseUrl = "http://222.85.144.89:19002/ifzt/api/"; | |||
| private final String FileUrl = "http://222.85.144.89:19003/ifzt/api/"; | |||
| private final String appId = "admin001"; | |||
| private final String IFCODE = ""; | |||
| private final String bizContent = ""; | |||
| public static Map<String, String> parameter(String[] keyArr, String... vlaueArr) { | |||
| if (keyArr.length != vlaueArr.length){ | |||
| if (keyArr.length != vlaueArr.length) { | |||
| return null; | |||
| } | |||
| Map<String, String> params = new HashMap<>(); | |||
| for (int i = 0; i < keyArr.length; i++) { | |||
| String item = keyArr[i]; | |||
| params.put(item,vlaueArr[i]); | |||
| params.put(item, vlaueArr[i]); | |||
| } | |||
| return params; | |||
| } | |||
| public static void newInstance(String code, Object bean, ReturnResult result) { | |||
| newInstance(null, false, code, bean, result); | |||
| } | |||
| public static void newInstance(Context context, String code, Object bean, ReturnResult result) { | |||
| newInstance(context, false, code, bean, result); | |||
| } | |||
| public static void newInstance(Boolean start, String code, Object bean, ReturnResult result) { | |||
| newInstance(null, start, code, bean, result); | |||
| } | |||
| public static void newInstance(Context context, Boolean start, String code, Object bean, ReturnResult result) { | |||
| RequestParameters parameters = new RequestParameters(code, new Gson().toJson(bean)); | |||
| String loadHint = "加载中..."; | |||
| //通过IFCODE | |||
| if (context != null) { | |||
| loadHint = IFCode.LoadingMsgMap.get(code); | |||
| } | |||
| new MyRetrofit().getRetrofit().create(Api.class) | |||
| .message2(parameters) | |||
| .enqueue(new Converter<Result>(null, "加载中...") { | |||
| .enqueue(new Converter<Result>(context, start, loadHint) { | |||
| @Override | |||
| protected void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent) { | |||
| result.onSuccess(resultBean, bizContent); | |||
| @@ -81,6 +103,7 @@ public class MyRetrofit { | |||
| }); | |||
| } | |||
| //回调 | |||
| public interface ReturnResult { | |||
| void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent); | |||
| @@ -37,7 +37,7 @@ public class IFCode { | |||
| LoadingMsgMap.put(IFCode.IFCODE22, "提交个人用户信息中..."); | |||
| LoadingMsgMap.put(IFCode.IFCODE15, "OCR识别身份证中..."); | |||
| LoadingMsgMap.put(IFCode.IFCODE16, "OCR识别行驶证中..."); | |||
| LoadingMsgMap.put(IFCode.IFCODE17, "文件上传接口中..."); | |||
| LoadingMsgMap.put(IFCode.IFCODE17, "文件上传中..."); | |||
| LoadingMsgMap.put(IFCode.IFCODE18, "提交车辆信息中..."); | |||
| LoadingMsgMap.put(IFCode.IFCODE30, "获取所有的快递公司信息中..."); | |||
| LoadingMsgMap.put(IFCode.IFCODE31, "订单发货录入中..."); | |||
| @@ -6,37 +6,37 @@ import com.huntersun.vkyes.etcopencard.databinding.ActivityObuActivationHintBind | |||
| import com.huntersun.vkyes.etcopencard.src.app.AppActivity; | |||
| /** | |||
| * | |||
| * @ClassName: ObuActivationHintActivity | |||
| * @Description: obu温馨提示 | |||
| * @Author: lujin | |||
| * @CreateDate: 2023/3/15 10:54 | |||
| * @ClassName: ObuActivationHintActivity | |||
| * @Description: obu温馨提示 | |||
| * @Author: lujin | |||
| * @CreateDate: 2023/3/15 10:54 | |||
| */ | |||
| public class ObuActivationHintActivity extends AppActivity { | |||
| private ActivityObuActivationHintBinding binding; | |||
| @Override | |||
| protected View getLayoutView() { | |||
| binding = ActivityObuActivationHintBinding.inflate(getLayoutInflater()); | |||
| return binding.getRoot(); | |||
| } | |||
| @Override | |||
| protected void initView() { | |||
| setTitle("设备激活"); | |||
| binding.btnNext.setOnClickListener(this); | |||
| } | |||
| @Override | |||
| protected void initData() { | |||
| } | |||
| @Override | |||
| public void onClick(View view) { | |||
| if (view==binding.btnNext){ | |||
| startActivity(ObuActivationUploadActivity.class); | |||
| } | |||
| } | |||
| private ActivityObuActivationHintBinding binding; | |||
| @Override | |||
| protected View getLayoutView() { | |||
| binding = ActivityObuActivationHintBinding.inflate(getLayoutInflater()); | |||
| return binding.getRoot(); | |||
| } | |||
| @Override | |||
| protected void initView() { | |||
| setTitle("设备激活"); | |||
| binding.btnNext.setOnClickListener(this); | |||
| } | |||
| @Override | |||
| protected void initData() { | |||
| } | |||
| @Override | |||
| public void onClick(View view) { | |||
| if (view == binding.btnNext) { | |||
| startActivity(ObuActivationUploadActivity.class); | |||
| } | |||
| } | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.huntersun.vkyes.etcopencard.project.ui.activity.obu; | |||
| import android.view.View; | |||
| import com.google.gson.Gson; | |||
| import com.huntersun.vky.obublelib.box.BoxManagers; | |||
| import com.huntersun.vkyes.etcopencard.databinding.ActivityObuActivationUploadBinding; | |||
| import com.huntersun.vkyes.etcopencard.project.api.Api; | |||
| import com.huntersun.vkyes.etcopencard.project.api.Converter; | |||
| @@ -12,6 +13,8 @@ import com.huntersun.vkyes.etcopencard.project.api.Result; | |||
| import com.huntersun.vkyes.etcopencard.project.api.bean.IFCode; | |||
| import com.huntersun.vkyes.etcopencard.project.api.bean.ResultBean; | |||
| import com.huntersun.vkyes.etcopencard.project.api.bean.SendTheVerificationCodeBean; | |||
| import com.huntersun.vkyes.etcopencard.project.copapply.ObuActivateRequester; | |||
| import com.huntersun.vkyes.etcopencard.project.copapply.ObuActivation; | |||
| import com.huntersun.vkyes.etcopencard.project.tool.QRCode; | |||
| import com.huntersun.vkyes.etcopencard.src.app.AppActivity; | |||
| import com.huntersun.vkyes.etcopencard.src.ui.activity.ImageSelectActivity; | |||
| @@ -54,23 +57,38 @@ public class ObuActivationUploadActivity extends AppActivity { | |||
| @Override | |||
| public void onClick(View view) { | |||
| if (view == binding.btnNext) { | |||
| startActivity(ObuActivationBLESearchActivity.class); | |||
| // startActivity(ObuActivationBLESearchActivity.class); | |||
| bluetoothLink(new Currency() { | |||
| @Override | |||
| public void success() { | |||
| //设备激活 | |||
| new ObuActivation(BoxManagers.mDecryptVehicleApduBean, getContext()).start(bizContent -> { | |||
| //激活步骤 | |||
| new ObuActivateRequester().start(bizContent, getContext()); | |||
| }); | |||
| } | |||
| }); | |||
| } else if (view == binding.rcly || view == binding.rcly2 || view == binding.rcly3) { | |||
| ImageSelectActivity.start(this, new ImageSelectActivity.OnPhotoSelectListener() { | |||
| @Override | |||
| public void onSelected(List<String> data) { | |||
| SendTheVerificationCodeBean bean = new SendTheVerificationCodeBean(); | |||
| bean.setFileBase64(QRCode.imageToBase64(data.get(0))); | |||
| RequestParameters parameters = new RequestParameters(IFCode.IFCODE17, new Gson().toJson(bean)); | |||
| new MyRetrofit().getRetrofit().create(Api.class) | |||
| .message2(parameters) | |||
| .enqueue(new Converter<Result>(getActivity(), true, "加载中...") { | |||
| @Override | |||
| protected void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent) { | |||
| ResultBean.ProductInfo decVehInfo = | |||
| Gson().fromJson(String.valueOf(resultBean.getBizContent()), ResultBean.ProductInfo.class); | |||
| } | |||
| }); | |||
| /** | |||
| * 文件资源上传 | |||
| */ | |||
| MyRetrofit.newInstance(getActivity(), true, IFCode.IFCODE17, bean, new MyRetrofit.ReturnResult() { | |||
| @Override | |||
| public void onSuccess(ResultBean resultBean, ResultBean.BizContent bizContent) { | |||
| ResultBean.ProductInfo decVehInfo = | |||
| Gson().fromJson(String.valueOf(resultBean.getBizContent()), ResultBean.ProductInfo.class); | |||
| } | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| @@ -146,8 +146,9 @@ public class FragmentHomeTow extends TitleBarFragment<MainActivity> { | |||
| @SingleClick | |||
| public void onClick(View v) { | |||
| switch (item.message) { | |||
| case "卡签查询": | |||
| startActivity(CardSignQueryActivity.class); | |||
| case "卡签信息查询": | |||
| startActivity(InfoTabActivity.class); | |||
| // startActivity(CardSignQueryActivity.class); | |||
| break; | |||
| case "发货管理": | |||
| startActivity(ListDeliveryActivity.class); | |||