Compare commits
No commits in common. "a20419f577f28f70568aaf824ae79fdb5ab9fed8" and "5a9ada8d24c3f424eb256dd6f162c4795c7ac21a" have entirely different histories.
a20419f577
...
5a9ada8d24
@ -94,8 +94,8 @@ android {
|
|||||||
JPUSH_APPKEY : "fba6f55621c670d8c1fe9191",
|
JPUSH_APPKEY : "fba6f55621c670d8c1fe9191",
|
||||||
//暂时填写默认值即可.
|
//暂时填写默认值即可.
|
||||||
JPUSH_CHANNEL: "developer-n"]
|
JPUSH_CHANNEL: "developer-n"]
|
||||||
|
buildConfigField("String", "OPEN_AL_URL", "\"https://oapi-staging.alct56.com\"")
|
||||||
buildConfigField("String", "BASE_URL", "\"http://192.168.1.118:8082/devApi/\"")
|
buildConfigField("String", "BASE_URL", "\"http://192.168.1.118:8082/devApi/\"")
|
||||||
buildConfigField("String", "BASE_LJ_URL", "\"http://api.kehui56.cn/api/v1/\"")
|
|
||||||
// buildConfigField("String", "BASE_URL", "\"http://192.168.1.118:8080/devApi/\"")
|
// buildConfigField("String", "BASE_URL", "\"http://192.168.1.118:8080/devApi/\"")
|
||||||
// buildConfigField("String", "BASE_URL", "\"http://platform.test.v2.dahehuoyun.com/devApi/\"")
|
// buildConfigField("String", "BASE_URL", "\"http://platform.test.v2.dahehuoyun.com/devApi/\"")
|
||||||
buildConfigField "boolean", "isTest", "true"
|
buildConfigField "boolean", "isTest", "true"
|
||||||
@ -111,8 +111,8 @@ android {
|
|||||||
JPUSH_APPKEY : "fba6f55621c670d8c1fe9191",
|
JPUSH_APPKEY : "fba6f55621c670d8c1fe9191",
|
||||||
//暂时填写默认值即可.
|
//暂时填写默认值即可.
|
||||||
JPUSH_CHANNEL: "developer-default"]
|
JPUSH_CHANNEL: "developer-default"]
|
||||||
|
buildConfigField("String", "OPEN_AL_URL", "\"https://oapi.alct56.com\"")
|
||||||
buildConfigField("String", "BASE_URL", "\"http://app.dahehuoyun.com/api/\"")
|
buildConfigField("String", "BASE_URL", "\"http://app.dahehuoyun.com/api/\"")
|
||||||
buildConfigField("String", "BASE_LJ_URL", "\"https://api.kehui56.com/api/v1/\"")
|
|
||||||
buildConfigField "boolean", "isTest", "false"
|
buildConfigField "boolean", "isTest", "false"
|
||||||
resValue "string", "appName", "司机端"
|
resValue "string", "appName", "司机端"
|
||||||
}
|
}
|
||||||
@ -179,10 +179,10 @@ dependencies {
|
|||||||
|
|
||||||
//安联
|
//安联
|
||||||
//当引入的与之前引入的库有重复冲突部分的时候,使用compileOnly
|
//当引入的与之前引入的库有重复冲突部分的时候,使用compileOnly
|
||||||
// implementation files('libs\\mdp_sdk.jar')
|
implementation files('libs\\mdp_sdk.jar')
|
||||||
// implementation 'com.loopj.android:android-async-http:1.4.9'
|
implementation 'com.loopj.android:android-async-http:1.4.9'
|
||||||
// implementation 'com.j256.ormlite:ormlite-android:4.48'
|
implementation 'com.j256.ormlite:ormlite-android:4.48'
|
||||||
// implementation 'com.j256.ormlite:ormlite-core:4.48'
|
implementation 'com.j256.ormlite:ormlite-core:4.48'
|
||||||
implementation 'com.github.hotchemi:permissionsdispatcher:2.3.1'
|
implementation 'com.github.hotchemi:permissionsdispatcher:2.3.1'
|
||||||
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.3.1'
|
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.3.1'
|
||||||
|
|
||||||
|
BIN
app/libs/EsignSDK.aar
Normal file
BIN
app/libs/EsignSDK.aar
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libBaiduMapSDK_base_v5_1_0.so
Normal file
BIN
app/libs/arm64-v8a/libBaiduMapSDK_base_v5_1_0.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libBaiduMapSDK_map_v5_1_0.so
Normal file
BIN
app/libs/arm64-v8a/libBaiduMapSDK_map_v5_1_0.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/libindoor.so
Normal file
BIN
app/libs/arm64-v8a/libindoor.so
Normal file
Binary file not shown.
BIN
app/libs/arm64-v8a/liblocSDK7b.so
Normal file
BIN
app/libs/arm64-v8a/liblocSDK7b.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_base_v5_1_0.so
Normal file
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_base_v5_1_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_map_v5_1_0.so
Normal file
BIN
app/libs/armeabi-v7a/libBaiduMapSDK_map_v5_1_0.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libindoor.so
Normal file
BIN
app/libs/armeabi-v7a/libindoor.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/liblocSDK7b.so
Normal file
BIN
app/libs/armeabi-v7a/liblocSDK7b.so
Normal file
Binary file not shown.
BIN
app/libs/mdp_sdk.jar
Normal file
BIN
app/libs/mdp_sdk.jar
Normal file
Binary file not shown.
@ -91,13 +91,13 @@
|
|||||||
android:name="android.notch_support"
|
android:name="android.notch_support"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
|
|
||||||
<!-- <meta-data-->
|
<meta-data
|
||||||
<!-- android:name="com.amap.api.v2.apikey"-->
|
android:name="com.amap.api.v2.apikey"
|
||||||
<!-- android:value="78019612271411eca3af34db91930620" />-->
|
android:value="78019612271411eca3af34db91930620" />
|
||||||
|
|
||||||
<!-- <service-->
|
<service
|
||||||
<!-- android:name="com.amap.api.location.APSService"-->
|
android:name="com.amap.api.location.APSService"
|
||||||
<!-- android:foregroundServiceType="location" />-->
|
android:foregroundServiceType="location" />
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||||
|
@ -8,6 +8,7 @@ import android.os.Process
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import cn.jiguang.api.utils.JCollectionAuth
|
import cn.jiguang.api.utils.JCollectionAuth
|
||||||
import cn.jpush.android.api.JPushInterface
|
import cn.jpush.android.api.JPushInterface
|
||||||
|
import com.alct.mdp.MDPLocationCollectionManager
|
||||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig
|
import com.arpa.hndahesudintocctmsdriver.BuildConfig
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.Api
|
import com.arpa.hndahesudintocctmsdriver.net.Api
|
||||||
import com.arpa.hndahesudintocctmsdriver.oss.OssServiceUtil
|
import com.arpa.hndahesudintocctmsdriver.oss.OssServiceUtil
|
||||||
@ -97,7 +98,7 @@ class App : Application() {
|
|||||||
//安联初始化
|
//安联初始化
|
||||||
if (packageName == getCurrentProcessName(this)) {
|
if (packageName == getCurrentProcessName(this)) {
|
||||||
//Log.e("--使用的测试环境--",BuildConfig.OPEN_API_URL);
|
//Log.e("--使用的测试环境--",BuildConfig.OPEN_API_URL);
|
||||||
// MDPLocationCollectionManager.initialize(applicationContext, BuildConfig.OPEN_AL_URL)
|
MDPLocationCollectionManager.initialize(applicationContext, BuildConfig.OPEN_AL_URL)
|
||||||
// MDPLocationCollectionManager.initServiceProcessProguard(applicationContext) // 保活代码
|
// MDPLocationCollectionManager.initServiceProcessProguard(applicationContext) // 保活代码
|
||||||
// startService(Intent(this, PlayerMusicService::class.java)) // 保活代码
|
// startService(Intent(this, PlayerMusicService::class.java)) // 保活代码
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.base
|
|
||||||
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hlh
|
|
||||||
* @version 1.0.0
|
|
||||||
* @date 2022/1/10 11:34
|
|
||||||
* @description:交通厅参数
|
|
||||||
*/
|
|
||||||
object NewLJConstant {
|
|
||||||
const val ENTER_PRISE_CODE: String = "E0019169"
|
|
||||||
|
|
||||||
val ENTER_PRISE_IDENTITY: String = if (BuildConfig.isTest) "95033cc3492e420d83d7f09eea1400ac" else "9179388b0e0847e1862d6400f9cbc778"
|
|
||||||
|
|
||||||
val ENTER_PRISE_KEY: String =
|
|
||||||
if (BuildConfig.isTest) "e9844a9b0bba417e89cb8623489abd2f" else "156d724e9701420198fcbd52cb1ca529"
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.bean
|
|
||||||
|
|
||||||
import java.io.Serializable
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName NewLjBean
|
|
||||||
* @Author john
|
|
||||||
* @Date 2025/1/21 09:16
|
|
||||||
* @Description TODO
|
|
||||||
*/
|
|
||||||
data class LjTokenBean(
|
|
||||||
var enterpriseCode: String = "",
|
|
||||||
var enterpriseIdentity: String = "",
|
|
||||||
var enterpriseKey: String = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
data class PickupBean(
|
|
||||||
var shipmentCode: String = "", var enterpriseCode: String = "", var location: GDLocation? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
data class GDLocation(
|
|
||||||
var baiduLongitude: Double = 0.0,
|
|
||||||
var baiduLatitude: Double = 0.0,
|
|
||||||
var location: String = "",
|
|
||||||
var time: String = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
data class UpimgBean(
|
|
||||||
var shipmentCode: String = "",
|
|
||||||
var enterpriseCode: String = "",
|
|
||||||
var image: GDImage? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
data class GDImage(
|
|
||||||
var fileName: String = "",
|
|
||||||
var fileData: String = "",
|
|
||||||
var fileExt: String = "",
|
|
||||||
var imageTakenDate: String = "",
|
|
||||||
var baiduLongitude: Double = 0.0,
|
|
||||||
var baiduLatitude: Double = 0.0,
|
|
||||||
var location: String = "",
|
|
||||||
var time: String = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
data class InvoiceBean(
|
|
||||||
var driverIdentification: String = "",
|
|
||||||
var driverInvoiceCode: String = "",
|
|
||||||
var enterpriseCode: String = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ShipmentStatusBean(var shipmentCode: String = "", var enterpriseCode: String = "")
|
|
||||||
|
|
||||||
|
|
||||||
data class InvoicesBean(
|
|
||||||
var totalPage: String? = null,
|
|
||||||
var totalCount: String? = null,
|
|
||||||
var pageSize: String? = null,
|
|
||||||
var currentPage: String? = null,
|
|
||||||
var sortField: String? = null,
|
|
||||||
var sortDirection: String? = null,
|
|
||||||
var driverInvoices: List<DataDTO>? = null
|
|
||||||
) : Serializable {
|
|
||||||
|
|
||||||
data class DataDTO(
|
|
||||||
var taxAmount: String? = null,
|
|
||||||
var totalAmount: String? = null,
|
|
||||||
var invoiceReceiverName: String? = null,
|
|
||||||
var totalAmountIncludeTax: String? = null,
|
|
||||||
var driverInvoiceCode: String? = null,
|
|
||||||
var taxRate: String? = null
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.callback
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName OnGDDownloadResultListener
|
|
||||||
* @Author john
|
|
||||||
* @Date 2025/1/21 10:40
|
|
||||||
* @Description TODO
|
|
||||||
*/
|
|
||||||
interface OnGDDownloadResultListener {
|
|
||||||
fun onSuccess(var1: String)
|
|
||||||
|
|
||||||
fun onFailure(code: String, message: String)
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.callback
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName OnGDResultListener
|
|
||||||
* @Author john
|
|
||||||
* @Date 2025/1/21 10:14
|
|
||||||
* @Description TODO
|
|
||||||
*/
|
|
||||||
interface OnGDResultListener {
|
|
||||||
fun onSuccess()
|
|
||||||
|
|
||||||
fun onFailure(code: String, message: String)
|
|
||||||
}
|
|
@ -1,36 +1,26 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.net
|
package com.arpa.hndahesudintocctmsdriver.net
|
||||||
|
|
||||||
import com.arpa.glex.bean.*
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig
|
import com.arpa.hndahesudintocctmsdriver.BuildConfig
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.AppVersion
|
import com.arpa.hndahesudintocctmsdriver.bean.AppVersion
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.AuthTeamBean
|
import com.arpa.hndahesudintocctmsdriver.bean.AuthTeamBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.CaptainBean
|
import com.arpa.hndahesudintocctmsdriver.bean.CaptainBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.CarBean
|
import com.arpa.hndahesudintocctmsdriver.bean.CarBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.CarDetail
|
import com.arpa.hndahesudintocctmsdriver.bean.CarDetail
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.CashConfig
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.DiCarColor
|
import com.arpa.hndahesudintocctmsdriver.bean.DiCarColor
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.DriverBean
|
import com.arpa.hndahesudintocctmsdriver.bean.DriverBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.FaceBean
|
import com.arpa.hndahesudintocctmsdriver.bean.FaceBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.InviteRecord
|
import com.arpa.hndahesudintocctmsdriver.bean.InviteRecord
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.InvoiceBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.InvoicesBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.LjTokenBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.MessageBean
|
import com.arpa.hndahesudintocctmsdriver.bean.MessageBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.MyJtt
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.MyLocation
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.OcrPersonBean
|
import com.arpa.hndahesudintocctmsdriver.bean.OcrPersonBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.OrderChild
|
import com.arpa.hndahesudintocctmsdriver.bean.OrderChild
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.OrderDetailBean
|
import com.arpa.hndahesudintocctmsdriver.bean.OrderDetailBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.OssBean
|
import com.arpa.hndahesudintocctmsdriver.bean.OssBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.PickupBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.ProBean
|
import com.arpa.hndahesudintocctmsdriver.bean.ProBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.QueDetail
|
import com.arpa.hndahesudintocctmsdriver.bean.QueDetail
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.QuestionBean
|
import com.arpa.hndahesudintocctmsdriver.bean.QuestionBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.RateBean
|
import com.arpa.hndahesudintocctmsdriver.bean.RateBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.ShipmentStatusBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpBankInfoBean
|
import com.arpa.hndahesudintocctmsdriver.bean.UpBankInfoBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpCaptain
|
import com.arpa.hndahesudintocctmsdriver.bean.UpCaptain
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpCashBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpDriverCar
|
import com.arpa.hndahesudintocctmsdriver.bean.UpDriverCar
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpDriverInfoBean
|
import com.arpa.hndahesudintocctmsdriver.bean.UpDriverInfoBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpDrivingInfoBean
|
import com.arpa.hndahesudintocctmsdriver.bean.UpDrivingInfoBean
|
||||||
@ -42,18 +32,19 @@ import com.arpa.hndahesudintocctmsdriver.bean.UpPicBean
|
|||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpQualiInfoBean
|
import com.arpa.hndahesudintocctmsdriver.bean.UpQualiInfoBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpRate
|
import com.arpa.hndahesudintocctmsdriver.bean.UpRate
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpRoadInfoBean
|
import com.arpa.hndahesudintocctmsdriver.bean.UpRoadInfoBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpimgBean
|
import com.arpa.glex.bean.*
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.bean.CashConfig
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.bean.MyJtt
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.bean.MyLocation
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.bean.UpCashBean
|
||||||
import com.arpa.mylibrary.net.CommonResponseBean
|
import com.arpa.mylibrary.net.CommonResponseBean
|
||||||
import io.reactivex.rxjava3.core.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
import retrofit2.http.Multipart
|
import retrofit2.http.Multipart
|
||||||
import retrofit2.http.POST
|
import retrofit2.http.POST
|
||||||
import retrofit2.http.PUT
|
|
||||||
import retrofit2.http.Part
|
import retrofit2.http.Part
|
||||||
import retrofit2.http.Path
|
|
||||||
import retrofit2.http.Query
|
import retrofit2.http.Query
|
||||||
|
|
||||||
|
|
||||||
@ -671,149 +662,10 @@ interface Api {
|
|||||||
@GET(BASE_URL + "driver/message/read")
|
@GET(BASE_URL + "driver/message/read")
|
||||||
fun messageRead(@Query("messageId") messageId: String): Observable<CommonResponseBean<Any>>
|
fun messageRead(@Query("messageId") messageId: String): Observable<CommonResponseBean<Any>>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********安联开始***********/
|
|
||||||
|
|
||||||
@POST(BASE_LJ_URL + "openapi/enterprises/login")
|
|
||||||
fun getToken(@Body bean: LjTokenBean?): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
@POST(BASE_LJ_URL + "openapi/enterprises/login")
|
|
||||||
fun getRefreshToken(@Body bean: LjTokenBean?): Call<HashMap<String, String>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单提货
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@POST(BASE_LJ_URL + "openapi/shipments/pickup")
|
|
||||||
fun pickup(@Body bean: PickupBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单卸货
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@POST(BASE_LJ_URL + "openapi/shipments/unload")
|
|
||||||
fun unload(@Body bean: PickupBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单签收
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@POST(BASE_LJ_URL + "openapi/shipments/sign")
|
|
||||||
fun sign(@Body bean: PickupBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单回单
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@POST(BASE_LJ_URL + "openapi/shipments/pod")
|
|
||||||
fun pod(@Body bean: PickupBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单提货照片上传
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@POST(BASE_LJ_URL + "openapi/shipments/uploadPickupImage")
|
|
||||||
fun uploadPickupImage(@Body bean: UpimgBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单卸货照片上传
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@POST(BASE_LJ_URL + "openapi/shipments/uploadUnloadImage")
|
|
||||||
fun uploadUnloadImage(@Body bean: UpimgBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单回单照片上传
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@POST(BASE_LJ_URL + "openapi/shipments/uploadPODImage")
|
|
||||||
fun uploadPODImage(@Body bean: UpimgBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同意发票申请
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PUT(BASE_LJ_URL + "openapi/confirmInvoice")
|
|
||||||
fun confirmInvoice(@Body bean: InvoiceBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 待同意发票列表获取
|
|
||||||
* @param enterpriseCodeParam
|
|
||||||
* @param driverIdentification
|
|
||||||
* @param currentPage
|
|
||||||
* @param pageSize
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GET(BASE_LJ_URL + "openapi/getInvoices")
|
|
||||||
fun getInvoices(
|
|
||||||
@Query("enterpriseCodeParam") enterpriseCodeParam: String?,
|
|
||||||
@Query("driverIdentification") driverIdentification: String?,
|
|
||||||
@Query("currentPage") currentPage: Int,
|
|
||||||
@Query("pageSize") pageSize: Int
|
|
||||||
): Observable<CommonResponseBean<InvoicesBean>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取运单状态
|
|
||||||
* @param bean
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@POST(BASE_LJ_URL + "/openapi/getShipmentStatus")
|
|
||||||
fun getShipmentStatus(@Body bean: ShipmentStatusBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
@POST(BASE_LJ_URL + "/openapi/shipments/getPODImageNames")
|
|
||||||
fun getPODImageNames(@Body bean: ShipmentStatusBean): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
@GET("$BASE_LJ_URL/openapi/drivers")
|
|
||||||
fun searchDriver(@Query("identityNo") identityNo: String): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 司机车辆绑定关系
|
|
||||||
* @param identityNo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GET(BASE_LJ_URL + "openapi/drivers/{identityNo}/trucks")
|
|
||||||
fun trucks(@Path("identityNo") identityNo: String): Observable<CommonResponseBean<Any>>
|
|
||||||
|
|
||||||
|
|
||||||
/*********安联结束***********/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
// String BASE_URL = "https://tmstest.dahehuoyun.com/";
|
// String BASE_URL = "https://tmstest.dahehuoyun.com/";
|
||||||
const val BASE_URL = BuildConfig.BASE_URL
|
const val BASE_URL = BuildConfig.BASE_URL
|
||||||
|
|
||||||
const val BASE_LJ_URL: String =BuildConfig.BASE_LJ_URL
|
|
||||||
|
|
||||||
//获取版本
|
//获取版本
|
||||||
const val VERSION = BASE_URL + "app/version"
|
const val VERSION = BASE_URL + "app/version"
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.arpa.hndahesudintocctmsdriver.net
|
|||||||
|
|
||||||
import com.arpa.mylibrary.CommonBaseLibrary
|
import com.arpa.mylibrary.CommonBaseLibrary
|
||||||
import com.arpa.mylibrary.base.BaseSingNoParam
|
import com.arpa.mylibrary.base.BaseSingNoParam
|
||||||
|
import com.arpa.mylibrary.net.JsonInterceptor
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.core.ObservableTransformer
|
import io.reactivex.rxjava3.core.ObservableTransformer
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
@ -1,120 +0,0 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.net;
|
|
||||||
|
|
||||||
import static com.arpa.mylibrary.utils.BaseSPUtils.NEW_LJ_TOKEN;
|
|
||||||
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig;
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.base.App;
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.base.NewLJConstant;
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.LjTokenBean;
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.utils.SPUtils;
|
|
||||||
import com.arpa.mylibrary.CommonBaseLibrary;
|
|
||||||
import com.arpa.mylibrary.net.ResultException;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import kotlin.jvm.Synchronized;
|
|
||||||
import okhttp3.Interceptor;
|
|
||||||
import okhttp3.MediaType;
|
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import okhttp3.ResponseBody;
|
|
||||||
import okio.Buffer;
|
|
||||||
import okio.BufferedSource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* json的Interceptor
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class JsonInterceptor implements Interceptor {
|
|
||||||
private static final String TAG = "JsonInterceptor";
|
|
||||||
|
|
||||||
public JsonInterceptor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Response intercept(Chain chain) throws IOException {
|
|
||||||
Request request = chain.request();
|
|
||||||
Response response = chain.proceed(request);
|
|
||||||
ResponseBody responseBody = response.body();
|
|
||||||
//为了不消耗buffer,我们这里使用source先获得buffer对象,然后clone()后使用
|
|
||||||
BufferedSource source = responseBody.source();
|
|
||||||
source.request(Long.MAX_VALUE); // Buffer the entire body.
|
|
||||||
//获得返回的数据
|
|
||||||
Buffer buffer = source.buffer();
|
|
||||||
//使用前clone()下,避免直接消耗
|
|
||||||
String responseBodyStr = buffer.clone().readString(Charset.forName("UTF-8"));
|
|
||||||
Log.i(TAG, "result-body= " + responseBodyStr);
|
|
||||||
try {
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject(responseBodyStr);
|
|
||||||
String str = jsonObject.optString("data");
|
|
||||||
int code = jsonObject.optInt("code");
|
|
||||||
String url = request.url().url().toString();
|
|
||||||
|
|
||||||
//判断是否是路交接口
|
|
||||||
if (url.startsWith(BuildConfig.BASE_LJ_URL)){
|
|
||||||
if (401 == code) {
|
|
||||||
refreshToken();
|
|
||||||
response.close();
|
|
||||||
try {
|
|
||||||
return chain.proceed(request);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (-1 == code) {
|
|
||||||
jsonObject.put("data", new JSONObject());
|
|
||||||
throw new ResultException();
|
|
||||||
} else {
|
|
||||||
if (TextUtils.isEmpty(str)) {
|
|
||||||
jsonObject.put("data", new JSONObject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}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);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
response = response.newBuilder().body(responseBody).build();
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Synchronized
|
|
||||||
private void refreshToken() throws IOException {
|
|
||||||
Api api = CommonBaseLibrary.getRetrofit().newBuilder()
|
|
||||||
.client(new OkHttpClient.Builder()
|
|
||||||
.connectTimeout(30, TimeUnit.SECONDS)
|
|
||||||
.readTimeout(30, TimeUnit.SECONDS)
|
|
||||||
.writeTimeout(30, TimeUnit.SECONDS)
|
|
||||||
.build())
|
|
||||||
// .addNetworkInterceptor(new TokenInterceptor())
|
|
||||||
.build().create(Api.class);
|
|
||||||
LjTokenBean ljTokenBean = new LjTokenBean();
|
|
||||||
ljTokenBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE);
|
|
||||||
ljTokenBean.setEnterpriseIdentity(NewLJConstant.INSTANCE.getENTER_PRISE_IDENTITY());
|
|
||||||
ljTokenBean.setEnterpriseKey(NewLJConstant.INSTANCE.getENTER_PRISE_KEY());
|
|
||||||
retrofit2.Response<HashMap<String, String>> execute = api.getRefreshToken(ljTokenBean).execute();
|
|
||||||
if (execute.body() != null) {
|
|
||||||
String refreshToken = execute.body().get("token");
|
|
||||||
SPUtils.put(App.Companion.getApp(), NEW_LJ_TOKEN, refreshToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,104 @@
|
|||||||
|
package com.arpa.hndahesudintocctmsdriver.third
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.Log
|
||||||
|
import com.alct.mdp.MDPLocationCollectionManager
|
||||||
|
import com.alct.mdp.callback.OnDownloadResultListener
|
||||||
|
import com.alct.mdp.callback.OnResultListener
|
||||||
|
import com.alct.mdp.model.Identity
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.BuildConfig
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.bean.FqBean
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.utils.SPUtils
|
||||||
|
import com.google.gson.Gson
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hlh
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2021/8/16 10:35
|
||||||
|
* @description:安联流程
|
||||||
|
*/
|
||||||
|
class ALProcess {
|
||||||
|
companion object {
|
||||||
|
//企业代码
|
||||||
|
private const val ENTERPRISE_CODE = "E0019169"
|
||||||
|
|
||||||
|
//企业app的身份码
|
||||||
|
private const val APP_IDENTITY = "b4a472a025e443b383970cdd5465552e"
|
||||||
|
|
||||||
|
//企业app验证码
|
||||||
|
private const val APP_KEY = "b948efbb4c2a4ba0805c534f2fba0c89"
|
||||||
|
|
||||||
|
//企业代码-测试
|
||||||
|
private const val ENTERPRISE_CODE_TEXT = "E0019093"
|
||||||
|
|
||||||
|
//企业app的身份码-测试
|
||||||
|
private const val APP_IDENTITY_TEXT = "a15b4ba5bd2542cc9a6bea9bdadf9ef9"
|
||||||
|
|
||||||
|
//企业app验证码-测试
|
||||||
|
private const val APP_KEY_TEXT = "07a6256cad5642138ed6e962a5a157be"
|
||||||
|
fun verification(con: Context?) {
|
||||||
|
val userInfo = SPUtils.instance.getUserInfo(con)
|
||||||
|
val idy = Identity()
|
||||||
|
//企业代码
|
||||||
|
idy.enterpriseCode = if (BuildConfig.isTest) ENTERPRISE_CODE_TEXT else ENTERPRISE_CODE
|
||||||
|
//企业app的身份码
|
||||||
|
idy.appIdentity = if (BuildConfig.isTest) APP_IDENTITY_TEXT else APP_IDENTITY
|
||||||
|
//企业app验证码
|
||||||
|
idy.appKey = if (BuildConfig.isTest) APP_KEY_TEXT else APP_KEY
|
||||||
|
//司机身份证
|
||||||
|
idy.driverIdentity = userInfo?.idcard
|
||||||
|
// idy.driverIdentity = "410423199703041014"
|
||||||
|
MDPLocationCollectionManager.register(con, idy, object : OnResultListener {
|
||||||
|
override fun onSuccess() {
|
||||||
|
Log.e("--success--", "验证成功")
|
||||||
|
getFq(con)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(s: String, s1: String) {
|
||||||
|
Log.e("--error--", s + s1 + "")
|
||||||
|
// new MessageUtils().showCenMessage(con,s1);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getFq(con: Context?) {
|
||||||
|
MDPLocationCollectionManager.getInvoices(
|
||||||
|
con,
|
||||||
|
100,
|
||||||
|
1,
|
||||||
|
object : OnDownloadResultListener {
|
||||||
|
override fun onSuccess(o: Any) {
|
||||||
|
Log.e("--获取发票列表成功--", Gson().toJson(o))
|
||||||
|
try {
|
||||||
|
val fb = Gson().fromJson(Gson().toJson(o), FqBean::class.java)
|
||||||
|
applyFq(con, fb)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("--失败--", "数据解析失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(s: String, s1: String) {
|
||||||
|
Log.e("--获取发票列表失败--", s + s1 + "")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun applyFq(con: Context?, fb: FqBean) {
|
||||||
|
for (driverInvoice in fb.driverInvoices) {
|
||||||
|
MDPLocationCollectionManager.confirmInvoice(
|
||||||
|
con,
|
||||||
|
if (BuildConfig.isTest) ENTERPRISE_CODE_TEXT else ENTERPRISE_CODE,
|
||||||
|
driverInvoice.driverInvoiceCode,
|
||||||
|
object : OnResultListener {
|
||||||
|
override fun onSuccess() {
|
||||||
|
Log.e("--成功--", "申请发票成功")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(s: String, s1: String) {
|
||||||
|
Log.e("--失败--", "申请发票失败$s$s1")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,8 +6,10 @@ import android.os.Bundle
|
|||||||
import android.os.Process
|
import android.os.Process
|
||||||
import cn.jiguang.api.utils.JCollectionAuth
|
import cn.jiguang.api.utils.JCollectionAuth
|
||||||
import cn.jpush.android.api.JPushInterface
|
import cn.jpush.android.api.JPushInterface
|
||||||
|
import com.alct.mdp.MDPLocationCollectionManager
|
||||||
import com.amap.api.location.AMapLocationClient
|
import com.amap.api.location.AMapLocationClient
|
||||||
import com.amap.api.maps.MapsInitializer
|
import com.amap.api.maps.MapsInitializer
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.BuildConfig
|
||||||
import com.arpa.hndahesudintocctmsdriver.databinding.ActivityLauncherBinding
|
import com.arpa.hndahesudintocctmsdriver.databinding.ActivityLauncherBinding
|
||||||
import com.arpa.hndahesudintocctmsdriver.third.JTTProcess
|
import com.arpa.hndahesudintocctmsdriver.third.JTTProcess
|
||||||
import com.arpa.hndahesudintocctmsdriver.third.SPUtil
|
import com.arpa.hndahesudintocctmsdriver.third.SPUtil
|
||||||
@ -80,7 +82,10 @@ class LauncherActivity : BaseActivity<ActivityLauncherBinding>() {
|
|||||||
//安联初始化
|
//安联初始化
|
||||||
if (packageName == getCurrentProcessName(this)) {
|
if (packageName == getCurrentProcessName(this)) {
|
||||||
//Log.e("--使用的测试环境--",BuildConfig.OPEN_API_URL);
|
//Log.e("--使用的测试环境--",BuildConfig.OPEN_API_URL);
|
||||||
|
MDPLocationCollectionManager.initialize(
|
||||||
|
applicationContext,
|
||||||
|
BuildConfig.OPEN_AL_URL
|
||||||
|
)
|
||||||
}
|
}
|
||||||
//初始化交通厅
|
//初始化交通厅
|
||||||
JTTProcess.init(application)
|
JTTProcess.init(application)
|
||||||
|
@ -20,6 +20,7 @@ import com.arpa.hndahesudintocctmsdriver.event.GoWaybillEvent
|
|||||||
import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
|
import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.third.ALProcess
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.home.activity.BusinessActivity
|
import com.arpa.hndahesudintocctmsdriver.ui.home.activity.BusinessActivity
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.mine.activity.PersonInfoActivity
|
import com.arpa.hndahesudintocctmsdriver.ui.mine.activity.PersonInfoActivity
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillDetailActivity
|
import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillDetailActivity
|
||||||
@ -206,8 +207,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
|||||||
|
|
||||||
|
|
||||||
// getLocation()
|
// getLocation()
|
||||||
//安联认证
|
ALProcess.verification(mContext)
|
||||||
// ALProcess.verification(mContext)
|
|
||||||
//证件过期判断+轨迹上传判断
|
//证件过期判断+轨迹上传判断
|
||||||
DataManager.getInstance().getUserInfo()
|
DataManager.getInstance().getUserInfo()
|
||||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||||
@ -220,7 +220,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
|||||||
|
|
||||||
//初始化安联
|
//初始化安联
|
||||||
if (t.data.auditStatus == "100003") {
|
if (t.data.auditStatus == "100003") {
|
||||||
|
ALProcess.verification(mContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
//执行中运单轨迹上传
|
//执行中运单轨迹上传
|
||||||
|
@ -3,17 +3,19 @@ package com.arpa.hndahesudintocctmsdriver.ui.waybill.activity
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import com.alct.mdp.MDPLocationCollectionManager
|
||||||
|
import com.alct.mdp.callback.OnResultListener
|
||||||
|
import com.alct.mdp.model.Goods
|
||||||
|
import com.alct.mdp.model.Image
|
||||||
|
import com.alct.mdp.model.Location
|
||||||
import com.amap.api.maps.model.LatLng
|
import com.amap.api.maps.model.LatLng
|
||||||
import com.arpa.hndahesudintocctmsdriver.base.AppConfig
|
import com.arpa.hndahesudintocctmsdriver.base.AppConfig
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.GDImage
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.GDLocation
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.LUInputBean
|
import com.arpa.hndahesudintocctmsdriver.bean.LUInputBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.OrderDetailBean
|
import com.arpa.hndahesudintocctmsdriver.bean.OrderDetailBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpPicBean
|
import com.arpa.hndahesudintocctmsdriver.bean.UpPicBean
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.WaybillPhoto
|
import com.arpa.hndahesudintocctmsdriver.bean.WaybillPhoto
|
||||||
import com.arpa.hndahesudintocctmsdriver.callback.OnGDDownloadResultListener
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.callback.OnGDResultListener
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.databinding.ActivityWaybillUppicBinding
|
import com.arpa.hndahesudintocctmsdriver.databinding.ActivityWaybillUppicBinding
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
|
import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
||||||
@ -21,7 +23,6 @@ import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
|||||||
import com.arpa.hndahesudintocctmsdriver.oss.OssServiceUtil
|
import com.arpa.hndahesudintocctmsdriver.oss.OssServiceUtil
|
||||||
import com.arpa.hndahesudintocctmsdriver.third.JTTProcess
|
import com.arpa.hndahesudintocctmsdriver.third.JTTProcess
|
||||||
import com.arpa.hndahesudintocctmsdriver.utils.GDLocationUtils
|
import com.arpa.hndahesudintocctmsdriver.utils.GDLocationUtils
|
||||||
import com.arpa.hndahesudintocctmsdriver.utils.NewLJUtils
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.utils.OcrUtils
|
import com.arpa.hndahesudintocctmsdriver.utils.OcrUtils
|
||||||
import com.arpa.hndahesudintocctmsdriver.utils.OrderUtils
|
import com.arpa.hndahesudintocctmsdriver.utils.OrderUtils
|
||||||
import com.arpa.mylibrary.adapter.GridImageAdapter
|
import com.arpa.mylibrary.adapter.GridImageAdapter
|
||||||
@ -124,15 +125,14 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
var myAdapter = GridImageAdapter(mContext, mData)
|
var myAdapter = GridImageAdapter(mContext, mData)
|
||||||
myAdapter.selectMax = if (type == 2) 6 else 1
|
myAdapter.selectMax = if (type==2) 6 else 1
|
||||||
myAdapter.setOnItemClickListener(object : OnItemClickListener {
|
myAdapter.setOnItemClickListener(object : OnItemClickListener {
|
||||||
override fun onItemClick(v: View?, position: Int) {
|
override fun onItemClick(v: View?, position: Int) {
|
||||||
PopsUtils.getInstance()
|
PopsUtils.getInstance()
|
||||||
.showSelPic(mContext, if (type == 2) 6 else 1, true, myAdapter) { it ->
|
.showSelPic(mContext, if (type==2) 6 else 1, true, myAdapter) { it ->
|
||||||
OssServiceUtil.getInstance().asyncPutImages(
|
OssServiceUtil.getInstance().asyncPutImages(it.map { it.availablePath },this@WaybillUpPicActivity
|
||||||
it.map { it.availablePath }, this@WaybillUpPicActivity
|
|
||||||
) { success, failure ->
|
) { success, failure ->
|
||||||
upBean.waybillPhotoList.removeAll { it.type == "3" }
|
upBean.waybillPhotoList.removeAll { it.type=="3" }
|
||||||
success.forEachIndexed { index, s ->
|
success.forEachIndexed { index, s ->
|
||||||
picBean = WaybillPhoto()
|
picBean = WaybillPhoto()
|
||||||
picBean.run {
|
picBean.run {
|
||||||
@ -157,11 +157,10 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
|
|
||||||
override fun openPicture() {
|
override fun openPicture() {
|
||||||
PopsUtils.getInstance()
|
PopsUtils.getInstance()
|
||||||
.showSelPic(mContext, if (type == 2) 6 else 1, true, myAdapter) { it ->
|
.showSelPic(mContext, if (type==2) 6 else 1, true, myAdapter) { it ->
|
||||||
OssServiceUtil.getInstance().asyncPutImages(
|
OssServiceUtil.getInstance().asyncPutImages(it.map { it.availablePath },this@WaybillUpPicActivity
|
||||||
it.map { it.availablePath }, this@WaybillUpPicActivity
|
|
||||||
) { success, failure ->
|
) { success, failure ->
|
||||||
upBean.waybillPhotoList.removeAll { it.type == "3" }
|
upBean.waybillPhotoList.removeAll { it.type=="3" }
|
||||||
success.forEachIndexed { index, s ->
|
success.forEachIndexed { index, s ->
|
||||||
picBean = WaybillPhoto()
|
picBean = WaybillPhoto()
|
||||||
picBean.run {
|
picBean.run {
|
||||||
@ -264,7 +263,7 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val dis =
|
var dis =
|
||||||
TimeUtil.compareNowDate(TimeUtil.string2Millis(orderBean.waybillInfo.loadTime))
|
TimeUtil.compareNowDate(TimeUtil.string2Millis(orderBean.waybillInfo.loadTime))
|
||||||
if (dis <= 5) { //大于五分钟可以接单
|
if (dis <= 5) { //大于五分钟可以接单
|
||||||
ToastUtils.showToast(this@WaybillUpPicActivity, "请到卸货地再进行卸货操作!")
|
ToastUtils.showToast(this@WaybillUpPicActivity, "请到卸货地再进行卸货操作!")
|
||||||
@ -272,28 +271,57 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val l = GDLocation().apply {
|
val l = Location()
|
||||||
baiduLongitude = bdLatLng.longitude
|
l.baiduLongitude = bdLatLng.longitude
|
||||||
baiduLatitude = bdLatLng.latitude
|
l.baiduLatitude = bdLatLng.latitude
|
||||||
location = binding.tvLoca.text.toString()
|
l.location = binding.tvLoca.text.toString()
|
||||||
time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
l.time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||||
}
|
|
||||||
|
|
||||||
if (orderType == 1) {//装货
|
if (orderType == 1) {//装货
|
||||||
load(l)
|
load(l)
|
||||||
} else {//卸货
|
} else {//卸货
|
||||||
unLoad(l)
|
unLoad(l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// DataManager.getInstance().driverLoadOrUnload(upBean)
|
||||||
|
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||||
|
// .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
||||||
|
// override fun onSuccess(t: CommonResponseBean<Any>) {
|
||||||
|
// super.onSuccess(t)
|
||||||
|
// if (1 == orderType) {
|
||||||
|
// ActivityUtils.startActivity(
|
||||||
|
// mContext,
|
||||||
|
// WaybillSuccActivity::class.java,
|
||||||
|
// intent.extras
|
||||||
|
// )
|
||||||
|
// //装货成功-开启轨迹上传
|
||||||
|
// OrderUtils.getInstance().upLocation(mContext)
|
||||||
|
// } else {
|
||||||
|
// OrderUtils.getInstance().stopUpLocation(mContext)
|
||||||
|
// ActivityUtils.startActivity(
|
||||||
|
// mContext,
|
||||||
|
// WaybillSuccActivity::class.java,
|
||||||
|
// intent.extras
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }))
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun load(location: GDLocation) {
|
private fun load(location: Location) {
|
||||||
NewLJUtils.getInstance()
|
MDPLocationCollectionManager.pickup(
|
||||||
.getShipmentStatus(mContext, orderBean.orderNum, object : OnGDDownloadResultListener {
|
mContext,
|
||||||
override fun onSuccess(var1: String) {
|
orderBean.orderNum,
|
||||||
if (var1 == "30") {
|
location,
|
||||||
|
object : OnResultListener {
|
||||||
|
override fun onSuccess() {
|
||||||
Log.e("上报安联", "装货上传成功")
|
Log.e("上报安联", "装货上传成功")
|
||||||
// //上传安联和交通厅,平台-装货
|
|
||||||
// //交通厅
|
//上传安联和交通厅,平台-装货
|
||||||
|
//交通厅
|
||||||
if (orderBean.report === "1") {
|
if (orderBean.report === "1") {
|
||||||
JTTProcess.start(mContext, orderBean, "")
|
JTTProcess.start(mContext, orderBean, "")
|
||||||
}
|
}
|
||||||
@ -309,87 +337,20 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
OrderUtils.getInstance().upLocation(mContext)
|
OrderUtils.getInstance().upLocation(mContext)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
} else {
|
|
||||||
NewLJUtils.getInstance()
|
|
||||||
.pickUp(mContext, orderBean.orderNum, location, object :
|
|
||||||
OnGDResultListener {
|
|
||||||
override fun onSuccess() {
|
|
||||||
Log.e("上报安联", "装货上传成功")
|
|
||||||
|
|
||||||
//上传安联和交通厅,平台-装货
|
|
||||||
//交通厅
|
|
||||||
if (orderBean.report === "1") {
|
|
||||||
JTTProcess.start(mContext, orderBean, "")
|
|
||||||
}
|
|
||||||
upLoadImage()
|
|
||||||
DataManager.getInstance().driverLoadOrUnload(upBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(
|
|
||||||
BaseObserver(
|
|
||||||
mContext,
|
|
||||||
object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
//装货成功-开启轨迹上传
|
|
||||||
OrderUtils.getInstance()
|
|
||||||
.upLocation(mContext)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
override fun onFailure(p0: String?, p1: String?) {
|
||||||
ToastUtils.showToast(mContext, """${code},${message}""")
|
Log.e("上报安联失败(装货):", p0 + p1)
|
||||||
|
ToastUtils.showToast(mContext, """${p1},${p0}""")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
private fun unLoad(location: Location) {
|
||||||
ToastUtils.showToast(mContext, """${code},${message}""")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// MDPLocationCollectionManager.pickup(
|
|
||||||
// mContext,
|
|
||||||
// orderBean.orderNum,
|
|
||||||
// location,
|
|
||||||
// object : OnResultListener {
|
|
||||||
// override fun onSuccess() {
|
|
||||||
// Log.e("上报安联", "装货上传成功")
|
|
||||||
//
|
|
||||||
// //上传安联和交通厅,平台-装货
|
|
||||||
// //交通厅
|
|
||||||
// if (orderBean.report === "1") {
|
|
||||||
// JTTProcess.start(mContext, orderBean, "")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// upLoadImage()
|
|
||||||
//
|
|
||||||
// DataManager.getInstance().driverLoadOrUnload(upBean)
|
|
||||||
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
|
||||||
// .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
|
||||||
// override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
// super.onSuccess(t)
|
|
||||||
// //装货成功-开启轨迹上传
|
|
||||||
// OrderUtils.getInstance().upLocation(mContext)
|
|
||||||
// }
|
|
||||||
// }))
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onFailure(p0: String?, p1: String?) {
|
|
||||||
// Log.e("上报安联失败(装货):", p0 + p1)
|
|
||||||
// ToastUtils.showToast(mContext, """${p1},${p0}""")
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun unLoad(location: GDLocation) {
|
|
||||||
showLoading()
|
showLoading()
|
||||||
NewLJUtils.getInstance()
|
MDPLocationCollectionManager.unload(mContext, orderBean.orderNum, location,
|
||||||
.unload(mContext, orderBean.orderNum, location, object : OnGDResultListener {
|
object : OnResultListener {
|
||||||
override fun onSuccess() {
|
override fun onSuccess() {
|
||||||
Log.e("上报安联", "卸货上传成功")
|
Log.e("上报安联", "卸货上传成功")
|
||||||
// 交通厅
|
// 交通厅
|
||||||
@ -415,47 +376,14 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
override fun onFailure(s: String, s1: String) {
|
||||||
Log.e("上报安联失败(卸货):", code + message)
|
Log.e("上报安联失败(卸货):", s + s1)
|
||||||
|
// MessageUtils().showCenMessage(con, s1)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// MDPLocationCollectionManager.unload(mContext, orderBean.orderNum, location,
|
|
||||||
// object : OnResultListener {
|
|
||||||
// override fun onSuccess() {
|
|
||||||
// Log.e("上报安联", "卸货上传成功")
|
|
||||||
// // 交通厅
|
|
||||||
// if (orderBean.report === "1") {
|
|
||||||
// JTTProcess.stop(mContext, orderBean, "")
|
|
||||||
// }
|
|
||||||
// //卸货状态-平台
|
|
||||||
//// hyr.dischargeCargo(lub)
|
|
||||||
// //卸货照片-安联
|
|
||||||
// upUnloadImage()
|
|
||||||
//
|
|
||||||
// //卸货回单
|
|
||||||
// upTrafficSign(location)
|
|
||||||
// upTrafficReceipt(location)
|
|
||||||
// receiptImage()
|
|
||||||
//
|
|
||||||
// //todo 平台更换运单状态 暂时注释
|
|
||||||
// DataManager.getInstance().driverLoadOrUnload(upBean)
|
|
||||||
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
|
||||||
// .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
|
|
||||||
// override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
// super.onSuccess(t)
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }))
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onFailure(s: String, s1: String) {
|
|
||||||
// Log.e("上报安联失败(卸货):", s + s1)
|
|
||||||
//// MessageUtils().showCenMessage(con, s1)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -464,24 +392,24 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
||||||
|
|
||||||
var photoPaht = upBean.waybillPhotoList.find { it.type == "1" }?.localPhotoUrl
|
var photoPaht = upBean.waybillPhotoList.find { it.type == "1" }?.localPhotoUrl
|
||||||
val base: String = BitmapUtil.imageToBase64(photoPaht)
|
|
||||||
val file = File(photoPaht)
|
val file = File(photoPaht)
|
||||||
val image = GDImage().apply {
|
val image = Image()
|
||||||
fileData = "data:image/" + FileUtil.lastName(file) + ";base64," + base
|
val base: String = BitmapUtil.imageToBase64(photoPaht)
|
||||||
fileExt = FileUtil.lastName(file)
|
image.fileData = "data:image/" + FileUtil.lastName(file) + ";base64," + base
|
||||||
fileName = FileUtil.fileName(file)
|
image.fileExt = FileUtil.lastName(file)
|
||||||
imageTakenDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
image.fileName = FileUtil.fileName(file)
|
||||||
time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
image.imageTakenDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||||
baiduLongitude = bdLatLng.longitude
|
image.baiduLongitude = bdLatLng.longitude
|
||||||
baiduLatitude = bdLatLng.latitude
|
image.baiduLatitude = bdLatLng.latitude
|
||||||
location = binding.tvLoca.text.toString()
|
image.location = binding.tvLoca.text.toString()
|
||||||
}
|
MDPLocationCollectionManager.uploadPickupImage(
|
||||||
|
mContext,
|
||||||
NewLJUtils.getInstance()
|
orderBean.orderNum,
|
||||||
.uploadPickupImage(mContext, orderBean.orderNum, image, object : OnGDResultListener {
|
image,
|
||||||
|
object : OnResultListener {
|
||||||
override fun onSuccess() {
|
override fun onSuccess() {
|
||||||
Log.e("上报安联", "装货照片上传成功")
|
Log.e("上报安联", "装货照片上传成功")
|
||||||
ToastUtils.showToast(mContext, "上传成功")
|
Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
||||||
ActivityUtils.startActivity(
|
ActivityUtils.startActivity(
|
||||||
mContext,
|
mContext,
|
||||||
WaybillSuccActivity::class.java,
|
WaybillSuccActivity::class.java,
|
||||||
@ -489,136 +417,98 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
override fun onFailure(s: String, s1: String) {
|
||||||
Log.e("上报安联失败(装货照片):", code + message)
|
Log.e("上报安联失败(装货照片):", s + s1)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// MDPLocationCollectionManager.uploadPickupImage(
|
|
||||||
// mContext,
|
|
||||||
// orderBean.orderNum,
|
|
||||||
// image,
|
|
||||||
// object : OnResultListener {
|
|
||||||
// override fun onSuccess() {
|
|
||||||
// Log.e("上报安联", "装货照片上传成功")
|
|
||||||
// Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
|
||||||
// ActivityUtils.startActivity(
|
|
||||||
// mContext,
|
|
||||||
// WaybillSuccActivity::class.java,
|
|
||||||
// intent.extras
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onFailure(s: String, s1: String) {
|
|
||||||
// Log.e("上报安联失败(装货照片):", s + s1)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//上传安联卸货
|
//上传安联卸货
|
||||||
fun upUnloadImage() {
|
fun upUnloadImage() {
|
||||||
var photoPaht = upBean.waybillPhotoList.find { it.type == "2" }?.localPhotoUrl
|
var photoPaht = upBean.waybillPhotoList.find { it.type == "2" }?.localPhotoUrl
|
||||||
val file = File(photoPaht)
|
val file = File(photoPaht)
|
||||||
|
val image = Image()
|
||||||
val base = BitmapUtil.imageToBase64(photoPaht)
|
val base = BitmapUtil.imageToBase64(photoPaht)
|
||||||
val image = GDImage().apply {
|
image.fileData = "data:image/" + FileUtil.lastName(file) + ";base64," + base
|
||||||
fileData = "data:image/" + FileUtil.lastName(file) + ";base64," + base
|
image.fileExt = FileUtil.lastName(file)
|
||||||
fileExt = FileUtil.lastName(file)
|
image.fileName = FileUtil.fileName(file)
|
||||||
fileName = FileUtil.fileName(file)
|
image.imageTakenDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||||
imageTakenDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
image.baiduLongitude = bdLatLng.longitude
|
||||||
baiduLongitude = bdLatLng.longitude
|
image.baiduLatitude = bdLatLng.latitude
|
||||||
baiduLatitude = bdLatLng.latitude
|
image.location = binding.tvLoca.text.toString()
|
||||||
location = binding.tvLoca.text.toString()
|
MDPLocationCollectionManager.uploadUnloadImage(
|
||||||
time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
mContext,
|
||||||
}
|
orderBean.orderNum,
|
||||||
|
image,
|
||||||
NewLJUtils.getInstance()
|
object : OnResultListener {
|
||||||
.uploadUnloadImage(mContext, orderBean.orderNum, image, object : OnGDResultListener {
|
|
||||||
override fun onSuccess() {
|
override fun onSuccess() {
|
||||||
Log.e("上报安联", "卸货照片上传成功")
|
Log.e("上报安联", "卸货照片上传成功")
|
||||||
|
// Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
||||||
|
// finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
override fun onFailure(s: String, s1: String) {
|
||||||
Log.e("上报安联失败(卸货照片):", code + message)
|
Log.e("上报安联失败(卸货照片):", s + s1)
|
||||||
|
// SPUtil.insSP(con,"make","卸货",sob.getData().getShippingNoteNumber());
|
||||||
|
// SPUtil.insSP(con,"make","卸货-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||||
|
// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||||
|
// startService(serviceIn);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// MDPLocationCollectionManager.uploadUnloadImage(
|
|
||||||
// mContext,
|
|
||||||
// orderBean.orderNum,
|
|
||||||
// image,
|
|
||||||
// object : OnResultListener {
|
|
||||||
// override fun onSuccess() {
|
|
||||||
// Log.e("上报安联", "卸货照片上传成功")
|
|
||||||
//// Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
|
||||||
//// finish()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onFailure(s: String, s1: String) {
|
|
||||||
// Log.e("上报安联失败(卸货照片):", s + s1)
|
|
||||||
// // SPUtil.insSP(con,"make","卸货",sob.getData().getShippingNoteNumber());
|
|
||||||
//// SPUtil.insSP(con,"make","卸货-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
|
||||||
//// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
|
||||||
//// startService(serviceIn);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//上传安联-签收
|
//上传安联-签收
|
||||||
fun upTrafficSign(location: GDLocation) {
|
fun upTrafficSign(location: Location) {
|
||||||
//安联
|
//安联
|
||||||
NewLJUtils.getInstance()
|
val gs = mutableListOf<Goods>()
|
||||||
.sign(mContext, orderBean.orderNum, location, object : OnGDResultListener {
|
orderBean.goodsList.forEach {
|
||||||
|
var g = Goods()
|
||||||
|
g.goodsName = it.goodName
|
||||||
|
g.unit = it.packName
|
||||||
|
g.itemNo = it.orderGoodsId.toInt()
|
||||||
|
//实收
|
||||||
|
g.quantity = 1
|
||||||
|
//应收
|
||||||
|
g.receivedQuantity = 1
|
||||||
|
//破损
|
||||||
|
g.damageQuantity = 1
|
||||||
|
//丢失
|
||||||
|
g.quantity = 1
|
||||||
|
gs.add(g)
|
||||||
|
}
|
||||||
|
MDPLocationCollectionManager.sign(
|
||||||
|
mContext,
|
||||||
|
orderBean.orderNum,
|
||||||
|
location,
|
||||||
|
gs,
|
||||||
|
object : OnResultListener {
|
||||||
override fun onSuccess() {
|
override fun onSuccess() {
|
||||||
Log.e("上报安联", "签收成功")
|
Log.e("上报安联", "签收成功")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
override fun onFailure(s: String, s1: String) {
|
||||||
Log.e("上报安联失败(签收):", code + message)
|
Log.e("上报安联失败(签收):", s + s1)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// MDPLocationCollectionManager.sign(
|
|
||||||
// mContext,
|
|
||||||
// orderBean.orderNum,
|
|
||||||
// location,
|
|
||||||
// gs,
|
|
||||||
// object : OnResultListener {
|
|
||||||
// override fun onSuccess() {
|
|
||||||
// Log.e("上报安联", "签收成功")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onFailure(s: String, s1: String) {
|
|
||||||
// Log.e("上报安联失败(签收):", s + s1)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//上传安联-回单
|
//上传安联-回单
|
||||||
fun upTrafficReceipt(location: GDLocation) {
|
fun upTrafficReceipt(location: Location) {
|
||||||
//安联
|
//安联
|
||||||
NewLJUtils.getInstance()
|
MDPLocationCollectionManager.pod(
|
||||||
.pod(mContext, orderBean.orderNum, location, object : OnGDResultListener {
|
mContext,
|
||||||
|
orderBean.orderNum,
|
||||||
|
location,
|
||||||
|
object : OnResultListener {
|
||||||
override fun onSuccess() {
|
override fun onSuccess() {
|
||||||
Log.e("上报安联", "回单上传成功")
|
Log.e("上报安联", "回单上传成功")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
override fun onFailure(s: String, s1: String) {
|
||||||
Log.e("上报安联失败(回单):", code + message)
|
Log.e("上报安联失败(回单):", s + s1)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// MDPLocationCollectionManager.pod(
|
|
||||||
// mContext,
|
|
||||||
// orderBean.orderNum,
|
|
||||||
// location,
|
|
||||||
// object : OnResultListener {
|
|
||||||
// override fun onSuccess() {
|
|
||||||
// Log.e("上报安联", "回单上传成功")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun onFailure(s: String, s1: String) {
|
|
||||||
// Log.e("上报安联失败(回单):", s + s1)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//卸货回单照片
|
//卸货回单照片
|
||||||
@ -628,25 +518,25 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.forEach { it ->
|
upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.forEach { it ->
|
||||||
var photoPaht = it.localPhotoUrl
|
var photoPaht = it.localPhotoUrl
|
||||||
val file: File = File(photoPaht)
|
val file: File = File(photoPaht)
|
||||||
|
val image = Image()
|
||||||
val base = BitmapUtil.imageToBase64(photoPaht)
|
val base = BitmapUtil.imageToBase64(photoPaht)
|
||||||
val image = GDImage().apply {
|
image.fileData = "data:image/" + FileUtil.lastName(file) + ";base64," + base
|
||||||
fileData = "data:image/" + FileUtil.lastName(file) + ";base64," + base
|
image.fileExt = FileUtil.lastName(file)
|
||||||
fileExt = FileUtil.lastName(file)
|
image.fileName = FileUtil.fileName(file)
|
||||||
fileName = FileUtil.fileName(file)
|
image.imageTakenDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||||
imageTakenDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
image.baiduLongitude = bdLatLng.longitude
|
||||||
time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
image.baiduLatitude = bdLatLng.latitude
|
||||||
baiduLongitude = bdLatLng.longitude
|
image.location = binding.tvLoca.text.toString()
|
||||||
baiduLatitude = bdLatLng.latitude
|
MDPLocationCollectionManager.uploadPODImage(
|
||||||
location = binding.tvLoca.text.toString()
|
mContext,
|
||||||
}
|
orderBean.orderNum,
|
||||||
|
image,
|
||||||
NewLJUtils.getInstance()
|
object : OnResultListener {
|
||||||
.uploadPODImage(mContext, orderBean.orderNum, image, object : OnGDResultListener {
|
|
||||||
override fun onSuccess() {
|
override fun onSuccess() {
|
||||||
Log.e("上报安联", "回单照片上传成功")
|
Log.e("上报安联", "回单照片上传成功")
|
||||||
upCount++
|
upCount++
|
||||||
dissLoading()
|
dissLoading()
|
||||||
if (upCount == upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.size) {
|
if (upCount==upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.size){
|
||||||
//跳转成功页面,停止上传轨迹
|
//跳转成功页面,停止上传轨迹
|
||||||
OrderUtils.getInstance().stopUpLocation(mContext)
|
OrderUtils.getInstance().stopUpLocation(mContext)
|
||||||
ActivityUtils.startActivity(
|
ActivityUtils.startActivity(
|
||||||
@ -654,13 +544,15 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
WaybillSuccActivity::class.java,
|
WaybillSuccActivity::class.java,
|
||||||
intent.extras
|
intent.extras
|
||||||
)
|
)
|
||||||
ToastUtils.showToast(mContext, "上传成功")
|
Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
// finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(s: String, s1: String) {
|
||||||
upCount++
|
upCount++
|
||||||
if (upCount == upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.size) {
|
if (upCount==upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.size){
|
||||||
//跳转成功页面,停止上传轨迹
|
//跳转成功页面,停止上传轨迹
|
||||||
OrderUtils.getInstance().stopUpLocation(mContext)
|
OrderUtils.getInstance().stopUpLocation(mContext)
|
||||||
ActivityUtils.startActivity(
|
ActivityUtils.startActivity(
|
||||||
@ -668,11 +560,33 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
WaybillSuccActivity::class.java,
|
WaybillSuccActivity::class.java,
|
||||||
intent.extras
|
intent.extras
|
||||||
)
|
)
|
||||||
ToastUtils.showToast(mContext, "上传成功")
|
Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
Log.e("上报安联失败(回单照片):", code + message)
|
Log.e("上报安联失败(回单照片):", s + s1)
|
||||||
|
// SPUtil.insSP(con,"make","回单",sob.getData().getShippingNoteNumber());
|
||||||
|
//// SPUtil.insSP(con,"make","回单-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||||
|
//// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||||
|
//// startService(serviceIn);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// var photoPaht =
|
||||||
|
// upBean.waybillPhotoList.find { it.type == "3" && it.receiptType == "5" }?.localPhotoUrl
|
||||||
|
// val file: File = File(photoPaht)
|
||||||
|
// val image = Image()
|
||||||
|
// val base = BitmapUtil.imageToBase64(photoPaht)
|
||||||
|
// image.fileData = "data:image/" + FileUtil.lastName(file) + ";base64," + base
|
||||||
|
// image.fileExt = FileUtil.lastName(file)
|
||||||
|
// image.fileName = FileUtil.fileName(file)
|
||||||
|
// image.imageTakenDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||||
|
// image.baiduLongitude = bdLatLng.longitude
|
||||||
|
// image.baiduLatitude = bdLatLng.latitude
|
||||||
|
// image.location = binding.tvLoca.text.toString()
|
||||||
// MDPLocationCollectionManager.uploadPODImage(
|
// MDPLocationCollectionManager.uploadPODImage(
|
||||||
// mContext,
|
// mContext,
|
||||||
// orderBean.orderNum,
|
// orderBean.orderNum,
|
||||||
@ -680,9 +594,7 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
// object : OnResultListener {
|
// object : OnResultListener {
|
||||||
// override fun onSuccess() {
|
// override fun onSuccess() {
|
||||||
// Log.e("上报安联", "回单照片上传成功")
|
// Log.e("上报安联", "回单照片上传成功")
|
||||||
// upCount++
|
|
||||||
// dissLoading()
|
// dissLoading()
|
||||||
// if (upCount==upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.size){
|
|
||||||
// //跳转成功页面,停止上传轨迹
|
// //跳转成功页面,停止上传轨迹
|
||||||
// OrderUtils.getInstance().stopUpLocation(mContext)
|
// OrderUtils.getInstance().stopUpLocation(mContext)
|
||||||
// ActivityUtils.startActivity(
|
// ActivityUtils.startActivity(
|
||||||
@ -691,23 +603,10 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
// intent.extras
|
// intent.extras
|
||||||
// )
|
// )
|
||||||
// Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
// Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
||||||
// }
|
|
||||||
//
|
|
||||||
//// finish()
|
//// finish()
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// override fun onFailure(s: String, s1: String) {
|
// override fun onFailure(s: String, s1: String) {
|
||||||
// upCount++
|
|
||||||
// if (upCount==upBean.waybillPhotoList.filter { it.type == "3" && it.receiptType == "5" }.size){
|
|
||||||
// //跳转成功页面,停止上传轨迹
|
|
||||||
// OrderUtils.getInstance().stopUpLocation(mContext)
|
|
||||||
// ActivityUtils.startActivity(
|
|
||||||
// mContext,
|
|
||||||
// WaybillSuccActivity::class.java,
|
|
||||||
// intent.extras
|
|
||||||
// )
|
|
||||||
// Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show()
|
|
||||||
// }
|
|
||||||
// Log.e("上报安联失败(回单照片):", s + s1)
|
// Log.e("上报安联失败(回单照片):", s + s1)
|
||||||
// // SPUtil.insSP(con,"make","回单",sob.getData().getShippingNoteNumber());
|
// // SPUtil.insSP(con,"make","回单",sob.getData().getShippingNoteNumber());
|
||||||
////// SPUtil.insSP(con,"make","回单-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
////// SPUtil.insSP(con,"make","回单-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||||
@ -716,7 +615,6 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
|||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private val mData: List<LocalMedia> = ArrayList()
|
private val mData: List<LocalMedia> = ArrayList()
|
||||||
|
@ -1,599 +0,0 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.utils
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.text.TextUtils
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.base.NewLJConstant
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.GDImage
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.GDLocation
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.InvoiceBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.LjTokenBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.PickupBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.ShipmentStatusBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.bean.UpimgBean
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.callback.OnGDDownloadResultListener
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.callback.OnGDResultListener
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.BaseObserver
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.DataManager
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.net.RxHttpCallBack
|
|
||||||
import com.arpa.mylibrary.base.SingletonNoPHolder
|
|
||||||
import com.arpa.mylibrary.bean.LJDriverBean
|
|
||||||
import com.arpa.mylibrary.net.CommonResponseBean
|
|
||||||
import com.arpa.mylibrary.utils.BaseSPUtils
|
|
||||||
import com.arpa.mylibrary.utils.BaseSPUtils.NEW_LJ_TOKEN
|
|
||||||
import com.arpa.mylibrary.utils.ToastUtils
|
|
||||||
import com.express.mdp.Api
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName NewLJUtils
|
|
||||||
* @Author john
|
|
||||||
* @Date 2025/1/21 08:59
|
|
||||||
* @Description TODO
|
|
||||||
*/
|
|
||||||
class NewLJUtils private constructor() {
|
|
||||||
|
|
||||||
companion object : SingletonNoPHolder<NewLJUtils>(::NewLJUtils)
|
|
||||||
|
|
||||||
fun getToken(ctx: Context) {
|
|
||||||
val ljTokenBean = LjTokenBean().apply {
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
enterpriseIdentity = NewLJConstant.ENTER_PRISE_IDENTITY
|
|
||||||
enterpriseKey = NewLJConstant.ENTER_PRISE_KEY
|
|
||||||
}
|
|
||||||
|
|
||||||
DataManager.getInstance().getToken(ljTokenBean)
|
|
||||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
BaseSPUtils.put(ctx, NEW_LJ_TOKEN, t.getToken())
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getToken(ctx: Context?, listener: OnGDResultListener) {
|
|
||||||
val ljTokenBean = LjTokenBean().apply {
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
enterpriseIdentity = NewLJConstant.ENTER_PRISE_IDENTITY
|
|
||||||
enterpriseKey = NewLJConstant.ENTER_PRISE_KEY
|
|
||||||
}
|
|
||||||
|
|
||||||
DataManager.getInstance().getToken(ljTokenBean)
|
|
||||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx!!, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
BaseSPUtils.put(ctx, NEW_LJ_TOKEN, t.getToken())
|
|
||||||
if (listener != null) listener.onSuccess()
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单提货
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param shipmentCode
|
|
||||||
* @param location
|
|
||||||
*/
|
|
||||||
fun pickUp(
|
|
||||||
ctx: Context,
|
|
||||||
shipmentCode: String,
|
|
||||||
location: GDLocation,
|
|
||||||
listener: OnGDResultListener
|
|
||||||
) {
|
|
||||||
if (TextUtils.isEmpty(shipmentCode)) {
|
|
||||||
ToastUtils.showToast(ctx, "运单号不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.baiduLongitude == 0.0 || location.baiduLatitude == 0.0) {
|
|
||||||
ToastUtils.showToast(ctx, "经纬度不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val pickupBean = PickupBean().apply {
|
|
||||||
this.shipmentCode = shipmentCode
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
this.location = location
|
|
||||||
}
|
|
||||||
DataManager.getInstance().pickup(pickupBean)
|
|
||||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "运单提货操作异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单卸货
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param shipmentCode
|
|
||||||
* @param location
|
|
||||||
*/
|
|
||||||
fun unload(
|
|
||||||
ctx: Context,
|
|
||||||
shipmentCode: String,
|
|
||||||
location: GDLocation,
|
|
||||||
listener: OnGDResultListener
|
|
||||||
) {
|
|
||||||
if (TextUtils.isEmpty(shipmentCode)) {
|
|
||||||
ToastUtils.showToast(ctx, "运单号不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.baiduLongitude == 0.0 || location.baiduLatitude == 0.0) {
|
|
||||||
ToastUtils.showToast(ctx, "经纬度不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val pickupBean = PickupBean().apply {
|
|
||||||
this.shipmentCode = shipmentCode
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
this.location = location
|
|
||||||
}
|
|
||||||
DataManager.getInstance().unload(pickupBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "运单卸货操作异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单签收
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param shipmentCode
|
|
||||||
* @param location
|
|
||||||
*/
|
|
||||||
fun sign(
|
|
||||||
ctx: Context,
|
|
||||||
shipmentCode: String,
|
|
||||||
location: GDLocation,
|
|
||||||
listener: OnGDResultListener
|
|
||||||
) {
|
|
||||||
if (TextUtils.isEmpty(shipmentCode)) {
|
|
||||||
ToastUtils.showToast(ctx, "运单号不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.baiduLongitude == 0.0 || location.baiduLatitude == 0.0) {
|
|
||||||
ToastUtils.showToast(ctx, "经纬度不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val pickupBean = PickupBean().apply {
|
|
||||||
this.shipmentCode = shipmentCode
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
this.location = location
|
|
||||||
}
|
|
||||||
DataManager.getInstance().sign(pickupBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "运单签收操作异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单回单
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param shipmentCode
|
|
||||||
* @param location
|
|
||||||
*/
|
|
||||||
fun pod(
|
|
||||||
ctx: Context,
|
|
||||||
shipmentCode: String,
|
|
||||||
location: GDLocation,
|
|
||||||
listener: OnGDResultListener
|
|
||||||
) {
|
|
||||||
if (TextUtils.isEmpty(shipmentCode)) {
|
|
||||||
ToastUtils.showToast(ctx, "运单号不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.baiduLongitude == 0.0 || location.baiduLatitude == 0.0) {
|
|
||||||
ToastUtils.showToast(ctx, "经纬度不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val pickupBean = PickupBean().apply {
|
|
||||||
this.shipmentCode = shipmentCode
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
this.location = location
|
|
||||||
}
|
|
||||||
|
|
||||||
DataManager.getInstance().pod(pickupBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "运单回单操作异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单提货照片上传
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param shipmentCode
|
|
||||||
* @param imageDTO
|
|
||||||
*/
|
|
||||||
fun uploadPickupImage(
|
|
||||||
ctx: Context,
|
|
||||||
shipmentCode: String,
|
|
||||||
imageDTO: GDImage,
|
|
||||||
listener: OnGDResultListener
|
|
||||||
) {
|
|
||||||
if (TextUtils.isEmpty(shipmentCode)) {
|
|
||||||
ToastUtils.showToast(ctx, "运单号不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TextUtils.isEmpty(imageDTO.fileName)) {
|
|
||||||
ToastUtils.showToast(ctx, "照片不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val pickupBean: UpimgBean = UpimgBean().apply {
|
|
||||||
this.shipmentCode = shipmentCode
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
image = imageDTO
|
|
||||||
}
|
|
||||||
DataManager.getInstance().uploadPickupImage(pickupBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "运单提货照片操作异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单卸货照片上传
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param shipmentCode
|
|
||||||
* @param imageDTO
|
|
||||||
*/
|
|
||||||
fun uploadUnloadImage(
|
|
||||||
ctx: Context,
|
|
||||||
shipmentCode: String,
|
|
||||||
imageDTO: GDImage,
|
|
||||||
listener: OnGDResultListener
|
|
||||||
) {
|
|
||||||
if (TextUtils.isEmpty(shipmentCode)) {
|
|
||||||
ToastUtils.showToast(ctx, "运单号不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TextUtils.isEmpty(imageDTO.fileName)) {
|
|
||||||
ToastUtils.showToast(ctx, "照片不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val pickupBean: UpimgBean = UpimgBean().apply {
|
|
||||||
this.shipmentCode = shipmentCode
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
image = imageDTO
|
|
||||||
}
|
|
||||||
|
|
||||||
DataManager.getInstance().uploadUnloadImage(pickupBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "运单卸货照片操作异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单回单照片上传
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param shipmentCode
|
|
||||||
* @param imageDTO
|
|
||||||
*/
|
|
||||||
fun uploadPODImage(
|
|
||||||
ctx: Context,
|
|
||||||
shipmentCode: String,
|
|
||||||
imageDTO: GDImage,
|
|
||||||
listener: OnGDResultListener
|
|
||||||
) {
|
|
||||||
if (TextUtils.isEmpty(shipmentCode)) {
|
|
||||||
ToastUtils.showToast(ctx, "运单号不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TextUtils.isEmpty(imageDTO.fileName)) {
|
|
||||||
ToastUtils.showToast(ctx, "照片不能为空")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val pickupBean: UpimgBean = UpimgBean().apply {
|
|
||||||
this.shipmentCode = shipmentCode
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
image = imageDTO
|
|
||||||
}
|
|
||||||
DataManager.getInstance().uploadPODImage(pickupBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "运单回单照片操作异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同意发票申请
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
*/
|
|
||||||
fun confirmInvoice(ctx: Context, listener: OnGDResultListener) {
|
|
||||||
val userInfo = SPUtils.instance.getUserInfo(ctx)
|
|
||||||
if (userInfo == null){
|
|
||||||
ToastUtils.showToast(ctx, "账号未登录")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(userInfo.idcard)){
|
|
||||||
ToastUtils.showToast(ctx, "未查到身份证号码")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val idcard = userInfo.idcard
|
|
||||||
|
|
||||||
searchDriver(ctx, idcard, object : OnGDDownloadResultListener {
|
|
||||||
override fun onSuccess(var1: String) {
|
|
||||||
val invoiceBean: InvoiceBean = InvoiceBean().apply {
|
|
||||||
enterpriseCode=NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
driverInvoiceCode = var1
|
|
||||||
driverIdentification = idcard
|
|
||||||
}
|
|
||||||
DataManager.getInstance().confirmInvoice(invoiceBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "同意发票异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运单状态查询
|
|
||||||
*
|
|
||||||
* @param ctx
|
|
||||||
* @param shipmentCode
|
|
||||||
*/
|
|
||||||
fun getShipmentStatus(
|
|
||||||
ctx: Context,
|
|
||||||
shipmentCode: String,
|
|
||||||
listener: OnGDDownloadResultListener
|
|
||||||
) {
|
|
||||||
val shipmentStatusBean: ShipmentStatusBean = ShipmentStatusBean().apply {
|
|
||||||
this.shipmentCode = shipmentCode
|
|
||||||
enterpriseCode = NewLJConstant.ENTER_PRISE_CODE
|
|
||||||
}
|
|
||||||
DataManager.getInstance().getShipmentStatus(shipmentStatusBean)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
listener.onSuccess(t.statusCode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "运单状态查询异常" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开启位置上传
|
|
||||||
*
|
|
||||||
* @param act
|
|
||||||
*/
|
|
||||||
fun startLocationService(act: AppCompatActivity) {
|
|
||||||
val userInfo = SPUtils.instance.getUserInfo(act)
|
|
||||||
if (userInfo == null){
|
|
||||||
ToastUtils.showToast(act, "账号未登录")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(userInfo.idcard)){
|
|
||||||
ToastUtils.showToast(act, "未查到身份证号码")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val idcard = userInfo.idcard
|
|
||||||
searchDriver(act, idcard, object : OnGDDownloadResultListener {
|
|
||||||
override fun onSuccess(var1: String) {
|
|
||||||
try {
|
|
||||||
//开启定位服务
|
|
||||||
if (BuildConfig.isTest) {
|
|
||||||
Api.setBaseUrl("https://kehui56.cn/api", "https://api.kehui56.cn/api")
|
|
||||||
}
|
|
||||||
val result = Api.startLocationService(
|
|
||||||
act, var1
|
|
||||||
) { s: String? ->
|
|
||||||
Log.e(
|
|
||||||
"位置上报",
|
|
||||||
s!!
|
|
||||||
)
|
|
||||||
}
|
|
||||||
println(result)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
throw RuntimeException(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(code: String, message: String) {
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭定位服务
|
|
||||||
*/
|
|
||||||
fun stopLocationService() {
|
|
||||||
Api.stopLocationService()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询司机
|
|
||||||
*/
|
|
||||||
fun searchDriver(ctx: Context, idCard: String, listener: OnGDDownloadResultListener) {
|
|
||||||
DataManager.getInstance().searchDriver(idCard)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(BaseObserver(ctx, object : RxHttpCallBack<Any>() {
|
|
||||||
override fun onSuccess(t: CommonResponseBean<Any>) {
|
|
||||||
super.onSuccess(t)
|
|
||||||
val driver: LJDriverBean = t.driver
|
|
||||||
if (!TextUtils.isEmpty(driver.driverCode)) {
|
|
||||||
listener.onSuccess(driver.driverCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCodeError(
|
|
||||||
mContext: Context?,
|
|
||||||
t: CommonResponseBean<Any>
|
|
||||||
) {
|
|
||||||
super.onCodeError(mContext, t)
|
|
||||||
listener.onFailure(
|
|
||||||
t.code.toString(),
|
|
||||||
if (TextUtils.isEmpty(t.message)) "司机异常请联系管理员" else t.message
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.arpa.mylibrary.bean;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName LJDriverBean
|
|
||||||
* @Author john
|
|
||||||
* @Date 2025/1/21 10:47
|
|
||||||
* @Description TODO
|
|
||||||
*/
|
|
||||||
public class LJDriverBean implements Serializable {
|
|
||||||
private String driverCode;
|
|
||||||
private String isTaxRegistered;
|
|
||||||
private String taxRegisterStatus;
|
|
||||||
private String taxRegisterStatusDescription;
|
|
||||||
|
|
||||||
public String getDriverCode() {
|
|
||||||
return driverCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDriverCode(String driverCode) {
|
|
||||||
this.driverCode = driverCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsTaxRegistered() {
|
|
||||||
return isTaxRegistered;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsTaxRegistered(String isTaxRegistered) {
|
|
||||||
this.isTaxRegistered = isTaxRegistered;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTaxRegisterStatus() {
|
|
||||||
return taxRegisterStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaxRegisterStatus(String taxRegisterStatus) {
|
|
||||||
this.taxRegisterStatus = taxRegisterStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTaxRegisterStatusDescription() {
|
|
||||||
return taxRegisterStatusDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaxRegisterStatusDescription(String taxRegisterStatusDescription) {
|
|
||||||
this.taxRegisterStatusDescription = taxRegisterStatusDescription;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,5 @@
|
|||||||
package com.arpa.mylibrary.net;
|
package com.arpa.mylibrary.net;
|
||||||
|
|
||||||
import com.arpa.mylibrary.bean.LJDriverBean;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -20,70 +18,6 @@ public class CommonResponseBean<T> extends JSONObject implements Serializable {
|
|||||||
|
|
||||||
private boolean success;
|
private boolean success;
|
||||||
|
|
||||||
private String message;
|
|
||||||
private String url;
|
|
||||||
private String fileName;
|
|
||||||
private String token;
|
|
||||||
private String expiryIn;
|
|
||||||
private String statusCode;
|
|
||||||
|
|
||||||
private LJDriverBean driver;
|
|
||||||
|
|
||||||
public LJDriverBean getDriver() {
|
|
||||||
return driver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDriver(LJDriverBean driver) {
|
|
||||||
this.driver = driver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFileName() {
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileName(String fileName) {
|
|
||||||
this.fileName = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getToken() {
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToken(String token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExpiryIn() {
|
|
||||||
return expiryIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExpiryIn(String expiryIn) {
|
|
||||||
this.expiryIn = expiryIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatusCode() {
|
|
||||||
return statusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatusCode(String statusCode) {
|
|
||||||
this.statusCode = statusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRes() {
|
public int getRes() {
|
||||||
return res;
|
return res;
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.arpa.mylibrary.net;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
import okio.Buffer;
|
||||||
|
import okio.BufferedSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json的Interceptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class JsonInterceptor implements Interceptor {
|
||||||
|
private static final String TAG = "JsonInterceptor";
|
||||||
|
|
||||||
|
public JsonInterceptor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response intercept(Chain chain) throws IOException {
|
||||||
|
Request request = chain.request();
|
||||||
|
Response response = chain.proceed(request);
|
||||||
|
ResponseBody responseBody = response.body();
|
||||||
|
//为了不消耗buffer,我们这里使用source先获得buffer对象,然后clone()后使用
|
||||||
|
BufferedSource source = responseBody.source();
|
||||||
|
source.request(Long.MAX_VALUE); // Buffer the entire body.
|
||||||
|
//获得返回的数据
|
||||||
|
Buffer buffer = source.buffer();
|
||||||
|
//使用前clone()下,避免直接消耗
|
||||||
|
String responseBodyStr = buffer.clone().readString(Charset.forName("UTF-8"));
|
||||||
|
Log.i(TAG, "result-body= " + responseBodyStr);
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject(responseBodyStr);
|
||||||
|
String str = jsonObject.optString("data");
|
||||||
|
int code = jsonObject.optInt("code");
|
||||||
|
// if (500 == code) {
|
||||||
|
// jsonObject.put("data", new JSONObject());
|
||||||
|
// throw new ResultException();
|
||||||
|
// } else {
|
||||||
|
// if (TextUtils.isEmpty(str)) {
|
||||||
|
// jsonObject.put("data", new JSONObject());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(str)) {
|
||||||
|
jsonObject.put("data", new JSONObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
String data = jsonObject.toString();
|
||||||
|
responseBody = ResponseBody.create(MediaType.parse("application/json; charset=utf-8"), data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
response = response.newBuilder().body(responseBody).build();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
@ -20,7 +20,6 @@ public class BaseSPUtils {
|
|||||||
public static final String USER_INFO_KEY = "driver_user_info_key";
|
public static final String USER_INFO_KEY = "driver_user_info_key";
|
||||||
public static final String USER_TOKEN_KEY = "driver_user_token_key";
|
public static final String USER_TOKEN_KEY = "driver_user_token_key";
|
||||||
public static final String NET_SERVICE_TEST = "driver_net_service_test";
|
public static final String NET_SERVICE_TEST = "driver_net_service_test";
|
||||||
public static final String NEW_LJ_TOKEN = "NEW_LJ_TOKEN";
|
|
||||||
public static final String SEARRH_CACHE = "driver_search_cache";
|
public static final String SEARRH_CACHE = "driver_search_cache";
|
||||||
public static final String NAVI_PH_EDIT_CACHE = "driver_navi_ph_edit_cache";
|
public static final String NAVI_PH_EDIT_CACHE = "driver_navi_ph_edit_cache";
|
||||||
public static final String FIRST_OPEN = "driver_first_open";
|
public static final String FIRST_OPEN = "driver_first_open";
|
||||||
|
Loading…
Reference in New Issue
Block a user