169 lines
7.4 KiB
Java
169 lines
7.4 KiB
Java
package com.arpa.hndahesudintocctmsdriver.request;
|
|
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
import android.util.Log;
|
|
|
|
import com.arpa.hndahesudintocctmsdriver.util.map.MapUtil;
|
|
import com.google.gson.Gson;
|
|
import com.arpa.hndahesudintocctmsdriver.request.bean.IDInputBean;
|
|
import com.arpa.hndahesudintocctmsdriver.request.bean.LicenseInputBean;
|
|
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 java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import okhttp3.Request;
|
|
|
|
/**
|
|
* @author hlh
|
|
* @version 1.0.0
|
|
* @date 2021/8/5 15:09
|
|
* @description:认证信息接口
|
|
*/
|
|
public class AuthRequest {
|
|
|
|
private String token;
|
|
private Gson gson = new Gson();
|
|
|
|
public String getToken(Context con) {
|
|
return SPUtil.getSP(con, LoginActivity.USER, LoginActivity.USER_TOKEN);
|
|
}
|
|
|
|
//获取身份证认证信息
|
|
public void getCard(Context con, Handler hd) {
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getIsauthIdcard(), ""), getToken(con), con);
|
|
RequestUtil.start(1, CertificatesActivity.ISAUTH, re, con, hd);
|
|
}
|
|
|
|
//获取驾驶证认证信息
|
|
public void getDriverAuthLicense(Context con, Handler hd) {
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getIsauthDriverauthLicense(), ""), getToken(con), con);
|
|
RequestUtil.start(1, CertificatesActivity.ISAUTH, re, con, hd);
|
|
}
|
|
|
|
//上传文件
|
|
public void upload(Context con, Handler hd, File file) {
|
|
Request re = OkHttpUtil.postFile(new OkDate(RequestConstant.getUPLOAD(), ""), getToken(con), file);
|
|
RequestUtil.start(12, "upload", re, con, hd);
|
|
}
|
|
|
|
//上传个人信息
|
|
//身份证认证{{url}}/app/driver/auth/driverAuthIdCard
|
|
public void driverAuthIdCard(Context con, Handler hd, IDInputBean ib) {
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getDRIVERAUTHIDCARD(), gson.toJson(ib)), getToken(con), con);
|
|
RequestUtil.start(1, "driverAuthIdCard", re, con, hd);
|
|
}
|
|
|
|
//驾驶证认证
|
|
public void driverAuthLicense(Context con, Handler hd, LicenseInputBean iib) {
|
|
Log.e("--认证信息--", gson.toJson(iib));
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getDRIVERAUTHLICENSE(), gson.toJson(iib)), getToken(con), con);
|
|
RequestUtil.start(1, "driverAuthLicense", re, con, hd);
|
|
}
|
|
|
|
//保存车辆信息-行驶证/app/carDriver/saveVehicleLicense
|
|
public void saveVehicleLicense(Context con, Handler hd, String data) {
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getSAVEVEHICLELICENSE(), data), getToken(con), con);
|
|
RequestUtil.start(1, "saveVehicleLicense", re, con, hd);
|
|
}
|
|
|
|
//上传头像
|
|
public void upHeadImg(Context con, Handler hd, String imgUrl) {
|
|
String mt = "{\"headportrait\": \"" + imgUrl + "\"}";
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getUploadHead(), mt), getToken(con), con);
|
|
RequestUtil.start(1, "upHeadImg", re, con, hd);
|
|
}
|
|
|
|
//上传车辆照片
|
|
public void saveCarImg(Context con, Handler hd, String carId, int imgId, int type) {
|
|
String mt = "{\n" +
|
|
"\t\"carId\": " + carId + ",\n" +
|
|
"\t\"imgId\": " + imgId + ",\n" +
|
|
"\t\"type\": " + type + "\n" +
|
|
"}";
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getSAVECARIMG(), mt), getToken(con), con);
|
|
RequestUtil.start(1, "saveCarImg", re, con, hd);
|
|
}
|
|
|
|
//从业资格证认证/app/driver/auth/driverAuthQualification
|
|
public void driverAuthQualification(Context con, Handler hd, String id, int imgid, String date) {
|
|
String mt = "{\n" +
|
|
"\t\"qualificationCertificate\": \"" + id + "\",\n" +
|
|
"\t\"qualificationCertificatePhoto\": " + imgid + ",\n" +
|
|
"\t\"qualificationCertificateValidity\": \"" + date + "\"\n" +
|
|
"}";
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getDriverAuthQualification(), mt), getToken(con), con);
|
|
RequestUtil.start(1, "driverAuthQualification", re, con, hd);
|
|
}
|
|
|
|
|
|
//从业资格证认证/app/driver/auth/driverAuthQualification
|
|
public void saveCarRegisterNo(Context con, Handler hd, String id, String registerNo) {
|
|
String mt = "{\n" +
|
|
"\t\"carId\": \"" + id + "\",\n" +
|
|
"\t\"registerNo\": " + registerNo + ",\n" +
|
|
"}";
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getDriverSaveCarRegisterNo(), mt), getToken(con), con);
|
|
RequestUtil.start(1, "saveCarRegisterNo", re, con, hd);
|
|
}
|
|
|
|
//道路运输许可证编号
|
|
public void saveCarRoadLicenseNo(Context con, Handler hd, String id, String registerNo) {
|
|
String mt = "{\n" +
|
|
"\t\"carId\": \"" + id + "\",\n" +
|
|
"\t\"roadLicense\": " + registerNo + ",\n" +
|
|
"}";
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getDriverSaveCarRoadLicenseNo(), mt), getToken(con), con);
|
|
RequestUtil.start(1, "saveCarRoadLicenseNo", re, con, hd);
|
|
}
|
|
|
|
//车辆交强保险
|
|
public void saveTrafficInsurance(Context con, Handler hd, String id, String insuranceEndDay, String insuranceCompany) {
|
|
String mt = "{\n" +
|
|
"\t\"carId\": \"" + id + "\",\n" +
|
|
"\t\"insuranceEndDay\": \"" + insuranceEndDay + "\",\n" +
|
|
"\t\"insuranceCompany\": \"" + insuranceCompany + "\",\n" +
|
|
"}";
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getTrafficInsurance(), mt), getToken(con), con);
|
|
RequestUtil.start(1, "saveTrafficInsurance", re, con, hd);
|
|
}
|
|
|
|
//获取资格证认证信息
|
|
public void isDriverAuthQualification(Context con, Handler hd) {
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getIsAuthDriverAuthQualification(), ""), getToken(con), con);
|
|
RequestUtil.start(1, "isAuthDriverAuthQualification", re, con, hd);
|
|
}
|
|
|
|
//添加挂车/app/carDriver/saveDrawCar
|
|
public void saveDrawCar(Context con, Handler hd, String map) {
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getSaveDrawCar(), map), getToken(con), con);
|
|
RequestUtil.start(1, "saveDrawCar", re, con, hd);
|
|
}
|
|
|
|
//获取实名认证的url
|
|
public void getAuthUrl(Context con, Handler hd) {
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getAuthUrl(), ""), getToken(con), con);
|
|
RequestUtil.start(1, "authUrl", re, con, hd);
|
|
}
|
|
//获取车牌颜色
|
|
public void getCarColor(Context con, Handler hd) {
|
|
// Map<String, Object> map = new HashMap<>();
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getCarColor(), ""), getToken(con), con);
|
|
RequestUtil.start(1, CertificatesActivity.CAR_COLOR, re, con, hd);
|
|
}
|
|
|
|
//获取燃油类型
|
|
public void getCarEnergyType(Context con, Handler hd) {
|
|
// Map<String, Object> map = new HashMap<>();
|
|
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getCarEnergyType(), ""), getToken(con), con);
|
|
RequestUtil.start(1, CertificatesActivity.CAR_ENERGY_TYPE, re, con, hd);
|
|
}
|
|
}
|