集成定位服务

This commit is contained in:
2024-11-28 08:26:45 +08:00
parent bfbe7e9b5f
commit 7d29c5ec89
13 changed files with 113 additions and 89 deletions
@@ -1,20 +1,12 @@
package com.arpa.hndahesudintocctmsdriver.cuspop
import android.Manifest
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.view.View
import android.widget.Toast
import androidx.fragment.app.FragmentActivity
import android.widget.TextView
import com.arpa.hndahesudintocctmsdriver.R
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil
import com.dahe.mylibrary.utils.ToastUtils
import com.lxj.xpopup.core.CenterPopupView
import com.lxj.xpopup.util.XPermission
import com.permissionx.guolindev.PermissionX
import kotlinx.android.synthetic.main.load.view.*
import kotlinx.android.synthetic.main.pop_message_center.view.*
/**
@@ -38,9 +30,14 @@ class MessagePop(context: Context) : CenterPopupView(context), View.OnClickListe
}
override fun getImplLayoutId() = R.layout.pop_message_center
private lateinit var tvPhone : TextView
override fun onCreate() {
super.onCreate()
val tvCancel = findViewById<View>(R.id.tvCancel) as TextView
val tvOk = findViewById<View>(R.id.tvOk) as TextView
tvPhone = findViewById<View>(R.id.tvPhone) as TextView
val tvContent = findViewById<View>(R.id.tvContent) as TextView
val tvMessage2 = findViewById<View>(R.id.tvMessage2) as TextView
tvCancel.setOnClickListener(this)
tvOk.setOnClickListener(this)
tvPhone.setOnClickListener(this)
@@ -2,11 +2,9 @@ package com.arpa.hndahesudintocctmsdriver.cuspop
import android.content.Context
import android.view.View
import android.widget.TextView
import com.arpa.hndahesudintocctmsdriver.R
import com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity
import com.lxj.xpopup.core.CenterPopupView
import kotlinx.android.synthetic.main.pop_sim_center.view.*
import org.bouncycastle.jcajce.provider.symmetric.Rijndael
/**
@@ -33,6 +31,10 @@ class SimCenterPop(context: Context) : CenterPopupView(context), View.OnClickLis
override fun onCreate() {
super.onCreate()
val tvCancel = findViewById<View>(R.id.tvCancel) as TextView
val tvOk = findViewById<View>(R.id.tvOk) as TextView
val tvContent = findViewById<View>(R.id.tvContent) as TextView
tvCancel.text = titleLeft
tvOk.text = titleReft
tvCancel.setOnClickListener(this)
@@ -1,11 +1,11 @@
package com.arpa.hndahesudintocctmsdriver.cuspop
import android.content.Context
import android.view.View
import android.widget.TextView
import com.arpa.hndahesudintocctmsdriver.R
import com.lxj.xpopup.core.PositionPopupView
import com.lxj.xpopup.enums.DragOrientation
import kotlinx.android.synthetic.main.popup_qq_msg.view.tvMessage
import kotlinx.android.synthetic.main.popup_qq_msg.view.tvTitle
/**
* Description: 自定义自由定位Position弹窗
@@ -30,6 +30,9 @@ class TopMsgPopup(context: Context,title:String, message: String) : PositionPopu
override fun onCreate() {
super.onCreate()
val tvMessage = findViewById<View>(R.id.tvMessage) as TextView
val tvTitle = findViewById<View>(R.id.tvTitle) as TextView
tvMessage.text = message
tvTitle.text = title
}
@@ -115,5 +115,8 @@ public interface Api {
*/
@POST(BASE_URL+"/openapi/getShipmentStatus")
Observable<CommonResponseBean> getShipmentStatus(@Body ShipmentStatusBean bean);
@POST(BASE_URL+"/openapi/shipments/getPODImageNames")
Observable<CommonResponseBean> getPODImageNames(@Body ShipmentStatusBean bean);
}
@@ -698,6 +698,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
NewLJUtils.getInstance().sign(con, sob.getData().getShippingNoteNumber(), l, new OnGDResultListener() {
@Override
public void onSuccess() {
NewLJUtils.getInstance().stopLocationService();
up_trafficReceipt();
receipt_image();
Log.e("上报安联", "签收成功");
@@ -984,6 +985,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (sob.getData().getReport() == 1) {
JTTProcess.start(con, sob, "");
}
NewLJUtils.getInstance().startLocationService(ShangChuangImgActivity.this);
//装货状态
hyr.loading(lub);
//装货照片
@@ -1050,6 +1052,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (sob.getData().getReport() == 1) {
JTTProcess.stop(con, sob, "");
}
//卸货状态-平台
hyr.dischargeCargo(lub);
//卸货照片-安联
@@ -16,6 +16,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.arpa.hndahesudintocctmsdriver.event.PersonEvent;
import com.arpa.hndahesudintocctmsdriver.event.RefreshCarListEvent;
@@ -8,8 +8,6 @@ import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import com.alct.mdp.model.Image;
import com.alct.mdp.model.Location;
import com.arpa.hndahesudintocctmsdriver.bean.GDImage;
import com.arpa.hndahesudintocctmsdriver.bean.GDLocation;
import com.arpa.hndahesudintocctmsdriver.constant.NewLJConstant;
@@ -21,12 +19,11 @@ import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.UpimgBean;
import com.arpa.hndahesudintocctmsdriver.request.net.BaseObserver;
import com.arpa.hndahesudintocctmsdriver.request.net.DataManager;
import com.arpa.hndahesudintocctmsdriver.request.net.RxHttpCallBack;
import com.arpa.hndahesudintocctmsdriver.util.time.Timer;
import com.dahe.mylibrary.callback.OnGDDownloadResultListener;
import com.dahe.mylibrary.callback.OnGDResultListener;
import com.dahe.mylibrary.net.CommonResponseBean;
import com.dahe.mylibrary.utils.TimeUtil;
import com.dahe.mylibrary.utils.ToastUtils;
import com.express.mdp.Api;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
@@ -447,25 +444,48 @@ public class NewLJUtils {
}));
}
public void getPODImageNames(Context ctx, String shipmentCode){
ShipmentStatusBean shipmentStatusBean = new ShipmentStatusBean();
shipmentStatusBean.setShipmentCode(shipmentCode);
shipmentStatusBean.setEnterpriseCode(NewLJConstant.ENTER_PRISE_CODE);
DataManager.getInstance().getPODImageNames(shipmentStatusBean)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BaseObserver(ctx, new RxHttpCallBack<CommonResponseBean>() {
@Override
public void onSuccess(CommonResponseBean t) {
super.onSuccess(t);
System.out.println("sadf");
}
@Override
public void onCodeError(Context mContext, CommonResponseBean<CommonResponseBean> t) {
super.onCodeError(mContext, t);
System.out.println("sadf");
}
}));
}
/**
* 开启位置上传
* @param act
*/
// public void startLocationService(AppCompatActivity act){
// try {
// Api.startLocationService(act, NewLJConstant.ENTER_PRISE_CODE, s -> {
// Log.e("位置上报", s);
// });
// } catch (JSONException e) {
// throw new RuntimeException(e);
// }
// }
public void startLocationService(AppCompatActivity act){
try {
Api.setBaseUrl("https://kehui56.cn/api","https://api.kehui56.cn/api");
Api.startLocationService(act, NewLJConstant.ENTER_PRISE_CODE, s -> {
Log.e("位置上报", s);
});
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* 关闭定位服务
*/
// public void stopLocationService(){
// Api.stopLocationService();
// }
public void stopLocationService(){
Api.stopLocationService();
}
}