车辆类型接口替换

This commit is contained in:
lijia 2024-04-26 11:13:54 +08:00
parent fe4b14176e
commit 6054bc3159
6 changed files with 95 additions and 33 deletions

View File

@ -72,6 +72,19 @@ interface Api {
): Observable<CommonResponseBean<MutableList<DiCarColor>>> ): Observable<CommonResponseBean<MutableList<DiCarColor>>>
/**
* 查询车辆类型字典
* @param name String
* @param groupType String 0=车头1=挂车
* @return Observable<CommonResponseBean<MutableList<DiCarColor>>>
*/
@GET(BASE_URL + "driver/common/dict/selectCarTypeVoAll")
fun selectCarTypeVoAll(
@Query("name") name: String,
@Query("groupType") groupType: String
): Observable<CommonResponseBean<MutableList<DiCarColor>>>
/** /**
* 获取验证码 * 获取验证码
* */ * */

View File

@ -157,7 +157,7 @@ class AuthDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
//识别车辆类型后调用接口匹配code值 //识别车辆类型后调用接口匹配code值
DicUtils.getInstance() DicUtils.getInstance()
.getCarTypeByValue(mContext, it.vehicleType) { position, item -> .getCarTypeByValue(mContext, it.vehicleType,"0") { position, item ->
if (item != null) { if (item != null) {
var data = item as DiCarColor var data = item as DiCarColor
upDrivingInfoBean.run { upDrivingInfoBean.run {

View File

@ -54,7 +54,8 @@ class AuthTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
mContext, mContext,
this@AuthTrailerActivity, this@AuthTrailerActivity,
"重型自卸半挂车", "重型自卸半挂车",
true true,
"1"
) { position, item -> ) { position, item ->
var data = item as DiCarColor var data = item as DiCarColor
tvCarType.text = data.dictLabel tvCarType.text = data.dictLabel
@ -123,7 +124,7 @@ class AuthTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
//识别车辆类型后调用接口匹配code值 //识别车辆类型后调用接口匹配code值
DicUtils.getInstance() DicUtils.getInstance()
.getCarTypeByValue(mContext, it.vehicleType) { position, item -> .getCarTypeByValue(mContext, it.vehicleType,"1") { position, item ->
if (item != null) { if (item != null) {
var data = item as DiCarColor var data = item as DiCarColor
upDrivingInfoBean.run { upDrivingInfoBean.run {

View File

@ -210,7 +210,7 @@ class EditDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
//识别车辆类型后调用接口匹配code值 //识别车辆类型后调用接口匹配code值
DicUtils.getInstance() DicUtils.getInstance()
.getCarTypeByValue(mContext, it.vehicleType) { position, item -> .getCarTypeByValue(mContext, it.vehicleType,"0") { position, item ->
if (item != null) { if (item != null) {
var data = item as DiCarColor var data = item as DiCarColor
upDrivingInfoBean.run { upDrivingInfoBean.run {

View File

@ -56,7 +56,8 @@ class EditTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
mContext, mContext,
this@EditTrailerActivity, this@EditTrailerActivity,
"重型自卸半挂车", "重型自卸半挂车",
true true,
"1"
) { _, item -> ) { _, item ->
var data = item as DiCarColor var data = item as DiCarColor
tvCarType.text = data.dictLabel tvCarType.text = data.dictLabel
@ -171,7 +172,7 @@ class EditTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
//识别车辆类型后调用接口匹配code值 //识别车辆类型后调用接口匹配code值
DicUtils.getInstance() DicUtils.getInstance()
.getCarTypeByValue(mContext, it.vehicleType) { position, item -> .getCarTypeByValue(mContext, it.vehicleType,"1") { position, item ->
if (item != null) { if (item != null) {
var data = item as DiCarColor var data = item as DiCarColor
upDrivingInfoBean.run { upDrivingInfoBean.run {

View File

@ -34,14 +34,18 @@ class DicUtils private constructor() {
activity: AppCompatActivity, activity: AppCompatActivity,
defaultCont: String = "重型半挂牵引车", defaultCont: String = "重型半挂牵引车",
isLoading: Boolean = false, isLoading: Boolean = false,
groupType: String = "0",
listener: OnOptionPickedListener listener: OnOptionPickedListener
) { ) {
//车辆类型 //车辆类型
DataManager.getInstance().getSysDictDataList("vehicle_type") DataManager.getInstance().selectCarTypeVoAll("",groupType)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
BaseObserver(context, object : RxHttpCallBack<MutableList<DiCarColor>>(if (isLoading) activity else null) { BaseObserver(
context,
object :
RxHttpCallBack<MutableList<DiCarColor>>(if (isLoading) activity else null) {
override fun onSuccess(t: CommonResponseBean<MutableList<DiCarColor>>) { override fun onSuccess(t: CommonResponseBean<MutableList<DiCarColor>>) {
super.onSuccess(t) super.onSuccess(t)
PickerUtils.getInstance() PickerUtils.getInstance()
@ -54,6 +58,29 @@ class DicUtils private constructor() {
} }
}) })
) )
// //车辆类型
// DataManager.getInstance().getSysDictDataList("vehicle_type")
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// BaseObserver(
// context,
// object :
// RxHttpCallBack<MutableList<DiCarColor>>(if (isLoading) activity else null) {
// override fun onSuccess(t: CommonResponseBean<MutableList<DiCarColor>>) {
// super.onSuccess(t)
// PickerUtils.getInstance()
// .showSelectCarColor(
// activity,
// "车辆类型",
// "重型半挂牵引车",
// t.data, listener
// )
// }
// })
// )
} }
/** /**
@ -65,10 +92,13 @@ class DicUtils private constructor() {
fun getCarTypeByValue( fun getCarTypeByValue(
context: Context, context: Context,
value: String, value: String,
groupType: String = "0",
listener: OnOptionPickedListener listener: OnOptionPickedListener
) { ) {
if (value.isNullOrEmpty())
return
//车辆类型 //车辆类型
DataManager.getInstance().getSysDictDataList("vehicle_type") DataManager.getInstance().selectCarTypeVoAll(value, groupType)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
@ -80,6 +110,20 @@ class DicUtils private constructor() {
} }
}) })
) )
//车辆类型
// DataManager.getInstance().getSysDictDataList("vehicle_type")
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// BaseObserver(context, object : RxHttpCallBack<MutableList<DiCarColor>>() {
// override fun onSuccess(t: CommonResponseBean<MutableList<DiCarColor>>) {
// super.onSuccess(t)
// var first = t.data?.firstOrNull { it.dictLabel == value }
// listener.onOptionPicked(0, first)
// }
// })
// )
} }
@ -91,14 +135,17 @@ class DicUtils private constructor() {
*/ */
fun getCarColor( fun getCarColor(
context: Context, appCompatActivity: AppCompatActivity, context: Context, appCompatActivity: AppCompatActivity,
isLoading : Boolean=false, isLoading: Boolean = false,
listener: OnOptionPickedListener listener: OnOptionPickedListener
) { ) {
DataManager.getInstance().getSysDictDataList("plate_color") DataManager.getInstance().getSysDictDataList("plate_color")
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
BaseObserver(context, object : RxHttpCallBack<MutableList<DiCarColor>>(if (isLoading) appCompatActivity else null) { BaseObserver(
context,
object :
RxHttpCallBack<MutableList<DiCarColor>>(if (isLoading) appCompatActivity else null) {
override fun onSuccess(t: CommonResponseBean<MutableList<DiCarColor>>) { override fun onSuccess(t: CommonResponseBean<MutableList<DiCarColor>>) {
super.onSuccess(t) super.onSuccess(t)
PickerUtils.getInstance() PickerUtils.getInstance()