river-lucky-driver/app/src/main/java/com/arpa/hndahesudintocctmsdriver/request/OCRRequest.java

68 lines
3.2 KiB
Java

package com.arpa.hndahesudintocctmsdriver.request;
import android.content.Context;
import android.os.Handler;
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 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 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 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 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);
}
}