diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt b/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt deleted file mode 100644 index 0ddef38..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 报警记录上传的参数 - * */ -data class AlarmParam( - var alarmContent: String, - var alarmLongitude: String, - var alarmLatitude: String, - var alarmTime: String, - var alarmThresh: String, - var alarmPicture: String, - var deviceId: String, - var alarmStatus: String, - var alarmType: String, - var alarmVideo: String, - var alarmValue: String, - var taskId: String -) diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt b/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt deleted file mode 100644 index 0ddef38..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 报警记录上传的参数 - * */ -data class AlarmParam( - var alarmContent: String, - var alarmLongitude: String, - var alarmLatitude: String, - var alarmTime: String, - var alarmThresh: String, - var alarmPicture: String, - var deviceId: String, - var alarmStatus: String, - var alarmType: String, - var alarmVideo: String, - var alarmValue: String, - var taskId: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java b/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java deleted file mode 100644 index 9f03944..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.casic.br.ktd.model; - -public class AlarmPointModel { - private String uuid; - private String alarmTime; - private double alarmLat; - private double alarmLng; - /** - * ppm·m - */ - private int alarmValue; - /** - * 摄像头水平角度 - */ - private double horizontal; - /** - * 摄像头垂直角度 - */ - private double vertical; - /** - * 报警阈值 - */ - private int threshold; - private float carSpeed; - private String videoPath; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public double getAlarmLat() { - return alarmLat; - } - - public void setAlarmLat(double alarmLat) { - this.alarmLat = alarmLat; - } - - public double getAlarmLng() { - return alarmLng; - } - - public void setAlarmLng(double alarmLng) { - this.alarmLng = alarmLng; - } - - public int getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(int alarmValue) { - this.alarmValue = alarmValue; - } - - public double getHorizontal() { - return horizontal; - } - - public void setHorizontal(double horizontal) { - this.horizontal = horizontal; - } - - public double getVertical() { - return vertical; - } - - public void setVertical(double vertical) { - this.vertical = vertical; - } - - public int getThreshold() { - return threshold; - } - - public void setThreshold(int threshold) { - this.threshold = threshold; - } - - public float getCarSpeed() { - return carSpeed; - } - - public void setCarSpeed(float carSpeed) { - this.carSpeed = carSpeed; - } - - public String getVideoPath() { - return videoPath; - } - - public void setVideoPath(String videoPath) { - this.videoPath = videoPath; - } -} diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt b/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt deleted file mode 100644 index 0ddef38..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 报警记录上传的参数 - * */ -data class AlarmParam( - var alarmContent: String, - var alarmLongitude: String, - var alarmLatitude: String, - var alarmTime: String, - var alarmThresh: String, - var alarmPicture: String, - var deviceId: String, - var alarmStatus: String, - var alarmType: String, - var alarmVideo: String, - var alarmValue: String, - var taskId: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java b/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java deleted file mode 100644 index 9f03944..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.casic.br.ktd.model; - -public class AlarmPointModel { - private String uuid; - private String alarmTime; - private double alarmLat; - private double alarmLng; - /** - * ppm·m - */ - private int alarmValue; - /** - * 摄像头水平角度 - */ - private double horizontal; - /** - * 摄像头垂直角度 - */ - private double vertical; - /** - * 报警阈值 - */ - private int threshold; - private float carSpeed; - private String videoPath; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public double getAlarmLat() { - return alarmLat; - } - - public void setAlarmLat(double alarmLat) { - this.alarmLat = alarmLat; - } - - public double getAlarmLng() { - return alarmLng; - } - - public void setAlarmLng(double alarmLng) { - this.alarmLng = alarmLng; - } - - public int getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(int alarmValue) { - this.alarmValue = alarmValue; - } - - public double getHorizontal() { - return horizontal; - } - - public void setHorizontal(double horizontal) { - this.horizontal = horizontal; - } - - public double getVertical() { - return vertical; - } - - public void setVertical(double vertical) { - this.vertical = vertical; - } - - public int getThreshold() { - return threshold; - } - - public void setThreshold(int threshold) { - this.threshold = threshold; - } - - public float getCarSpeed() { - return carSpeed; - } - - public void setCarSpeed(float carSpeed) { - this.carSpeed = carSpeed; - } - - public String getVideoPath() { - return videoPath; - } - - public void setVideoPath(String videoPath) { - this.videoPath = videoPath; - } -} diff --git a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt b/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt deleted file mode 100644 index 4183d4b..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 任务上传的参数 - * - * status 任务状态(1:启用,0:停用) - * - * valid 数据有效(0:有效,1:删除) - * */ -data class TaskParam( - val taskTitle: String, - val carId: String, - val beginDate: String, - val status: String, - val valid: String, - val endDate: String -) diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt b/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt deleted file mode 100644 index 0ddef38..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 报警记录上传的参数 - * */ -data class AlarmParam( - var alarmContent: String, - var alarmLongitude: String, - var alarmLatitude: String, - var alarmTime: String, - var alarmThresh: String, - var alarmPicture: String, - var deviceId: String, - var alarmStatus: String, - var alarmType: String, - var alarmVideo: String, - var alarmValue: String, - var taskId: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java b/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java deleted file mode 100644 index 9f03944..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.casic.br.ktd.model; - -public class AlarmPointModel { - private String uuid; - private String alarmTime; - private double alarmLat; - private double alarmLng; - /** - * ppm·m - */ - private int alarmValue; - /** - * 摄像头水平角度 - */ - private double horizontal; - /** - * 摄像头垂直角度 - */ - private double vertical; - /** - * 报警阈值 - */ - private int threshold; - private float carSpeed; - private String videoPath; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public double getAlarmLat() { - return alarmLat; - } - - public void setAlarmLat(double alarmLat) { - this.alarmLat = alarmLat; - } - - public double getAlarmLng() { - return alarmLng; - } - - public void setAlarmLng(double alarmLng) { - this.alarmLng = alarmLng; - } - - public int getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(int alarmValue) { - this.alarmValue = alarmValue; - } - - public double getHorizontal() { - return horizontal; - } - - public void setHorizontal(double horizontal) { - this.horizontal = horizontal; - } - - public double getVertical() { - return vertical; - } - - public void setVertical(double vertical) { - this.vertical = vertical; - } - - public int getThreshold() { - return threshold; - } - - public void setThreshold(int threshold) { - this.threshold = threshold; - } - - public float getCarSpeed() { - return carSpeed; - } - - public void setCarSpeed(float carSpeed) { - this.carSpeed = carSpeed; - } - - public String getVideoPath() { - return videoPath; - } - - public void setVideoPath(String videoPath) { - this.videoPath = videoPath; - } -} diff --git a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt b/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt deleted file mode 100644 index 4183d4b..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 任务上传的参数 - * - * status 任务状态(1:启用,0:停用) - * - * valid 数据有效(0:有效,1:删除) - * */ -data class TaskParam( - val taskTitle: String, - val carId: String, - val beginDate: String, - val status: String, - val valid: String, - val endDate: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java index 4db9a25..835e082 100644 --- a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java @@ -4,15 +4,15 @@ public class VehicleListModel { - private int code; + private Integer code; private DataModel data; private String message; - public int getCode() { + public Integer getCode() { return code; } - public void setCode(int code) { + public void setCode(Integer code) { this.code = code; } @@ -34,7 +34,7 @@ public static class DataModel { private List rows; - private int total; + private Integer total; public List getRows() { return rows; @@ -44,32 +44,49 @@ this.rows = rows; } - public int getTotal() { + public Integer getTotal() { return total; } - public void setTotal(int total) { + public void setTotal(Integer total) { this.total = total; } public static class RowsModel { - private String carName; + private String beginDate; + private String carId; private String carPlate; - private String deptId; private String description; + private String description1; + private String description2; + private String endDate; private String id; + private String km; private String latitude; private String longitude; + private String modelName; private String status; + private String statusName; + private String taskCode; + private String taskName; private String ts; + private String updateTime; private String valid; - public String getCarName() { - return carName; + public String getBeginDate() { + return beginDate; } - public void setCarName(String carName) { - this.carName = carName; + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + public String getCarId() { + return carId; + } + + public void setCarId(String carId) { + this.carId = carId; } public String getCarPlate() { @@ -80,14 +97,6 @@ this.carPlate = carPlate; } - public String getDeptId() { - return deptId; - } - - public void setDeptId(String deptId) { - this.deptId = deptId; - } - public String getDescription() { return description; } @@ -96,6 +105,30 @@ this.description = description; } + public String getDescription1() { + return description1; + } + + public void setDescription1(String description1) { + this.description1 = description1; + } + + public String getDescription2() { + return description2; + } + + public void setDescription2(String description2) { + this.description2 = description2; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + public String getId() { return id; } @@ -104,6 +137,14 @@ this.id = id; } + public String getKm() { + return km; + } + + public void setKm(String km) { + this.km = km; + } + public String getLatitude() { return latitude; } @@ -120,6 +161,14 @@ this.longitude = longitude; } + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getStatus() { return status; } @@ -128,6 +177,30 @@ this.status = status; } + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + public String getTs() { return ts; } @@ -136,6 +209,14 @@ this.ts = ts; } + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + public String getValid() { return valid; } diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt b/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt deleted file mode 100644 index 0ddef38..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 报警记录上传的参数 - * */ -data class AlarmParam( - var alarmContent: String, - var alarmLongitude: String, - var alarmLatitude: String, - var alarmTime: String, - var alarmThresh: String, - var alarmPicture: String, - var deviceId: String, - var alarmStatus: String, - var alarmType: String, - var alarmVideo: String, - var alarmValue: String, - var taskId: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java b/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java deleted file mode 100644 index 9f03944..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.casic.br.ktd.model; - -public class AlarmPointModel { - private String uuid; - private String alarmTime; - private double alarmLat; - private double alarmLng; - /** - * ppm·m - */ - private int alarmValue; - /** - * 摄像头水平角度 - */ - private double horizontal; - /** - * 摄像头垂直角度 - */ - private double vertical; - /** - * 报警阈值 - */ - private int threshold; - private float carSpeed; - private String videoPath; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public double getAlarmLat() { - return alarmLat; - } - - public void setAlarmLat(double alarmLat) { - this.alarmLat = alarmLat; - } - - public double getAlarmLng() { - return alarmLng; - } - - public void setAlarmLng(double alarmLng) { - this.alarmLng = alarmLng; - } - - public int getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(int alarmValue) { - this.alarmValue = alarmValue; - } - - public double getHorizontal() { - return horizontal; - } - - public void setHorizontal(double horizontal) { - this.horizontal = horizontal; - } - - public double getVertical() { - return vertical; - } - - public void setVertical(double vertical) { - this.vertical = vertical; - } - - public int getThreshold() { - return threshold; - } - - public void setThreshold(int threshold) { - this.threshold = threshold; - } - - public float getCarSpeed() { - return carSpeed; - } - - public void setCarSpeed(float carSpeed) { - this.carSpeed = carSpeed; - } - - public String getVideoPath() { - return videoPath; - } - - public void setVideoPath(String videoPath) { - this.videoPath = videoPath; - } -} diff --git a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt b/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt deleted file mode 100644 index 4183d4b..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 任务上传的参数 - * - * status 任务状态(1:启用,0:停用) - * - * valid 数据有效(0:有效,1:删除) - * */ -data class TaskParam( - val taskTitle: String, - val carId: String, - val beginDate: String, - val status: String, - val valid: String, - val endDate: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java index 4db9a25..835e082 100644 --- a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java @@ -4,15 +4,15 @@ public class VehicleListModel { - private int code; + private Integer code; private DataModel data; private String message; - public int getCode() { + public Integer getCode() { return code; } - public void setCode(int code) { + public void setCode(Integer code) { this.code = code; } @@ -34,7 +34,7 @@ public static class DataModel { private List rows; - private int total; + private Integer total; public List getRows() { return rows; @@ -44,32 +44,49 @@ this.rows = rows; } - public int getTotal() { + public Integer getTotal() { return total; } - public void setTotal(int total) { + public void setTotal(Integer total) { this.total = total; } public static class RowsModel { - private String carName; + private String beginDate; + private String carId; private String carPlate; - private String deptId; private String description; + private String description1; + private String description2; + private String endDate; private String id; + private String km; private String latitude; private String longitude; + private String modelName; private String status; + private String statusName; + private String taskCode; + private String taskName; private String ts; + private String updateTime; private String valid; - public String getCarName() { - return carName; + public String getBeginDate() { + return beginDate; } - public void setCarName(String carName) { - this.carName = carName; + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + public String getCarId() { + return carId; + } + + public void setCarId(String carId) { + this.carId = carId; } public String getCarPlate() { @@ -80,14 +97,6 @@ this.carPlate = carPlate; } - public String getDeptId() { - return deptId; - } - - public void setDeptId(String deptId) { - this.deptId = deptId; - } - public String getDescription() { return description; } @@ -96,6 +105,30 @@ this.description = description; } + public String getDescription1() { + return description1; + } + + public void setDescription1(String description1) { + this.description1 = description1; + } + + public String getDescription2() { + return description2; + } + + public void setDescription2(String description2) { + this.description2 = description2; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + public String getId() { return id; } @@ -104,6 +137,14 @@ this.id = id; } + public String getKm() { + return km; + } + + public void setKm(String km) { + this.km = km; + } + public String getLatitude() { return latitude; } @@ -120,6 +161,14 @@ this.longitude = longitude; } + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getStatus() { return status; } @@ -128,6 +177,30 @@ this.status = status; } + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + public String getTs() { return ts; } @@ -136,6 +209,14 @@ this.ts = ts; } + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + public String getValid() { return valid; } diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java new file mode 100644 index 0000000..d894f6b --- /dev/null +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java @@ -0,0 +1,154 @@ +package com.casic.br.ktd.model; + +import java.util.List; + +public class VehicleRouteModel { + + private Integer code; + private List data; + private String message; + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String alarmCode; + private String deviceStatus; + private String direction; + private String gas; + private String id; + private String isAlarm; + private String lagitude; + private String longitude; + private String pitch; + private String position; + private String speed; + private String taskId; + private String ts; + + public String getAlarmCode() { + return alarmCode; + } + + public void setAlarmCode(String alarmCode) { + this.alarmCode = alarmCode; + } + + public String getDeviceStatus() { + return deviceStatus; + } + + public void setDeviceStatus(String deviceStatus) { + this.deviceStatus = deviceStatus; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getGas() { + return gas; + } + + public void setGas(String gas) { + this.gas = gas; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIsAlarm() { + return isAlarm; + } + + public void setIsAlarm(String isAlarm) { + this.isAlarm = isAlarm; + } + + public String getLagitude() { + return lagitude; + } + + public void setLagitude(String lagitude) { + this.lagitude = lagitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getPitch() { + return pitch; + } + + public void setPitch(String pitch) { + this.pitch = pitch; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getSpeed() { + return speed; + } + + public void setSpeed(String speed) { + this.speed = speed; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + } +} diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt b/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt deleted file mode 100644 index 0ddef38..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 报警记录上传的参数 - * */ -data class AlarmParam( - var alarmContent: String, - var alarmLongitude: String, - var alarmLatitude: String, - var alarmTime: String, - var alarmThresh: String, - var alarmPicture: String, - var deviceId: String, - var alarmStatus: String, - var alarmType: String, - var alarmVideo: String, - var alarmValue: String, - var taskId: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java b/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java deleted file mode 100644 index 9f03944..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.casic.br.ktd.model; - -public class AlarmPointModel { - private String uuid; - private String alarmTime; - private double alarmLat; - private double alarmLng; - /** - * ppm·m - */ - private int alarmValue; - /** - * 摄像头水平角度 - */ - private double horizontal; - /** - * 摄像头垂直角度 - */ - private double vertical; - /** - * 报警阈值 - */ - private int threshold; - private float carSpeed; - private String videoPath; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public double getAlarmLat() { - return alarmLat; - } - - public void setAlarmLat(double alarmLat) { - this.alarmLat = alarmLat; - } - - public double getAlarmLng() { - return alarmLng; - } - - public void setAlarmLng(double alarmLng) { - this.alarmLng = alarmLng; - } - - public int getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(int alarmValue) { - this.alarmValue = alarmValue; - } - - public double getHorizontal() { - return horizontal; - } - - public void setHorizontal(double horizontal) { - this.horizontal = horizontal; - } - - public double getVertical() { - return vertical; - } - - public void setVertical(double vertical) { - this.vertical = vertical; - } - - public int getThreshold() { - return threshold; - } - - public void setThreshold(int threshold) { - this.threshold = threshold; - } - - public float getCarSpeed() { - return carSpeed; - } - - public void setCarSpeed(float carSpeed) { - this.carSpeed = carSpeed; - } - - public String getVideoPath() { - return videoPath; - } - - public void setVideoPath(String videoPath) { - this.videoPath = videoPath; - } -} diff --git a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt b/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt deleted file mode 100644 index 4183d4b..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 任务上传的参数 - * - * status 任务状态(1:启用,0:停用) - * - * valid 数据有效(0:有效,1:删除) - * */ -data class TaskParam( - val taskTitle: String, - val carId: String, - val beginDate: String, - val status: String, - val valid: String, - val endDate: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java index 4db9a25..835e082 100644 --- a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java @@ -4,15 +4,15 @@ public class VehicleListModel { - private int code; + private Integer code; private DataModel data; private String message; - public int getCode() { + public Integer getCode() { return code; } - public void setCode(int code) { + public void setCode(Integer code) { this.code = code; } @@ -34,7 +34,7 @@ public static class DataModel { private List rows; - private int total; + private Integer total; public List getRows() { return rows; @@ -44,32 +44,49 @@ this.rows = rows; } - public int getTotal() { + public Integer getTotal() { return total; } - public void setTotal(int total) { + public void setTotal(Integer total) { this.total = total; } public static class RowsModel { - private String carName; + private String beginDate; + private String carId; private String carPlate; - private String deptId; private String description; + private String description1; + private String description2; + private String endDate; private String id; + private String km; private String latitude; private String longitude; + private String modelName; private String status; + private String statusName; + private String taskCode; + private String taskName; private String ts; + private String updateTime; private String valid; - public String getCarName() { - return carName; + public String getBeginDate() { + return beginDate; } - public void setCarName(String carName) { - this.carName = carName; + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + public String getCarId() { + return carId; + } + + public void setCarId(String carId) { + this.carId = carId; } public String getCarPlate() { @@ -80,14 +97,6 @@ this.carPlate = carPlate; } - public String getDeptId() { - return deptId; - } - - public void setDeptId(String deptId) { - this.deptId = deptId; - } - public String getDescription() { return description; } @@ -96,6 +105,30 @@ this.description = description; } + public String getDescription1() { + return description1; + } + + public void setDescription1(String description1) { + this.description1 = description1; + } + + public String getDescription2() { + return description2; + } + + public void setDescription2(String description2) { + this.description2 = description2; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + public String getId() { return id; } @@ -104,6 +137,14 @@ this.id = id; } + public String getKm() { + return km; + } + + public void setKm(String km) { + this.km = km; + } + public String getLatitude() { return latitude; } @@ -120,6 +161,14 @@ this.longitude = longitude; } + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getStatus() { return status; } @@ -128,6 +177,30 @@ this.status = status; } + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + public String getTs() { return ts; } @@ -136,6 +209,14 @@ this.ts = ts; } + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + public String getValid() { return valid; } diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java new file mode 100644 index 0000000..d894f6b --- /dev/null +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java @@ -0,0 +1,154 @@ +package com.casic.br.ktd.model; + +import java.util.List; + +public class VehicleRouteModel { + + private Integer code; + private List data; + private String message; + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String alarmCode; + private String deviceStatus; + private String direction; + private String gas; + private String id; + private String isAlarm; + private String lagitude; + private String longitude; + private String pitch; + private String position; + private String speed; + private String taskId; + private String ts; + + public String getAlarmCode() { + return alarmCode; + } + + public void setAlarmCode(String alarmCode) { + this.alarmCode = alarmCode; + } + + public String getDeviceStatus() { + return deviceStatus; + } + + public void setDeviceStatus(String deviceStatus) { + this.deviceStatus = deviceStatus; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getGas() { + return gas; + } + + public void setGas(String gas) { + this.gas = gas; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIsAlarm() { + return isAlarm; + } + + public void setIsAlarm(String isAlarm) { + this.isAlarm = isAlarm; + } + + public String getLagitude() { + return lagitude; + } + + public void setLagitude(String lagitude) { + this.lagitude = lagitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getPitch() { + return pitch; + } + + public void setPitch(String pitch) { + this.pitch = pitch; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getSpeed() { + return speed; + } + + public void setSpeed(String speed) { + this.speed = speed; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + } +} diff --git a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt index f5b052c..8a06ac4 100644 --- a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt @@ -100,13 +100,20 @@ ): String /** - * 获取巡检任务列表 + * 巡检车信息 */ - @POST("/system/busPatrolCar/listPage") + @POST("/system/busOverView/carList") suspend fun getVehicles( + @Header("token") token: String + ): String + + /** + * 获取巡检车轨迹 + */ + @POST("/system/busPatrolTask/detail") + suspend fun getVehicleRoute( @Header("token") token: String, - @QueryMap limit: Map, - @QueryMap offset: Map + @Body requestBody: RequestBody ): String /** diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt b/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt deleted file mode 100644 index 0ddef38..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 报警记录上传的参数 - * */ -data class AlarmParam( - var alarmContent: String, - var alarmLongitude: String, - var alarmLatitude: String, - var alarmTime: String, - var alarmThresh: String, - var alarmPicture: String, - var deviceId: String, - var alarmStatus: String, - var alarmType: String, - var alarmVideo: String, - var alarmValue: String, - var taskId: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java b/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java deleted file mode 100644 index 9f03944..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.casic.br.ktd.model; - -public class AlarmPointModel { - private String uuid; - private String alarmTime; - private double alarmLat; - private double alarmLng; - /** - * ppm·m - */ - private int alarmValue; - /** - * 摄像头水平角度 - */ - private double horizontal; - /** - * 摄像头垂直角度 - */ - private double vertical; - /** - * 报警阈值 - */ - private int threshold; - private float carSpeed; - private String videoPath; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public double getAlarmLat() { - return alarmLat; - } - - public void setAlarmLat(double alarmLat) { - this.alarmLat = alarmLat; - } - - public double getAlarmLng() { - return alarmLng; - } - - public void setAlarmLng(double alarmLng) { - this.alarmLng = alarmLng; - } - - public int getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(int alarmValue) { - this.alarmValue = alarmValue; - } - - public double getHorizontal() { - return horizontal; - } - - public void setHorizontal(double horizontal) { - this.horizontal = horizontal; - } - - public double getVertical() { - return vertical; - } - - public void setVertical(double vertical) { - this.vertical = vertical; - } - - public int getThreshold() { - return threshold; - } - - public void setThreshold(int threshold) { - this.threshold = threshold; - } - - public float getCarSpeed() { - return carSpeed; - } - - public void setCarSpeed(float carSpeed) { - this.carSpeed = carSpeed; - } - - public String getVideoPath() { - return videoPath; - } - - public void setVideoPath(String videoPath) { - this.videoPath = videoPath; - } -} diff --git a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt b/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt deleted file mode 100644 index 4183d4b..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 任务上传的参数 - * - * status 任务状态(1:启用,0:停用) - * - * valid 数据有效(0:有效,1:删除) - * */ -data class TaskParam( - val taskTitle: String, - val carId: String, - val beginDate: String, - val status: String, - val valid: String, - val endDate: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java index 4db9a25..835e082 100644 --- a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java @@ -4,15 +4,15 @@ public class VehicleListModel { - private int code; + private Integer code; private DataModel data; private String message; - public int getCode() { + public Integer getCode() { return code; } - public void setCode(int code) { + public void setCode(Integer code) { this.code = code; } @@ -34,7 +34,7 @@ public static class DataModel { private List rows; - private int total; + private Integer total; public List getRows() { return rows; @@ -44,32 +44,49 @@ this.rows = rows; } - public int getTotal() { + public Integer getTotal() { return total; } - public void setTotal(int total) { + public void setTotal(Integer total) { this.total = total; } public static class RowsModel { - private String carName; + private String beginDate; + private String carId; private String carPlate; - private String deptId; private String description; + private String description1; + private String description2; + private String endDate; private String id; + private String km; private String latitude; private String longitude; + private String modelName; private String status; + private String statusName; + private String taskCode; + private String taskName; private String ts; + private String updateTime; private String valid; - public String getCarName() { - return carName; + public String getBeginDate() { + return beginDate; } - public void setCarName(String carName) { - this.carName = carName; + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + public String getCarId() { + return carId; + } + + public void setCarId(String carId) { + this.carId = carId; } public String getCarPlate() { @@ -80,14 +97,6 @@ this.carPlate = carPlate; } - public String getDeptId() { - return deptId; - } - - public void setDeptId(String deptId) { - this.deptId = deptId; - } - public String getDescription() { return description; } @@ -96,6 +105,30 @@ this.description = description; } + public String getDescription1() { + return description1; + } + + public void setDescription1(String description1) { + this.description1 = description1; + } + + public String getDescription2() { + return description2; + } + + public void setDescription2(String description2) { + this.description2 = description2; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + public String getId() { return id; } @@ -104,6 +137,14 @@ this.id = id; } + public String getKm() { + return km; + } + + public void setKm(String km) { + this.km = km; + } + public String getLatitude() { return latitude; } @@ -120,6 +161,14 @@ this.longitude = longitude; } + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getStatus() { return status; } @@ -128,6 +177,30 @@ this.status = status; } + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + public String getTs() { return ts; } @@ -136,6 +209,14 @@ this.ts = ts; } + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + public String getValid() { return valid; } diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java new file mode 100644 index 0000000..d894f6b --- /dev/null +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java @@ -0,0 +1,154 @@ +package com.casic.br.ktd.model; + +import java.util.List; + +public class VehicleRouteModel { + + private Integer code; + private List data; + private String message; + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String alarmCode; + private String deviceStatus; + private String direction; + private String gas; + private String id; + private String isAlarm; + private String lagitude; + private String longitude; + private String pitch; + private String position; + private String speed; + private String taskId; + private String ts; + + public String getAlarmCode() { + return alarmCode; + } + + public void setAlarmCode(String alarmCode) { + this.alarmCode = alarmCode; + } + + public String getDeviceStatus() { + return deviceStatus; + } + + public void setDeviceStatus(String deviceStatus) { + this.deviceStatus = deviceStatus; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getGas() { + return gas; + } + + public void setGas(String gas) { + this.gas = gas; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIsAlarm() { + return isAlarm; + } + + public void setIsAlarm(String isAlarm) { + this.isAlarm = isAlarm; + } + + public String getLagitude() { + return lagitude; + } + + public void setLagitude(String lagitude) { + this.lagitude = lagitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getPitch() { + return pitch; + } + + public void setPitch(String pitch) { + this.pitch = pitch; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getSpeed() { + return speed; + } + + public void setSpeed(String speed) { + this.speed = speed; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + } +} diff --git a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt index f5b052c..8a06ac4 100644 --- a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt @@ -100,13 +100,20 @@ ): String /** - * 获取巡检任务列表 + * 巡检车信息 */ - @POST("/system/busPatrolCar/listPage") + @POST("/system/busOverView/carList") suspend fun getVehicles( + @Header("token") token: String + ): String + + /** + * 获取巡检车轨迹 + */ + @POST("/system/busPatrolTask/detail") + suspend fun getVehicleRoute( @Header("token") token: String, - @QueryMap limit: Map, - @QueryMap offset: Map + @Body requestBody: RequestBody ): String /** diff --git a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitServiceManager.kt index 08f1716..d186587 100644 --- a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitServiceManager.kt @@ -195,12 +195,19 @@ * 获取巡检车列表 */ suspend fun getVehicles(): String { - val limitMap = HashMap() - limitMap["limit"] = LocaleConstant.PAGE_LIMIT + return api.getVehicles(AuthenticationHelper.token) + } - val offsetMap = HashMap() - offsetMap["offset"] = 1 - return api.getVehicles(AuthenticationHelper.token, limitMap, offsetMap) + /** + * 获取巡检车轨迹 + * */ + suspend fun getVehicleRoute(id: String): String { + val param = JsonObject() + param.addProperty("id", id) + val requestBody = param.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getVehicleRoute(AuthenticationHelper.token, requestBody) } /** diff --git a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt index 7b8d65b..97df59a 100644 --- a/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/br/ktd/fragment/HomePageFragment.kt @@ -1,6 +1,7 @@ package com.casic.br.ktd.fragment import android.annotation.SuppressLint +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Message @@ -18,6 +19,7 @@ import com.amap.api.maps.model.LatLng import com.amap.api.maps.model.Marker import com.amap.api.maps.model.MarkerOptions +import com.amap.api.maps.model.PolylineOptions import com.casic.br.ktd.R import com.casic.br.ktd.databinding.FragmentHomeBinding import com.casic.br.ktd.extensions.toChineseAddress @@ -156,39 +158,39 @@ } } } -// taskViewModel.detailResult.observe(this) { -// if (it.code == 200) { -// //设置起点 -// val first = it.data.first() -// addMarker( -// LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), -// "", -// R.mipmap.start -// ) -// //设置终点 -// val last = it.data.last() -// addMarker( -// LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), -// "", -// R.mipmap.end -// ) -// it.data.forEach { task -> -// if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { -// //瞄点画线 -// val latLngPoints = ArrayList() -// latLngPoints.add( -// LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) -// ) -// aMap.addPolyline( -// PolylineOptions() -// .addAll(latLngPoints) -// .width(10.toFloat()) -// .color(Color.RED) -// ) -// } -// } -// } -// } + vehicleViewModel.routeResult.observe(this) { + if (it.code == 200) { + //设置起点 + val first = it.data.first() + addMarker( + LatLng(first.lagitude.toDouble(), first.longitude.toDouble()), + "", + R.mipmap.start + ) + //设置终点 + val last = it.data.last() + addMarker( + LatLng(last.lagitude.toDouble(), last.longitude.toDouble()), + "", + R.mipmap.end + ) + it.data.forEach { task -> + if (task.lagitude.isNotEmpty() && task.longitude.isNotEmpty()) { + //瞄点画线 + val latLngPoints = ArrayList() + latLngPoints.add( + LatLng(task.lagitude.toDouble(), task.longitude.toDouble()) + ) + aMap.addPolyline( + PolylineOptions() + .addAll(latLngPoints) + .width(10.toFloat()) + .color(Color.RED) + ) + } + } + } + } } override fun handleMessage(msg: Message): Boolean { @@ -312,9 +314,8 @@ } } - //TODO 待确定 routeView.setOnClickListener { -// taskViewModel.getTaskDetail(id, "", "", "", "", "") + vehicleViewModel.getVehicleRoute(id) } } } diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt b/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt deleted file mode 100644 index 0ddef38..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmParam.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 报警记录上传的参数 - * */ -data class AlarmParam( - var alarmContent: String, - var alarmLongitude: String, - var alarmLatitude: String, - var alarmTime: String, - var alarmThresh: String, - var alarmPicture: String, - var deviceId: String, - var alarmStatus: String, - var alarmType: String, - var alarmVideo: String, - var alarmValue: String, - var taskId: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java b/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java deleted file mode 100644 index 9f03944..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/AlarmPointModel.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.casic.br.ktd.model; - -public class AlarmPointModel { - private String uuid; - private String alarmTime; - private double alarmLat; - private double alarmLng; - /** - * ppm·m - */ - private int alarmValue; - /** - * 摄像头水平角度 - */ - private double horizontal; - /** - * 摄像头垂直角度 - */ - private double vertical; - /** - * 报警阈值 - */ - private int threshold; - private float carSpeed; - private String videoPath; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public double getAlarmLat() { - return alarmLat; - } - - public void setAlarmLat(double alarmLat) { - this.alarmLat = alarmLat; - } - - public double getAlarmLng() { - return alarmLng; - } - - public void setAlarmLng(double alarmLng) { - this.alarmLng = alarmLng; - } - - public int getAlarmValue() { - return alarmValue; - } - - public void setAlarmValue(int alarmValue) { - this.alarmValue = alarmValue; - } - - public double getHorizontal() { - return horizontal; - } - - public void setHorizontal(double horizontal) { - this.horizontal = horizontal; - } - - public double getVertical() { - return vertical; - } - - public void setVertical(double vertical) { - this.vertical = vertical; - } - - public int getThreshold() { - return threshold; - } - - public void setThreshold(int threshold) { - this.threshold = threshold; - } - - public float getCarSpeed() { - return carSpeed; - } - - public void setCarSpeed(float carSpeed) { - this.carSpeed = carSpeed; - } - - public String getVideoPath() { - return videoPath; - } - - public void setVideoPath(String videoPath) { - this.videoPath = videoPath; - } -} diff --git a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt b/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt deleted file mode 100644 index 4183d4b..0000000 --- a/app/src/main/java/com/casic/br/ktd/model/TaskParam.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.casic.br.ktd.model - -/** - * 任务上传的参数 - * - * status 任务状态(1:启用,0:停用) - * - * valid 数据有效(0:有效,1:删除) - * */ -data class TaskParam( - val taskTitle: String, - val carId: String, - val beginDate: String, - val status: String, - val valid: String, - val endDate: String -) diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java index 4db9a25..835e082 100644 --- a/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleListModel.java @@ -4,15 +4,15 @@ public class VehicleListModel { - private int code; + private Integer code; private DataModel data; private String message; - public int getCode() { + public Integer getCode() { return code; } - public void setCode(int code) { + public void setCode(Integer code) { this.code = code; } @@ -34,7 +34,7 @@ public static class DataModel { private List rows; - private int total; + private Integer total; public List getRows() { return rows; @@ -44,32 +44,49 @@ this.rows = rows; } - public int getTotal() { + public Integer getTotal() { return total; } - public void setTotal(int total) { + public void setTotal(Integer total) { this.total = total; } public static class RowsModel { - private String carName; + private String beginDate; + private String carId; private String carPlate; - private String deptId; private String description; + private String description1; + private String description2; + private String endDate; private String id; + private String km; private String latitude; private String longitude; + private String modelName; private String status; + private String statusName; + private String taskCode; + private String taskName; private String ts; + private String updateTime; private String valid; - public String getCarName() { - return carName; + public String getBeginDate() { + return beginDate; } - public void setCarName(String carName) { - this.carName = carName; + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + public String getCarId() { + return carId; + } + + public void setCarId(String carId) { + this.carId = carId; } public String getCarPlate() { @@ -80,14 +97,6 @@ this.carPlate = carPlate; } - public String getDeptId() { - return deptId; - } - - public void setDeptId(String deptId) { - this.deptId = deptId; - } - public String getDescription() { return description; } @@ -96,6 +105,30 @@ this.description = description; } + public String getDescription1() { + return description1; + } + + public void setDescription1(String description1) { + this.description1 = description1; + } + + public String getDescription2() { + return description2; + } + + public void setDescription2(String description2) { + this.description2 = description2; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + public String getId() { return id; } @@ -104,6 +137,14 @@ this.id = id; } + public String getKm() { + return km; + } + + public void setKm(String km) { + this.km = km; + } + public String getLatitude() { return latitude; } @@ -120,6 +161,14 @@ this.longitude = longitude; } + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + public String getStatus() { return status; } @@ -128,6 +177,30 @@ this.status = status; } + public String getStatusName() { + return statusName; + } + + public void setStatusName(String statusName) { + this.statusName = statusName; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + public String getTs() { return ts; } @@ -136,6 +209,14 @@ this.ts = ts; } + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + public String getValid() { return valid; } diff --git a/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java b/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java new file mode 100644 index 0000000..d894f6b --- /dev/null +++ b/app/src/main/java/com/casic/br/ktd/model/VehicleRouteModel.java @@ -0,0 +1,154 @@ +package com.casic.br.ktd.model; + +import java.util.List; + +public class VehicleRouteModel { + + private Integer code; + private List data; + private String message; + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public static class DataModel { + private String alarmCode; + private String deviceStatus; + private String direction; + private String gas; + private String id; + private String isAlarm; + private String lagitude; + private String longitude; + private String pitch; + private String position; + private String speed; + private String taskId; + private String ts; + + public String getAlarmCode() { + return alarmCode; + } + + public void setAlarmCode(String alarmCode) { + this.alarmCode = alarmCode; + } + + public String getDeviceStatus() { + return deviceStatus; + } + + public void setDeviceStatus(String deviceStatus) { + this.deviceStatus = deviceStatus; + } + + public String getDirection() { + return direction; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getGas() { + return gas; + } + + public void setGas(String gas) { + this.gas = gas; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getIsAlarm() { + return isAlarm; + } + + public void setIsAlarm(String isAlarm) { + this.isAlarm = isAlarm; + } + + public String getLagitude() { + return lagitude; + } + + public void setLagitude(String lagitude) { + this.lagitude = lagitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getPitch() { + return pitch; + } + + public void setPitch(String pitch) { + this.pitch = pitch; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getSpeed() { + return speed; + } + + public void setSpeed(String speed) { + this.speed = speed; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + } +} diff --git a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt index f5b052c..8a06ac4 100644 --- a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitService.kt @@ -100,13 +100,20 @@ ): String /** - * 获取巡检任务列表 + * 巡检车信息 */ - @POST("/system/busPatrolCar/listPage") + @POST("/system/busOverView/carList") suspend fun getVehicles( + @Header("token") token: String + ): String + + /** + * 获取巡检车轨迹 + */ + @POST("/system/busPatrolTask/detail") + suspend fun getVehicleRoute( @Header("token") token: String, - @QueryMap limit: Map, - @QueryMap offset: Map + @Body requestBody: RequestBody ): String /** diff --git a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitServiceManager.kt index 08f1716..d186587 100644 --- a/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/br/ktd/retrofit/RetrofitServiceManager.kt @@ -195,12 +195,19 @@ * 获取巡检车列表 */ suspend fun getVehicles(): String { - val limitMap = HashMap() - limitMap["limit"] = LocaleConstant.PAGE_LIMIT + return api.getVehicles(AuthenticationHelper.token) + } - val offsetMap = HashMap() - offsetMap["offset"] = 1 - return api.getVehicles(AuthenticationHelper.token, limitMap, offsetMap) + /** + * 获取巡检车轨迹 + * */ + suspend fun getVehicleRoute(id: String): String { + val param = JsonObject() + param.addProperty("id", id) + val requestBody = param.toString().toRequestBody( + "application/json;charset=UTF-8".toMediaType() + ) + return api.getVehicleRoute(AuthenticationHelper.token, requestBody) } /** diff --git a/app/src/main/java/com/casic/br/ktd/vm/VehicleViewModel.kt b/app/src/main/java/com/casic/br/ktd/vm/VehicleViewModel.kt index 686b024..33343a2 100644 --- a/app/src/main/java/com/casic/br/ktd/vm/VehicleViewModel.kt +++ b/app/src/main/java/com/casic/br/ktd/vm/VehicleViewModel.kt @@ -5,6 +5,7 @@ import com.casic.br.ktd.extensions.separateResponseCode import com.casic.br.ktd.extensions.toErrorMessage import com.casic.br.ktd.model.VehicleListModel +import com.casic.br.ktd.model.VehicleRouteModel import com.casic.br.ktd.retrofit.RetrofitServiceManager import com.google.gson.Gson import com.google.gson.reflect.TypeToken @@ -19,6 +20,7 @@ private val gson by lazy { Gson() } val vehicleList = MutableLiveData() + val routeResult = MutableLiveData() fun getVehicles() = launch({ val response = RetrofitServiceManager.getVehicles() @@ -33,4 +35,18 @@ }, { it.printStackTrace() }) + + fun getVehicleRoute(id: String) = launch({ + val response = RetrofitServiceManager.getVehicleRoute(id) + val responseCode = response.separateResponseCode() + if (responseCode == 200) { + routeResult.value = gson.fromJson( + response, object : TypeToken() {}.type + ) + } else { + response.toErrorMessage().show(BaseApplication.get()) + } + }, { + it.printStackTrace() + }) } \ No newline at end of file