车队长接口对接
This commit is contained in:
parent
0cef8d1da8
commit
b04c49c22e
@ -3,7 +3,20 @@
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State />
|
||||
<State>
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="C:\Users\用户\.android\avd\Pixel_2_API_30.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2024-02-29T08:36:21.502896400Z" />
|
||||
</State>
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
|
@ -117,7 +117,6 @@
|
||||
<activity
|
||||
android:name=".ui.account.CodeLoginActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
@ -139,44 +138,37 @@
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthDriverActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthQualificationActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthBankCardActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthFaceActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthDrivingActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.account.authperson.AuthRoadActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name=".ui.account.authteam.AuthTeamActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<!-- 司机车辆认证相关end -->
|
||||
@ -185,7 +177,6 @@
|
||||
<activity
|
||||
android:name=".ui.waybill.activity.WaybillDetailActivity"
|
||||
android:configChanges="keyboardHidden|orientation|locale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
@ -246,8 +237,6 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
|
||||
|
||||
|
||||
<!-- 我的相关end -->
|
||||
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
package com.dahe.glex.bean
|
||||
|
||||
/**
|
||||
* @ClassName TextBean
|
||||
* @Author 用户
|
||||
* @Date 2023/9/21 11:08
|
||||
* @Description TODO
|
||||
*/
|
||||
data class CommListBean(
|
||||
val list: MutableList<OrderBean>,
|
||||
val num: Int,
|
||||
val totalFreight: String
|
||||
)
|
@ -7,20 +7,41 @@ package com.dahe.glex.bean
|
||||
* @Description TODO
|
||||
*/
|
||||
data class OrderBean(
|
||||
var orderId: String,
|
||||
var waybillId: String,
|
||||
var orderNum: String,
|
||||
var waybillNum: String,
|
||||
var orderTime: String,
|
||||
var totalFreight: String,
|
||||
var dispatchType : Int,
|
||||
var effectiveTime: String,
|
||||
var sendPut: String,
|
||||
var distance: String,
|
||||
var loadingAddress: String,
|
||||
var receiverAddress: String,
|
||||
var waybillStatus: Int,
|
||||
var evaluation: Int,
|
||||
var complaint: Int,
|
||||
var multipleScore: String,
|
||||
val avatar: String,
|
||||
val distance: String,
|
||||
val driverFreight: Double,
|
||||
val goodsList: List<Goods>,
|
||||
val loadingArea: String,
|
||||
val loadingAreaCode: String,
|
||||
val loadingCity: String,
|
||||
val loadingCityCode: String,
|
||||
val loadingDeadline: String,
|
||||
val loadingProvince: String,
|
||||
val loadingProvinceCode: String,
|
||||
val orderId: String,
|
||||
val orderNum: String,
|
||||
val orderStatus: Int,
|
||||
val orderType: String,
|
||||
val passingPointsNum: String,
|
||||
val realCompanyName: String,
|
||||
val receiverArea: String,
|
||||
val receiverAreaCode: String,
|
||||
val receiverCity: String,
|
||||
val receiverCityCode: String,
|
||||
val receiverProvince: String,
|
||||
val receiverProvinceCode: String,
|
||||
val requirement: String,
|
||||
val shipperCreditRating: String,
|
||||
val shipperPositiveReviewRate: String,
|
||||
val shipperTransactionVolume: String,
|
||||
val vehicleLength: String,
|
||||
val vehicleType: String
|
||||
)
|
||||
|
||||
data class Goods(
|
||||
val goodCube: String,
|
||||
val goodItemGrossWeight: String,
|
||||
val goodName: String,
|
||||
val goodNum: String,
|
||||
val orderGoodsId: String
|
||||
)
|
@ -73,8 +73,17 @@ data class AuthTeamBean(
|
||||
var idcardIsEndless: String="",
|
||||
var idcardName: String="",
|
||||
var idcardNo: String="",
|
||||
var roadLicensePhotoUrl: String="",
|
||||
var roadLicense: String="",
|
||||
var roadLicenseValidity: String="",
|
||||
var businessLicensePhoneUrl: String="",
|
||||
var businessLicenseCreditCode: String="",
|
||||
var businessLicenseEffectiveStart: String="",
|
||||
var businessLicenseEffectiveEnd: String="",
|
||||
var idcardSex: String=""
|
||||
){
|
||||
constructor(captainType: String) : this()
|
||||
constructor(captainType: String) : this(){
|
||||
this.captainType = captainType
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
package com.dahe.gldriver.net
|
||||
|
||||
import WayBill2
|
||||
import com.dahe.gldriver.BuildConfig
|
||||
import com.dahe.gldriver.bean.AuthTeamBean
|
||||
import com.dahe.gldriver.bean.OcrPersonBean
|
||||
@ -22,22 +20,13 @@ import retrofit2.http.Query
|
||||
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/8/8 0008.
|
||||
* Created by Administrator on 2024/01/8 0008.
|
||||
*/
|
||||
interface Api {
|
||||
/*-------------------登录----------------------------*/
|
||||
@POST(BASE_URL + "common/register")
|
||||
fun log(@Body logBean: LogBean?): Observable<CommonResponseBean<UserBean>>
|
||||
|
||||
//运单列表
|
||||
@POST(BASE_URL + "app/driver/waybill/listV2")
|
||||
fun orderList(@Body bean: RefreshBean?): Observable<CommonResponseBean<CommListBean>>
|
||||
|
||||
//获取正在执行的运单/运单详情
|
||||
@POST(BASE_URL + "app/driver/waybill/getExecuteWaybill")
|
||||
fun getExecuteWaybill(@Body bean: WayBillBean?): Observable<CommonResponseBean<WayBill2>>
|
||||
fun getExecuteWaybill2(@Query("waybillId") waybillId: String?): Observable<CommonResponseBean<UserBean>>
|
||||
|
||||
@GET(BASE_URL + "auth/driver/login")
|
||||
fun login(
|
||||
@Query("contactPhone") contactPhone: String,
|
||||
@ -139,6 +128,13 @@ interface Api {
|
||||
fun authenticationCaptain(@Body bankBean: AuthTeamBean): Observable<CommonResponseBean<String>>
|
||||
|
||||
|
||||
@GET(BASE_URL + "driver/order/list")
|
||||
fun orderList(): Observable<CommonResponseBean<MutableList<OrderBean>>>
|
||||
|
||||
|
||||
@GET(BASE_URL + "driver/driver/setUpDriverRole")
|
||||
fun setUpDriverRole(@Query("role") role: String): Observable<CommonResponseBean<String>>
|
||||
|
||||
companion object {
|
||||
// String BASE_URL = "https://tmstest.dahehuoyun.com/";
|
||||
const val BASE_URL = BuildConfig.BASE_URL
|
||||
|
@ -22,7 +22,7 @@ import javax.net.ssl.SSLException
|
||||
abstract class RxHttpCallBack<T> {
|
||||
// private var dialog: ProgressDialog? = null
|
||||
private var dialog: LoadingPopupView? = null
|
||||
private fun initDialog(activity: AppCompatActivity, dialogMessage: String) {
|
||||
private fun initDialog(activity: AppCompatActivity?, dialogMessage: String) {
|
||||
// dialog = ProgressDialog(activity)
|
||||
// dialog!!.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
// dialog!!.setCanceledOnTouchOutside(false)
|
||||
@ -30,7 +30,7 @@ abstract class RxHttpCallBack<T> {
|
||||
// dialog!!.setMessage(dialogMessage)
|
||||
|
||||
|
||||
dialog = LoadingUtils.instance.init(activity)
|
||||
dialog = activity?.let { LoadingUtils.instance.init(it) }
|
||||
}
|
||||
|
||||
constructor(activity: AppCompatActivity, dialogMessage: String?) {
|
||||
@ -40,7 +40,7 @@ abstract class RxHttpCallBack<T> {
|
||||
)
|
||||
}
|
||||
|
||||
constructor(activity: AppCompatActivity) {
|
||||
constructor(activity: AppCompatActivity?) {
|
||||
initDialog(activity, "网络请求中......")
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class OssServiceUtil {
|
||||
}
|
||||
|
||||
private void initDialog(AppCompatActivity activity) {
|
||||
dialog = LoadingUtils.Companion.getInstance().init(activity,"网络请求中......");
|
||||
dialog = LoadingUtils.Companion.getInstance().init(activity, "网络请求中......");
|
||||
}
|
||||
|
||||
//初始化使用参数
|
||||
@ -84,10 +84,6 @@ public class OssServiceUtil {
|
||||
conf.setMaxErrorRetry(2); // 失败后最大重试次数,默认2次
|
||||
|
||||
oss = new OSSClient(App.Companion.getApp(), OssConfigBean.endpoint, credentialProvider, conf);
|
||||
|
||||
|
||||
System.out.println("ffff");
|
||||
// initDialog(activity);
|
||||
}
|
||||
|
||||
public void setResultCallBack(picResultCallback callback) {
|
||||
@ -105,7 +101,7 @@ public class OssServiceUtil {
|
||||
// if (object.equals("")) {
|
||||
// return;
|
||||
// }
|
||||
if (activity!=null){
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -151,23 +147,28 @@ public class OssServiceUtil {
|
||||
// if (mProgress != null) {
|
||||
// mProgress.setProgress(progress);
|
||||
// }
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(() -> {
|
||||
if (dialog != null&&!dialog.isShow()) {
|
||||
if (dialog != null && !dialog.isShow()) {
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
OSSAsyncTask task = oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() {
|
||||
@Override
|
||||
public void onSuccess(PutObjectRequest request, final PutObjectResult result) {
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(() -> {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String serverCallbackReturnBody = result.getServerCallbackReturnBody();
|
||||
callback.getPicData(result, OssConfigBean.BUCKET_BASE_URL + OssConfigBean.BUCKET_OBJECT + name);
|
||||
@ -175,11 +176,14 @@ public class OssServiceUtil {
|
||||
|
||||
@Override
|
||||
public void onFailure(PutObjectRequest request, ClientException clientExcepion, ServiceException serviceException) {
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(() -> {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
String info = "";
|
||||
// 请求异常
|
||||
if (clientExcepion != null) {
|
||||
@ -201,7 +205,6 @@ public class OssServiceUtil {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 上传次数
|
||||
*/
|
||||
|
@ -18,6 +18,8 @@ import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.flyco.tablayout.listener.CustomTabEntity
|
||||
import com.flyco.tablayout.listener.OnTabSelectListener
|
||||
import com.permissionx.guolindev.PermissionX
|
||||
import java.util.Timer
|
||||
import java.util.TimerTask
|
||||
|
||||
/**
|
||||
* @ClassName HomeActivity
|
||||
@ -86,6 +88,24 @@ class HomeActivity: BaseActivity<ActivityHomeBinding>(), OnTabSelectListener,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private var mBackKeyPressed = false
|
||||
override fun onBackPressed() {
|
||||
if (!mBackKeyPressed) {
|
||||
showToast("再按一次退出程序")
|
||||
mBackKeyPressed = true
|
||||
Timer().schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
mBackKeyPressed = false
|
||||
}
|
||||
}, 2000)
|
||||
} else {
|
||||
canCelToast()
|
||||
moveTaskToBack(true)
|
||||
// finish()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTabSelect(position: Int) {
|
||||
binding.homeNoScrollViewPager.setCurrentItem(position)
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ package com.dahe.gldriver.ui.account
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.databinding.ActivitySelectRoleBinding
|
||||
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.AuthBankCardActivity
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthDriverActivity
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthDrivingActivity
|
||||
@ -10,7 +13,10 @@ import com.dahe.gldriver.ui.account.authperson.AuthPersonActivity
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthQualificationActivity
|
||||
import com.dahe.gldriver.ui.account.authteam.AuthTeamActivity
|
||||
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
|
||||
|
||||
/**
|
||||
* @ClassName AuthRoleActivity
|
||||
@ -21,12 +27,33 @@ import com.dahe.mylibrary.utils.ActivityUtils
|
||||
class SelectRoleActivity : BaseActivity<ActivitySelectRoleBinding>() {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("选择角色",true)
|
||||
setTitleBar("选择角色", true)
|
||||
binding.rlPerson.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext, AuthDriverActivity::class.java)
|
||||
|
||||
|
||||
ActivityUtils.startActivity(mContext, AuthDrivingActivity::class.java)
|
||||
|
||||
// DataManager.getInstance().setUpDriverRole("0")
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>(this) {
|
||||
// override fun onSuccess(t: CommonResponseBean<String>) {
|
||||
// super.onSuccess(t)
|
||||
// ActivityUtils.startActivity(mContext, AuthPersonActivity::class.java)
|
||||
// }
|
||||
// }))
|
||||
|
||||
// ActivityUtils.startActivity(mContext, AuthPersonActivity::class.java)
|
||||
}
|
||||
binding.rlCom.setOnClickListener {
|
||||
DataManager.getInstance().setUpDriverRole("1")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>(this) {
|
||||
override fun onSuccess(t: CommonResponseBean<String>) {
|
||||
super.onSuccess(t)
|
||||
}
|
||||
}))
|
||||
ActivityUtils.startActivity(mContext, AuthTeamActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class AuthBankCardActivity : BaseActivity<ActivityAuthBankcardBinding>() {
|
||||
object : RxHttpCallBack<OcrPersonBean>(this) {
|
||||
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
super.onSuccess(t)
|
||||
t.data.data?.run {
|
||||
t.data?.data?.run {
|
||||
bankInfo.driverBankcardPhotoUrl = oldPath
|
||||
|
||||
binding.let {
|
||||
|
@ -1,13 +1,9 @@
|
||||
package com.dahe.gldriver.ui.account.authperson
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.widget.ContentLoadingProgressBar
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.bean.OcrPersonBean
|
||||
import com.dahe.gldriver.bean.UpDriverInfoBean
|
||||
import com.dahe.gldriver.bean.UpPersonInfoBean
|
||||
import com.dahe.gldriver.callback.OnOcrPicResultListener
|
||||
import com.dahe.gldriver.databinding.ActivityAuthDriverBinding
|
||||
import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
@ -20,6 +16,8 @@ import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.ImageLoader
|
||||
import com.dahe.mylibrary.utils.PopsUtils
|
||||
import com.dahe.mylibrary.utils.TimeUtil
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
@ -47,16 +45,16 @@ class AuthDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
|
||||
tvStart.run {
|
||||
setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDate(this@AuthDriverActivity, "有效起始日期") { year, month, day ->
|
||||
this.text = "$year-$month-$day"
|
||||
.showDate(this@AuthDriverActivity, "有效起始日期") { date ->
|
||||
this.text = date
|
||||
}
|
||||
}
|
||||
}
|
||||
tvEnd.run {
|
||||
setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDate(this@AuthDriverActivity, "有效结束日期") { year, month, day ->
|
||||
this.text = "$year-$month-$day"
|
||||
.showDate(this@AuthDriverActivity, "有效结束日期") { date ->
|
||||
this.text = date
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -89,6 +87,13 @@ class AuthDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
|
||||
licenseEffectiveStart = tvStart.text.toString()
|
||||
licenseEffectiveEnd = tvEnd.text.toString()
|
||||
}
|
||||
}
|
||||
if (driverInfoBean.licenseNo.isNullOrBlank() || driverInfoBean.licensePhotoBackUrl.isNullOrBlank()) {
|
||||
ToastUtils.showToast(mContext, "请完善信息")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
DataManager.getInstance().setUpDriverLicense(driverInfoBean)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -102,13 +107,15 @@ class AuthDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
|
||||
)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun selFrontPic() {
|
||||
OcrUtils.getInstance().ocrDriver(mContext, this@AuthDriverActivity) { picPath, result ->
|
||||
|
||||
OcrUtils.getInstance().ocrDriver(mContext, this) { picPath, result ->
|
||||
result.data.face?.data.let {
|
||||
ImageLoader.getInstance().loadRoundImage(mContext, picPath, 12, binding.ivFront)
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, binding.ivFront)
|
||||
driverInfoBean.licensePhotoFaceUrl = picPath.picPath
|
||||
it?.run {
|
||||
driverInfoBean.run {
|
||||
@ -131,93 +138,18 @@ class AuthDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
|
||||
}
|
||||
|
||||
|
||||
// PopsUtils.getInstance().showSimSelPic(mContext) {
|
||||
// var data = it[0]
|
||||
// ossServiceUtil.asyncPutImage(data.realPath, this@AuthDriverActivity)
|
||||
// ossServiceUtil.setResultCallBack { data, oldPath ->
|
||||
// DataManager.getInstance().recognizeDrivingLicense(oldPath)
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(
|
||||
// BaseObserver(mContext,
|
||||
// object : RxHttpCallBack<OcrPersonBean>() {
|
||||
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
// super.onSuccess(t)
|
||||
// t.data.data.face?.data.let {
|
||||
// driverInfoBean.licensePhotoFaceUrl = oldPath
|
||||
// it?.run {
|
||||
// driverInfoBean.run {
|
||||
// licenseApproveOrganization =
|
||||
// issueAuthority //发证机关
|
||||
// }
|
||||
//
|
||||
//
|
||||
// binding.run {
|
||||
// etName.setText(it.name)
|
||||
// etId.setText(it.licenseNumber)
|
||||
// tvCarType.text = it.approvedType
|
||||
// if (validPeriod.contains("至")) {
|
||||
// val split = validPeriod.split("至")
|
||||
// tvStart.text = split[0]
|
||||
// tvEnd.text =
|
||||
// if (split.size == 2) split[1] else ""
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// )
|
||||
//
|
||||
// }
|
||||
//
|
||||
// ImageLoader.getInstance().loadRoundImage(mContext, data.realPath, 12, binding.ivFront)
|
||||
// }
|
||||
}
|
||||
|
||||
private fun selBackPic() {
|
||||
PopsUtils.getInstance().showSimSelPic(mContext) {
|
||||
var data = it[0]
|
||||
ossServiceUtil.asyncPutImage(data.realPath, this@AuthDriverActivity)
|
||||
ossServiceUtil.setResultCallBack { data, oldPath ->
|
||||
run {
|
||||
DataManager.getInstance().recognizeDrivingLicense(oldPath)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
BaseObserver(mContext,
|
||||
object : RxHttpCallBack<OcrPersonBean>() {
|
||||
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
super.onSuccess(t)
|
||||
t.data.data.back?.data.let {
|
||||
driverInfoBean.licensePhotoBackUrl = oldPath
|
||||
// it?.run {
|
||||
// driverInfoBean.run {
|
||||
// licenseApproveOrganization =
|
||||
// issueAuthority //发证机关
|
||||
// }
|
||||
// binding.run {
|
||||
// etName.setText(it.name)
|
||||
// etId.setText(it.licenseNumber)
|
||||
// tvCarType.text = it.approvedType
|
||||
// if (validPeriod.contains("至")) {
|
||||
// val split = validPeriod.split("至")
|
||||
// tvStart.text = split[0]
|
||||
// tvEnd.text =
|
||||
// if (split.size == 2) split[1] else ""
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
OcrUtils.getInstance().ocrDriver(mContext, this) { picPath, result ->
|
||||
result.data.back?.data.let {
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, binding.ivBack)
|
||||
driverInfoBean.licensePhotoBackUrl = picPath.picPath
|
||||
ToastUtils.showToast(mContext, "驾驶证副页上传成功")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImageLoader.getInstance().loadRoundImage(mContext, data.realPath, 12, binding.ivBack)
|
||||
}
|
||||
}
|
||||
}
|
@ -10,6 +10,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.utils.OcrUtils
|
||||
import com.dahe.glex.bean.UserBean
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
@ -17,6 +18,7 @@ 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.dahe.mylibrary.utils.TimeUtil
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.functions.Function
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
@ -47,10 +49,10 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
btnOk.setOnClickListener {
|
||||
|
||||
perInfoBean.run {
|
||||
idcardNo = inBinding.etId.toString()
|
||||
idcardName = inBinding.etName.toString()
|
||||
idcardEffectiveStart = inBinding.tvStart.toString()
|
||||
idcardEffectiveEnd = inBinding.tvEnd.toString()
|
||||
idcardNo = inBinding.etId.text.toString()
|
||||
idcardName = inBinding.etName.text.toString()
|
||||
idcardEffectiveStart = inBinding.tvStart.text.toString()
|
||||
idcardEffectiveEnd = inBinding.tvEnd.text.toString()
|
||||
}
|
||||
|
||||
DataManager.getInstance().setUpDriverIdCard(perInfoBean)
|
||||
@ -58,7 +60,6 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<String>(){
|
||||
override fun onSuccess(t: CommonResponseBean<String>) {
|
||||
super.onSuccess(t)
|
||||
println("lijiaaaaa")
|
||||
ActivityUtils.startActivity(mContext, AuthDriverActivity::class.java)
|
||||
}
|
||||
}))
|
||||
@ -68,59 +69,30 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
tvStart.run {
|
||||
setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDate(this@AuthPersonActivity, "有效起始日期") { year, month, day ->
|
||||
this.text = "$year-$month-$day"
|
||||
.showDate(this@AuthPersonActivity, "有效起始日期") { date ->
|
||||
this.text = date
|
||||
}
|
||||
}
|
||||
}
|
||||
tvEnd.run {
|
||||
setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDate(this@AuthPersonActivity, "有效结束日期") { year, month, day ->
|
||||
this.text = "$year-$month-$day"
|
||||
.showDate(this@AuthPersonActivity, "有效结束日期") { date ->
|
||||
this.text = date
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ivFront.setOnClickListener {
|
||||
PopsUtils.getInstance().showSimSelPic(mContext) {
|
||||
var data = it[0]
|
||||
|
||||
val path: String
|
||||
if (data.isCut && !data.isCompressed) {
|
||||
// 裁剪过
|
||||
path = data.cutPath
|
||||
} else if (data.isCompressed || (data.isCut && data.isCompressed)) {
|
||||
// 压缩过,或者裁剪同时压缩过,以最终压缩过图片为准
|
||||
path = data.compressPath
|
||||
} else {
|
||||
// 原图
|
||||
path = data.path
|
||||
}
|
||||
ImageLoader.getInstance().loadRoundImage(mContext, data.realPath, 12, ivFront)
|
||||
|
||||
val file = File(data.realPath)
|
||||
val filePic: MultipartBody.Part = MultipartBody.Part.createFormData(
|
||||
"file",
|
||||
file.getName(),
|
||||
file.asRequestBody("multipart/form-data".toMediaTypeOrNull())
|
||||
)
|
||||
|
||||
DataManager.getInstance().uploadToOss(filePic).flatMap {
|
||||
perInfoBean.idcardFrontUrl = it.data.url
|
||||
DataManager.getInstance().recognizeIdcard(it.data.url)
|
||||
}.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
BaseObserver(
|
||||
mContext,
|
||||
object : RxHttpCallBack<OcrPersonBean>(this@AuthPersonActivity) {
|
||||
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
super.onSuccess(t)
|
||||
t.data.data.face?.data.let {
|
||||
OcrUtils.getInstance().ocrPerson(mContext,this@AuthPersonActivity){picPath,result->
|
||||
ImageLoader.getInstance().loadRoundImage(mContext, picPath.locPic, 12, ivFront)
|
||||
perInfoBean.idcardFrontUrl = picPath.picPath
|
||||
result.data.face?.data.let {
|
||||
it?.run {
|
||||
perInfoBean.run {
|
||||
idcardNo = idNumber
|
||||
idcardName = name
|
||||
idcardEthnicity = ethnicity
|
||||
idcardSex = if (sex == "男") "0" else "1"
|
||||
}
|
||||
}
|
||||
@ -130,18 +102,6 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
// ossServiceUtil.asyncPutImage(path, null)
|
||||
// ossServiceUtil.setResultCallBack { data, oldPath ->
|
||||
// {
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
ivBack.setOnClickListener {
|
||||
@ -183,9 +143,9 @@ class AuthPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
|
||||
if (it.data.validPeriod?.contains("-") == true) {
|
||||
val split = it.data.validPeriod.split("-")
|
||||
binding.run {
|
||||
tvStart.text = split[0]
|
||||
tvStart.text = TimeUtil.changeDateFormat(split[0])
|
||||
tvEnd.text =
|
||||
if (split.size == 2) split[1] else ""
|
||||
if (split.size == 2) TimeUtil.changeDateFormat(split[1]) else ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ class AuthQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
|
||||
tvDate.run {
|
||||
setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDate(
|
||||
.showDateSim(
|
||||
this@AuthQualificationActivity,
|
||||
"选择有效期至"
|
||||
) { year, month, day ->
|
||||
this.text = "$year-$month-$day"
|
||||
) { date ->
|
||||
this.text = date
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,7 +53,11 @@ class AuthQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
|
||||
ossServiceUtil.asyncPutImage(data.realPath, this@AuthQualificationActivity)
|
||||
ossServiceUtil.setResultCallBack { data, oldPath ->
|
||||
upQuaInfo.qualificationCertificatePhotoUrl = oldPath
|
||||
ImageLoader.getInstance().loadRoundImage(mContext, it[0].path, 12, ivFront)
|
||||
runOnUiThread {
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, it[0].realPath, 12, ivFront)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class AuthRoadActivity : BaseActivity<ActivityAuthRoadBinding>() {
|
||||
}
|
||||
|
||||
tvDate.setOnClickListener {
|
||||
PickerUtils.getInstance().showDate(this@AuthRoadActivity){ year, month, day ->
|
||||
PickerUtils.getInstance().showDate(this@AuthRoadActivity){ date ->
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import com.dahe.mylibrary.utils.LoadingUtils
|
||||
import com.dahe.mylibrary.utils.LoadingUtils3
|
||||
import com.dahe.mylibrary.utils.PickerUtils
|
||||
import com.dahe.mylibrary.utils.PopsUtils
|
||||
import com.dahe.mylibrary.utils.TimeUtil
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
@ -34,7 +35,9 @@ import java.io.File
|
||||
* @Description 个人车队认证
|
||||
*/
|
||||
class AuthTeamActivity : BaseActivity<ActivityAuthTeamBinding>(), View.OnClickListener {
|
||||
private var checkTeamType = 0 //1代表运输公司,0代表个人车队
|
||||
private var checkTeamType = 1 //1代表运输公司,0代表个人车队
|
||||
|
||||
var fff : MutableList<String> = mutableListOf("sdfsdf","asdfasdf")
|
||||
|
||||
var ossServiceUtil: OssServiceUtil = OssServiceUtil.getInstance()
|
||||
|
||||
@ -52,6 +55,13 @@ class AuthTeamActivity : BaseActivity<ActivityAuthTeamBinding>(), View.OnClickLi
|
||||
ivBusiness.setOnClickListener {
|
||||
OcrUtils.getInstance()
|
||||
.ocrBusinessCard(mContext, this@AuthTeamActivity) { picPath, result ->
|
||||
upComInfoBean.businessLicensePhoneUrl = picPath.picPath
|
||||
|
||||
result.data?.run {
|
||||
upComInfoBean.businessLicenseCreditCode = creditCode
|
||||
upComInfoBean.businessLicenseEffectiveStart= TimeUtil.changeDateNoneFormat(validFromDate)
|
||||
upComInfoBean.businessLicenseEffectiveEnd=TimeUtil.changeDateNoneFormat(validToDate)
|
||||
}
|
||||
ImageLoader.getInstance()
|
||||
.loadRoundImage(mContext, picPath.locPic, 12, ivBusiness)
|
||||
}
|
||||
@ -86,13 +96,12 @@ class AuthTeamActivity : BaseActivity<ActivityAuthTeamBinding>(), View.OnClickLi
|
||||
result.data.back?.data?.run {
|
||||
if (validPeriod.contains("-")) {
|
||||
val split = validPeriod.split("-")
|
||||
tvStart.text = split[0]
|
||||
tvEnd.text = if (split.size == 2) split[1] else ""
|
||||
tvStart.text = TimeUtil.changeDateFormat(split[0])
|
||||
tvEnd.text = if (split.size == 2) TimeUtil.changeDateFormat(split[1]) else ""
|
||||
upComInfoBean.run {
|
||||
idcardEffectiveStart = split[0]
|
||||
idcardEffectiveEnd = if (split.size == 2) split[1] else ""
|
||||
// idcardEffectiveStart = TimeUtil.changeDateFormat(split[0])
|
||||
// idcardEffectiveEnd = if (split.size == 2) TimeUtil.changeDateFormat(split[1]) else ""
|
||||
idcardBackUrl = picPath.picPath
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -129,14 +138,13 @@ class AuthTeamActivity : BaseActivity<ActivityAuthTeamBinding>(), View.OnClickLi
|
||||
result.data.back?.data?.run {
|
||||
if (validPeriod.contains("-")) {
|
||||
val split = validPeriod.split("-")
|
||||
tvPerStart.text = split[0]
|
||||
tvPerEnd.text = if (split.size == 2) split[1] else ""
|
||||
tvPerStart.text = TimeUtil.changeDateFormat(split[0])
|
||||
tvPerEnd.text = if (split.size == 2) TimeUtil.changeDateFormat(split[1]) else ""
|
||||
|
||||
upPerInfoBean.run {
|
||||
idcardEffectiveStart = split[0]
|
||||
idcardEffectiveEnd = if (split.size == 2) split[1] else ""
|
||||
idcardEffectiveStart = tvPerStart.text.toString()
|
||||
idcardEffectiveEnd = tvPerEnd.text.toString()
|
||||
idcardBackUrl = picPath.picPath
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -164,7 +172,8 @@ class AuthTeamActivity : BaseActivity<ActivityAuthTeamBinding>(), View.OnClickLi
|
||||
//道路运输许可证
|
||||
ivRoad.setOnClickListener {
|
||||
PopsUtils.getInstance().showSimSelPic(mContext) {
|
||||
ImageLoader.getInstance().loadRoundImage(mContext, it[0].path, 12, ivRoad)
|
||||
// upComInfoBean.roadLicensePhotoUrl = it[0].realPath
|
||||
ImageLoader.getInstance().loadRoundImage(mContext, it[0].realPath, 12, ivRoad)
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,15 +198,15 @@ class AuthTeamActivity : BaseActivity<ActivityAuthTeamBinding>(), View.OnClickLi
|
||||
|
||||
tvComDate.setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDate(this@AuthTeamActivity, "请选择有效期至") { year, month, day ->
|
||||
tvComDate.text = "$year-$month-$day"
|
||||
.showDate(this@AuthTeamActivity, "请选择有效期至") { date->
|
||||
tvComDate.text = date
|
||||
}
|
||||
}
|
||||
|
||||
tvPerStart.setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDate(this@AuthTeamActivity, "请选择有效期至") { year, month, day ->
|
||||
tvPerStart.text = "$year-$month-$day"
|
||||
.showDate(this@AuthTeamActivity, "请选择有效期至") { date ->
|
||||
tvPerStart.text = date
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,18 +8,26 @@ import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.GridItemAdapter
|
||||
import com.dahe.gldriver.adapter.WaybillAdapter
|
||||
import com.dahe.gldriver.bean.AuthTeamBean
|
||||
import com.dahe.gldriver.bean.GridBean
|
||||
import com.dahe.gldriver.databinding.FragmentHomeBinding
|
||||
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.waybill.activity.WaybillDetailActivity
|
||||
import com.dahe.glex.bean.OrderBean
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
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.ToastUtils
|
||||
import com.flyco.tablayout.listener.OnTabSelectListener
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import okhttp3.internal.wait
|
||||
|
||||
/**
|
||||
@ -53,6 +61,14 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
|
||||
binding.tvMar.isSelected = true
|
||||
|
||||
DataManager.getInstance().orderList()
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<MutableList<OrderBean>>(){
|
||||
override fun onSuccess(t: CommonResponseBean<MutableList<OrderBean>>) {
|
||||
super.onSuccess(t)
|
||||
}
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,8 +11,9 @@ import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.oss.OssServiceUtil
|
||||
import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.utils.PickerUtils
|
||||
import com.dahe.mylibrary.utils.LoadingUtils
|
||||
import com.dahe.mylibrary.utils.PopsUtils
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
@ -32,21 +33,38 @@ class OcrUtils private constructor() {
|
||||
* */
|
||||
fun ocrPerson(context: Context, activity: AppCompatActivity, listener: OnOcrPicResultListener) {
|
||||
PopsUtils.getInstance().showSimSelPic(context) { result ->
|
||||
LoadingUtils.instance.showLoading(activity)
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, activity)
|
||||
asyncPutImage(result[0].realPath, null)
|
||||
setResultCallBack { data, oldPath ->
|
||||
DataManager.getInstance().recognizeIdcard(oldPath)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(context, object : RxHttpCallBack<OcrPersonBean>(activity) {
|
||||
.subscribe(BaseObserver(context, object : RxHttpCallBack<OcrPersonBean>() {
|
||||
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
super.onSuccess(t)
|
||||
LoadingUtils.instance.dissLoading()
|
||||
t.data?.let {
|
||||
listener.onSuccResult(
|
||||
PicPath(result[0].realPath, oldPath), it
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCodeError(
|
||||
mContext: Context?,
|
||||
t: CommonResponseBean<OcrPersonBean>
|
||||
) {
|
||||
// super.onCodeError(mContext, t)
|
||||
LoadingUtils.instance.dissLoading()
|
||||
if (t.code == 500) {
|
||||
if (t.msg.contains("code: 400, The image type does not match the API operation")) {
|
||||
ToastUtils.showToast(mContext, "图片识别失败,请重新上传")
|
||||
} else {
|
||||
ToastUtils.showToast(mContext, t.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
@ -57,20 +75,47 @@ class OcrUtils private constructor() {
|
||||
* 驾驶证ocr识别
|
||||
* */
|
||||
fun ocrDriver(context: Context, activity: AppCompatActivity, listener: OnOcrPicResultListener) {
|
||||
PopsUtils.getInstance().showSimSelPic(context) {result->
|
||||
PopsUtils.getInstance().showSimSelPic(context) { result ->
|
||||
LoadingUtils.instance.showLoading(activity)
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, activity)
|
||||
asyncPutImage(result[0].realPath, null)
|
||||
setResultCallBack { data, oldPath ->
|
||||
DataManager.getInstance().recognizeDrivingLicense(oldPath)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
BaseObserver(
|
||||
context,
|
||||
object : RxHttpCallBack<OcrPersonBean>(activity) {
|
||||
object : RxHttpCallBack<OcrPersonBean>() {
|
||||
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
super.onSuccess(t)
|
||||
t.data?.let { listener.onSuccResult(PicPath(result[0].realPath, oldPath), it) }
|
||||
LoadingUtils.instance.dissLoading()
|
||||
t.data?.let {
|
||||
listener.onSuccResult(
|
||||
PicPath(
|
||||
result[0].realPath,
|
||||
oldPath
|
||||
), it
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCodeError(
|
||||
mContext: Context?,
|
||||
t: CommonResponseBean<OcrPersonBean>
|
||||
) {
|
||||
// super.onCodeError(mContext, t)
|
||||
LoadingUtils.instance.dissLoading()
|
||||
if (t.code == 500) {
|
||||
if (t.msg.contains("code: 400, The image type does not match the API operation")) {
|
||||
ToastUtils.showToast(
|
||||
mContext,
|
||||
"图片识别失败,请重新上传"
|
||||
)
|
||||
} else {
|
||||
ToastUtils.showToast(mContext, t.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
@ -88,7 +133,7 @@ class OcrUtils private constructor() {
|
||||
activity: AppCompatActivity,
|
||||
listener: OnOcrPicResultListener
|
||||
) {
|
||||
PopsUtils.getInstance().showSimSelPic(context) {result->
|
||||
PopsUtils.getInstance().showSimSelPic(context) { result ->
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, activity)
|
||||
@ -101,7 +146,32 @@ class OcrUtils private constructor() {
|
||||
object : RxHttpCallBack<OcrPersonBean>(activity) {
|
||||
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
super.onSuccess(t)
|
||||
t.data?.let { listener.onSuccResult(PicPath(result[0].realPath, oldPath), it) }
|
||||
t.data?.let {
|
||||
listener.onSuccResult(
|
||||
PicPath(
|
||||
result[0].realPath,
|
||||
oldPath
|
||||
), it
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCodeError(
|
||||
mContext: Context?,
|
||||
t: CommonResponseBean<OcrPersonBean>
|
||||
) {
|
||||
// super.onCodeError(mContext, t)
|
||||
LoadingUtils.instance.dissLoading()
|
||||
if (t.code == 500) {
|
||||
if (t.msg.contains("code: 400, The image type does not match the API operation")) {
|
||||
ToastUtils.showToast(
|
||||
mContext,
|
||||
"图片识别失败,请重新上传"
|
||||
)
|
||||
} else {
|
||||
ToastUtils.showToast(mContext, t.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
@ -119,7 +189,7 @@ class OcrUtils private constructor() {
|
||||
activity: AppCompatActivity,
|
||||
listener: OnOcrPicResultListener
|
||||
) {
|
||||
PopsUtils.getInstance().showSimSelPic(context) {result->
|
||||
PopsUtils.getInstance().showSimSelPic(context) { result ->
|
||||
//上传oss得到图片地址
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(result[0].realPath, activity)
|
||||
@ -132,7 +202,32 @@ class OcrUtils private constructor() {
|
||||
object : RxHttpCallBack<OcrPersonBean>(activity) {
|
||||
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
|
||||
super.onSuccess(t)
|
||||
t.data?.let { listener.onSuccResult(PicPath(result[0].realPath, oldPath), it) }
|
||||
t.data?.let {
|
||||
listener.onSuccResult(
|
||||
PicPath(
|
||||
result[0].realPath,
|
||||
oldPath
|
||||
), it
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCodeError(
|
||||
mContext: Context?,
|
||||
t: CommonResponseBean<OcrPersonBean>
|
||||
) {
|
||||
// super.onCodeError(mContext, t)
|
||||
LoadingUtils.instance.dissLoading()
|
||||
if (t.code == 500) {
|
||||
if (t.msg.contains("code: 400, The image type does not match the API operation")) {
|
||||
ToastUtils.showToast(
|
||||
mContext,
|
||||
"图片识别失败,请重新上传"
|
||||
)
|
||||
} else {
|
||||
ToastUtils.showToast(mContext, t.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.dahe.mylibrary.callback
|
||||
|
||||
/**
|
||||
* @ClassName OnMyDatePickedListener
|
||||
* @Author john
|
||||
* @Date 2024/3/1 10:26
|
||||
* @Description TODO
|
||||
*/
|
||||
fun interface OnMyDatePickedListener {
|
||||
fun onDatePicked(date: String)
|
||||
}
|
@ -11,9 +11,9 @@ public class CommonResponseBean<T> implements Serializable {
|
||||
private int code;
|
||||
private String info;
|
||||
private String msg;
|
||||
private String url;
|
||||
private int res;
|
||||
private String fileName;
|
||||
private int total;
|
||||
|
||||
private boolean success;
|
||||
|
||||
public int getRes() {
|
||||
@ -64,19 +64,12 @@ public class CommonResponseBean<T> implements Serializable {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
}
|
||||
|
@ -49,14 +49,14 @@ public class JsonInterceptor implements Interceptor {
|
||||
JSONObject jsonObject = new JSONObject(responseBodyStr);
|
||||
String str = jsonObject.optString("data");
|
||||
int code = jsonObject.optInt("code");
|
||||
if (-1 == code) {
|
||||
jsonObject.put("data", new JSONObject());
|
||||
throw new ResultException();
|
||||
} else {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
jsonObject.put("data", new JSONObject());
|
||||
}
|
||||
}
|
||||
// if (-1 == code) {
|
||||
// jsonObject.put("data", new JSONObject());
|
||||
// throw new ResultException();
|
||||
// } else {
|
||||
// if (TextUtils.isEmpty(str)) {
|
||||
// jsonObject.put("data", new JSONObject());
|
||||
// }
|
||||
// }
|
||||
|
||||
String data = jsonObject.toString();
|
||||
responseBody = ResponseBody.create(MediaType.parse("application/json; charset=utf-8"), data);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.dahe.mylibrary.utils
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.dahe.mylibrary.R
|
||||
import com.lxj.xpopup.XPopup
|
||||
import com.lxj.xpopup.impl.LoadingPopupView
|
||||
|
||||
@ -28,7 +29,7 @@ class LoadingUtils private constructor() {
|
||||
loadingPopup = XPopup.Builder(activity)
|
||||
.dismissOnBackPressed(false)
|
||||
.isLightNavigationBar(true)
|
||||
.asLoading(message, LoadingPopupView.Style.ProgressBar)
|
||||
.asLoading(message, LoadingPopupView.Style.Spinner)
|
||||
|
||||
return loadingPopup
|
||||
}
|
||||
@ -38,7 +39,8 @@ class LoadingUtils private constructor() {
|
||||
loadingPopup = XPopup.Builder(activity)
|
||||
.dismissOnBackPressed(true)
|
||||
.isLightNavigationBar(true)
|
||||
.asLoading(message, LoadingPopupView.Style.ProgressBar)
|
||||
// .asLoading(message, R.layout.custom_loading_popup,LoadingPopupView.Style.Spinner)
|
||||
.asLoading(message, LoadingPopupView.Style.Spinner)
|
||||
.show() as LoadingPopupView
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,11 @@ package com.dahe.mylibrary.utils
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
import com.dahe.mylibrary.callback.OnMyDatePickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.BirthdayPicker
|
||||
import com.github.gzuliyujiang.wheelpicker.DatePicker
|
||||
import com.github.gzuliyujiang.wheelpicker.OptionPicker
|
||||
import com.github.gzuliyujiang.wheelpicker.annotation.DateMode
|
||||
import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.entity.DateEntity
|
||||
@ -30,17 +33,46 @@ class PickerUtils private constructor() {
|
||||
activity: AppCompatActivity,
|
||||
title: String = "",
|
||||
dateEntity: DateEntity = DateEntity.today(),
|
||||
listener: OnDatePickedListener
|
||||
listener: OnMyDatePickedListener
|
||||
) {
|
||||
val picker = BirthdayPicker(activity)
|
||||
picker.setTitle(title)
|
||||
picker.setDefaultValue(1991, 11, 11)
|
||||
picker.setDefaultValue(dateEntity.year, dateEntity.month, dateEntity.day)
|
||||
picker.setOnDatePickedListener(listener)
|
||||
picker.setOnDatePickedListener { year, month, day ->
|
||||
if (listener != null)
|
||||
listener.onDatePicked("$year-${if (month <= 9) "0${month}" else month}-${if (day <= 9) "0${day}" else day}")
|
||||
}
|
||||
picker.wheelLayout.setResetWhenLinkage(false)
|
||||
picker.show()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* 底部弹出日期选择
|
||||
* @param activity
|
||||
* @param title 日期选择title
|
||||
* @param listener
|
||||
*/
|
||||
fun showDateSim(
|
||||
activity: AppCompatActivity,
|
||||
title: String = "",
|
||||
listener: OnMyDatePickedListener
|
||||
) {
|
||||
val picker = DatePicker(activity)
|
||||
picker.setTitle(title)
|
||||
val wheelLayout = picker.wheelLayout
|
||||
wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY)
|
||||
wheelLayout.setDateLabel("年", "月", "日")
|
||||
picker.setOnDatePickedListener { year, month, day ->
|
||||
listener.onDatePicked("$year-${if (month <= 9) "0${month}" else month}-${if (day <= 9) "0${day}" else day}")
|
||||
|
||||
}
|
||||
picker.show()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 选择驾驶证类型
|
||||
* @param activity
|
||||
|
@ -177,6 +177,9 @@ public final class TimeUtil {
|
||||
*/
|
||||
|
||||
private static final DateFormat DEFAULT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT_DATE = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT_DATE_POINT = new SimpleDateFormat("yyyy.MM.dd", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT_DATE_NONE = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZSS:SS", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault());
|
||||
|
||||
@ -215,7 +218,7 @@ public final class TimeUtil {
|
||||
* @return 毫秒时间戳
|
||||
*/
|
||||
public static long string2Millis(final String time) {
|
||||
if (TextUtils.isEmpty(time)){
|
||||
if (TextUtils.isEmpty(time)) {
|
||||
return -1;
|
||||
}
|
||||
return string2Millis(time, DEFAULT_FORMAT);
|
||||
@ -245,7 +248,7 @@ public final class TimeUtil {
|
||||
* @param time 时间字符串
|
||||
* @return 毫秒时间戳
|
||||
*/
|
||||
public static String string2String(final String time,final SimpleDateFormat format) {
|
||||
public static String string2String(final String time, final SimpleDateFormat format) {
|
||||
try {
|
||||
return date2String(format.parse(time));
|
||||
// return DEFAULT_FORMAT.format(DEFAULT_FORMAT2.parse(time).getTime());
|
||||
@ -421,7 +424,7 @@ public final class TimeUtil {
|
||||
* @return 合适型两个时间差
|
||||
*/
|
||||
public static String getFitTimeSpan(final String time0, final String time1, final int precision) {
|
||||
if (TextUtils.isEmpty(time0)||TextUtils.isEmpty(time1)){
|
||||
if (TextUtils.isEmpty(time0) || TextUtils.isEmpty(time1)) {
|
||||
return "";
|
||||
}
|
||||
return millis2FitTimeSpan(Math.abs(string2Millis(time0, DEFAULT_FORMAT) - string2Millis(time1, DEFAULT_FORMAT)), precision);
|
||||
@ -638,6 +641,24 @@ public final class TimeUtil {
|
||||
return getFitTimeSpan(getNowString(format), time, format, precision);
|
||||
}
|
||||
|
||||
|
||||
public static String changeDateFormat(String date) {
|
||||
long l = string2Millis(date,DEFAULT_FORMAT_DATE_POINT);
|
||||
if (l != -1) {
|
||||
return millis2String(l, DEFAULT_FORMAT_DATE);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public static String changeDateNoneFormat(String date) {
|
||||
long l = string2Millis(date,DEFAULT_FORMAT_DATE_NONE);
|
||||
if (l != -1) {
|
||||
return millis2String(l, DEFAULT_FORMAT_DATE);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取合适型与当前时间的差
|
||||
*
|
||||
@ -1685,7 +1706,7 @@ public final class TimeUtil {
|
||||
* @param compareDate
|
||||
* @return
|
||||
*/
|
||||
public static boolean compareDate(String nowDate, String compareDate,DateFormat format) {
|
||||
public static boolean compareDate(String nowDate, String compareDate, DateFormat format) {
|
||||
DateFormat df = format;
|
||||
try {
|
||||
Date now = df.parse(nowDate);
|
||||
|
16
mylibrary/src/main/res/layout/custom_loading_popup.xml
Normal file
16
mylibrary/src/main/res/layout/custom_loading_popup.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:padding="40dp"
|
||||
android:background="#EED3CFCF"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:indeterminate="false"
|
||||
android:indeterminateTintMode="src_atop"
|
||||
android:indeterminateTint="#FFFFFF"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"/>
|
||||
|
||||
</LinearLayout>
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#28B950</color>
|
||||
<color name="colorPrimaryDark">#28B950</color>
|
||||
<color name="colorPrimary">#FFFFFF</color>
|
||||
<color name="colorPrimaryDark">#FFFFFF</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
|
||||
<color name="colorWhite">#FFFFFFFF</color>
|
||||
|
Loading…
Reference in New Issue
Block a user