安联,交通厅引入1版
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
<!--允许程序访问CellID或WiFi热点来获取粗略的位置-->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<!-- 访问网络的变化, 需要某些信息用于网络定位 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
|
||||
<!--用于访问GPS定位-->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<!--用于获取wifi的获取权限,wifi信息会用来进行网络定位-->
|
||||
@@ -423,6 +426,47 @@
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|navigation"
|
||||
android:launchMode="singleInstance" />
|
||||
<!-- 导航相关end -->
|
||||
|
||||
|
||||
<!-- 交通厅相关start -->
|
||||
<service
|
||||
android:name=".third.JTTSendService"
|
||||
android:foregroundServiceType="location" />
|
||||
<!-- 交通厅相关end -->
|
||||
|
||||
<!-- 安联相关start -->
|
||||
|
||||
<service
|
||||
android:name="com.alct.mdp.MDPLocationService"
|
||||
android:exported="true"
|
||||
android:process=":mdpLocation_v1" />
|
||||
<service
|
||||
android:name="com.baidu.location.f"
|
||||
android:enabled="true"
|
||||
android:process=":remote">
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="com.alct.mdp.job.LocationUploadJobService"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" >
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="com.alct.mdp.job.LogUploadJobService"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" >
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="com.alct.mdp.job.AppRunningStatusUploadJobService"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" >
|
||||
</service>
|
||||
|
||||
<meta-data
|
||||
android:name="com.baidu.lbsapi.API_KEY"
|
||||
android:value="BiRjhNoG2FhrveK48ihjtbK7BNcBD5zt" />
|
||||
|
||||
<!-- 安联相关end -->
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,16 +1,21 @@
|
||||
package com.dahe.gldriver.base
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.app.Application
|
||||
import android.app.PendingIntent
|
||||
import android.app.PendingIntent.*
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Process
|
||||
import android.util.Log
|
||||
import com.alct.mdp.MDPLocationCollectionManager
|
||||
import com.dahe.gldriver.BuildConfig
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.net.Api
|
||||
import com.dahe.gldriver.oss.OssServiceUtil
|
||||
import com.dahe.gldriver.push.PushHelper
|
||||
import com.dahe.gldriver.third.JTTProcess
|
||||
import com.dahe.gldriver.third.SPUtil
|
||||
import com.dahe.gldriver.ui.HomeActivity
|
||||
import com.dahe.gldriver.utils.OrderUtils
|
||||
import com.dahe.mylibrary.CommonBaseLibrary
|
||||
@@ -54,6 +59,8 @@ class App : Application() {
|
||||
// EsignSdk.getInstance().init(AppConfig.E_KEY, AppConfig.E_LICENSE)
|
||||
initUmeng()
|
||||
|
||||
initThird()
|
||||
|
||||
var pendingIntent: PendingIntent = getActivity(
|
||||
applicationContext, 0,
|
||||
Intent(applicationContext, HomeActivity::class.java),
|
||||
@@ -93,6 +100,26 @@ class App : Application() {
|
||||
super.attachBaseContext(base)
|
||||
}
|
||||
|
||||
private fun initThird() {
|
||||
val state: String = SPUtil.getSP(this, "state_data", "authorization_state")
|
||||
if ("1" == state) {
|
||||
try {
|
||||
//安联初始化
|
||||
if (packageName == getCurrentProcessName(this)) {
|
||||
//Log.e("--使用的测试环境--",BuildConfig.OPEN_API_URL);
|
||||
MDPLocationCollectionManager.initialize(this, BuildConfig.OPEN_AL_URL)
|
||||
}
|
||||
|
||||
//初始化交通厅
|
||||
JTTProcess.init(this)
|
||||
SPUtil.insSP(this, "state_data", "authorization_state", "1")
|
||||
} catch (e: Exception) {
|
||||
SPUtil.insSP(this, "state_data", "authorization_state", "0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//忽略https的证书校验
|
||||
fun handleSSLHandshake() {
|
||||
try {
|
||||
@@ -168,4 +195,18 @@ class App : Application() {
|
||||
companion object {
|
||||
var app: App? = null
|
||||
}
|
||||
|
||||
fun getCurrentProcessName(context: Context): String? {
|
||||
var currentProcessName = ""
|
||||
val pid = Process.myPid()
|
||||
val mActivityManager = context.getSystemService(ACTIVITY_SERVICE) as ActivityManager
|
||||
if (mActivityManager.runningAppProcesses != null && mActivityManager.runningAppProcesses.size > 0) {
|
||||
for (appProcess in mActivityManager.runningAppProcesses) {
|
||||
if (appProcess.pid == pid) {
|
||||
currentProcessName = appProcess.processName
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentProcessName
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.dahe.gldriver.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/11/23 19:16
|
||||
* @description:
|
||||
*/
|
||||
public class FqBean {
|
||||
|
||||
private int pageSize;
|
||||
private int currentPage;
|
||||
private int totalCount;
|
||||
private int totalPage;
|
||||
private List<Invoice> driverInvoices;
|
||||
//{"currentPage":100,"driverInvoices":[],"pageSize":1,"totalCount":0,"totalPage":0}
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getCurrentPage() {
|
||||
return currentPage;
|
||||
}
|
||||
|
||||
public void setCurrentPage(int currentPage) {
|
||||
this.currentPage = currentPage;
|
||||
}
|
||||
|
||||
public int getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public void setTotalCount(int totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public int getTotalPage() {
|
||||
return totalPage;
|
||||
}
|
||||
|
||||
public void setTotalPage(int totalPage) {
|
||||
this.totalPage = totalPage;
|
||||
}
|
||||
|
||||
public List<Invoice> getDriverInvoices() {
|
||||
if (driverInvoices == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return driverInvoices;
|
||||
}
|
||||
|
||||
public void setDriverInvoices(List<Invoice> driverInvoices) {
|
||||
this.driverInvoices = driverInvoices;
|
||||
}
|
||||
|
||||
public class Invoice{
|
||||
String invoiceReceiverName; //受票方,string类型
|
||||
double taxRate; //发票税率,double类型
|
||||
double taxAmount; //税额, double类型
|
||||
double totalAmount; //金额, double类型
|
||||
double totalAmountIncludeTax; //金额+税额,double类型
|
||||
String driverInvoiceCode; //发票编号,string类型
|
||||
|
||||
public String getInvoiceReceiverName() {
|
||||
return invoiceReceiverName == null ? "" : invoiceReceiverName;
|
||||
}
|
||||
|
||||
public void setInvoiceReceiverName(String invoiceReceiverName) {
|
||||
this.invoiceReceiverName = invoiceReceiverName;
|
||||
}
|
||||
|
||||
public double getTaxRate() {
|
||||
return taxRate;
|
||||
}
|
||||
|
||||
public void setTaxRate(double taxRate) {
|
||||
this.taxRate = taxRate;
|
||||
}
|
||||
|
||||
public double getTaxAmount() {
|
||||
return taxAmount;
|
||||
}
|
||||
|
||||
public void setTaxAmount(double taxAmount) {
|
||||
this.taxAmount = taxAmount;
|
||||
}
|
||||
|
||||
public double getTotalAmount() {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
public void setTotalAmount(double totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
public double getTotalAmountIncludeTax() {
|
||||
return totalAmountIncludeTax;
|
||||
}
|
||||
|
||||
public void setTotalAmountIncludeTax(double totalAmountIncludeTax) {
|
||||
this.totalAmountIncludeTax = totalAmountIncludeTax;
|
||||
}
|
||||
|
||||
public String getDriverInvoiceCode() {
|
||||
return driverInvoiceCode == null ? "" : driverInvoiceCode;
|
||||
}
|
||||
|
||||
public void setDriverInvoiceCode(String driverInvoiceCode) {
|
||||
this.driverInvoiceCode = driverInvoiceCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.dahe.gldriver.bean;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2022/2/16 17:37
|
||||
* @description:
|
||||
*/
|
||||
public class JTT {
|
||||
|
||||
private int code;
|
||||
private DataDTO data;
|
||||
private String msg;
|
||||
private boolean success;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public DataDTO getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataDTO data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public static class DataDTO {
|
||||
private String createTime;
|
||||
private boolean delFlag;
|
||||
private int id;
|
||||
private String trafficCode;
|
||||
private String trafficId;
|
||||
private String trafficName;
|
||||
private String trafficNum;
|
||||
private String trafficSecret;
|
||||
private String trafficType;
|
||||
private String updateTime;
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public boolean isDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(boolean delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTrafficCode() {
|
||||
return trafficCode;
|
||||
}
|
||||
|
||||
public void setTrafficCode(String trafficCode) {
|
||||
this.trafficCode = trafficCode;
|
||||
}
|
||||
|
||||
public String getTrafficId() {
|
||||
return trafficId;
|
||||
}
|
||||
|
||||
public void setTrafficId(String trafficId) {
|
||||
this.trafficId = trafficId;
|
||||
}
|
||||
|
||||
public String getTrafficName() {
|
||||
return trafficName;
|
||||
}
|
||||
|
||||
public void setTrafficName(String trafficName) {
|
||||
this.trafficName = trafficName;
|
||||
}
|
||||
|
||||
public String getTrafficNum() {
|
||||
return trafficNum;
|
||||
}
|
||||
|
||||
public void setTrafficNum(String trafficNum) {
|
||||
this.trafficNum = trafficNum;
|
||||
}
|
||||
|
||||
public String getTrafficSecret() {
|
||||
return trafficSecret;
|
||||
}
|
||||
|
||||
public void setTrafficSecret(String trafficSecret) {
|
||||
this.trafficSecret = trafficSecret;
|
||||
}
|
||||
|
||||
public String getTrafficType() {
|
||||
return trafficType;
|
||||
}
|
||||
|
||||
public void setTrafficType(String trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.dahe.gldriver.bean
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/8/13 10:27
|
||||
* @description:装卸货输入参数实体
|
||||
*/
|
||||
class LUInputBean {
|
||||
var imageId: List<Int>? = null
|
||||
var latitude: String? = null
|
||||
var locationAddress: String? = null
|
||||
var longitude: String? = null
|
||||
var waybillId: String? = null
|
||||
var realLoadTime: String? = null
|
||||
}
|
||||
@@ -15,6 +15,7 @@ data class OrderDetailBean(
|
||||
val loadingDeadline: String,
|
||||
val orderChildList: List<OrderChild>,
|
||||
val orderId: String,
|
||||
|
||||
val orderNum: String,
|
||||
val orderStatus: String,
|
||||
val phone: String,
|
||||
@@ -34,7 +35,11 @@ data class OrderDetailBean(
|
||||
val vehicleType: String,
|
||||
val waybillId: String,
|
||||
val vehicleNum: String,
|
||||
val loadingAreaCode: String,
|
||||
val receiverAreaCode: String,
|
||||
val waybillInfo: WaybillInfo
|
||||
|
||||
|
||||
)
|
||||
|
||||
data class CaptainInfo(
|
||||
@@ -64,6 +69,7 @@ data class OrderChild(
|
||||
val city: String,
|
||||
val cityCode: String,
|
||||
val cost: String,
|
||||
val isPassingPoints: String,//是否途经点(0=否,1=是)
|
||||
val displayOrder: String,
|
||||
val isPassingPoStrings: String,
|
||||
val latitude: String,
|
||||
@@ -99,7 +105,7 @@ data class WaybillInfo(
|
||||
val trailerId: String,
|
||||
val trailerVehicleNum: String,
|
||||
val unloadTime: String,
|
||||
val vehicleNum: String,
|
||||
var vehicleNum: String,
|
||||
val carLong: String,
|
||||
val approvedLoad: String,
|
||||
val vehicleType: String,
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.dahe.gldriver.third
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
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.dahe.gldriver.BuildConfig
|
||||
import com.dahe.gldriver.bean.FqBean
|
||||
import com.dahe.gldriver.utils.SPUtils.Companion.instance
|
||||
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 (_, _, _, _, idcard) = 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 = idcard
|
||||
//idy.setDriverIdentity("410725198311042012");
|
||||
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")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.dahe.gldriver.third
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2022/1/10 11:34
|
||||
* @description:交通厅参数
|
||||
*/
|
||||
object JTTConstant {
|
||||
const val JTT_DATA_NAME = "jtt_data"
|
||||
const val JTT_DATA_JTTORDER_KEY = "JTT_order_key"
|
||||
const val JTT_DATA_ORDER_KEY = "order_key"
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
package com.dahe.gldriver.third
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.dahe.gldriver.bean.JTT
|
||||
import com.dahe.gldriver.bean.OrderDetailBean
|
||||
import com.dahe.gldriver.utils.SPUtils
|
||||
import com.dahe.gldriver.utils.StringUtil
|
||||
import com.google.gson.Gson
|
||||
import com.hdgq.locationlib.LocationOpenApi
|
||||
import com.hdgq.locationlib.entity.ShippingNoteInfo
|
||||
import com.hdgq.locationlib.listener.OnResultListener
|
||||
import com.hdgq.locationlib.listener.OnSendResultListener
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/12/10 9:38
|
||||
* @description:交通厅位置上传sdk
|
||||
*/
|
||||
object JTTProcess {
|
||||
private const val APPID = "com.arpa.hndahesudintocctmsdriver"
|
||||
private const val APP_SECURITY =
|
||||
"01e20fc6585a42738ac88a12321dc41bff473b4b20184aacbbcee7d7864359a6"
|
||||
private const val CODE = "41110447"
|
||||
private const val ENVIRONMENT = "release"
|
||||
private val gson = Gson()
|
||||
|
||||
//初始化+获取授权
|
||||
fun init(app: Application?) {
|
||||
LocationOpenApi.init(app)
|
||||
//auth(app.getBaseContext());
|
||||
}
|
||||
|
||||
//获取授权
|
||||
fun auth(con: Context) {
|
||||
val jttStr: String = SPUtil.getSP(con, "data", "jtt")
|
||||
val jtt = gson.fromJson(jttStr, JTT::class.java)
|
||||
if (jtt.data == null) {
|
||||
return
|
||||
}
|
||||
LocationOpenApi.auth(con, APPID, StringUtil.isNull(jtt.data.trafficCode, APP_SECURITY),
|
||||
StringUtil.isNull(jtt.data.trafficId, CODE),
|
||||
ENVIRONMENT, object : OnResultListener {
|
||||
override fun onFailure(s: String, s1: String) {
|
||||
Log.e("交通厅-获取授权", s + s1)
|
||||
}
|
||||
|
||||
override fun onSuccess(list: List<ShippingNoteInfo>) {
|
||||
Log.e("交通厅-获取授权", gson.toJson(list))
|
||||
if (list.size > 0) {
|
||||
SPUtil.insSP(
|
||||
con,
|
||||
JTTConstant.JTT_DATA_NAME,
|
||||
JTTConstant.JTT_DATA_JTTORDER_KEY,
|
||||
gson.toJson(
|
||||
list[0]
|
||||
)
|
||||
)
|
||||
val `in` = Intent(con, JTTSendService::class.java)
|
||||
con.startService(`in`)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//开启定位-装货
|
||||
//shippingNoteInfos 为运单信息列表,考虑到一车多单的情况,本版SDK 一辆车运单数最大支持数为 10。
|
||||
fun start(con: Context, sob: OrderDetailBean, remark: String?) {
|
||||
val snis = arrayOfNulls<ShippingNoteInfo>(1)
|
||||
val sni = ShippingNoteInfo()
|
||||
val startWay = sob.orderChildList.filter { it.isPassingPoints!="0" }.first { it.type == "1" }
|
||||
val endWay = sob.orderChildList.filter { it.isPassingPoints!="0" }.first { it.type == "2" }
|
||||
sni.shippingNoteNumber = sob.orderNum
|
||||
sni.serialNumber = "0000"
|
||||
sni.startLatitude = startWay.latitude.toDouble()
|
||||
sni.startLongitude = startWay.longitude.toDouble()
|
||||
sni.startLocationText = startWay.province + startWay.city + startWay.area + startWay.address
|
||||
sni.startCountrySubdivisionCode = sob.loadingAreaCode
|
||||
sni.endLatitude = endWay.latitude.toDouble()
|
||||
sni.endLongitude = endWay.longitude.toDouble()
|
||||
sni.endLocationText = endWay.province + endWay.city + endWay.area + endWay.address
|
||||
sni.endCountrySubdivisionCode = sob.receiverAreaCode
|
||||
snis[0] = sni
|
||||
// Log.e("起点代码",sob.getData().getStartCountrySubdivisionCode());
|
||||
// Log.e("终点代码",sob.getData().getEndCountrySubdivisionCode());
|
||||
// AMapLocationClient.updatePrivacyShow(con,true,true);
|
||||
// AMapLocationClient.updatePrivacyAgree(con,true);
|
||||
|
||||
LocationOpenApi.start(
|
||||
con,
|
||||
sob.waybillInfo.vehicleNum,
|
||||
if (SPUtils.instance.getUserInfo(con).idcardName == null) "" else SPUtils.instance.getUserInfo(
|
||||
con
|
||||
).idcardName,
|
||||
remark,
|
||||
snis,
|
||||
object : OnResultListener {
|
||||
override fun onFailure(s: String, s1: String) {
|
||||
Log.e("交通厅-开启定位失败", s + s1 + "")
|
||||
}
|
||||
|
||||
override fun onSuccess(list: List<ShippingNoteInfo>) {
|
||||
Log.e("交通厅-开启定位成功", gson.toJson(list))
|
||||
if (list.size > 0) {
|
||||
SPUtil.insSP(
|
||||
con,
|
||||
JTTConstant.JTT_DATA_NAME,
|
||||
JTTConstant.JTT_DATA_JTTORDER_KEY,
|
||||
gson.toJson(
|
||||
list[0]
|
||||
)
|
||||
)
|
||||
val `in` = Intent(con, JTTSendService::class.java)
|
||||
con.startService(`in`)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//发送定位
|
||||
//参数 ShippingNoteInfo 和 start 接口中的参数 ShippingNoteInfo 相
|
||||
//同,这里 shippingNoteInfo 信息只需传入运单号和分单号即可
|
||||
fun send(con: Context?, sob: OrderDetailBean, remark: String?) {
|
||||
val snis = arrayOfNulls<ShippingNoteInfo>(1)
|
||||
val sni = ShippingNoteInfo()
|
||||
sni.shippingNoteNumber = sob.orderNum
|
||||
sni.serialNumber = "0000"
|
||||
sni.startCountrySubdivisionCode = sob.loadingAreaCode
|
||||
sni.endCountrySubdivisionCode = sob.receiverAreaCode
|
||||
snis[0] = sni
|
||||
LocationOpenApi.send(
|
||||
con,
|
||||
sob.waybillInfo.vehicleNum,
|
||||
if (SPUtils.instance.getUserInfo(con).idcardName == null) "" else SPUtils.instance.getUserInfo(
|
||||
con
|
||||
).idcardName,
|
||||
remark,
|
||||
snis,
|
||||
object : OnSendResultListener {
|
||||
override fun onFailure(s: String, s1: String, list: List<ShippingNoteInfo>) {
|
||||
Log.e("交通厅-发送定位失败", s + s1 + "")
|
||||
}
|
||||
|
||||
override fun onSuccess(list: List<ShippingNoteInfo>) {
|
||||
Log.e("交通厅-发送定位成功", gson.toJson(list))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//暂停定位
|
||||
//运单运输过程中,如果出现换驾驶员、换车或换手机的情况,则需驾驶员在原手机上操作,对运送运单列表执行暂停操作,
|
||||
//调用本接口将运单列表中所有运单标记为暂停状态,并结束本手机的运单定位。
|
||||
fun pause(con: Context?, sob: OrderDetailBean, remark: String?) {
|
||||
val snis = arrayOfNulls<ShippingNoteInfo>(1)
|
||||
val sni = ShippingNoteInfo()
|
||||
val startWay = sob.orderChildList.filter { it.isPassingPoints!="0" }.first { it.type == "1" }
|
||||
val endWay = sob.orderChildList.filter { it.isPassingPoints!="0" }.first { it.type == "2" }
|
||||
sni.shippingNoteNumber = sob.orderNum
|
||||
sni.serialNumber = "0000"
|
||||
sni.startLatitude = startWay.latitude.toDouble()
|
||||
sni.startLongitude = startWay.longitude.toDouble()
|
||||
sni.startLocationText = startWay.province + startWay.city + startWay.area + startWay.address
|
||||
sni.startCountrySubdivisionCode = sob.loadingAreaCode
|
||||
sni.endLatitude = endWay.latitude.toDouble()
|
||||
sni.endLongitude = endWay.longitude.toDouble()
|
||||
sni.endLocationText = endWay.province + endWay.city + endWay.area + endWay.address
|
||||
sni.endCountrySubdivisionCode = sob.receiverAreaCode
|
||||
snis[0] = sni
|
||||
LocationOpenApi.pause(
|
||||
con,
|
||||
sob.waybillInfo.vehicleNum,
|
||||
if (SPUtils.instance.getUserInfo(con).idcardName == null) "" else SPUtils.instance.getUserInfo(
|
||||
con
|
||||
).idcardName,
|
||||
remark,
|
||||
snis,
|
||||
object : OnResultListener {
|
||||
override fun onFailure(s: String, s1: String) {
|
||||
Log.e("交通厅-暂停定位失败", s + s1 + "")
|
||||
}
|
||||
|
||||
override fun onSuccess(list: List<ShippingNoteInfo>) {
|
||||
Log.e("交通厅-暂停定位成功", gson.toJson(list))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//重启定位
|
||||
//对应 pause 接口,本接口的作用是对已暂停的运单列表执行重启定位操作
|
||||
fun restart(con: Context?, sob: OrderDetailBean, remark: String?) {
|
||||
val snis = arrayOfNulls<ShippingNoteInfo>(1)
|
||||
val sni = ShippingNoteInfo()
|
||||
val startWay = sob.orderChildList.filter { it.isPassingPoints!="0" }.first { it.type == "1" }
|
||||
val endWay = sob.orderChildList.filter { it.isPassingPoints!="0" }.first { it.type == "2" }
|
||||
sni.shippingNoteNumber = sob.orderNum
|
||||
sni.serialNumber = "0000"
|
||||
sni.startLatitude = startWay.latitude.toDouble()
|
||||
sni.startLongitude = startWay.longitude.toDouble()
|
||||
sni.startLocationText = startWay.province + startWay.city + startWay.area + startWay.address
|
||||
sni.startCountrySubdivisionCode = sob.loadingAreaCode
|
||||
sni.endLatitude = endWay.latitude.toDouble()
|
||||
sni.endLongitude = endWay.longitude.toDouble()
|
||||
sni.endLocationText = endWay.province + endWay.city + endWay.area + endWay.address
|
||||
sni.endCountrySubdivisionCode = sob.receiverAreaCode
|
||||
snis[0] = sni
|
||||
LocationOpenApi.restart(
|
||||
con,
|
||||
sob.waybillInfo.vehicleNum,
|
||||
if (SPUtils.instance.getUserInfo(con).idcardName == null) "" else SPUtils.instance.getUserInfo(
|
||||
con
|
||||
).idcardName,
|
||||
remark,
|
||||
snis,
|
||||
object : OnResultListener {
|
||||
override fun onFailure(s: String, s1: String) {
|
||||
Log.e("交通厅-重启定位失败", s + s1 + "")
|
||||
}
|
||||
|
||||
override fun onSuccess(list: List<ShippingNoteInfo>) {
|
||||
Log.e("交通厅-重启定位成功", gson.toJson(list))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//结束定位-卸货
|
||||
fun stop(con: Context, sob: OrderDetailBean, remark: String?) {
|
||||
val snis = arrayOfNulls<ShippingNoteInfo>(1)
|
||||
val sni = ShippingNoteInfo()
|
||||
val startWay = sob.orderChildList.filter { it.isPassingPoints!="0" }.first { it.type == "1" }
|
||||
val endWay = sob.orderChildList.filter { it.isPassingPoints!="0" }.first { it.type == "2" }
|
||||
sni.shippingNoteNumber = sob.orderNum
|
||||
sni.serialNumber = "0000"
|
||||
sni.startLatitude = startWay.latitude.toDouble()
|
||||
sni.startLongitude = startWay.longitude.toDouble()
|
||||
sni.startLocationText = startWay.province + startWay.city + startWay.area + startWay.address
|
||||
sni.startCountrySubdivisionCode = sob.loadingAreaCode
|
||||
sni.endLatitude = endWay.latitude.toDouble()
|
||||
sni.endLongitude = endWay.longitude.toDouble()
|
||||
sni.endLocationText = endWay.province + endWay.city + endWay.area + endWay.address
|
||||
sni.endCountrySubdivisionCode = sob.receiverAreaCode
|
||||
snis[0] = sni
|
||||
//remark="[00]车辆损坏货物无法送达";
|
||||
//sob.getData().setCarNumber("豫PK2861");
|
||||
LocationOpenApi.stop(
|
||||
con,
|
||||
sob.waybillInfo.vehicleNum,
|
||||
if (SPUtils.instance.getUserInfo(con).idcardName == null) "" else SPUtils.instance.getUserInfo(
|
||||
con
|
||||
).idcardName,
|
||||
remark,
|
||||
snis,
|
||||
object : OnResultListener {
|
||||
override fun onFailure(s: String, s1: String) {
|
||||
Log.e("交通厅-结束定位失败", s + s1 + "")
|
||||
}
|
||||
|
||||
override fun onSuccess(list: List<ShippingNoteInfo>) {
|
||||
Log.e("交通厅-结束定位成功", gson.toJson(list))
|
||||
val stopIntent = Intent(con, JTTSendService::class.java)
|
||||
con.stopService(stopIntent)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.dahe.gldriver.third;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.dahe.gldriver.bean.OrderDetailBean;
|
||||
import com.google.gson.Gson;
|
||||
import com.hdgq.locationlib.entity.ShippingNoteInfo;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/12/24 14:16
|
||||
* @description:
|
||||
*/
|
||||
public class JTTSendService extends Service {
|
||||
|
||||
private Context con;
|
||||
private String snn="";
|
||||
private Gson gson=new Gson();
|
||||
private OrderDetailBean sob=null;
|
||||
|
||||
private Handler hd=new Handler(msg -> {
|
||||
switch (msg.what){
|
||||
case 66:
|
||||
JTTProcess.INSTANCE.send(con,sob,"");
|
||||
break;
|
||||
case 67:
|
||||
JTTProcess.INSTANCE.pause(getBaseContext(),sob,"");
|
||||
sob.getWaybillInfo().setVehicleNum("豫PK2861");
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
MsgUtil.addHdMsgWat(hd,68);
|
||||
}
|
||||
},6000,100000000);
|
||||
break;
|
||||
case 68:
|
||||
JTTProcess.INSTANCE.restart(getBaseContext(),sob,"[03]换车");
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {return null; }
|
||||
|
||||
private int sum=0;
|
||||
private ShippingNoteInfo sf;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e("交通厅","开启位置上传");
|
||||
con=this;
|
||||
String str= SPUtil.getSP(con, JTTConstant.JTT_DATA_NAME,JTTConstant.JTT_DATA_JTTORDER_KEY);
|
||||
String str2=SPUtil.getSP(con,JTTConstant.JTT_DATA_NAME,JTTConstant.JTT_DATA_ORDER_KEY);
|
||||
sf=gson.fromJson(str,ShippingNoteInfo.class);
|
||||
sob=gson.fromJson(str2,OrderDetailBean.class);
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
while (true){
|
||||
String str= SPUtil.getSP(con,JTTConstant.JTT_DATA_NAME,JTTConstant.JTT_DATA_JTTORDER_KEY);
|
||||
if ("".equals(str)) {
|
||||
break;
|
||||
}
|
||||
sf=gson.fromJson(str, ShippingNoteInfo.class);
|
||||
try {
|
||||
Thread.sleep(sf.getInterval()+1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
MsgUtil.addHdMsgWat(hd,66);
|
||||
try {
|
||||
Thread.sleep(6000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// sum++;
|
||||
// if(sum==3){
|
||||
// MsgUtil.addHdMsgWat(hd,67);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
//开始
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e("服务开启","-----");
|
||||
return START_STICKY;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.dahe.gldriver.third;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/7/30 16:29
|
||||
* @description:
|
||||
*/
|
||||
public class MsgUtil {
|
||||
|
||||
public static void addHdMsgWat(Handler hd,int what){
|
||||
Message msg=Message.obtain();
|
||||
msg.what=what;
|
||||
hd.sendMessage(msg);
|
||||
}
|
||||
public static void addHdMsgWatBody(Handler hd,int what,String body){
|
||||
Message msg=Message.obtain();
|
||||
msg.what=what;
|
||||
msg.obj=body;
|
||||
hd.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.dahe.gldriver.third;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class SPUtil {
|
||||
|
||||
private static SharedPreferences sp=null;
|
||||
public static String getSP(Context con, String dataname, String name){
|
||||
sp=con.getSharedPreferences(dataname,con.MODE_PRIVATE);
|
||||
return sp.getString(name,"");
|
||||
}
|
||||
|
||||
public static void insSP(Context con, String dataname, String name, String body){
|
||||
SharedPreferences.Editor editor=con.getSharedPreferences(dataname,con.MODE_PRIVATE).edit();
|
||||
editor.putString(name,body);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,17 @@
|
||||
package com.dahe.gldriver.ui
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.os.Process
|
||||
import com.alct.mdp.MDPLocationCollectionManager
|
||||
import com.amap.api.location.AMapLocationClient
|
||||
import com.amap.api.maps.MapsInitializer
|
||||
import com.dahe.gldriver.BuildConfig
|
||||
import com.dahe.gldriver.base.App
|
||||
import com.dahe.gldriver.databinding.ActivityLauncherBinding
|
||||
import com.dahe.gldriver.third.JTTProcess
|
||||
import com.dahe.gldriver.third.SPUtil
|
||||
import com.dahe.gldriver.ui.account.LoginActivity
|
||||
import com.dahe.gldriver.utils.CommonPopUtils
|
||||
import com.dahe.gldriver.utils.SPUtils
|
||||
@@ -47,6 +55,7 @@ class LauncherActivity : BaseActivity<ActivityLauncherBinding>() {
|
||||
AMapLocationClient.updatePrivacyShow(mContext, true, true)
|
||||
AMapLocationClient.updatePrivacyAgree(mContext, true)
|
||||
MapsInitializer.updatePrivacyAgree(this, true)
|
||||
initThird()
|
||||
goNext()
|
||||
}
|
||||
} else {
|
||||
@@ -54,6 +63,24 @@ class LauncherActivity : BaseActivity<ActivityLauncherBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun initThird() {
|
||||
val state: String = SPUtil.getSP(mContext, "state_data", "authorization_state")
|
||||
if ("1" != state) {
|
||||
try {
|
||||
//安联初始化
|
||||
if (packageName == getCurrentProcessName(this)) {
|
||||
//Log.e("--使用的测试环境--",BuildConfig.OPEN_API_URL);
|
||||
MDPLocationCollectionManager.initialize(this, BuildConfig.OPEN_AL_URL)
|
||||
}
|
||||
//初始化交通厅
|
||||
JTTProcess.init(application)
|
||||
SPUtil.insSP(mContext, "state_data", "authorization_state", "1")
|
||||
} catch (e: Exception) {
|
||||
SPUtil.insSP(mContext, "state_data", "authorization_state", "0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
mDisposable?.dispose()
|
||||
@@ -86,4 +113,18 @@ class LauncherActivity : BaseActivity<ActivityLauncherBinding>() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCurrentProcessName(context: Context): String? {
|
||||
var currentProcessName = ""
|
||||
val pid = Process.myPid()
|
||||
val mActivityManager = context.getSystemService(ACTIVITY_SERVICE) as ActivityManager
|
||||
if (mActivityManager.runningAppProcesses != null && mActivityManager.runningAppProcesses.size > 0) {
|
||||
for (appProcess in mActivityManager.runningAppProcesses) {
|
||||
if (appProcess.pid == pid) {
|
||||
currentProcessName = appProcess.processName
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentProcessName
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
private fun initRecy() {
|
||||
adapter = binding.recyclerView.run {
|
||||
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||
setHasFixedSize(true)
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package com.dahe.gldriver.ui.waybill.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
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.dahe.gldriver.base.AppConfig
|
||||
import com.dahe.gldriver.bean.OcrPersonBean
|
||||
import com.dahe.gldriver.bean.LUInputBean
|
||||
import com.dahe.gldriver.bean.UpPicBean
|
||||
import com.dahe.gldriver.bean.WaybillPhoto
|
||||
import com.dahe.gldriver.databinding.ActivityWaybillUppicBinding
|
||||
@@ -14,6 +20,7 @@ import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.oss.OssServiceUtil
|
||||
import com.dahe.gldriver.third.JTTProcess
|
||||
import com.dahe.gldriver.utils.GDLocationUtils
|
||||
import com.dahe.gldriver.utils.OcrUtils
|
||||
import com.dahe.gldriver.utils.OrderUtils
|
||||
@@ -22,21 +29,20 @@ import com.dahe.mylibrary.adapter.GridImageAdapter.OnItemClickListener
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.BitmapUtil
|
||||
import com.dahe.mylibrary.utils.FileUtil
|
||||
import com.dahe.mylibrary.utils.LoadingUtils
|
||||
import com.dahe.mylibrary.utils.PopsUtils
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import com.dahe.mylibrary.weight.FullyGridLayoutManager
|
||||
import com.dahe.mylibrary.weight.GlideEngine
|
||||
import com.luck.picture.lib.basic.PictureSelector
|
||||
import com.luck.picture.lib.decoration.GridSpacingItemDecoration
|
||||
import com.luck.picture.lib.entity.LocalMedia
|
||||
import com.luck.picture.lib.utils.DensityUtil
|
||||
import com.luck.picture.lib.widget.SquareRelativeLayout
|
||||
import com.lxj.xpopup.XPopup
|
||||
import com.lxj.xpopup.interfaces.OnSrcViewUpdateListener
|
||||
import com.lxj.xpopup.util.SmartGlideImageLoader
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
/**
|
||||
* @ClassName WaybillUpPicActivity
|
||||
@@ -52,6 +58,9 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
||||
var orderId: String = ""
|
||||
var waybillId: String = ""
|
||||
lateinit var latLng: LatLng
|
||||
lateinit var bdLatLng: LatLng
|
||||
|
||||
private val lub: LUInputBean = LUInputBean()
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
upBean = UpPicBean()
|
||||
@@ -89,11 +98,11 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
||||
myAdapter.selectMax = 1
|
||||
myAdapter.setOnItemClickListener(object : OnItemClickListener {
|
||||
override fun onItemClick(v: View?, position: Int) {
|
||||
selGoodPic(type,myAdapter)
|
||||
selGoodPic(type, myAdapter)
|
||||
}
|
||||
|
||||
override fun openPicture() {
|
||||
selGoodPic(type,myAdapter)
|
||||
selGoodPic(type, myAdapter)
|
||||
}
|
||||
})
|
||||
adapter = myAdapter
|
||||
@@ -177,59 +186,291 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
||||
|
||||
|
||||
btnUnload.setOnClickListener {
|
||||
upBean.run {
|
||||
orderId = this@WaybillUpPicActivity.orderId
|
||||
waybillId = this@WaybillUpPicActivity.waybillId
|
||||
latitude = latLng.latitude.toString()
|
||||
longitude = latLng.longitude.toString()
|
||||
this.type = if (type == 1) "1" else "2"
|
||||
}
|
||||
|
||||
if (type == 1) {
|
||||
if (upBean.waybillPhotoList.find { it.type == "1" } == null) {
|
||||
showToast("请上传装货照片")
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
|
||||
if (type == 2) {
|
||||
if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
|
||||
showToast("请上传卸货照片")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (upBean.waybillPhotoList.find { it.receiptType == "4" || it.receiptType == "5" } == null) {
|
||||
showToast("卸货请上传卸货回单照片")
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
|
||||
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 == type) {
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
}))
|
||||
subMit(type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun subMit(orderType: Int?) {
|
||||
upBean.run {
|
||||
orderId = this@WaybillUpPicActivity.orderId
|
||||
waybillId = this@WaybillUpPicActivity.waybillId
|
||||
latitude = latLng.latitude.toString()
|
||||
longitude = latLng.longitude.toString()
|
||||
type = if (orderType == 1) "1" else "2"
|
||||
}
|
||||
|
||||
if (orderType == 1) {
|
||||
if (upBean.waybillPhotoList.find { it.type == "1" } == null) {
|
||||
showToast("请上传装货照片")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (orderType == 2) {
|
||||
if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
|
||||
showToast("请上传卸货照片")
|
||||
return
|
||||
}
|
||||
if (upBean.waybillPhotoList.find { it.receiptType == "4" || it.receiptType == "5" } == null) {
|
||||
showToast("卸货请上传卸货回单照片")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//装货
|
||||
// lub.latitude = latLng.latitude.toString()
|
||||
// lub.longitude = latLng.longitude.toString()
|
||||
// lub.locationAddress = binding.tvLoca.text.toString()
|
||||
// //todo imageId需确定
|
||||
// lub.imageId = upBean.waybillPhotoList.filter { it.type == "1" }.map { it.photoUrl.toInt() }
|
||||
// lub.waybillId = ""
|
||||
|
||||
val l = Location()
|
||||
l.baiduLongitude = bdLatLng.longitude
|
||||
l.baiduLatitude = bdLatLng.latitude
|
||||
l.location = binding.tvLoca.text.toString()
|
||||
l.time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||
|
||||
|
||||
|
||||
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: Location) {
|
||||
MDPLocationCollectionManager.pickup(mContext, "", location, object : OnResultListener {
|
||||
override fun onSuccess() {
|
||||
Log.e("上报安联", "装货上传成功")
|
||||
|
||||
//上传安联和交通厅,平台-装货
|
||||
// JTTProcess.start(mContext, sob, "")
|
||||
upLoadImage()
|
||||
|
||||
}
|
||||
|
||||
override fun onFailure(p0: String?, p1: String?) {
|
||||
Log.e("上报安联失败(装货):", p0 + p1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun unLoad(location: Location) {
|
||||
MDPLocationCollectionManager.unload(mContext, "getShippingNoteNumber()", location,
|
||||
object : OnResultListener {
|
||||
override fun onSuccess() {
|
||||
Log.e("上报安联", "卸货上传成功")
|
||||
//交通厅
|
||||
// if (sob.getData().getReport() === 1) {
|
||||
// JTTProcess.stop(mContext, sob, "")
|
||||
// }
|
||||
//卸货状态-平台
|
||||
// hyr.dischargeCargo(lub)
|
||||
//卸货照片-安联
|
||||
upUnloadImage()
|
||||
|
||||
//卸货回单
|
||||
upTrafficSign()
|
||||
upTrafficReceipt()
|
||||
receiptImage()
|
||||
}
|
||||
|
||||
override fun onFailure(s: String, s1: String) {
|
||||
Log.e("上报安联失败(卸货):", s + s1)
|
||||
// MessageUtils().showCenMessage(con, s1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//上传安联装货
|
||||
fun upLoadImage() {
|
||||
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
||||
val file: File = File("")
|
||||
val image = Image()
|
||||
val base: String = BitmapUtil.imageToBase64("path")
|
||||
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.uploadPickupImage(
|
||||
mContext,
|
||||
"sob.getData().getShippingNoteNumber()",
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//上传安联卸货
|
||||
fun upUnloadImage() {
|
||||
val file: File = File("path")
|
||||
val image = Image()
|
||||
val base = BitmapUtil.imageToBase64("path")
|
||||
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.uploadUnloadImage(
|
||||
mContext,
|
||||
"sob.getData().getShippingNoteNumber()",
|
||||
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() {
|
||||
//安联
|
||||
val l = Location()
|
||||
l.baiduLongitude = latLng.longitude
|
||||
l.baiduLatitude = latLng.latitude
|
||||
l.location = binding.tvLoca.text.toString()
|
||||
l.time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||
val gs: List<Goods> = java.util.ArrayList()
|
||||
// for (wayChild in sob.getData().getWayChildren()) {
|
||||
// if (wid == wayChild.getId() + "") {
|
||||
// for (good in wayChild.getGoods()) {
|
||||
// val g = Goods()
|
||||
// g.goodsName = good.getGoodName()
|
||||
// g.unit = good.getGoodUnit()
|
||||
// g.itemNo = good.getId()
|
||||
// //实收
|
||||
// g.quantity = 1
|
||||
// //应收
|
||||
// g.receivedQuantity = 1
|
||||
// //破损
|
||||
// g.damageQuantity = 1
|
||||
// //丢失
|
||||
// g.quantity = 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
MDPLocationCollectionManager.sign(
|
||||
mContext,
|
||||
"sob.getData().getShippingNoteNumber()",
|
||||
l,
|
||||
gs,
|
||||
object : OnResultListener {
|
||||
override fun onSuccess() {
|
||||
Log.e("上报安联", "签收成功")
|
||||
}
|
||||
|
||||
override fun onFailure(s: String, s1: String) {
|
||||
Log.e("上报安联失败(签收):", s + s1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//上传安联-回单
|
||||
fun upTrafficReceipt() {
|
||||
//安联
|
||||
val l = Location()
|
||||
l.baiduLongitude = latLng.longitude
|
||||
l.baiduLatitude = latLng.latitude
|
||||
l.location = binding.tvLoca.text.toString()
|
||||
l.time = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(Date())
|
||||
MDPLocationCollectionManager.pod(
|
||||
mContext,
|
||||
"sob.getData().getShippingNoteNumber()",
|
||||
l,
|
||||
object : OnResultListener {
|
||||
override fun onSuccess() {
|
||||
Log.e("上报安联", "回单上传成功")
|
||||
}
|
||||
|
||||
override fun onFailure(s: String, s1: String) {
|
||||
Log.e("上报安联失败(回单):", s + s1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//卸货回单照片
|
||||
fun receiptImage() {
|
||||
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
||||
val file: File = File("")
|
||||
val image = Image()
|
||||
val base = BitmapUtil.imageToBase64("path")
|
||||
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 = latLng.longitude
|
||||
image.baiduLatitude = latLng.latitude
|
||||
image.location = binding.tvLoca.text.toString()
|
||||
MDPLocationCollectionManager.uploadPODImage(
|
||||
mContext,
|
||||
"sob.getData().getShippingNoteNumber()",
|
||||
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);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
private val mData: List<LocalMedia> = ArrayList()
|
||||
override fun initDate() {
|
||||
@@ -247,6 +488,7 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
||||
it.getLongitude()//经 度
|
||||
it.getLatitude()//纬 度
|
||||
latLng = LatLng(it.latitude, it.longitude)
|
||||
bdLatLng = GDLocationUtils.instance.convertGPSToBaidu(latLng)
|
||||
binding.tvLoca.text = it.address
|
||||
} else {
|
||||
showToast("定位失败,请检查定位权限是否开启")
|
||||
@@ -255,7 +497,7 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun selGoodPic(goodType:Int?,myAdapter: GridImageAdapter) {
|
||||
private fun selGoodPic(goodType: Int?, myAdapter: GridImageAdapter) {
|
||||
PopsUtils.getInstance().showSelPic(mContext, false, myAdapter) {
|
||||
OssServiceUtil.getInstance().run {
|
||||
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
|
||||
@@ -291,4 +533,6 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import android.os.Build
|
||||
import com.amap.api.location.AMapLocationClient
|
||||
import com.amap.api.location.AMapLocationClientOption
|
||||
import com.amap.api.location.AMapLocationListener
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.baidu.mapapi.utils.CoordinateConverter
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.service.MyNotification
|
||||
|
||||
@@ -118,6 +120,13 @@ class GDLocationUtils private constructor(){
|
||||
}
|
||||
}
|
||||
|
||||
fun convertGPSToBaidu(srLatLng: LatLng): LatLng {
|
||||
val converter = CoordinateConverter()
|
||||
converter.from(CoordinateConverter.CoordType.COMMON)
|
||||
converter.coord(com.baidu.mapapi.model.LatLng(srLatLng.latitude,srLatLng.longitude))
|
||||
return LatLng(converter.convert().latitude,converter.convert().longitude)
|
||||
}
|
||||
|
||||
|
||||
fun stopLocation(){
|
||||
if(null != mLocationClient){
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.dahe.gldriver.utils;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/8/7 17:54
|
||||
* @description:字符串工具类
|
||||
*/
|
||||
public class StringUtil {
|
||||
|
||||
public static String isNull(String in_str,String out_str){
|
||||
if(in_str==null || in_str.equals("null") || in_str.trim().equals("")){
|
||||
return out_str;
|
||||
}
|
||||
return in_str;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user