package com.arpa.hndahesudintocctmsdriver.request; import android.content.Context; import android.os.Handler; import com.arpa.hndahesudintocctmsdriver.BuildConfig; import com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity; import com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity; import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil; import com.arpa.hndahesudintocctmsdriver.util.http.OkDate; import com.arpa.hndahesudintocctmsdriver.util.http.OkHttpUtil; import com.arpa.hndahesudintocctmsdriver.util.http.RequestUtil; import java.io.File; import okhttp3.Request; public class OCRRequest { public String getToken(Context con) { return SPUtil.getSP(con, LoginActivity.USER, LoginActivity.USER_TOKEN); } //银行卡识别 public void ORCBank(Context con, Handler hd, File file) { Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getOrcBank()), getToken(con), file); RequestUtil.start(12, "OCR_BANK", re, con, hd); } //银行卡识别-中交 public void ORCBankZj(Context con, Handler hd, String imgUrl) { Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getOrcBank() + "?imgurl=" + imgUrl, ""), getToken(con), con); RequestUtil.start(1, "OCR_BANK", re, con, hd); } //从业资格证-中交 public void ORCQualificaZj(Context con, Handler hd, String imgUrl) { Request re = OkHttpUtil.posts(new OkDate(BuildConfig.BASE_URL+"sinoiov/ocr/getTransQualificationCertOCR" + "?imgurl=" + imgUrl, ""), getToken(con), con); RequestUtil.start(1, "ORCQualificaZj", re, con, hd); } //道路运输许可证-中交 public void ORCRoadLicZj(Context con, Handler hd, String imgUrl) { Request re = OkHttpUtil.posts(new OkDate(BuildConfig.BASE_URL+"sinoiov/ocr/getVehicleRoadLicenseOCR" + "?faceDataUrl=" + imgUrl, ""), getToken(con), con); RequestUtil.start(1, "ORCRoadLicZj", re, con, hd); } //身份证正面识别 public void OCRCard(Context con, Handler hd, File file) { Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getIdCardFront()), getToken(con), file); RequestUtil.start(12, CertificatesActivity.TYPE_NAME[0], re, con, hd); } //身份证背面识别 public void OCRCardBack(Context con, Handler hd, File file) { Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getIdCardBack()), getToken(con), file); RequestUtil.start(12, CertificatesActivity.TYPE_NAME_BANK[0], re, con, hd); } //身份证正面识别-中交 public void OCRZjCard(Context con, Handler hd, String imgUrl) { Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getIdCardFront() + "?faceDataUrl=" + imgUrl, ""), getToken(con), con); RequestUtil.start(1, CertificatesActivity.TYPE_NAME[0], re, con, hd); } //身份证背面识别-中交 public void OCRZjCardBack(Context con, Handler hd, String imgUrl) { Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getIdCardFront() + "?backDataUrl=" + imgUrl, ""), getToken(con), con); RequestUtil.start(1, CertificatesActivity.TYPE_NAME_BANK[0], re, con, hd); } //驾驶证正面识别 public void OCRDrivingLicense(Context con, Handler hd, File file) { Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getDrivingLicense()), getToken(con), file); RequestUtil.start(12, CertificatesActivity.TYPE_NAME[1], re, con, hd); } //驾驶证背面识别 public void OCRDrivingLicenseBack(Context con, Handler hd, File file) { Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getDrivingLicenseBack()), getToken(con), file); RequestUtil.start(12, CertificatesActivity.TYPE_NAME_BANK[1], re, con, hd); } //驾驶证正面识别-中交 public void OCRDrivingLicenseZj(Context con, Handler hd, String imgUrl){ Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getDrivingLicense()+"?faceDataUrl="+imgUrl,""),getToken(con),con); RequestUtil.start(1, CertificatesActivity.TYPE_NAME[1],re,con,hd); } //驾驶证背面识别-中交 public void OCRDrivingLicenseBackZj(Context con, Handler hd, String imgUrl){ Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getDrivingLicense()+"?backDataUrl="+imgUrl,""),getToken(con),con); RequestUtil.start(1, CertificatesActivity.TYPE_NAME_BANK[1],re,con,hd); } //行驶证正面识别 public void OCRVehicleLicense(Context con, Handler hd, File file) { Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getVehicleLicense()), getToken(con), file); RequestUtil.start(12, CertificatesActivity.TYPE_NAME[2], re, con, hd); } //行驶证背面识别 public void OCRVehicleLicenseBack(Context con, Handler hd, File file, String carId, String carNum, boolean isSave) { Request re = OkHttpUtil.postFiles(new OkDate(RequestConstant.getVehicleLicenseBack()), file, getToken(con), carId, carNum, isSave); RequestUtil.start(12, CertificatesActivity.TYPE_NAME_BANK[2], re, con, hd); } //行驶证正面识别-中交 public void OCRVehicleLicenseZj(Context con, Handler hd, String imgUrl) { Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getVehicleLicense() + "?faceDataUrl=" + imgUrl, ""), getToken(con), con); RequestUtil.start(1, CertificatesActivity.TYPE_NAME[2], re, con, hd); } //行驶证背面识别-中交 public void OCRVehicleLicenseBackZj(Context con, Handler hd, String imgUrl) { Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getVehicleLicense() + "?backDataUrl=" + imgUrl, ""), getToken(con), con); RequestUtil.start(1, CertificatesActivity.TYPE_NAME_BANK[2], re, con, hd); } public void OCRPlateLicense(Context con, Handler hd, File file) { Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getPlateLicense()), getToken(con), file); RequestUtil.start(12, "carName", re, con, hd); } public void OCRCarPlateLicense(Context con, Handler hd, File file) { Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getPlateLicense2()), getToken(con), file); RequestUtil.start(12, "carNum", re, con, hd); } }