3.2.3司机认证优化

This commit is contained in:
lijia 2023-08-17 15:18:24 +08:00
parent c686fb4e8f
commit 9345621309
11 changed files with 542 additions and 210 deletions

View File

@ -3,6 +3,7 @@ plugins {
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.huawei.agconnect'
id 'kotlin-android-extensions'
}
android {
@ -34,8 +35,8 @@ android {
applicationId "com.arpa.hndahesudintocctmsdriver"
minSdkVersion 23
targetSdkVersion 30
versionCode 53
versionName "3.2.2"
versionCode 54
versionName "3.2.3"
flavorDimensions "CHANNEL_VALUE"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {

View File

@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.arpa.hndahesudintocctmsdriver">
<uses-permission android:name="android.permission.CALL_PHONE" />
<!-- 白名单 -->
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- 基础权限 -->

View File

@ -40,7 +40,6 @@ public class App extends Application {
public static int APP_STATUS = APP_STATUS_KILLED; // 记录App的启动状态
private Context con;
public static App mApplication = null;
@Override
public void onCreate() {
super.onCreate();

View File

@ -0,0 +1,69 @@
package com.arpa.hndahesudintocctmsdriver.cuspop
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.view.View
import com.arpa.hndahesudintocctmsdriver.R
import com.dahe.mylibrary.utils.BaseUtils
import com.dahe.mylibrary.utils.ToastUtils
import com.lxj.xpopup.core.CenterPopupView
import kotlinx.android.synthetic.main.load.view.*
import kotlinx.android.synthetic.main.pop_message_center.view.*
/**
* @ClassName MessagePop
* @Author 用户
* @Date 2023/8/14 18:01
* @Description TODO
*/
class MessagePop(context: Context) : CenterPopupView(context), View.OnClickListener {
lateinit var content :String
constructor(context: Context,message : String) :this(context) {
content = message
}
override fun getImplLayoutId() = R.layout.pop_message_center
override fun onCreate() {
super.onCreate()
tvCancel.setOnClickListener(this)
tvOk.setOnClickListener(this)
tvPhone.setOnClickListener(this)
tvContent.text = "$content"
}
override fun onClick(v: View?) {
when(v?.id){
R.id.tvCancel -> {
dismiss()
}
R.id.tvOk,R.id.tvPhone -> {
dismiss()
val toString = tvPhone.text.toString()
val intent = Intent(Intent.ACTION_CALL)
val data = Uri.parse("tel:$toString")
intent.data = data
context.startActivity(intent)
dismiss()
// BaseUtils.callPhone(content as Activity, tvPhone.text.toString())
}
}
}
private var listener: OnMyItemClickListener? = null
fun setOnMyItemClickListener(listener: OnMyItemClickListener?): MessagePop {
this.listener = listener
return this
}
interface OnMyItemClickListener {
fun onItemClick(startTime: String, endTime: String)
}
}

View File

@ -8,7 +8,10 @@ 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.App;
import com.arpa.hndahesudintocctmsdriver.parts.AuthParts;
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
import com.arpa.hndahesudintocctmsdriver.util.msg.MsgUtil;
import com.google.gson.Gson;
import com.arpa.hndahesudintocctmsdriver.bean.DriverAuthDataBean;
import com.arpa.hndahesudintocctmsdriver.bean.FqBean;
@ -50,6 +53,7 @@ public class ALProcess {
@Override
public void onFailure(java.lang.String s, java.lang.String s1) {
Log.e("--error--",s+s1+"");
new MessageUtils().showCenMessage(con,s1);
}
});
}
@ -113,4 +117,33 @@ public class ALProcess {
}
public static void verification(Context con,Handler hd){
DriverAuthDataBean auth= AuthParts.getAuth(con);
Identity idy=new Identity();
//企业代码
idy.setEnterpriseCode(ENTERPRISE_CODE);
//企业app的身份码
idy.setAppIdentity(APP_IDENTITY);
//企业app验证码
idy.setAppKey(APP_KEY);
//司机身份证
idy.setDriverIdentity(auth.getData().getIdcard());
//idy.setDriverIdentity("410725198311042012");
MDPLocationCollectionManager.register(con, idy, new OnResultListener() {
@Override
public void onSuccess() {
MsgUtil.addHdMsgWatBody(hd, 1111,"认证成功");
Log.e("--success--","验证成功");
getFq(con);
}
@Override
public void onFailure(java.lang.String s, java.lang.String s1) {
Log.e("--error--",s+s1+"");
MsgUtil.addHdMsgWatBody(hd, 2222,s1);
new MessageUtils().showCenMessage(con,s1);
}
});
}
}

View File

@ -123,6 +123,7 @@ public class HomeFragment extends BaseFragment {
private ImageConfig ic;
private DriverExpireBean deb;
@Override
public void msgMethod(Message m) {
super.msgMethod(m);

View File

@ -21,8 +21,10 @@ import com.alibaba.fastjson.JSONObject;
import com.arpa.hndahesudintocctmsdriver.bean.JTT;
import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
import com.arpa.hndahesudintocctmsdriver.report.ALProcess;
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
import com.arpa.hndahesudintocctmsdriver.ui.auth.PersonalAuthActivity;
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
import com.arpa.hndahesudintocctmsdriver.util.img.ImageGetUtil;
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
@ -32,6 +34,7 @@ import com.esign.esignsdk.data.AuthEvent;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.OnCancelListener;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.arpa.hndahesudintocctmsdriver.R;
import com.arpa.hndahesudintocctmsdriver.bean.BaseBean;
@ -120,6 +123,21 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
car.setText("选择车辆:" + clb.getData().get(index).getCarNumber());
cid = clb.getData().get(index).getCarId();
break;
case 1111://安联用户验证通过接单
new XPopup.Builder(con)
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认接单", "是否确定承运此运单?",
"取消", "确认",
() -> {
Log.e("--id--", "cid:" + cid + "---wid:" + id);
hyr.confirm(cid, id);
}, () -> customDialog.dismiss(), false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
break;
case 2222://安联用户验证不通过
customDialog.dismiss();
new MessageUtils().showCenMessage(con, (String) m.obj);
break;
}
}
@ -236,20 +254,7 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
if (cid != null) {
// if (fpKey){
if (key) {
new XPopup.Builder(con)
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认接单", "是否确定承运此运单?",
"取消", "确认",
new OnConfirmListener() {
@Override
public void onConfirm() {
Log.e("--id--", "cid:" + cid + "---wid:" + id);
customDialog = new CustomDialog(con, "正在接单...");
customDialog.show();
hyr.confirm(cid, id);
}
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
reOrder();
} else {
Toast.makeText(con, "请先同意并签署运输合同", Toast.LENGTH_SHORT).show();
}
@ -350,4 +355,15 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
}
}
/**
* 接单
* 先判断安联用户信息验证随后接单
*/
private void reOrder() {
customDialog = new CustomDialog(con, "正在接单...");
customDialog.show();
//验证安联用户是否通过
ALProcess.verification(con, hd);
}
}

View File

@ -19,8 +19,10 @@ 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.arpa.hndahesudintocctmsdriver.report.ALProcess;
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
import com.arpa.hndahesudintocctmsdriver.util.BitmapUtil;
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
import com.arpa.hndahesudintocctmsdriver.util.NfcUtils;
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
import com.arpa.hndahesudintocctmsdriver.util.img.GetCarImageAlert;
@ -156,7 +158,8 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
// }
hyr.uploadFile(new File(path));
break;
default:break;
default:
break;
}
}
@ -313,11 +316,12 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
lub.setWaybillId(wid);
Log.e("--装货信息", gson.toJson(lub));
if (locationKey) {
hyr.loading(lub);
if (keys) {
nfc();
up_traffic_start();
up_image_z();
loadInfo();
// up_traffic_start();
// up_image_z();
}
} else {
Toast.makeText(con, "定位异常,请重新定位", Toast.LENGTH_SHORT).show();
@ -339,10 +343,10 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (locationKey) {
if (keys) {
nfc();
up_traffic_end();
up_image();
uploadInfo();
}
hyr.dischargeCargo(lub);
} else {
Toast.makeText(con, "定位异常,请重新定位", Toast.LENGTH_SHORT).show();
}
@ -378,7 +382,8 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
Toast.makeText(con, "图片上传异常,请重新上传", Toast.LENGTH_SHORT).show();
}
break;
default:break;
default:
break;
}
}
@ -402,6 +407,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
@Override
public void onFailure(String s, String s1) {
Log.e("上报安联失败(装货):", s + s1);
new MessageUtils().showCenMessage(con, s1);
}
});
}
@ -644,5 +650,77 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
Log.e("nfc", nfcStr);
}
/**
* 上传安联和交通厅,平台-装货
*/
private void loadInfo() {
//安联
if (sob.getData().getReportAlct() == 1) {
Location l = new Location();
l.setBaiduLongitude(lu.getLongitude());
l.setBaiduLatitude(lu.getLatitude());
l.setLocation(lu.getAddress());
l.setTime(Timer.getTimerT());
MDPLocationCollectionManager.pickup(con, sob.getData().getShippingNoteNumber(), l, new com.alct.mdp.callback.OnResultListener() {
@Override
public void onSuccess() {
Log.e("上报安联", "装货上传成功");
//交通厅
if (sob.getData().getReport() == 1) {
JTTProcess.start(con, sob, "");
}
//装货照片
up_image_z();
//装货状态
hyr.loading(lub);
}
@Override
public void onFailure(String s, String s1) {
Log.e("上报安联失败(装货):", s + s1);
new MessageUtils().showCenMessage(con, s1);
}
});
}
}
/**
* 上传安联和交通厅平台-卸货
*/
private void uploadInfo() {
//安联
if (sob.getData().getReportAlct() == 1) {
Location l = new Location();
l.setBaiduLongitude(lu.getLongitude());
l.setBaiduLatitude(lu.getLatitude());
l.setLocation(lu.getAddress());
l.setTime(Timer.getTimerT());
Log.e("-安联卸货信息-", gson.toJson(l));
MDPLocationCollectionManager.unload(con, sob.getData().getShippingNoteNumber(), l, new com.alct.mdp.callback.OnResultListener() {
@Override
public void onSuccess() {
Log.e("上报安联", "卸货上传成功");
//交通厅
if (sob.getData().getReport() == 1) {
JTTProcess.stop(con, sob, "");
}
//卸货照片-安联
up_image();
//卸货状态-平台
hyr.dischargeCargo(lub);
}
@Override
public void onFailure(String s, String s1) {
Log.e("上报安联失败(卸货):", s + s1);
new MessageUtils().showCenMessage(con, s1);
}
});
}
}
}

View File

@ -0,0 +1,35 @@
package com.arpa.hndahesudintocctmsdriver.util
import android.content.Context
import com.arpa.hndahesudintocctmsdriver.cuspop.MessagePop
import com.ct.auth.communication.request.Content
import com.lxj.xpopup.XPopup
/**
* @ClassName MessageUtils
* @Author 用户
* @Date 2023/8/15 09:51
* @Description TODO
*/
class MessageUtils {
companion object {
fun getInstance() = InstanceHelper.sSingle
}
object InstanceHelper {
val sSingle = MessageUtils()
}
fun showCenMessage(ctx: Context, message: String) {
XPopup.Builder(ctx) //
.hasNavigationBar(false)
.isDestroyOnDismiss(true) //对于只使用一次的弹窗对象,推荐设置这个
.asCustom(MessagePop(ctx, message).setOnMyItemClickListener(object : MessagePop.OnMyItemClickListener{
override fun onItemClick(startTime: String, endTime: String) {
}
}))
.show()
}
}

View File

@ -12,12 +12,12 @@ import android.os.Message;
public class MsgUtil {
public static void addHdMsgWat(Handler hd,int what){
Message msg=new Message();
Message msg=Message.obtain();
msg.what=what;
hd.sendMessage(msg);
}
public static void addHdMsgWatBody(Handler hd,int what,String body){
Message msg=new Message();
Message msg=Message.obtain();
msg.what=what;
msg.obj=body;
hd.sendMessage(msg);

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_16"
android:background="@color/white"
android:elevation="@dimen/dp_5"
app:cardCornerRadius="@dimen/dp_10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_marginTop="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提示"
android:textStyle="bold"
android:textColor="@color/red"
android:textSize="@dimen/sp_20"></TextView>
<TextView
android:lineSpacingExtra="@dimen/dp_6"
android:gravity="center"
android:id="@+id/tvContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:textColor="#D86B6B"
android:textSize="@dimen/sp_14"
tools:text="提示"></TextView>
<TextView
android:lineSpacingExtra="@dimen/dp_6"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:textColor="@color/color_9"
android:textSize="@dimen/sp_14"
android:text="请重新登录或联系管理员"></TextView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="联系电话:"
android:textColor="@color/black"
android:textSize="@dimen/sp_14"></TextView>
<TextView
android:id="@+id/tvPhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="13783631930"
android:textColor="#009688"
android:textSize="@dimen/sp_16"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<TextView
android:id="@+id/tvCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="取消"
android:textSize="@dimen/sp_16"></TextView>
<TextView
android:id="@+id/tvOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="确认拨打"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_16"></TextView>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>