diff --git a/app/build.gradle b/app/build.gradle index 1165ba6..1448ba7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,19 +16,21 @@ android { keyPassword '123456' storeFile file('key.jks') storePassword '123456' + v1SigningEnabled true + v2SigningEnabled true } - debug { - keyAlias 'key0' - keyPassword '123456' - storeFile file('key.jks') - storePassword '123456' - } - release { - keyAlias 'key0' - keyPassword '123456' - storeFile file('key.jks') - storePassword '123456' - } +// debug { +// keyAlias 'key0' +// keyPassword '123456' +// storeFile file('key.jks') +// storePassword '123456' +// } +// release { +// keyAlias 'key0' +// keyPassword '123456' +// storeFile file('key.jks') +// storePassword '123456' +// } } defaultConfig { @@ -86,9 +88,10 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.config } debug { - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.config } } compileOptions { @@ -116,12 +119,16 @@ android { buildConfigField("String", "OPEN_AL_URL", "\"https://oapi-staging.alct56.com\"") buildConfigField("String", "BASE_URL", "\"http://app.test.dahehuoyun.com/api/\"") buildConfigField "boolean", "isTest", "true" + //APP名称,可以在androidMainfest中引用 + resValue "string", "appName", "司机测试" } product { manifestPlaceholders = [CHANNEL_VALUE: "大河好运司机"] buildConfigField("String", "OPEN_AL_URL", "\"https://oapi.alct56.com\"") buildConfigField("String", "BASE_URL", "\"http://app.dahehuoyun.com/api/\"") buildConfigField "boolean", "isTest", "false" + //APP名称,可以在androidMainfest中引用 + resValue "string", "appName", "大河好运司机" } } @@ -133,9 +140,14 @@ android { android.applicationVariants.all { variant -> variant.outputs.all { def date = new Date().format("MMdd_HH-mm" , TimeZone.getTimeZone("GMT+08")) - if(variant.buildType.name.equals('release')){ - outputFileName = "dhhy-driver-"+date+"-${versionName}.apk" + def isText = variant.productFlavors[0].properties.get("buildConfigFields").getAt("isTest").properties.get("value") + def appName = null + if (isText=="true") { + appName = '大河好运司机测试_' + }else{ + appName = '大河好运司机_' } + outputFileName =appName+"${variant.buildType.name}_${defaultConfig.versionName}_${date}.apk" } } lintOptions { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e057f53..62bcba9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -54,13 +54,13 @@ android:allowBackup="true" android:excludeFromRecents="true" android:icon="@drawable/diver_logo" - android:label="@string/app_name" + android:label="@string/appName" android:largeHeap="true" android:requestLegacyExternalStorage="true" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true" - tools:replace="android:icon"> + tools:replace="android:label,android:allowBackup"> { + FaceEvent he = new FaceEvent("刷脸成功"); + EventBus.getDefault().post(he); + finish(); + }, 800); tsignCode = "签署成功"; } else { tsignCode = "签署失败"; } Toast.makeText(H5Activity.this, "签署结果: " + tsignCode, Toast.LENGTH_LONG).show(); } - finish(); +// finish(); return true; } else if (uri.getScheme().equals("alipays")) { // 跳转到支付宝刷脸 diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/cuspop/MessagePop.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/cuspop/MessagePop.kt index ead82bb..bc09dde 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/cuspop/MessagePop.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/cuspop/MessagePop.kt @@ -1,13 +1,10 @@ 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.* @@ -52,11 +49,10 @@ class MessagePop(context: Context) : CenterPopupView(context), View.OnClickListe R.id.tvOk,R.id.tvPhone -> { dismiss() val toString = tvPhone.text.toString() - val intent = Intent(Intent.ACTION_CALL) + val intent = Intent(Intent.ACTION_DIAL) val data = Uri.parse("tel:$toString") intent.data = data context.startActivity(intent) - dismiss() // BaseUtils.callPhone(content as Activity, tvPhone.text.toString()) } } diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/report/ALProcess.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/report/ALProcess.java index 885ca39..74addfe 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/report/ALProcess.java +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/report/ALProcess.java @@ -141,6 +141,7 @@ public class ALProcess { MDPLocationCollectionManager.register(con, idy, new OnResultListener() { @Override public void onSuccess() { + MsgUtil.addHdMsgWatBody(hd, 1111,"认证成功"); Log.e("--success--","验证成功"); getFq(con); } diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/home/StartYunDanActivity.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/home/StartYunDanActivity.java index 6445340..3361880 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/home/StartYunDanActivity.java +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/home/StartYunDanActivity.java @@ -40,7 +40,10 @@ import com.amap.api.services.route.DriveStep; import com.amap.api.services.route.RideRouteResult; import com.amap.api.services.route.RouteSearch; import com.amap.api.services.route.WalkRouteResult; +import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil; import com.bumptech.glide.Glide; +import com.dahe.mylibrary.utils.TimeUtil; +import com.dahe.mylibrary.utils.ToastUtils; import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.gson.Gson; import com.arpa.hndahesudintocctmsdriver.R; @@ -73,11 +76,11 @@ import java.util.List; public class StartYunDanActivity extends BaseActivity { - public static final String GET_EVALUTE="getEvalute"; - public static final String KEEP_EVALUTE="keepEvalte"; - public static final String GET_COMPLAINT="getComplaint"; + public static final String GET_EVALUTE = "getEvalute"; + public static final String KEEP_EVALUTE = "keepEvalte"; + public static final String GET_COMPLAINT = "getComplaint"; - private String TAG="StartYunDanActivity"; + private String TAG = "StartYunDanActivity"; private NestedScrollView bottomSheet; private MapView map; private BaseRecyclerView brv; @@ -85,57 +88,58 @@ public class StartYunDanActivity extends BaseActivity { private LinearLayout protect; //private RelativeLayout title_rl; private TextView title; - private ScoreView sv1,sv2; - private Gson gson=new Gson(); + private ScoreView sv1, sv2; + private Gson gson = new Gson(); private StartOrderBean sob; private WNewsBean wnb; private HuoYuanRequset hyr; //是否处于展开状态 - private boolean key=false; - private int id=0; + private boolean key = false; + private int id = 0; LocationGDUtil ld; @Override public void msgMethod(Message m) { super.msgMethod(m); - switch (m.what){ + switch (m.what) { case RequsetCodeConstants.SUCCESS: //获取页面数据 - if (CacheGroup.cacheList.get(HuoYuanFragmengt.START_ORDER)!=null && CacheGroup.cacheList.get(GET_EVALUTE)!=null) { - Log.e("-评论-",CacheGroup.cacheList.get(GET_EVALUTE)); - Log.e("-运单-",CacheGroup.cacheList.get(HuoYuanFragmengt.START_ORDER)); - sob=gson.fromJson(CacheGroup.cacheList.get(HuoYuanFragmengt.START_ORDER), StartOrderBean.class); - wnb=gson.fromJson(CacheGroup.cacheList.get(GET_EVALUTE), WNewsBean.class); - if(sob.getCode()==200 && sob.getData()!=null){ + if (CacheGroup.cacheList.get(HuoYuanFragmengt.START_ORDER) != null && CacheGroup.cacheList.get(GET_EVALUTE) != null) { + Log.e("-评论-", CacheGroup.cacheList.get(GET_EVALUTE)); + Log.e("-运单-", CacheGroup.cacheList.get(HuoYuanFragmengt.START_ORDER)); + sob = gson.fromJson(CacheGroup.cacheList.get(HuoYuanFragmengt.START_ORDER), StartOrderBean.class); + wnb = gson.fromJson(CacheGroup.cacheList.get(GET_EVALUTE), WNewsBean.class); + if (sob.getCode() == 200 && sob.getData() != null) { id = sob.getData().getWaybillId(); initView(null); - }else if(sob.getData()==null){ + } else if (sob.getData() == null) { // Toast.makeText(con,"运单执行结束",Toast.LENGTH_SHORT).show(); - SPUtil.insSP(con,"order","ShippingNoteNumber",""); + SPUtil.insSP(con, "order", "ShippingNoteNumber", ""); UiAuxiliary.homeRequest("运单结束"); // finish(); - }else{ - Toast.makeText(con,sob.getMsg(),Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(con, sob.getMsg(), Toast.LENGTH_SHORT).show(); } CacheGroup.cacheList.remove(HuoYuanFragmengt.START_ORDER); CacheGroup.cacheList.remove(GET_EVALUTE); } //保存评价 - if(CacheGroup.cacheList.get(KEEP_EVALUTE)!=null){ - BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(KEEP_EVALUTE),BaseBean.class); - if(bb.getCode()==200){ - Toast.makeText(con,"评价保存成功",Toast.LENGTH_SHORT).show(); + if (CacheGroup.cacheList.get(KEEP_EVALUTE) != null) { + BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(KEEP_EVALUTE), BaseBean.class); + if (bb.getCode() == 200) { + Toast.makeText(con, "评价保存成功", Toast.LENGTH_SHORT).show(); hyr.startOrder(id); hyr.getEvaluate(id); - }else{ - Toast.makeText(con,bb.getMsg(),Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show(); } CacheGroup.cacheList.remove(KEEP_EVALUTE); } break; case 15: break; - default:break; + default: + break; } } @@ -147,28 +151,28 @@ public class StartYunDanActivity extends BaseActivity { super.onCreate(savedInstanceState); StateStyleUtil.stateTextColor(this); setContentView(R.layout.activity_yundan_start); - con=this; - id=getIntent().getExtras().getInt("id"); - brv=findViewById(R.id.brv); - protect=findViewById(R.id.protect); - title=findViewById(R.id.title); - bottomSheet =findViewById(R.id.bottom_sheet); + con = this; + id = getIntent().getExtras().getInt("id"); + brv = findViewById(R.id.brv); + protect = findViewById(R.id.protect); + title = findViewById(R.id.title); + bottomSheet = findViewById(R.id.bottom_sheet); BottomSheetBehavior mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); mBottomSheetBehavior.setHideable(false); mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); //mBottomSheetBehavior.set - map=findViewById(R.id.map); + map = findViewById(R.id.map); map.onCreate(savedInstanceState); if (aMap == null) { aMap = map.getMap(); initLoaction(); } - Log.e("--id--",""+id); - String userdata= SPUtil.getSP(con,"data","userdata"); - if(!userdata.equals("")){ - ub=gson.fromJson(userdata,UserBean.class); + Log.e("--id--", "" + id); + String userdata = SPUtil.getSP(con, "data", "userdata"); + if (!userdata.equals("")) { + ub = gson.fromJson(userdata, UserBean.class); } - hyr=new HuoYuanRequset(con,hd); + hyr = new HuoYuanRequset(con, hd); // hyr.startOrder(id); // hyr.getEvaluate(id); } @@ -184,59 +188,60 @@ public class StartYunDanActivity extends BaseActivity { //控件隐藏的动画 mHiddenAmin = new AlphaAnimation(1.0f, 0.0f); mHiddenAmin.setDuration(1000); - List list=new ArrayList<>(); + List list = new ArrayList<>(); //list.add(new ManyBean(new model(),R.layout.yundan_start_top)); - list.add(new ManyBean(sob.getData(),R.layout.item_yundan_yunxing)); - list.add(new ManyBean(sob.getData(),R.layout.yundan_start_bottom)); - brv.creates(con,list).setOnItemViewListener((position, o, v, layout) -> { - switch (layout){ + list.add(new ManyBean(sob.getData(), R.layout.item_yundan_yunxing)); + list.add(new ManyBean(sob.getData(), R.layout.yundan_start_bottom)); + brv.creates(con, list).setOnItemViewListener((position, o, v, layout) -> { + switch (layout) { case R.layout.yundan_start_top: - ImageButton return_btn=v.findViewById(R.id.return_btn); + ImageButton return_btn = v.findViewById(R.id.return_btn); return_btn.setOnClickListener(v1 -> finish()); break; case R.layout.yundan_start_bottom: initStartBody(v); break; case R.layout.item_yundan_yunxing: - ImageView head_img=v.findViewById(R.id.head_img); - if(ub!=null && ub.getData()!=null && !ub.getData().getHeadportraitUrl().equals("")){ + ImageView head_img = v.findViewById(R.id.head_img); + if (ub != null && ub.getData() != null && !ub.getData().getHeadportraitUrl().equals("")) { Glide.with(con).load(ub.getData().getHeadportraitUrl()).into(head_img); } break; - default: break; + default: + break; } }); } - private boolean iskey=false; + private boolean iskey = false; - private void initStartBody(View v){ - LinearLayout jiesuan=v.findViewById(R.id.jiesuan); + private void initStartBody(View v) { + LinearLayout jiesuan = v.findViewById(R.id.jiesuan); // if(id==0){ // jiesuan.setVisibility(View.GONE); // }else{ // jiesuan.setVisibility(View.VISIBLE); // } - sv1=v.findViewById(R.id.score1); - sv2=v.findViewById(R.id.score2); + sv1 = v.findViewById(R.id.score1); + sv2 = v.findViewById(R.id.score2); sv1.initView(); sv2.initView(); sv1.setScore(5); //设置是否可以修改评分,默认为true - TextView pl_submit=v.findViewById(R.id.pl_submit); - TextView m_pl_value=v.findViewById(R.id.m_pl_value); - TextView pl_value=v.findViewById(R.id.pl_value); - if(wnb.getData()!=null){ + TextView pl_submit = v.findViewById(R.id.pl_submit); + TextView m_pl_value = v.findViewById(R.id.m_pl_value); + TextView pl_value = v.findViewById(R.id.pl_value); + if (wnb.getData() != null) { for (WNewsBean.DataDTO datum : wnb.getData()) { - if(datum.getType()==0){ + if (datum.getType() == 0) { sv1.setScore(datum.getAttitudeScore()); m_pl_value.setText(datum.getContent()); pl_submit.setVisibility(View.GONE); sv1.setUpKey(false); m_pl_value.setEnabled(false); } - if(datum.getType()==1){ - Log.e("分数",datum.getAttitudeScore()+"_"); + if (datum.getType() == 1) { + Log.e("分数", datum.getAttitudeScore() + "_"); sv2.setScore(datum.getAttitudeScore()); pl_value.setText(datum.getContent()); } @@ -244,45 +249,45 @@ public class StartYunDanActivity extends BaseActivity { } sv2.setUpKey(false); pl_submit.setOnClickListener(v12 -> { - String evaluate=m_pl_value.getText()+""; - if(id!=0){ - if(evaluate.length()>=5){ - Log.e("星星",""+sv1.getScore()); - hyr.keepEvaluate(sv1.getScore(),m_pl_value.getText()+"",id); - }else{ - Toast.makeText(con,"写够5个字才是好司机~",Toast.LENGTH_SHORT).show(); + String evaluate = m_pl_value.getText() + ""; + if (id != 0) { + if (evaluate.length() >= 5) { + Log.e("星星", "" + sv1.getScore()); + hyr.keepEvaluate(sv1.getScore(), m_pl_value.getText() + "", id); + } else { + Toast.makeText(con, "写够5个字才是好司机~", Toast.LENGTH_SHORT).show(); } - }else{ - Toast.makeText(con,"运单尚未结束",Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(con, "运单尚未结束", Toast.LENGTH_SHORT).show(); } }); - Button complaint=v.findViewById(R.id.complaint); + Button complaint = v.findViewById(R.id.complaint); complaint.setOnClickListener(v1 -> { - Intent in=new Intent(con, OrderComplaintActivity.class); - in.putExtra("id",id); + Intent in = new Intent(con, OrderComplaintActivity.class); + in.putExtra("id", id); startActivity(in); }); - BaseRecyclerView bv_zhuang=v.findViewById(R.id.bv_zhuang); - BaseRecyclerView bv_xie=v.findViewById(R.id.bv_xie); + BaseRecyclerView bv_zhuang = v.findViewById(R.id.bv_zhuang); + BaseRecyclerView bv_xie = v.findViewById(R.id.bv_xie); //bv_zhuang.set - List list_zhuang=new ArrayList<>(); - List list_xie=new ArrayList<>(); - for(int i=0;i list_zhuang = new ArrayList<>(); + List list_xie = new ArrayList<>(); + for (int i = 0; i < sob.getData().getWayChildren().size(); i++) { + StartOrderBean.DataDTO.WayChildrenDTO sdw = sob.getData().getWayChildren().get(i); + if (sdw.getType() == 1) { + sdw.setUpdateTime(StringUtil.isNull((String) sdw.getUpdateTime(), "未装货")); list_zhuang.add(sdw); - }else{ - sdw.setUpdateTime(StringUtil.isNull((String) sdw.getUpdateTime(),"未卸货")); + } else { + sdw.setUpdateTime(StringUtil.isNull((String) sdw.getUpdateTime(), "未卸货")); list_xie.add(sdw); } } - TextView get_contract=v.findViewById(R.id.get_contract); + TextView get_contract = v.findViewById(R.id.get_contract); get_contract.setOnClickListener(v13 -> { - Intent in=new Intent(con, WebPDFActivity.class); - in.putExtra("title","电子合同"); - Log.e("--地址--",sob.getData().getContractUrl()); - in.putExtra("url",sob.getData().getContractUrl()); + Intent in = new Intent(con, WebPDFActivity.class); + in.putExtra("title", "电子合同"); + Log.e("--地址--", sob.getData().getContractUrl()); + in.putExtra("url", sob.getData().getContractUrl()); startActivity(in); }); // v.findViewById(R.id.upload_receipt).setOnClickListener(new View.OnClickListener() { @@ -294,134 +299,149 @@ public class StartYunDanActivity extends BaseActivity { // startActivity(in); // } // }); - bv_zhuang.createV(con,list_zhuang,R.layout.item_huoyuan_start_zx).setOnItemViewListener((position, o, v14) -> { + bv_zhuang.createV(con, list_zhuang, R.layout.item_huoyuan_start_zx).setOnItemViewListener((position, o, v14) -> { // - boolean upkey=false; - if(position==0){ - upkey=true; + boolean upkey = false; + if (position == 0) { + upkey = true; } - initZX(upkey, v14,position,o,0); + initZX(upkey, v14, position, o, 0); }); - bv_xie.createV(con,list_xie,R.layout.item_huoyuan_start_zx).setOnItemViewListener((position, o, v15) -> { + bv_xie.createV(con, list_xie, R.layout.item_huoyuan_start_zx).setOnItemViewListener((position, o, v15) -> { // - boolean upkey=false; - if(position==(list_xie.size()-1)){ - upkey=true; + boolean upkey = false; + if (position == (list_xie.size() - 1)) { + upkey = true; } initZX(upkey, v15, position, o, 1); }); search(); } - public void initZX(boolean key,View v,int position,Object o,int type){ - StartOrderBean.DataDTO.WayChildrenDTO sdw= (StartOrderBean.DataDTO.WayChildrenDTO) o; - TextView index=v.findViewById(R.id.index); - TextView s_zx=v.findViewById(R.id.s_zx); - TextView j_zx=v.findViewById(R.id.j_zx); - if(type==1){ + public void initZX(boolean key, View v, int position, Object o, int type) { + StartOrderBean.DataDTO.WayChildrenDTO sdw = (StartOrderBean.DataDTO.WayChildrenDTO) o; + TextView index = v.findViewById(R.id.index); + TextView s_zx = v.findViewById(R.id.s_zx); + TextView j_zx = v.findViewById(R.id.j_zx); + if (type == 1) { s_zx.setText("实际卸货时间:"); j_zx.setText("计划卸货时间:"); } - if(position==0){ - if(type==0){ + if (position == 0) { + if (type == 0) { index.setText("装货地"); - }else{ + } else { index.setText("卸货地"); } - }else{ - if(type==0) { + } else { + if (type == 0) { index.setText("第" + (position + 1) + "装货地"); - }else{ + } else { index.setText("第" + (position + 1) + "卸货地"); } } - TextView goodName=v.findViewById(R.id.goodName); - TextView goodNum=v.findViewById(R.id.goodNum); - TextView goodUnit=v.findViewById(R.id.goodUnit); + TextView goodName = v.findViewById(R.id.goodName); + TextView goodNum = v.findViewById(R.id.goodNum); + TextView goodUnit = v.findViewById(R.id.goodUnit); goodName.setText(sdw.getGoods().get(0).getGoodName()); goodNum.setText(sdw.getGoods().get(0).getGoodNum()); goodUnit.setText(sdw.getGoods().get(0).getGoodUnit()); - TextView huoyuan_state=v.findViewById(R.id.huoyuan_state); - huoyuan_state.setText(stateText(sdw.getStatus(),type)); + TextView huoyuan_state = v.findViewById(R.id.huoyuan_state); + huoyuan_state.setText(stateText(sdw.getStatus(), type)); huoyuan_state.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - String wid= sdw.getId()+""; - if(sdw.getStatus()==0){ - if(type==0){ - Intent in=new Intent(con, ShangChuangImgActivity.class); - in.putExtra("type",type); - in.putExtra("wid",wid); - in.putExtra("sob",gson.toJson(sob)); - in.putExtra("keys",key); + String wid = sdw.getId() + ""; + if (sdw.getStatus() == 0) { + if (type == 0) { + Intent in = new Intent(con, ShangChuangImgActivity.class); + in.putExtra("type", type); + in.putExtra("wid", wid); + in.putExtra("sob", gson.toJson(sob)); + in.putExtra("keys", key); startActivity(in); - }else{ - Toast.makeText(con,"您还没有装货",Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(con, "您还没有装货", Toast.LENGTH_SHORT).show(); } - }else if(sdw.getStatus()==1){//装货回单 - if(type==0){ - Intent in=new Intent(con, ShangChuangImgActivity.class); - in.putExtra("type",2); - in.putExtra("wid",wid); - in.putExtra("h_type",type); - in.putExtra("sob",gson.toJson(sob)); - startActivity(in); - }else{ - Toast.makeText(con,"您还没有上传回单信息",Toast.LENGTH_SHORT).show(); + } else if (sdw.getStatus() == 1) {//装货回单 + Intent in = new Intent(con, ShangChuangImgActivity.class); + in.putExtra("type", 2); + in.putExtra("wid", wid); + in.putExtra("h_type", type); + in.putExtra("sob", gson.toJson(sob)); + startActivity(in); + } else if (sdw.getStatus() == 2) {//上传收货单(卸货回单) + Intent in = new Intent(con, ShangChuangImgActivity.class); + in.putExtra("type", 2); + in.putExtra("wid", wid); + in.putExtra("h_type", type); + in.putExtra("sob", gson.toJson(sob)); + in.putExtra("keys", key); + startActivity(in); + } else if (sdw.getStatus() == 3) { + Intent in = new Intent(con, GetShangChuanActivity.class); + in.putExtra("sdwStr", gson.toJson(sdw)); + startActivity(in); + } else {//卸货照片 + StartOrderBean.DataDTO.WayChildrenDTO zInfo; + for (int i = 0; i < sob.getData().getWayChildren().size(); i++) { + if (sob.getData().getWayChildren().get(i).getType() == 1) { + zInfo = sob.getData().getWayChildren().get(i); + int dis = TimeUtil.compareNowDate(TimeUtil.string2Millis(zInfo.getImageTakenDate(), TimeUtil.DEFAULT_FORMAT4)); + if (dis > 5) { + if (zInfo.getReceiptUrl() != null && zInfo.getReceiptUrl().size() > 0) { + Intent in = new Intent(con, ShangChuangImgActivity.class); + in.putExtra("type", type); + in.putExtra("wid", wid); + in.putExtra("sob", gson.toJson(sob)); + in.putExtra("keys", key); + startActivity(in); + break; + } else { + ToastUtils.showToast(StartYunDanActivity.this, "请先上传出货单,再进行卸货操作!"); + } + } else {//大于五分钟可以接单 + ToastUtils.showToast(StartYunDanActivity.this, "装卸货时间间隔过短,请稍后重试!"); + } + break; + } } - }else if(sdw.getStatus()==2){//上传收货单(卸货回单) - Intent in=new Intent(con, ShangChuangImgActivity.class); - in.putExtra("type",2); - in.putExtra("wid",wid); - in.putExtra("h_type",type); - in.putExtra("sob",gson.toJson(sob)); - in.putExtra("keys",key); - startActivity(in); - }else if(sdw.getStatus()==3){ - Intent in=new Intent(con, GetShangChuanActivity.class); - in.putExtra("sdwStr",gson.toJson(sdw)); - startActivity(in); - }else{//卸货照片 - Intent in=new Intent(con, ShangChuangImgActivity.class); - in.putExtra("type",type); - in.putExtra("wid",wid); - in.putExtra("sob",gson.toJson(sob)); - in.putExtra("keys",key); - startActivity(in); + } } }); } - public String stateText(int state,int type){ - String str=""; + public String stateText(int state, int type) { + String str = ""; //0待装货,1已装货 2已卸货 3已上传回单 4待卸货 - switch (state){ + switch (state) { case 0://str="待装货"; - if(type==0){ - str="立即装货"; + if (type == 0) { + str = "立即装货"; // str="确认装货"; - }else{ - str="请先装货"; + } else { + str = "请先装货"; } break; case 1://str="已装货"; - str="上传出货单"; + str = "上传出货单"; // str="确认回单"; break; case 2://str="已卸货"; - str="上传收货单"; + str = "上传收货单"; // str="确认回单"; break; case 3: //str="已上传回单"; - str="查看凭证"; + str = "查看凭证"; break; case 4: //str="待卸货"; - str="确认卸货"; + str = "确认卸货"; + break; + default: break; - default:break; } return str; } @@ -429,7 +449,7 @@ public class StartYunDanActivity extends BaseActivity { @Override protected void onResume() { super.onResume(); - if(map!=null){ + if (map != null) { map.onResume(); } hyr.startOrder(id); @@ -439,7 +459,7 @@ public class StartYunDanActivity extends BaseActivity { @Override protected void onPause() { super.onPause(); - if(map!=null){ + if (map != null) { map.onPause(); } } @@ -447,7 +467,7 @@ public class StartYunDanActivity extends BaseActivity { @Override protected void onDestroy() { super.onDestroy(); - if(map!=null){ + if (map != null) { map.onDestroy(); } } @@ -457,11 +477,12 @@ public class StartYunDanActivity extends BaseActivity { super.onSaveInstanceState(outState); map.onSaveInstanceState(outState); } + LocationSource.OnLocationChangedListener mListener; AMapLocationClient mlocationClient; AMapLocationClientOption mLocationOption; - public void initLoaction(){ + public void initLoaction() { // 设置定位监听 aMap.setLocationSource(new LocationSource() { @Override @@ -480,13 +501,13 @@ public class StartYunDanActivity extends BaseActivity { mlocationClient.setLocationListener(new AMapLocationListener() { @Override public void onLocationChanged(AMapLocation aMapLocation) { - if (mListener != null&&aMapLocation != null) { + if (mListener != null && aMapLocation != null) { if (aMapLocation != null - &&aMapLocation.getErrorCode() == 0) { + && aMapLocation.getErrorCode() == 0) { mListener.onLocationChanged(aMapLocation);// 显示系统小蓝点 } else { - String errText = "定位失败," + aMapLocation.getErrorCode()+ ": " + aMapLocation.getErrorInfo(); - Log.e("AmapErr",errText); + String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo(); + Log.e("AmapErr", errText); } } } @@ -538,45 +559,44 @@ public class StartYunDanActivity extends BaseActivity { private RouteSearch mRouteSearch;//路线查询器 - private List lists=new ArrayList<>(); + private List lists = new ArrayList<>(); - public void search(){ + public void search() { // try { // AMapLocationClient.updatePrivacyShow(con,true,true); // AMapLocationClient.updatePrivacyAgree(con,true); - mRouteSearch = new RouteSearch(this); + mRouteSearch = new RouteSearch(this); // } catch (AMapException e) { // e.printStackTrace(); // } //设置数据回调监听器 mRouteSearch.setRouteSearchListener(new OnRouteSearchListener()); //设置开始位置坐标点(注意经纬度不能写反,会报错1800(只能规划到中国区域里的地图路线)) - LatLonPoint startPoint=new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), + LatLonPoint startPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude())); //设置目的地坐标点 - LatLonPoint endPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size()-1)).getLatitude()), - Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size()-1)).getLongitude())); + LatLonPoint endPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()), + Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude())); //查询信息对象 - for (int i=0;i paths = driveRouteResult.getPaths(); //创建存储坐标点的集合 List latLngs = new ArrayList<>(); @@ -594,7 +614,7 @@ public class StartYunDanActivity extends BaseActivity { for (DriveStep mDriveStep : mDrivePath.getSteps()) { for (LatLonPoint mLatLonPoint : mDriveStep.getPolyline()) { latLngs.add(new - LatLng(mLatLonPoint.getLatitude(),mLatLonPoint.getLongitude())); + LatLng(mLatLonPoint.getLatitude(), mLatLonPoint.getLongitude())); } } } @@ -605,24 +625,24 @@ public class StartYunDanActivity extends BaseActivity { .icon(BitmapDescriptorFactory.fromResource(R.mipmap.qi)) .position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()), Double.parseDouble(sob.getData().getWayChildren().get(0).getLongitude())))); - for(int i=0;i { if (!locationKey) { customDialog.show(); lgdu.onCreate(); + lu = new LocationUtil(con, hd); + lu.onCreate(); } }); hyr = new HuoYuanRequset(con, hd); @@ -348,9 +354,12 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity { lub.setImageId(imgIds); lub.setWaybillId(wid); Log.e("--装货信息", gson.toJson(lub)); - if (locationKey) { - + if (locationKey) {//高德定位 if (keys) { + if (lu!=null&&lu.getErrorCode()!=161){ + ToastUtils.showToast(this,"百度地图定位失败,请确认开启定位后重试!"); + return; + } nfc(); loadInfo(); // up_traffic_start(); @@ -375,6 +384,10 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity { Log.e("--卸货信息", gson.toJson(lub)); if (locationKey) { if (keys) { + if (lu!=null&&lu.getErrorCode()!=161){ + ToastUtils.showToast(this,"百度地图定位失败,请确认开启定位后重试!"); + return; + } nfc(); uploadInfo(); @@ -403,6 +416,10 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity { Log.e("--回单信息", gson.toJson(urib)); if (locationKey) { if (index == 2 && keys) { + if (lu!=null&&lu.getErrorCode()!=161){ + ToastUtils.showToast(this,"百度地图定位失败,请确认开启定位后重试!"); + return; + } up_trafficSign(); up_trafficReceipt(); receipt_image(); diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/util/location/LocationUtil.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/util/location/LocationUtil.java index 179549e..6f21432 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/util/location/LocationUtil.java +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/util/location/LocationUtil.java @@ -20,6 +20,7 @@ public class LocationUtil{ private double latitude; private double longitude; + private int errorCode; private String address; private Context con; private Handler hd; @@ -39,6 +40,10 @@ public class LocationUtil{ return longitude; } + public double getErrorCode() { + return errorCode; + } + public String getAddress() { return address; } @@ -62,7 +67,7 @@ public class LocationUtil{ //LocationMode.Hight_Accuracy:高精度; //LocationMode. Battery_Saving:低功耗; //LocationMode. Device_Sensors:仅使用设备; - option.setCoorType("GCJ02"); + option.setCoorType("BD09ll"); //可选,设置返回经纬度坐标类型,默认GCJ02 //GCJ02:国测局坐标; //BD09ll:百度经纬度坐标; @@ -112,7 +117,8 @@ public class LocationUtil{ float radius = location.getRadius(); //获取定位精度,默认值为0.0f String coorType = location.getCoorType(); //获取经纬度坐标类型,以LocationClientOption中设置过的坐标类型为准 - int errorCode = location.getLocType(); + errorCode = location.getLocType(); + String locTypeDescription = location.getLocTypeDescription(); //获取定位类型、定位错误返回码,具体信息可参照类参考中BDLocation类中的说明 Log.e("定位位置address",address+""); Log.e("定位坐标latitude",latitude+""); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e3afca6..6813176 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ - 大河好运司机 + 最小时长 最大时长 diff --git a/mylibrary/src/main/java/com/dahe/mylibrary/utils/TimeUtil.java b/mylibrary/src/main/java/com/dahe/mylibrary/utils/TimeUtil.java index 0cc51bc..45a0aee 100644 --- a/mylibrary/src/main/java/com/dahe/mylibrary/utils/TimeUtil.java +++ b/mylibrary/src/main/java/com/dahe/mylibrary/utils/TimeUtil.java @@ -179,6 +179,7 @@ public final class TimeUtil { private static final DateFormat DEFAULT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); private static final DateFormat DEFAULT_FORMAT2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZSS:SS", Locale.getDefault()); private static final DateFormat DEFAULT_FORMAT3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault()); + public static final DateFormat DEFAULT_FORMAT4 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault()); private TimeUtil() { throw new UnsupportedOperationException("u can't instantiate me..."); @@ -215,7 +216,7 @@ public final class TimeUtil { * @return 毫秒时间戳 */ public static long string2Millis(final String time) { - if (TextUtils.isEmpty(time)){ + if (TextUtils.isEmpty(time)) { return -1; } return string2Millis(time, DEFAULT_FORMAT); @@ -242,10 +243,10 @@ public final class TimeUtil { * 将时间字符串转为时间戳 *

time格式为format

* - * @param time 时间字符串 + * @param time 时间字符串 * @return 毫秒时间戳 */ - public static String string2String(final String time,final SimpleDateFormat format) { + public static String string2String(final String time, final SimpleDateFormat format) { try { return date2String(format.parse(time)); // return DEFAULT_FORMAT.format(DEFAULT_FORMAT2.parse(time).getTime()); @@ -421,7 +422,7 @@ public final class TimeUtil { * @return 合适型两个时间差 */ public static String getFitTimeSpan(final String time0, final String time1, final int precision) { - if (TextUtils.isEmpty(time0)||TextUtils.isEmpty(time1)){ + if (TextUtils.isEmpty(time0) || TextUtils.isEmpty(time1)) { return ""; } return millis2FitTimeSpan(Math.abs(string2Millis(time0, DEFAULT_FORMAT) - string2Millis(time1, DEFAULT_FORMAT)), precision); @@ -1685,7 +1686,7 @@ public final class TimeUtil { * @param compareDate * @return */ - public static boolean compareDate(String nowDate, String compareDate,DateFormat format) { + public static boolean compareDate(String nowDate, String compareDate, DateFormat format) { DateFormat df = format; try { Date now = df.parse(nowDate); @@ -1700,4 +1701,22 @@ public final class TimeUtil { return false; } } + + + /** + * 得到二个日期间的间隔天数 + * + * @return 间格的天数(null表示时间格式不正确) + */ + public static int compareNowDate(long comTime) { + int min; + try { + min = (int) ((getNowMills() - comTime) / (60 * 1000)); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + + return min; + } } \ No newline at end of file