车辆类型接口替换

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>>>
/**
* 查询车辆类型字典
* @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值
DicUtils.getInstance()
.getCarTypeByValue(mContext, it.vehicleType) { position, item ->
.getCarTypeByValue(mContext, it.vehicleType,"0") { position, item ->
if (item != null) {
var data = item as DiCarColor
upDrivingInfoBean.run {

View File

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

View File

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

View File

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

View File

@ -34,14 +34,18 @@ class DicUtils private constructor() {
activity: AppCompatActivity,
defaultCont: String = "重型半挂牵引车",
isLoading: Boolean = false,
groupType: String = "0",
listener: OnOptionPickedListener
) {
//车辆类型
DataManager.getInstance().getSysDictDataList("vehicle_type")
DataManager.getInstance().selectCarTypeVoAll("",groupType)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.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>>) {
super.onSuccess(t)
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(
context: Context,
value: String,
groupType: String = "0",
listener: OnOptionPickedListener
) {
if (value.isNullOrEmpty())
return
//车辆类型
DataManager.getInstance().getSysDictDataList("vehicle_type")
DataManager.getInstance().selectCarTypeVoAll(value, groupType)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.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)
// }
// })
// )
}
@ -98,7 +142,10 @@ class DicUtils private constructor() {
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.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>>) {
super.onSuccess(t)
PickerUtils.getInstance()