diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4bbbc96..f2feead 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -199,17 +199,32 @@ android:launchMode="singleTop" android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan|stateHidden" /> + + + > + /** + * + * 修改车辆信息 + * */ + @POST(BASE_URL + "driver/car/editCar") + fun editCar(@Body upDrivingInfoBean: UpDrivingInfoBean): Observable> + + + /** + * 根据挂车车牌号查询挂车信息 + * @param vehicleNum String + * @return Observable> + */ + @GET(BASE_URL + "driver/car/getTrailerByVehicleNum") + fun getTrailerByVehicleNum(@Query("vehicleNum") vehicleNum: String): Observable> + /** * * 新增挂车信息 @@ -323,6 +340,13 @@ interface Api { @POST(BASE_URL + "driver/car/addTrailer") fun addTrailer(@Body upDrivingInfoBean: UpDrivingInfoBean): Observable> + /** + * + * 修改挂车信息 + * */ + @POST(BASE_URL + "driver/car/editTrailer") + fun editTrailer(@Body upDrivingInfoBean: UpDrivingInfoBean): Observable> + /** * *邀请司机加入车队 @@ -400,6 +424,14 @@ interface Api { @GET(BASE_URL + "driver/captain/getCaptainById") fun getCaptainById(@Query("captainId") captainId: String): Observable> + /** + * 查询车辆证件完整度 + * @param captainId String + * @return Observable>> + */ + @GET(BASE_URL + "driver/car/getCarDocIntegrity") + fun getCarDocIntegrity(@Query("carId") carId: String): Observable> + /** * 查询运单评价信息列表 diff --git a/app/src/main/java/com/dahe/gldriver/ui/account/authperson/AuthTrailerActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/account/authperson/AuthTrailerActivity.kt index 19ea453..37fa59e 100644 --- a/app/src/main/java/com/dahe/gldriver/ui/account/authperson/AuthTrailerActivity.kt +++ b/app/src/main/java/com/dahe/gldriver/ui/account/authperson/AuthTrailerActivity.kt @@ -25,7 +25,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers * @ClassName AuthTrailerActivity * @Author john * @Date 2024/3/11 10:00 - * @Description TODO + * @Description 挂车认证 */ class AuthTrailerActivity : BaseActivity() { @@ -69,12 +69,12 @@ class AuthTrailerActivity : BaseActivity() { } } - tvEnd.setOnClickListener { - PickerUtils.getInstance().showDateSim(this@AuthTrailerActivity) { - tvEnd.text = it - upDrivingInfoBean.licenseValidity = it - } - } +// tvEnd.setOnClickListener { +// PickerUtils.getInstance().showDateSim(this@AuthTrailerActivity) { +// tvEnd.text = it +// upDrivingInfoBean.licenseValidity = it +// } +// } btnOk.setOnClickListener { subMint() @@ -129,14 +129,14 @@ class AuthTrailerActivity : BaseActivity() { result?.data?.back?.data?.let { if (it.inspectionRecord.length > 19) { //行驶证到期时间 - val changeDateNoneFormat = TimeUtil.changeDateNoneFormat( - it.inspectionRecord.substring(12, 19), - "yyyy年MM月" - ) - if (!changeDateNoneFormat.isNullOrEmpty()) { - upDrivingInfoBean.licenseValidity = changeDateNoneFormat - binding.tvEnd.text = changeDateNoneFormat - } +// val changeDateNoneFormat = TimeUtil.changeDateNoneFormat( +// it.inspectionRecord.substring(12, 19), +// "yyyy年MM月" +// ) +// if (!changeDateNoneFormat.isNullOrEmpty()) { +// upDrivingInfoBean.licenseValidity = changeDateNoneFormat +// binding.tvEnd.text = changeDateNoneFormat +// } } } } @@ -148,8 +148,7 @@ class AuthTrailerActivity : BaseActivity() { binding.etCarNum.text.isNullOrEmpty() || binding.tvCarColor.text.isNullOrEmpty() || upDrivingInfoBean.licenseFaceUrl.isNullOrEmpty() || - upDrivingInfoBean.licenseBackUrl.isNullOrEmpty() || - binding.tvEnd.text.isNullOrEmpty() + upDrivingInfoBean.licenseBackUrl.isNullOrEmpty() ) { showToast("请完善证件信息") return @@ -159,7 +158,6 @@ class AuthTrailerActivity : BaseActivity() { upDrivingInfoBean.run { vehicleNum = binding.etCarNum.text.trim().toString() vehicleType = binding.tvCarType.text.trim().toString()//车辆类型 - licenseValidity = binding.tvEnd.text.trim().toString() trailerPlateColor = binding.tvCarColor.text.trim().toString() carId = this@AuthTrailerActivity.carId } diff --git a/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditDrivingActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditDrivingActivity.kt new file mode 100644 index 0000000..598dd92 --- /dev/null +++ b/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditDrivingActivity.kt @@ -0,0 +1,317 @@ +package com.dahe.gldriver.ui.account.authperson + +import android.os.Bundle +import android.view.View +import com.dahe.gldriver.R +import com.dahe.gldriver.base.AppConfig +import com.dahe.gldriver.bean.DiCarColor +import com.dahe.gldriver.bean.UpDrivingInfoBean +import com.dahe.gldriver.databinding.ActivityAuthDrivingBinding +import com.dahe.gldriver.net.BaseObserver +import com.dahe.gldriver.net.DataManager +import com.dahe.gldriver.net.RxHttpCallBack +import com.dahe.gldriver.ui.account.AuthSuccActivity +import com.dahe.gldriver.utils.DicUtils +import com.dahe.gldriver.utils.OcrUtils +import com.dahe.mylibrary.base.BaseActivity +import com.dahe.mylibrary.net.CommonResponseBean +import com.dahe.mylibrary.utils.ActivityUtils +import com.dahe.mylibrary.utils.ImageLoader +import com.dahe.mylibrary.utils.PickerUtils +import com.dahe.mylibrary.utils.TimeUtil +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers +import io.reactivex.rxjava3.schedulers.Schedulers +import java.text.Bidi + +/** + * @ClassName AuthRoleActivity + * @Author 用户 + * @Date 2024/1/25 11:15 + * @Description 行驶证认证-编辑 + */ +class EditDrivingActivity : BaseActivity() { + + + var upDrivingInfoBean = UpDrivingInfoBean() + override fun initView(savedInstanceState: Bundle?) { + setStatusBarColor(R.color.white) + setTitleBar("实名认证", true) + binding.btnOk.setOnClickListener { + subMit() + } + binding.run { + btnOk.text = "确定" + ivFront.setOnClickListener { + selFrontPic() + } + + ivBack.setOnClickListener { + selBackPic() + } + ivRoadFront.setOnClickListener { + OcrUtils.getInstance() + .noOcrUpPic(mContext, this@EditDrivingActivity) { picPath, ocrResult -> + ImageLoader.getInstance() + .loadRoundImage(mContext, picPath.locPic, 12, ivRoadFront) + upDrivingInfoBean.roadLicensePhotoUrl = picPath.picPath + } + } + ivCar.setOnClickListener { + OcrUtils.getInstance() + .noOcrUpPic(mContext, this@EditDrivingActivity) { picPath, ocrResult -> + ImageLoader.getInstance() + .loadRoundImage(mContext, picPath.locPic, 12, ivCar) + upDrivingInfoBean.carUrl = picPath.picPath + } + } + + tvDate.setOnClickListener { + PickerUtils.getInstance().showDateSim(this@EditDrivingActivity) { + tvDate.text = it + } + } + //车辆类型 + tvCarType.setOnClickListener { + //车辆类型 + DicUtils.getInstance() + .selectDicCarType( + mContext, + this@EditDrivingActivity, + isLoading = true + ) { position, item -> + var data = item as DiCarColor + tvCarType.text = data.dictLabel + upDrivingInfoBean.run { + vehicleTypeCode = data.dictValue + vehicleType = data.dictLabel + } + } + } + tvEnd.setOnClickListener { + PickerUtils.getInstance().showDateSim(this@EditDrivingActivity) { + tvEnd.text = it + } + } + + + + tvCarColor.setOnClickListener { + DicUtils.getInstance() + .getCarColor(mContext, this@EditDrivingActivity) { position, item -> + var data = item as DiCarColor + tvCarColor.text = data.dictLabel + upDrivingInfoBean.run { + plateColorCode = data.dictValue + plateColor = data.dictLabel + } + } + } + } + } + + override fun initDate() { + var carId = intent.extras?.getString(AppConfig.CAR_ID).toString() + DataManager.getInstance().getCarByCarVehicleNum(carId) + .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) + .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { + override fun onSuccess(t: CommonResponseBean) { + super.onSuccess(t) + initViewByData(t.data) + } + })) + + } + + private fun initViewByData(data: UpDrivingInfoBean) { + upDrivingInfoBean = data + var isOnlyShow = + intent.extras?.getBoolean(AppConfig.IS_ONLY_SHOW, false) == true + if (isOnlyShow) { + binding.run { + llBtn.visibility = View.GONE + etCarNum.isEnabled = false + etID.isEnabled = false + tvCarType.isEnabled = false + etOwner.isEnabled = false + etUseNature.isEnabled = false + tvEnd.isEnabled = false + tvDate.isEnabled = false + tvCarColor.isEnabled = false + ivRoadFront.isEnabled = false + ivCar.isEnabled = false + ivFront.isEnabled = false + ivBack.isEnabled = false + } + } + binding.run { + ImageLoader.getInstance() + .loadRoundImage(mContext, data.licenseFaceUrl, 12, ivFront) + ImageLoader.getInstance() + .loadRoundImage(mContext, data.licenseBackUrl, 12, ivBack) + ImageLoader.getInstance() + .loadRoundImage(mContext, data.carUrl, 12, ivCar) + ImageLoader.getInstance() + .loadRoundImage(mContext, data.roadLicensePhotoUrl, 12, ivRoadFront) + + etCarNum.setText(data.vehicleNum) + tvCarType.text = data.vehicleType + + etOwner.setText(data.owner) + etUseNature.setText(data.useNature) + tvCarColor.text = data.plateColor + tvEnd.text = data.licenseValidity + + + etID.setText(data.roadLicense) + tvDate.text = data.roadLicenseValidity + } + + + } + + /** + * 行驶证正面 + */ + private fun selFrontPic() { + OcrUtils.getInstance().ocrDriveing(mContext, this) { picPath, result -> + ImageLoader.getInstance() + .loadRoundImage(mContext, picPath.locPic, 12, binding.ivFront) + upDrivingInfoBean.licenseFaceUrl = picPath.picPath//行驶证照片(正面) + result?.data?.face?.data?.let { + var isHasFow = it.vehicleType.contains("牵引车") + upDrivingInfoBean.isTrailer = if (isHasFow) "1" else "0"//是否有挂车(0否 1是) + + + //识别车辆类型后,调用接口匹配code值!!!??? + DicUtils.getInstance() + .getCarTypeByValue(mContext, it.vehicleType) { position, item -> + if (item != null) { + var data = item as DiCarColor + upDrivingInfoBean.run { + vehicleTypeCode = data.dictValue + vehicleType = data.dictLabel + } + binding.tvCarType.text = data.dictLabel + } + } + + binding.run { + etCarNum.setText(it.licensePlateNumber) + etOwner.setText(it.owner) + etUseNature.setText(it.useNature) + etCurbWeight.setText(it.curbWeight) + etPermittedWeight.setText(it.permittedWeight) + } + } + } + } + + private fun selBackPic() { + + OcrUtils.getInstance().ocrDriveing(mContext, this) { picPath, result -> + ImageLoader.getInstance() + .loadRoundImage(mContext, picPath.locPic, 12, binding.ivBack) + upDrivingInfoBean.licenseBackUrl = picPath.picPath//行驶证照片(反面) + + result?.data?.back?.data?.let { + if (it.inspectionRecord.length > 13) { + val changeDateNoneFormat = TimeUtil.changeDateNoneFormat( + it.inspectionRecord.substring(6, 14), + "yyyy年MM月" + ) + if (!changeDateNoneFormat.isNullOrEmpty()) { + upDrivingInfoBean.licenseValidity = changeDateNoneFormat//行驶证到期时间 + binding.tvEnd.text = changeDateNoneFormat + } + } + //车长 + val split = it.overallDimension.split("mm")[0].split("X") + if (split != null && split.size > 2) { + upDrivingInfoBean.run { + carLong = split[0] + carWidth = split[1] + carHeight = split[2] + } + } + upDrivingInfoBean.tractionWeight = it.tractionWeight + upDrivingInfoBean.energySignCode = it.energySign + binding.run { + etCurbWeight.setText(it.curbWeight)//整备质量 + etPermittedWeight.setText(it.permittedWeight)//核定载质量 + } + } + } + } + + private fun subMit() { + binding.run { + if (etCarNum.text.isNullOrEmpty() || + tvCarType.text.isNullOrEmpty() || + tvEnd.text.isNullOrEmpty() || + tvCarColor.text.isNullOrEmpty() + ) { + showToast("请完善车辆信息") + return@subMit + } + } + + upDrivingInfoBean.run { + roadLicenseValidity = binding.tvDate.text.toString()//道路有效期 + licenseValidity = binding.tvEnd.text.toString()//行驶证有效期 + roadLicense = binding.etID.text.toString()//道路运输许可证号 + vehicleNum = binding.etCarNum.text.trim().toString() + vehicleType = binding.tvCarType.text.trim().toString() + plateColor = binding.tvCarColor.text.trim().toString() + } + + DataManager.getInstance().editCar(upDrivingInfoBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { + override fun onSuccess(t: CommonResponseBean) { + super.onSuccess(t) + showToast("修改成功") + setResult(RESULT_OK) + finish() + } + })) + } + + + /** + * 根据车牌号查询车辆信任 + * @param carNum String + */ + private fun getCarInfoByCarNum(carNum: String) { + DataManager.getInstance().getCarByCarVehicleNum(carNum) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { + override fun onSuccess(t: CommonResponseBean) { + super.onSuccess(t) + t.data.let { + binding.run { + ImageLoader.getInstance() + .loadRoundImage(mContext, it.licenseFaceUrl, 12, ivFront) + ImageLoader.getInstance() + .loadRoundImage(mContext, it.licenseBackUrl, 12, ivBack) + ImageLoader.getInstance() + .loadRoundImage(mContext, it.carUrl, 12, ivCar) + ImageLoader.getInstance() + .loadRoundImage(mContext, it.roadLicensePhotoUrl, 12, ivRoadFront) + + etCarNum.setText(it.vehicleNum) + etOwner.setText(it.owner) + tvCarType.text = it.vehicleType + etUseNature.setText(it.useNature) + etID.setText(it.roadLicense) + tvDate.text = it.roadLicenseValidity + } + } + + } + })) + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditRoadActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditRoadActivity.kt new file mode 100644 index 0000000..04a7601 --- /dev/null +++ b/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditRoadActivity.kt @@ -0,0 +1,123 @@ +package com.dahe.gldriver.ui.account.authperson + +import android.os.Bundle +import android.view.View +import com.dahe.gldriver.R +import com.dahe.gldriver.base.AppConfig +import com.dahe.gldriver.bean.UpDrivingInfoBean +import com.dahe.gldriver.bean.UpQualiInfoBean +import com.dahe.gldriver.bean.UpRoadInfoBean +import com.dahe.gldriver.databinding.ActivityAuthRoadBinding +import com.dahe.gldriver.net.BaseObserver +import com.dahe.gldriver.net.DataManager +import com.dahe.gldriver.net.RxHttpCallBack +import com.dahe.gldriver.oss.OssServiceUtil +import com.dahe.gldriver.ui.account.AuthSuccActivity +import com.dahe.gldriver.ui.account.SelectRoleActivity +import com.dahe.gldriver.utils.OcrUtils +import com.dahe.mylibrary.base.BaseActivity +import com.dahe.mylibrary.net.CommonResponseBean +import com.dahe.mylibrary.utils.ActivityUtils +import com.dahe.mylibrary.utils.ImageLoader +import com.dahe.mylibrary.utils.PickerUtils +import com.dahe.mylibrary.utils.PopsUtils +import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener +import com.mobile.auth.gatewayauth.model.popsdkconfig.UploadData +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers +import io.reactivex.rxjava3.schedulers.Schedulers + +/** + * @ClassName AuthRoadActivity + * @Author john + * @Date 2024/1/25 16:02 + * @Description 道路运输许可证认证-编辑 + */ +class EditRoadActivity : BaseActivity() { + + var upRoad = UpDrivingInfoBean() + + override fun initView(savedInstanceState: Bundle?) { + setStatusBarColor(R.color.white) + setTitleBar("实名认证", true) + binding.run { + btnOk.text = "确定" + btnOk.setOnClickListener { + subMit() + } + + tvDate.setOnClickListener { + PickerUtils.getInstance().showDateSim(this@EditRoadActivity) { + upRoad.roadLicenseValidity = it + binding.tvDate.text = it + } + } + ivFront.setOnClickListener { + OcrUtils.getInstance() + .noOcrUpPic(mContext, this@EditRoadActivity) { picPath, ocrResult -> + ImageLoader.getInstance() + .loadRoundImage(mContext, picPath.locPic, 12, ivFront) + upRoad.roadLicensePhotoUrl = picPath.picPath + } + } + } + } + + override fun initDate() { + var carId = intent.extras?.getString(AppConfig.CAR_ID).toString() + DataManager.getInstance().getCarByCarVehicleNum(carId) + .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) + .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { + override fun onSuccess(t: CommonResponseBean) { + super.onSuccess(t) + initViewByData(t.data) + } + })) + } + + private fun initViewByData(data: UpDrivingInfoBean) { + upRoad = data + var isOnlyShow = + intent.extras?.getBoolean(AppConfig.IS_ONLY_SHOW, false) == true + if (isOnlyShow) { + binding.run { + llBtn.visibility = View.GONE + etID.isEnabled = false + tvDate.isEnabled = false + ivFront.isEnabled = false + } + } + binding.run { + ImageLoader.getInstance() + .loadRoundImage(mContext, data.licenseFaceUrl, 12, ivFront) + + etID.setText(data.roadLicense) + tvDate.text = data.roadLicenseValidity + } + + + } + + private fun subMit() { + upRoad.run { + roadLicense = binding.etID.text.trim().toString() + roadLicenseValidity = binding.tvDate.text.toString() + + if (upRoad.roadLicense.isNullOrEmpty() || upRoad.roadLicenseValidity.isNullOrEmpty() || upRoad.roadLicensePhotoUrl.isNullOrEmpty()) { + showToast("请完善信息") + return + } + + DataManager.getInstance().editCar(upRoad) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { + override fun onSuccess(t: CommonResponseBean) { + super.onSuccess(t) + showToast("修改成功") + setResult(RESULT_OK) + finish() + } + })) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditTrailerActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditTrailerActivity.kt new file mode 100644 index 0000000..4ad1052 --- /dev/null +++ b/app/src/main/java/com/dahe/gldriver/ui/account/authperson/EditTrailerActivity.kt @@ -0,0 +1,226 @@ +package com.dahe.gldriver.ui.account.authperson + +import android.os.Bundle +import android.view.View +import com.dahe.gldriver.R +import com.dahe.gldriver.base.AppConfig +import com.dahe.gldriver.bean.DiCarColor +import com.dahe.gldriver.bean.UpDrivingInfoBean +import com.dahe.gldriver.databinding.ActivityAuthTrailerBinding +import com.dahe.gldriver.net.BaseObserver +import com.dahe.gldriver.net.DataManager +import com.dahe.gldriver.net.RxHttpCallBack +import com.dahe.gldriver.ui.account.AuthSuccActivity +import com.dahe.gldriver.utils.DicUtils +import com.dahe.gldriver.utils.OcrUtils +import com.dahe.mylibrary.base.BaseActivity +import com.dahe.mylibrary.net.CommonResponseBean +import com.dahe.mylibrary.utils.ActivityUtils +import com.dahe.mylibrary.utils.ImageLoader +import com.dahe.mylibrary.utils.PickerUtils +import com.dahe.mylibrary.utils.TimeUtil +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers +import io.reactivex.rxjava3.schedulers.Schedulers + +/** + * @ClassName AuthTrailerActivity + * @Author john + * @Date 2024/3/25 10:00 + * @Description 挂车认证-编辑 + */ +class EditTrailerActivity : BaseActivity() { + + var carId: String = "" + var upDrivingInfoBean = UpDrivingInfoBean() + override fun initView(savedInstanceState: Bundle?) { + setStatusBarColor(R.color.white) + setTitleBar("实名认证", true) + carId = intent.extras?.getString(AppConfig.CAR_ID, "").toString() + + binding.run { + btnOk.text = "确定" + ivFront.setOnClickListener { + selFrontPic() + } + + ivBack.setOnClickListener { + selBackPic() + } + tvCarType.setOnClickListener { + //车辆类型 + DicUtils.getInstance() + .selectDicCarType( + mContext, + this@EditTrailerActivity, + "重型自卸半挂车", + true + ) { position, item -> + var data = item as DiCarColor + tvCarType.text = data.dictLabel + upDrivingInfoBean.run { + vehicleTypeCode = data.dictValue + vehicleType = data.dictLabel + } + } + } + + tvCarColor.setOnClickListener { + DicUtils.getInstance() + .getCarColor(mContext, this@EditTrailerActivity, true) { position, item -> + var data = item as DiCarColor + tvCarColor.text = data.dictLabel + upDrivingInfoBean.run { + trailerPlateColorCode = data.dictValue + trailerPlateColor = data.dictLabel + } + } + } + +// tvEnd.setOnClickListener { +// PickerUtils.getInstance().showDateSim(this@EditTrailerActivity) { +// tvEnd.text = it +// upDrivingInfoBean.licenseValidity = it +// } +// } + + btnOk.setOnClickListener { + subMint() + } + + } + } + + override fun initDate() { + var carId = intent.extras?.getString(AppConfig.CAR_ID).toString() + DataManager.getInstance().getTrailerByVehicleNum(carId) + .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) + .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { + override fun onSuccess(t: CommonResponseBean) { + super.onSuccess(t) + initViewByData(t.data) + } + })) + } + + private fun initViewByData(data: UpDrivingInfoBean) { + upDrivingInfoBean = data + var isOnlyShow = + intent.extras?.getBoolean(AppConfig.IS_ONLY_SHOW, false) == true + if (isOnlyShow) { + binding.run { + llBtn.visibility = View.GONE + etCarNum.isEnabled = false + tvCarType.isEnabled = false + etUseNature.isEnabled = false + tvEnd.isEnabled = false + tvCarColor.isEnabled = false + ivFront.isEnabled = false + ivBack.isEnabled = false + } + } + binding.run { + ImageLoader.getInstance() + .loadRoundImage(mContext, data.licenseFaceUrl, 12, ivFront) + ImageLoader.getInstance() + .loadRoundImage(mContext, data.licenseBackUrl, 12, ivBack) + ImageLoader.getInstance() + + etCarNum.setText(data.vehicleNum) + tvCarType.text = data.vehicleType + + etUseNature.setText(data.useNature) + tvCarColor.text = data.trailerPlateColor +// tvEnd.text = data.licenseValidity + + } + + + } + + /** + * 行驶证正面 + */ + private fun selFrontPic() { + OcrUtils.getInstance().ocrDriveing(mContext, this) { picPath, result -> + ImageLoader.getInstance() + .loadRoundImage(mContext, picPath.locPic, 12, binding.ivFront) + upDrivingInfoBean.licenseFaceUrl = picPath.picPath//行驶证照片(正面) + + result?.data?.face?.data?.let { + + //识别车辆类型后,调用接口匹配code值!!!??? + DicUtils.getInstance() + .getCarTypeByValue(mContext, it.vehicleType) { position, item -> + if (item != null) { + var data = item as DiCarColor + upDrivingInfoBean.run { + vehicleTypeCode = data.dictValue + vehicleType = data.dictLabel + } + binding.tvCarType.text = data.dictLabel + } + } + + binding.run { + etCarNum.setText(it.licensePlateNumber) + etUseNature.setText(it.useNature) + } + } + } + } + + private fun selBackPic() { + + OcrUtils.getInstance().ocrDriveing(mContext, this) { picPath, result -> + ImageLoader.getInstance() + .loadRoundImage(mContext, picPath.locPic, 12, binding.ivBack) + upDrivingInfoBean.licenseBackUrl = picPath.picPath//行驶证照片(反面) + + result?.data?.back?.data?.let { + if (it.inspectionRecord.length > 19) { + //行驶证到期时间 +// val changeDateNoneFormat = TimeUtil.changeDateNoneFormat( +// it.inspectionRecord.substring(12, 19), +// "yyyy年MM月" +// ) +// if (!changeDateNoneFormat.isNullOrEmpty()) { +// upDrivingInfoBean.licenseValidity = changeDateNoneFormat +// binding.tvEnd.text = changeDateNoneFormat +// } + } + } + } + } + + + private fun subMint() { + if (binding.tvCarType.text.isNullOrEmpty() || + binding.etCarNum.text.isNullOrEmpty() || + binding.tvCarColor.text.isNullOrEmpty() || + upDrivingInfoBean.licenseFaceUrl.isNullOrEmpty() || + upDrivingInfoBean.licenseBackUrl.isNullOrEmpty() + ) { + showToast("请完善证件信息") + return + } + + + upDrivingInfoBean.run { + vehicleNum = binding.etCarNum.text.trim().toString() + vehicleType = binding.tvCarType.text.trim().toString()//车辆类型 + trailerPlateColor = binding.tvCarColor.text.trim().toString() + } + + DataManager.getInstance().editTrailer(upDrivingInfoBean) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { + override fun onSuccess(t: CommonResponseBean) { + super.onSuccess(t) + showToast("修改成功") + setResult(RESULT_OK) + finish() + } + })) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/dahe/gldriver/ui/mine/activity/CarDetailActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/mine/activity/CarDetailActivity.kt index be1a577..b61a6b7 100644 --- a/app/src/main/java/com/dahe/gldriver/ui/mine/activity/CarDetailActivity.kt +++ b/app/src/main/java/com/dahe/gldriver/ui/mine/activity/CarDetailActivity.kt @@ -1,16 +1,26 @@ package com.dahe.gldriver.ui.mine.activity +import android.content.Intent import android.os.Bundle import android.view.View +import com.dahe.gldriver.base.AppConfig +import com.dahe.gldriver.bean.CarDetail import com.dahe.gldriver.databinding.ActivityCarDetailBinding import com.dahe.gldriver.databinding.ActivityDriverTeamDetailBinding import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.RxHttpCallBack +import com.dahe.gldriver.ui.account.authperson.EditDriverActivity +import com.dahe.gldriver.ui.account.authperson.EditDrivingActivity +import com.dahe.gldriver.ui.account.authperson.EditPersonActivity +import com.dahe.gldriver.ui.account.authperson.EditQualificationActivity +import com.dahe.gldriver.ui.account.authperson.EditRoadActivity +import com.dahe.gldriver.ui.account.authperson.EditTrailerActivity import com.dahe.gldriver.utils.SPUtils import com.dahe.glex.bean.UserDetail import com.dahe.mylibrary.base.BaseActivity import com.dahe.mylibrary.net.CommonResponseBean +import com.dahe.mylibrary.utils.ActivityUtils import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.schedulers.Schedulers @@ -18,53 +28,132 @@ import io.reactivex.rxjava3.schedulers.Schedulers * @ClassName CarDetailActivity * @Author john * @Date 2024/3/21 11:24 - * @Description TODO + * @Description 车辆详情 */ -class CarDetailActivity : BaseActivity() { +class CarDetailActivity : BaseActivity(), View.OnClickListener { - var doneInfoCount = 0 + + lateinit var CarDetail: CarDetail override fun initView(savedInstanceState: Bundle?) { setStatusHeightParams(binding.rlTop) setTitleBar("车辆详情", true) + binding.run { + circleBarView2.run { + text = "完成度" + unitText = "%" + progress = 0 + } + + btnId.setOnClickListener(this@CarDetailActivity) + llAgainId.setOnClickListener(this@CarDetailActivity) + llSeeId.setOnClickListener(this@CarDetailActivity) + + btnDriver.setOnClickListener(this@CarDetailActivity) + llAgainDriver.setOnClickListener(this@CarDetailActivity) + llSeeDriver.setOnClickListener(this@CarDetailActivity) + + + btnQua.setOnClickListener(this@CarDetailActivity) + llAgainQua.setOnClickListener(this@CarDetailActivity) + llSeeQua.setOnClickListener(this@CarDetailActivity) + } + } + + override fun onClick(view: View?) { + super.onClick(view) + if (!::CarDetail.isInitialized) { + showToast("车辆信息未查到") + return + } + + binding.run { + when (view?.id) { + btnId.id, llAgainId.id -> ActivityUtils.startActivityForResult( + this@CarDetailActivity, + EditDrivingActivity::class.java, Bundle().apply { + putString(AppConfig.CAR_ID, CarDetail.vehicleNum) + }, 1 + ) + + llSeeId.id -> ActivityUtils.startActivity( + mContext, + EditDrivingActivity::class.java, + Bundle().apply { + putBoolean(AppConfig.IS_ONLY_SHOW, true) + putString(AppConfig.CAR_ID, CarDetail.vehicleNum) + }) + + btnDriver.id, llAgainDriver.id -> ActivityUtils.startActivityForResult( + this@CarDetailActivity, + EditTrailerActivity::class.java, Bundle().apply { + putString(AppConfig.CAR_ID, CarDetail.trailerVehicleNum) + }, 1 + ) + + llSeeDriver.id -> ActivityUtils.startActivity( + mContext, + EditTrailerActivity::class.java, + Bundle().apply { + putBoolean(AppConfig.IS_ONLY_SHOW, true) + putString(AppConfig.CAR_ID, CarDetail.trailerVehicleNum) + }) + + btnQua.id, llAgainQua.id -> ActivityUtils.startActivityForResult( + this@CarDetailActivity, + EditRoadActivity::class.java, Bundle().apply { + putString(AppConfig.CAR_ID, CarDetail.vehicleNum) + }, 1 + ) + + llSeeQua.id -> ActivityUtils.startActivity( + mContext, + EditRoadActivity::class.java, + Bundle().apply { + putBoolean(AppConfig.IS_ONLY_SHOW, true) + putString(AppConfig.CAR_ID, CarDetail.vehicleNum) + }) + } + } } override fun initDate() { - DataManager.getInstance().getUserDetail() + var carId = intent.extras?.getString(AppConfig.CAR_ID).toString() + DataManager.getInstance().getCarDocIntegrity(carId) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) - .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { - override fun onSuccess(t: CommonResponseBean) { + .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { + override fun onSuccess(t: CommonResponseBean) { super.onSuccess(t) initViewByData(t.data) } })) } - private fun initViewByData(data: UserDetail) { -// userDetail = data + private fun initViewByData(data: CarDetail) { + var doneInfoCount = 0 + CarDetail = data binding.run { - val userInfo = SPUtils.instance.getUserInfo(mContext) var missInfo = "" - if (data.idcardNo.isNullOrEmpty()) { + if (data.vehicleNum.isNullOrEmpty()) { tvInfo.text = "证件缺失将无法进行接单" missInfo.plus("行驶证、") } else { doneInfoCount++ - tvInfo.text = """${data.idcardName} ${data.idcardNo}""" + tvInfo.text = """${data.vehicleNum} ${data.vehicleType}""" } - if (data.licenseNo.isNullOrEmpty()) { + if (data.trailerVehicleNum.isNullOrEmpty()) { tvDriverInfo.text = "证件缺失将无法进行接单" missInfo.plus("挂车行驶证、") } else { doneInfoCount++ - tvDriverInfo.text = """${data.licenseName} ${data.licenseNo}""" + tvDriverInfo.text = """${data.trailerVehicleNum} ${data.trailerVehicleType}""" } - if (data.qualificationCertificateNo.isNullOrEmpty()) { + if (data.roadLicense.isNullOrEmpty()) { tvQualiInfo.text = "证件缺失将无法进行接单" missInfo.plus("道路运输许可证、") } else { doneInfoCount++ - tvQualiInfo.text = """${data.qualificationCertificateNo}""" + tvQualiInfo.text = """${data.roadLicense}""" } @@ -72,18 +161,27 @@ class CarDetailActivity : BaseActivity() { tvContent.text = if (missInfo.isNullOrEmpty()) "认证成功,请接单把!!!" else missInfo - llId.visibility = if (data.idcardNo.isNullOrEmpty()) View.GONE else View.VISIBLE - btnId.visibility = if (data.idcardNo.isNullOrEmpty()) View.VISIBLE else View.GONE + llId.visibility = if (data.vehicleNum.isNullOrEmpty()) View.GONE else View.VISIBLE + btnId.visibility = if (data.vehicleNum.isNullOrEmpty()) View.VISIBLE else View.GONE - llDriver.visibility = if (data.licenseNo.isNullOrEmpty()) View.GONE else View.VISIBLE - btnDriver.visibility = if (data.licenseNo.isNullOrEmpty()) View.VISIBLE else View.GONE + llDriver.visibility = + if (data.trailerVehicleNum.isNullOrEmpty()) View.GONE else View.VISIBLE + btnDriver.visibility = + if (data.trailerVehicleNum.isNullOrEmpty()) View.VISIBLE else View.GONE llQua.visibility = - if (data.qualificationCertificateNo.isNullOrEmpty()) View.GONE else View.VISIBLE + if (data.roadLicense.isNullOrEmpty()) View.GONE else View.VISIBLE btnQua.visibility = - if (data.qualificationCertificateNo.isNullOrEmpty()) View.VISIBLE else View.GONE + if (data.roadLicense.isNullOrEmpty()) View.VISIBLE else View.GONE circleBarView2.progress = doneInfoCount * 100 / 3 } } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + if (resultCode == RESULT_OK && requestCode == 1) { + initDate() + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/dahe/gldriver/ui/mine/activity/CarsManActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/mine/activity/CarsManActivity.kt index bdc5c2f..c21da84 100644 --- a/app/src/main/java/com/dahe/gldriver/ui/mine/activity/CarsManActivity.kt +++ b/app/src/main/java/com/dahe/gldriver/ui/mine/activity/CarsManActivity.kt @@ -7,6 +7,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.dahe.gldriver.R import com.dahe.gldriver.adapter.CarsAdapter +import com.dahe.gldriver.base.AppConfig import com.dahe.gldriver.bean.CarBean import com.dahe.gldriver.databinding.ActivityCarsManBinding import com.dahe.gldriver.net.BaseObserver @@ -50,8 +51,12 @@ class CarsManActivity : BaseActivity() { adapter as CarsAdapter }.apply { isStateViewEnable = true - setOnItemClickListener{_,_,position-> - ActivityUtils.startActivity(mContext,CarDetailActivity::class.java) + setOnItemClickListener { _, _, position -> + + ActivityUtils.startActivity( + mContext, + CarDetailActivity::class.java, + Bundle().apply { putString(AppConfig.CAR_ID, items[position].carId) }) } addOnItemChildClickListener(R.id.tvUnbind) { adapter, view, position -> CommonPopUtils.getInstance() diff --git a/app/src/main/java/com/dahe/gldriver/ui/mine/activity/PersonInfoActivity.kt b/app/src/main/java/com/dahe/gldriver/ui/mine/activity/PersonInfoActivity.kt index d5225c9..e2e659e 100644 --- a/app/src/main/java/com/dahe/gldriver/ui/mine/activity/PersonInfoActivity.kt +++ b/app/src/main/java/com/dahe/gldriver/ui/mine/activity/PersonInfoActivity.kt @@ -33,7 +33,6 @@ import io.reactivex.rxjava3.schedulers.Schedulers */ class PersonInfoActivity : BaseActivity(), View.OnClickListener { var doneInfoCount = 0 - var userDetail: UserDetail? = null override fun initView(savedInstanceState: Bundle?) { setStatusHeightParams(binding.rlTop) setTitleBar("实名认证", true) @@ -121,7 +120,6 @@ class PersonInfoActivity : BaseActivity(), View.OnCli private fun initViewByData(data: UserDetail) { doneInfoCount = 0 - userDetail = data binding.run { var missInfo = "" diff --git a/app/src/main/res/layout/activity_auth_driving.xml b/app/src/main/res/layout/activity_auth_driving.xml index f1aa920..1608f01 100644 --- a/app/src/main/res/layout/activity_auth_driving.xml +++ b/app/src/main/res/layout/activity_auth_driving.xml @@ -520,6 +520,7 @@