修复百度定位不准确,添加六分钟卸货限制,gradle优化

This commit is contained in:
lijia 2023-09-11 15:18:22 +08:00
parent f4d2048d81
commit 3955131756
9 changed files with 310 additions and 240 deletions

View File

@ -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 {

View File

@ -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">
<uses-library
android:name="com/alct/mdp"

View File

@ -317,14 +317,14 @@ public class H5Activity extends AppCompatActivity {
FaceEvent he = new FaceEvent("刷脸成功");
EventBus.getDefault().post(he);
finish();
}, 1500);
}, 800);
tsignCode = "签署成功";
} else {
tsignCode = "签署失败";
}
Toast.makeText(H5Activity.this, "签署结果: " + tsignCode, Toast.LENGTH_LONG).show();
}
finish();
// finish();
return true;
} else if (uri.getScheme().equals("alipays")) {
// 跳转到支付宝刷脸

View File

@ -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())
}
}

View File

@ -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<ManyBean> list=new ArrayList<>();
List<ManyBean> 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<Object> list_zhuang=new ArrayList<>();
List<Object> 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<Object> list_zhuang = new ArrayList<>();
List<Object> 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<LatLonPoint> lists=new ArrayList<>();
private List<LatLonPoint> 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<sob.getData().getWayChildren().size();i++){
if(i!=0 && i!=(sob.getData().getWayChildren().size()-1)){
LatLonPoint sp=new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(i).getLatitude()),
for (int i = 0; i < sob.getData().getWayChildren().size(); i++) {
if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) {
LatLonPoint sp = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(i).getLatitude()),
Double.parseDouble(sob.getData().getWayChildren().get((i)).getLongitude()));
lists.add(sp);
}
}
RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(startPoint,endPoint);
RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(startPoint, endPoint);
//设置搜索参数 1.fromAndTo 路径的起点终点 2.路径规划的策略(这里是驾车模式,具体看高德API) 3.
//经点可选 4.避让区域可选 5.避让道路 ,可选
RouteSearch.DriveRouteQuery query = new
RouteSearch.DriveRouteQuery(fromAndTo,RouteSearch.DRIVING_SINGLE_DEFAULT,lists,null,"");
RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, lists, null, "");
//开始异步查询
mRouteSearch.calculateDriveRouteAsyn(query);
}
class OnRouteSearchListener implements RouteSearch.OnRouteSearchListener{
class OnRouteSearchListener implements RouteSearch.OnRouteSearchListener {
@Override
public void onBusRouteSearched(BusRouteResult busRouteResult, int i) {
@ -585,7 +605,7 @@ public class StartYunDanActivity extends BaseActivity {
@Override
public void onDriveRouteSearched(DriveRouteResult driveRouteResult, int rCode) {
if (rCode == 1000){//获取规划路线成功,获取到的是了,路线坐标点的集合
if (rCode == 1000) {//获取规划路线成功,获取到的是了,路线坐标点的集合
List<DrivePath> paths = driveRouteResult.getPaths();
//创建存储坐标点的集合
List<LatLng> 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<sob.getData().getWayChildren().size();i++){
if(i!=0 && i!=(sob.getData().getWayChildren().size()-1)){
StartOrderBean.DataDTO.WayChildrenDTO sdw=sob.getData().getWayChildren().get(i);
int icon=0;
if(sdw.getType()==1){
icon=R.mipmap.z_loc;
}else{
icon=R.mipmap.x_loc;
for (int i = 0; i < sob.getData().getWayChildren().size(); i++) {
if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) {
StartOrderBean.DataDTO.WayChildrenDTO sdw = sob.getData().getWayChildren().get(i);
int icon = 0;
if (sdw.getType() == 1) {
icon = R.mipmap.z_loc;
} else {
icon = R.mipmap.x_loc;
}
aMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(icon))
.position(new LatLng(Double.parseDouble(sdw.getLatitude()),Double.parseDouble(sdw.getLongitude()))));
.position(new LatLng(Double.parseDouble(sdw.getLatitude()), Double.parseDouble(sdw.getLongitude()))));
}
}
aMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.zhong))
.position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size()-1)).getLatitude()),
Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size()-1)).getLongitude()))));
.position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()),
Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude()))));
//绘制规划路径路线
aMap.addPolyline(new PolylineOptions()
//路线坐标点的集合
@ -633,15 +653,15 @@ public class StartYunDanActivity extends BaseActivity {
//设置画线的颜色
//显示完整包含所有marker地图路线
LatLngBounds.Builder builder =LatLngBounds.builder();
LatLngBounds.Builder builder = LatLngBounds.builder();
for (int i = 0; i < latLngs.size(); i++) {
builder.include(latLngs.get(i));
}
//显示全部marker,第二个参数是四周留空宽度
aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(),200));
aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 200));
LatLng latLng = new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()),
Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude()));//构造一个位置
aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng,6));
aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 6));
}
}
@ -657,7 +677,7 @@ public class StartYunDanActivity extends BaseActivity {
}
public void up_traffic(){
public void up_traffic() {
// ShippingNoteInfo[] snis=new ShippingNoteInfo[1];
// ShippingNoteInfo sni=new ShippingNoteInfo();
// sni.setShippingNoteNumber(sob.getData().getShippingNoteNumber());

View File

@ -19,7 +19,6 @@ 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.H5Activity;
import com.arpa.hndahesudintocctmsdriver.bean.CarInfoBean;
import com.arpa.hndahesudintocctmsdriver.report.ALProcess;
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
@ -30,7 +29,12 @@ import com.arpa.hndahesudintocctmsdriver.util.NfcUtils;
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
import com.arpa.hndahesudintocctmsdriver.util.img.GetCarImageAlert;
import com.arpa.hndahesudintocctmsdriver.util.location.LocationUtil;
import com.baidu.mapapi.CoordType;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.utils.CoordinateConverter;
import com.bumptech.glide.Glide;
import com.dahe.mylibrary.utils.ToastUtils;
import com.google.gson.Gson;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
@ -233,14 +237,16 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
lgdu.onCreate();
lu = new LocationUtil(con, hd);
lu.onCreate();
if (keys) {
lu = new LocationUtil(con, hd);
lu.onCreate();
}
// if (keys) {
// lu = new LocationUtil(con, hd);
// lu.onCreate();
// }
tv_loaction.setOnClickListener(v -> {
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();

View File

@ -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+"");

View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">大河好运司机</string>
<!-- <string name="appName">大河好运司机</string>-->
<!--设置界面-->
<string name="alivc_recorder_setting_min_record_duration">最小时长</string>
<string name="alivc_recorder_setting_max_record_duration">最大时长</string>

View File

@ -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 {
* 将时间字符串转为时间戳
* <p>time格式为format</p>
*
* @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;
}
}