定位服务aar

This commit is contained in:
lijia 2024-11-27 14:18:09 +08:00
parent d8f80ad07d
commit a7db2019ad
10 changed files with 323 additions and 41 deletions

View File

@ -157,6 +157,9 @@ android {
dependencies {
// implementation(fileTree("libs"))
// implementation(name: 'mdp-release', ext: 'aar')
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.caverock:androidsvg-aar:1.3'
@ -216,6 +219,8 @@ dependencies {
implementation(name: 'EsignSDK', ext: 'aar')
implementation 'pub.devrel:easypermissions:1.3.0'
implementation "com.squareup.retrofit2:retrofit:2.4.0"
// implementation "com.squareup.retrofit2:converter-gson:2.4.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.4.0"
@ -229,6 +234,9 @@ dependencies {
//
implementation 'com.github.getActivity:XToast:8.2'
// implementation files('libs/mdp-release.aar')
// implementation(name: 'mdp-release', ext: 'aar')
implementation project(path: ':mylibrary')
}

View File

@ -100,8 +100,9 @@
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.VehicleAuthActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity"
android:screenOrientation="portrait">
android:name=".ui.home.shangchuan.ShangChuangImgActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
@ -114,8 +115,9 @@
</activity>
<activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgNewActivity"
android:screenOrientation="portrait">
android:name=".ui.home.shangchuan.ShangChuangImgNewActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
@ -128,8 +130,9 @@
</activity>
<activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivityBC"
android:screenOrientation="portrait">
android:name=".ui.home.shangchuan.ShangChuangImgActivityBC"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
@ -143,8 +146,9 @@
<activity
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity2"
android:screenOrientation="portrait">
android:name=".ui.home.shangchuan.ShangChuangImgActivity2"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
@ -262,6 +266,12 @@
android:name="com.alct.mdp.MDPLocationService"
android:exported="true"
android:process=":mdpLocation_v1" />
<service
android:name="com.express.mdp.GpsService"
android:foregroundServiceType="location"
android:label="GPS服务"
android:priority="1000" />
<service
android:name="com.baidu.location.f"
android:enabled="true"
@ -368,7 +378,8 @@
</intent-filter>
</activity>
<activity android:name=".ui.NFCActivity">
<activity android:name=".ui.NFCActivity"
android:exported="true">
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
@ -382,7 +393,8 @@
<activity
android:name=".H5Activity"
android:launchMode="singleTask"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
@ -404,7 +416,8 @@
<activity
android:name=".H5Activity2"
android:launchMode="singleTask"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

View File

@ -0,0 +1,53 @@
package com.arpa.hndahesudintocctmsdriver.bean;
import com.google.gson.annotations.SerializedName;
/**
* @ClassName GDImage
* @Author john
* @Date 2024/11/27 14:04
* @Description TODO
*/
public class GDImage extends GDLocation{
private String fileName;
private String fileData;
private String fileExt;
private String imageTakenDate;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileData() {
return fileData;
}
public void setFileData(String fileData) {
this.fileData = fileData;
}
public String getFileExt() {
return fileExt;
}
public void setFileExt(String fileExt) {
this.fileExt = fileExt;
}
public String getImageTakenDate() {
return imageTakenDate;
}
public void setImageTakenDate(String imageTakenDate) {
this.imageTakenDate = imageTakenDate;
}
}

View File

@ -0,0 +1,87 @@
package com.arpa.hndahesudintocctmsdriver.bean;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
/**
* @ClassName GDLocation
* @Author john
* @Date 2024/11/27 13:59
* @Description TODO
*/
public class GDLocation implements Serializable {
private double baiduLongitude;
private double baiduLatitude;
private String location;
private String time;
private double altitude;
private float speed;
private float direction;
private int interval;
public double getBaiduLongitude() {
return baiduLongitude;
}
public void setBaiduLongitude(double baiduLongitude) {
this.baiduLongitude = baiduLongitude;
}
public double getBaiduLatitude() {
return baiduLatitude;
}
public void setBaiduLatitude(double baiduLatitude) {
this.baiduLatitude = baiduLatitude;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public double getAltitude() {
return altitude;
}
public void setAltitude(double altitude) {
this.altitude = altitude;
}
public float getSpeed() {
return speed;
}
public void setSpeed(float speed) {
this.speed = speed;
}
public float getDirection() {
return direction;
}
public void setDirection(float direction) {
this.direction = direction;
}
public int getInterval() {
return interval;
}
public void setInterval(int interval) {
this.interval = interval;
}
}

View File

@ -1,6 +1,7 @@
package com.arpa.hndahesudintocctmsdriver.request.bean.newlj;
import com.alct.mdp.model.Location;
import com.arpa.hndahesudintocctmsdriver.bean.GDLocation;
import java.io.Serializable;
@ -14,7 +15,7 @@ public class PickupBean implements Serializable {
private String shipmentCode;
private String enterpriseCode;
private Location location;
private GDLocation location;
public String getShipmentCode() {
return shipmentCode;
@ -32,11 +33,11 @@ public class PickupBean implements Serializable {
this.enterpriseCode = enterpriseCode;
}
public Location getLocation() {
public GDLocation getLocation() {
return location;
}
public void setLocation(Location location) {
public void setLocation(GDLocation location) {
this.location = location;
}

View File

@ -1,6 +1,7 @@
package com.arpa.hndahesudintocctmsdriver.request.bean.newlj;
import com.alct.mdp.model.Image;
import com.arpa.hndahesudintocctmsdriver.bean.GDImage;
import java.io.Serializable;
@ -14,7 +15,7 @@ public class UpimgBean implements Serializable {
private String shipmentCode;
private String enterpriseCode;
private Image image;
private GDImage image;
public String getShipmentCode() {
return shipmentCode;
@ -32,11 +33,11 @@ public class UpimgBean implements Serializable {
this.enterpriseCode = enterpriseCode;
}
public Image getImage() {
public GDImage getImage() {
return image;
}
public void setImage(Image image) {
public void setImage(GDImage image) {
this.image = image;
}

View File

@ -11,6 +11,7 @@ import android.view.Window;
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
import com.arpa.hndahesudintocctmsdriver.ui.UiAuxiliary;
import com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity;
import com.arpa.hndahesudintocctmsdriver.util.NewLJUtils;
import com.dahe.mylibrary.net.CommonResponseBean;
import com.dahe.mylibrary.net.ResultException;
import com.dahe.mylibrary.utils.ToastUtils;
@ -86,12 +87,13 @@ public abstract class RxHttpCallBack<T> {
dialog.dismiss();
}
if (t.getCode() == "401") {
UiAuxiliary.delLogin(mContext);
Intent intent = new Intent(mContext, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
mContext.startActivity(intent);
ToastUtils.showToast(mContext,"您的账号再异地登录,请重新登录");
if ("401".equals(t.getCode())) {
NewLJUtils.getInstance().getToken(mContext);
// UiAuxiliary.delLogin(mContext);
// Intent intent = new Intent(mContext, MainActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
// mContext.startActivity(intent);
// ToastUtils.showToast(mContext,"您的账号再异地登录,请重新登录");
}else{
ToastUtils.showToast(mContext,t.getMsg());
}

View File

@ -27,6 +27,8 @@ import com.alct.mdp.model.Location;
import com.alct.mdp.model.ShipmentStatusEnum;
import com.arpa.hndahesudintocctmsdriver.BuildConfig;
import com.arpa.hndahesudintocctmsdriver.bean.CarInfoBean;
import com.arpa.hndahesudintocctmsdriver.bean.GDImage;
import com.arpa.hndahesudintocctmsdriver.bean.GDLocation;
import com.arpa.hndahesudintocctmsdriver.bean.WaybillStatusBean;
import com.arpa.hndahesudintocctmsdriver.event.HomeWaybillEvent;
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
@ -472,6 +474,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
// nfc();
loadInfo();
}
// NewLJUtils.getInstance().startLocationService(ShangChuangImgActivity.this);
}
@Override
@ -549,6 +552,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
nfc();
uploadInfo();
}
// NewLJUtils.getInstance().stopLocationService();
}
@Override
@ -618,8 +622,8 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (locationKey) {
if (index == 2 && keys) {
up_trafficSign();
up_trafficReceipt();
receipt_image();
// up_trafficReceipt();
// receipt_image();
}
hyr.receipt(urib);
} else {
@ -666,7 +670,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
//上传安联-签收
public void up_trafficSign() {
//安联
Location l = new Location();
GDLocation l = new GDLocation();
l.setBaiduLongitude(latLng.longitude);
l.setBaiduLatitude(latLng.latitude);
l.setLocation(lgdu.getAddress());
@ -694,6 +698,8 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
NewLJUtils.getInstance().sign(con, sob.getData().getShippingNoteNumber(), l, new OnGDResultListener() {
@Override
public void onSuccess() {
up_trafficReceipt();
receipt_image();
Log.e("上报安联", "签收成功");
}
@ -718,7 +724,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
//上传安联-回单
public void up_trafficReceipt() {
//安联
Location l = new Location();
GDLocation l = new GDLocation();
l.setBaiduLongitude(latLng.longitude);
l.setBaiduLatitude(latLng.latitude);
l.setLocation(lgdu.getAddress());
@ -753,16 +759,19 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
public void up_image_z() {
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
File file = new File(path);
Image image = new Image();
GDImage image = new GDImage();
String base = BitmapUtil.imageToBase64(path);
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
image.setFileExt(FileUtil.lastName(file));
image.setFileName(FileUtil.fileName(file));
image.setImageTakenDate(Timer.getTimerT());
image.setTime(Timer.getTimerT());
image.setBaiduLongitude(latLng.longitude);
image.setBaiduLatitude(latLng.latitude);
image.setLocation(lgdu.getAddress());
String json = new Gson().toJson(image);
NewLJUtils.getInstance().uploadPickupImage(con, sob.getData().getShippingNoteNumber(), image, new OnGDResultListener() {
@Override
public void onSuccess() {
@ -808,12 +817,13 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
public void up_image() {
File file = new File(path);
Image image = new Image();
GDImage image = new GDImage();
String base = BitmapUtil.imageToBase64(path);
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
image.setFileExt(FileUtil.lastName(file));
image.setFileName(FileUtil.fileName(file));
image.setImageTakenDate(Timer.getTimerT());
image.setTime(Timer.getTimerT());
image.setBaiduLongitude(latLng.longitude);
image.setBaiduLatitude(latLng.latitude);
image.setLocation(lgdu.getAddress());
@ -869,12 +879,13 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
public void receipt_image() {
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
File file = new File(path);
Image image = new Image();
GDImage image = new GDImage();
String base = BitmapUtil.imageToBase64(path);
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
image.setFileExt(FileUtil.lastName(file));
image.setFileName(FileUtil.fileName(file));
image.setImageTakenDate(Timer.getTimerT());
image.setTime(Timer.getTimerT());
image.setBaiduLongitude(latLng.longitude);
image.setBaiduLatitude(latLng.latitude);
image.setLocation(lgdu.getAddress());
@ -959,7 +970,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
private void loadInfo() {
//安联
if (sob.getData().getReportAlct() == 1) {
Location l = new Location();
GDLocation l = new GDLocation();
l.setBaiduLongitude(latLng.longitude);
l.setBaiduLatitude(latLng.latitude);
l.setLocation(lgdu.getAddress());
@ -1024,7 +1035,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
//安联
if (sob.getData().getReportAlct() == 1) {
Location l = new Location();
GDLocation l = new GDLocation();
l.setBaiduLongitude(latLng.longitude);
l.setBaiduLatitude(latLng.latitude);
l.setLocation(lgdu.getAddress());

View File

@ -4,9 +4,14 @@ import static com.dahe.mylibrary.utils.BaseSPUtils.NEW_LJ_TOKEN;
import android.content.Context;
import android.text.TextUtils;
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;
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.InvoiceBean;
import com.arpa.hndahesudintocctmsdriver.request.bean.newlj.LjTokenBean;
@ -23,8 +28,6 @@ import com.dahe.mylibrary.net.CommonResponseBean;
import com.dahe.mylibrary.utils.TimeUtil;
import com.dahe.mylibrary.utils.ToastUtils;
import java.text.SimpleDateFormat;
import java.util.Locale;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers;
@ -74,7 +77,7 @@ public class NewLJUtils {
* @param shipmentCode
* @param location
*/
public void pickUp(Context ctx, String shipmentCode, Location location, OnGDResultListener listener) {
public void pickUp(Context ctx, String shipmentCode, GDLocation location, OnGDResultListener listener) {
if (TextUtils.isEmpty(shipmentCode)) {
ToastUtils.showToast(ctx, "运单号不能为空");
return;
@ -117,7 +120,7 @@ public class NewLJUtils {
* @param shipmentCode
* @param location
*/
public void unload(Context ctx, String shipmentCode, Location location, OnGDResultListener listener) {
public void unload(Context ctx, String shipmentCode, GDLocation location, OnGDResultListener listener) {
if (TextUtils.isEmpty(shipmentCode)) {
ToastUtils.showToast(ctx, "运单号不能为空");
return;
@ -162,7 +165,7 @@ public class NewLJUtils {
* @param shipmentCode
* @param location
*/
public void sign(Context ctx, String shipmentCode, Location location, OnGDResultListener listener) {
public void sign(Context ctx, String shipmentCode, GDLocation location, OnGDResultListener listener) {
if (TextUtils.isEmpty(shipmentCode)) {
ToastUtils.showToast(ctx, "运单号不能为空");
return;
@ -207,7 +210,7 @@ public class NewLJUtils {
* @param shipmentCode
* @param location
*/
public void pod(Context ctx, String shipmentCode, Location location, OnGDResultListener listener) {
public void pod(Context ctx, String shipmentCode, GDLocation location, OnGDResultListener listener) {
if (TextUtils.isEmpty(shipmentCode)) {
ToastUtils.showToast(ctx, "运单号不能为空");
return;
@ -252,7 +255,7 @@ public class NewLJUtils {
* @param shipmentCode
* @param imageDTO
*/
public void uploadPickupImage(Context ctx, String shipmentCode, Image imageDTO, OnGDResultListener listener) {
public void uploadPickupImage(Context ctx, String shipmentCode, GDImage imageDTO, OnGDResultListener listener) {
if (TextUtils.isEmpty(shipmentCode)) {
ToastUtils.showToast(ctx, "运单号不能为空");
return;
@ -297,7 +300,7 @@ public class NewLJUtils {
* @param shipmentCode
* @param imageDTO
*/
public void uploadUnloadImage(Context ctx, String shipmentCode, Image imageDTO, OnGDResultListener listener) {
public void uploadUnloadImage(Context ctx, String shipmentCode, GDImage imageDTO, OnGDResultListener listener) {
if (TextUtils.isEmpty(shipmentCode)) {
ToastUtils.showToast(ctx, "运单号不能为空");
return;
@ -342,7 +345,7 @@ public class NewLJUtils {
* @param shipmentCode
* @param imageDTO
*/
public void uploadPODImage(Context ctx, String shipmentCode, Image imageDTO, OnGDResultListener listener) {
public void uploadPODImage(Context ctx, String shipmentCode, GDImage imageDTO, OnGDResultListener listener) {
if (TextUtils.isEmpty(shipmentCode)) {
ToastUtils.showToast(ctx, "运单号不能为空");
return;
@ -444,4 +447,25 @@ public class NewLJUtils {
}));
}
/**
* 开启位置上传
* @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 stopLocationService(){
// Api.stopLocationService();
// }
}

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="match_parent"
>
<RelativeLayout
android:id="@+id/rl_title"
android:layout_width="match_parent"
android:layout_height="44dp"
>
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:padding="5dp"
android:layout_marginLeft="10dp"
android:src="@mipmap/btn_back" />
<TextView
android:id="@+id/close"
android:layout_toRightOf="@id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="关闭" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:singleLine="true"
android:ellipsize="end"
android:layout_marginLeft="70dp"
android:layout_marginRight="60dp"
android:gravity="center_vertical"
android:textSize="17sp"
android:textColor="@color/color_333333"
android:text="人脸识别" />
</RelativeLayout>
<com.esign.esignsdk.h5.view.X5WebView
android:id="@+id/webview"
android:layout_below="@id/rl_title"
app:layout_constraintTop_toBottomOf="@id/rl_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<LinearLayout
android:id="@+id/ll_exception"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_white"
android:layout_below="@id/rl_title"
android:orientation="vertical"
android:visibility="gone"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:src="@mipmap/icon_exception"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textSize="16sp"
android:textColor="@color/color_282828"
android:text="@string/exception_tips"
android:gravity="center_horizontal"/>
</LinearLayout>
</RelativeLayout>