司机注册流程优化

This commit is contained in:
lijia 2024-04-18 11:16:31 +08:00
parent fcc2f166ce
commit 619042ae83
14 changed files with 326 additions and 91 deletions

View File

@ -9,6 +9,7 @@ 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.HomeActivity
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ActivityUtils
@ -31,7 +32,9 @@ class AuthBankCardActivity : BaseActivity<ActivityAuthBankcardBinding>() {
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("实名认证", true)
setTitleBar("实名认证"){
ActivityUtils.startActivity(mContext, HomeActivity::class.java)
}
binding.run {
btnOk.setOnClickListener {

View File

@ -9,6 +9,7 @@ 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.HomeActivity
import com.dahe.gldriver.utils.OcrUtils
import com.dahe.mylibrary.utils.PickerUtils
import com.dahe.mylibrary.base.BaseActivity
@ -35,7 +36,9 @@ class AuthDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("实名认证", true)
setTitleBar("实名认证"){
ActivityUtils.startActivity(mContext, HomeActivity::class.java)
}
binding.run {
btnOk.setOnClickListener {

View File

@ -9,6 +9,8 @@ import com.dahe.gldriver.event.FaceEvent
import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.ui.HomeActivity
import com.dahe.gldriver.ui.account.AuthSuccActivity
import com.dahe.gldriver.ui.esingn.H5Activity
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean
@ -25,10 +27,17 @@ import org.greenrobot.eventbus.Subscribe
* @Description 刷脸认证
*/
class AuthFaceActivity : BaseActivity<ActivityAuthFaceBinding>() {
var isSupp: Boolean? = false
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("实名认证", true)
var isSupp = intent.extras?.getBoolean(AppConfig.IS_SUPPLEMENT, false)
isSupp = intent.extras?.getBoolean(AppConfig.IS_SUPPLEMENT, false)
setTitleBar("实名认证") {
if (isSupp == true) {//个人中心进来
finish()
} else {
ActivityUtils.startActivity(mContext, HomeActivity::class.java)
}
}
binding.btnOk.setOnClickListener {
DataManager.getInstance().getESignPsnAuthUrl()
@ -36,15 +45,6 @@ class AuthFaceActivity : BaseActivity<ActivityAuthFaceBinding>() {
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<FaceBean>() {
override fun onSuccess(t: CommonResponseBean<FaceBean>) {
super.onSuccess(t)
t.data.toString()
// val intent: Intent = Intent(
// this,
// H5Activity::class.java
// )
// intent.putExtra("url", bb.getData() as String)
// intent.putExtra("view_file", false)
// startActivity(intent)
ActivityUtils.startActivity(mContext,
H5Activity::class.java, Bundle().apply {
putString("url", t.data.authUrl)
@ -84,8 +84,14 @@ class AuthFaceActivity : BaseActivity<ActivityAuthFaceBinding>() {
@Subscribe
fun eventStatu(event: FaceEvent) {
if (event != null && event.message == "刷脸成功") {
setResult(RESULT_OK)
finish()
if (isSupp == true) {//个人中心进来
setResult(RESULT_OK)
finish()
} else {
ActivityUtils.startActivity(mContext, HomeActivity::class.java)
// finish()
}
}
}

View File

@ -12,6 +12,7 @@ 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.HomeActivity
import com.dahe.gldriver.utils.OcrUtils
import com.dahe.glex.bean.UserDetail
import com.dahe.mylibrary.base.BaseActivity
@ -44,7 +45,9 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
var perInfoBean: UpPersonInfoBean = UpPersonInfoBean()
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("实名认证", true)
setTitleBar("实名认证"){
ActivityUtils.startActivity(mContext,HomeActivity::class.java)
}
// isOnlyShow = intent.extras?.getBoolean(AppConfig.IS_ONLY_SHOW, false) == true
binding.run {

View File

@ -8,6 +8,7 @@ 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.HomeActivity
import com.dahe.gldriver.utils.SPUtils
import com.dahe.mylibrary.utils.PickerUtils
import com.dahe.mylibrary.base.BaseActivity
@ -30,7 +31,9 @@ class AuthQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
var upQuaInfo = UpQualiInfoBean()
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("实名认证", true)
setTitleBar("实名认证"){
ActivityUtils.startActivity(mContext, HomeActivity::class.java)
}
binding.run {
// etId.setText(SPUtils.instance.getUserInfo(mContext).idcard)

View File

@ -3,6 +3,7 @@ package com.dahe.gldriver.ui.home
import android.Manifest
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -19,15 +20,18 @@ import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.ui.home.activity.BusinessActivity
import com.dahe.gldriver.ui.mine.activity.PersonInfoActivity
import com.dahe.gldriver.ui.waybill.activity.WaybillDetailActivity
import com.dahe.gldriver.utils.OrderUtils
import com.dahe.glex.bean.OrderBean
import com.dahe.glex.bean.UserDetail
import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.callback.RefreshCallBack
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils
import com.dahe.mylibrary.utils.ImageLoader
import com.permissionx.guolindev.PermissionX
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
@ -133,6 +137,10 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
ivAllWaybill.setOnClickListener {
showToast("敬请期待")
}
llNotic.setOnClickListener {
ActivityUtils.startActivity(mContext,PersonInfoActivity::class.java)
}
}
initData()
}
@ -169,6 +177,18 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
})
)
DataManager.getInstance().getUserDetail()
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<UserDetail>() {
override fun onSuccess(t: CommonResponseBean<UserDetail>) {
super.onSuccess(t)
if (t.data.auditStatus == "100001")
binding.llNotic.visibility = View.VISIBLE
else
binding.llNotic.visibility = View.GONE
}
}))
//执行中运单轨迹上传
OrderUtils.getInstance().upLocation(mContext)
}

View File

@ -6,19 +6,12 @@ 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.AuthFaceActivity
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

View File

@ -9,10 +9,7 @@ import com.dahe.gldriver.databinding.ActivityPersonInfoBinding
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.AuthDriverActivity
import com.dahe.gldriver.ui.account.authperson.AuthFaceActivity
import com.dahe.gldriver.ui.account.authperson.AuthPersonActivity
import com.dahe.gldriver.ui.account.authperson.AuthQualificationActivity
import com.dahe.gldriver.ui.account.authperson.EditBankCardActivity
import com.dahe.gldriver.ui.account.authperson.EditDriverActivity
import com.dahe.gldriver.ui.account.authperson.EditPersonActivity

View File

@ -89,67 +89,11 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
myAdapter.selectMax = 1
myAdapter.setOnItemClickListener(object : OnItemClickListener {
override fun onItemClick(v: View?, position: Int) {
PopsUtils.getInstance().showSelPic(mContext,false, myAdapter) {
OssServiceUtil.getInstance().run {
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
setResultCallBack { data, oldPath ->
OcrUtils.getInstance().ocrCarNumber(mContext, oldPath, this@WaybillUpPicActivity) { carNum ->
if (!carNum.isNullOrEmpty()) {
picBean = WaybillPhoto()
picBean.run {
photoUrl = oldPath
this.type = if (type == 1) "1" else "2"
}
if (upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" } == null) {
upBean.waybillPhotoList.add(picBean)
} else {
upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" }!!.photoUrl =
oldPath
}
} else {
ToastUtils.showToast(
mContext,
"未识别出车牌号码,请重新拍摄"
)
}
}
}
}
myAdapter.data.run {
clear()
addAll(it)
}
myAdapter.notifyDataSetChanged()
}
selGoodPic(type,myAdapter)
}
override fun openPicture() {
PopsUtils.getInstance().showSelPic(mContext,false, myAdapter) {
// TODO: 暂时注释
OssServiceUtil.getInstance().run {
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
setResultCallBack { data, oldPath ->
picBean = WaybillPhoto()
picBean.run {
photoUrl = oldPath
this.type = if (type == 1) "1" else "2"
}
if (upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" } == null) {
upBean.waybillPhotoList.add(picBean)
} else {
upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" }!!.photoUrl =
oldPath
}
}
}
myAdapter.data.run {
clear()
addAll(it)
}
myAdapter.notifyDataSetChanged()
}
selGoodPic(type,myAdapter)
}
})
adapter = myAdapter
@ -171,7 +115,7 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
myAdapter.selectMax = 1
myAdapter.setOnItemClickListener(object : OnItemClickListener {
override fun onItemClick(v: View?, position: Int) {
PopsUtils.getInstance().showSelPic(mContext,true, myAdapter) {
PopsUtils.getInstance().showSelPic(mContext, true, myAdapter) {
OssServiceUtil.getInstance().run {
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
setResultCallBack { data, oldPath ->
@ -199,7 +143,7 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
}
override fun openPicture() {
PopsUtils.getInstance().showSelPic(mContext,true, myAdapter) {
PopsUtils.getInstance().showSelPic(mContext, true, myAdapter) {
OssServiceUtil.getInstance().run {
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
setResultCallBack { data, oldPath ->
@ -310,4 +254,41 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
}
}
}
private fun selGoodPic(goodType:Int?,myAdapter: GridImageAdapter) {
PopsUtils.getInstance().showSelPic(mContext, false, myAdapter) {
OssServiceUtil.getInstance().run {
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
setResultCallBack { data, oldPath ->
OcrUtils.getInstance()
.ocrCarNumber(mContext, oldPath, this@WaybillUpPicActivity) { carNum ->
if (!carNum.isNullOrEmpty()) {
myAdapter.data.run {
clear()
addAll(it)
}
myAdapter.notifyDataSetChanged()
picBean = WaybillPhoto()
picBean.run {
photoUrl = oldPath
this.type = if (goodType == 1) "1" else "2"
}
if (upBean.waybillPhotoList.find { it.type == if (goodType == 1) "1" else "2" } == null) {
upBean.waybillPhotoList.add(picBean)
} else {
upBean.waybillPhotoList.find { it.type == if (goodType == 1) "1" else "2" }!!.photoUrl =
oldPath
}
} else {
ToastUtils.showToast(
mContext,
"未识别出车牌号码,请重新拍摄"
)
}
}
}
}
}
}
}

View File

@ -11,6 +11,7 @@ import com.dahe.gldriver.adapter.WaybillListAdapter
import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.callback.OnSearchListener
import com.dahe.gldriver.databinding.FragmentWaybillListBinding
import com.dahe.gldriver.event.RefreshEvent
import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack
@ -29,6 +30,8 @@ import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
/**
* @ClassName AllWaybillFragment
@ -46,6 +49,7 @@ class AllWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCa
}
override fun onFragmentFirstVisible() {
EventBus.getDefault().register(this);
binding.run {
setRefresh(refresh, this@AllWaybillFragment)
adapter = recyclerView.run {
@ -58,7 +62,8 @@ class AllWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCa
)
)
adapter = WaybillListAdapter(SPUtils.instance.getUserInfo(mContext).isCarCaptain=="1")
adapter =
WaybillListAdapter(SPUtils.instance.getUserInfo(mContext).isCarCaptain == "1")
adapter as WaybillListAdapter
}.apply {
// 打开空布局功能
@ -197,4 +202,14 @@ class AllWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCa
}
@Subscribe
fun eventStatu(event: RefreshEvent) {
initData()
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this);
}
}

View File

@ -15,6 +15,7 @@ import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ImageLoader
import com.dahe.mylibrary.utils.LoadingUtils
import com.dahe.mylibrary.utils.PopsUtils
import com.dahe.mylibrary.utils.RegexpUtils
import com.dahe.mylibrary.utils.ToastUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
@ -313,8 +314,18 @@ class OcrUtils private constructor() {
object : RxHttpCallBack<OcrPersonBean>() {
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
super.onSuccess(t)
if (t.data.data.info != null && t.data.data.info.isNotEmpty())
if (t.data.data.info != null && t.data.data.info.isNotEmpty() && RegexpUtils.isPlateNumber(
t.data.data.info[0].value
)
) {
listener.onSuccResult(t.data.data.info[0].value)
} else {
ToastUtils.showToast(
activity,
"未识别出车牌号码,请重新拍摄"
)
}
}
override fun onCodeError(
@ -326,7 +337,7 @@ class OcrUtils private constructor() {
if (t.code == 500) {
ToastUtils.showToast(
mContext,
"图片识别失败,请重新上传"
"未识别出车牌号码,请重新拍摄"
)
}
}

View File

@ -191,6 +191,38 @@
android:paddingLeft="@dimen/dp_14"
android:paddingTop="@dimen/dp_24"
android:paddingRight="@dimen/dp_14"></androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:visibility="gone"
android:id="@+id/llNotic"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_36"
android:background="#FFEDE5"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_8">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:singleLine="true"
android:text="您的实名认证资料不全,请继续进行上传证件。"
android:textColor="@color/main_red"
android:textSize="@dimen/dp_12" />
<Button
android:layout_width="@dimen/dp_65"
android:layout_height="@dimen/dp_22"
android:layout_marginRight="@dimen/dp_16"
android:background="@drawable/shape_btn_11"
android:clickable="false"
android:text="立即认证"
android:textColor="@color/white"
android:textSize="@dimen/sp_11" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -52,7 +52,7 @@ class PopBottomPic(
var xiangce = findViewById<Button>(R.id.btnXiangce)
var btnQuxiao = findViewById<Button>(R.id.btn_quxiao)
var img = findViewById<ImageView>(R.id.img)
if (isReturn) img.setBackgroundResource(R.drawable.huidan)
if (isReturn) img.setImageResource(R.drawable.huidan)
paizhao.setOnClickListener {
// 单独拍照

View File

@ -0,0 +1,168 @@
package com.dahe.mylibrary.utils
import java.util.regex.Pattern
/**
* @ClassName RegexpUtils
* @Author john
* @Date 2024/4/18 10:01
* @Description TODO
*/
class RegexpUtils {
var regularExpression =
"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)"
fun isNumeric(str: String?): Boolean {
val pattern = Pattern.compile("[0-9]*")
val isNum = pattern.matcher(str)
return if (!isNum.matches()) {
false
} else true
}
companion object {
/**
* 车牌号码Pattern
*/
val PLATE_NUMBER_PATTERN = Pattern
.compile("^[\u0391-\uFFE5]{1}[a-zA-Z0-9]{6,7}$")
/**
* 证件号码Pattern
*/
val ID_CODE_PATTERN = Pattern
.compile("^[a-zA-Z0-9]+$")
/**
* 编码Pattern
*/
val CODE_PATTERN = Pattern
.compile("^[a-zA-Z0-9]+$")
/**
* 固定电话编码Pattern
*/
val PHONE_NUMBER_PATTERN = Pattern
.compile("0\\d{2,3}-[0-9]+")
/**
* 邮政编码Pattern
*/
val POST_CODE_PATTERN = Pattern.compile("\\d{6}")
/**
* 面积Pattern
*/
val AREA_PATTERN = Pattern.compile("\\d*.?\\d*")
/**
* 手机号码Pattern
*/
val MOBILE_NUMBER_PATTERN = Pattern
.compile("\\d{11}")
val ID_CARD = Pattern.compile(
"^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}(" +
"(0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$"
)
/**
* 银行帐号Pattern
*/
val ACCOUNT_NUMBER_PATTERN = Pattern
.compile("\\d{16,21}")
/**
* 车牌号码是否正确
*
* @param s
* @return
*/
fun isPlateNumber(s: String?): Boolean {
val m = PLATE_NUMBER_PATTERN.matcher(s)
return m.matches()
}
/**
* 证件号码是否正确
*
* @param s
* @return
*/
fun isIDCode(s: String?): Boolean {
val m = ID_CODE_PATTERN.matcher(s)
return m.matches()
}
/**
* 编码是否正确
*
* @param s
* @return
*/
fun isCode(s: String?): Boolean {
val m = CODE_PATTERN.matcher(s)
return m.matches()
}
/**
* 固话编码是否正确
*
* @param s
* @return
*/
fun isPhoneNumber(s: String?): Boolean {
val m = PHONE_NUMBER_PATTERN.matcher(s)
return m.matches()
}
/**
* 邮政编码是否正确
*
* @param s
* @return
*/
fun isPostCode(s: String?): Boolean {
val m = POST_CODE_PATTERN.matcher(s)
return m.matches()
}
/**
* 面积是否正确
*
* @param s
* @return
*/
fun isArea(s: String?): Boolean {
val m = AREA_PATTERN.matcher(s)
return m.matches()
}
/**
* 手机号码否正确
*
* @param s
* @return
*/
fun isMobileNumber(s: String?): Boolean {
val m = MOBILE_NUMBER_PATTERN.matcher(s)
return m.matches()
}
fun isIdCard(s: String?): Boolean {
val m = ID_CARD.matcher(s)
return m.matches()
}
/**
* 银行账号否正确
*
* @param s
* @return
*/
fun isAccountNumber(s: String?): Boolean {
val m = ACCOUNT_NUMBER_PATTERN.matcher(s)
return m.matches()
}
}
}