Merge branch 'dev_robotaxi-d_240807_6.6.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_240807_6.6.0
This commit is contained in:
@@ -58,6 +58,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation rootProject.ext.dependencies.rxjava
|
implementation rootProject.ext.dependencies.rxjava
|
||||||
implementation rootProject.ext.dependencies.rxandroid
|
implementation rootProject.ext.dependencies.rxandroid
|
||||||
|
implementation rootProject.ext.dependencies.roomRxjava
|
||||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||||
kapt rootProject.ext.dependencies.recyclerviewadapterhelper
|
kapt rootProject.ext.dependencies.recyclerviewadapterhelper
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
package com.mogo.och.weaknet.bean;
|
package com.mogo.och.weaknet.bean;
|
||||||
|
|
||||||
import com.mogo.eagle.core.data.BaseData;
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||||
|
import com.mogo.och.weaknet.database.bean.LineDataBean;
|
||||||
|
import com.mogo.och.weaknet.database.bean.TaskDataBean;
|
||||||
|
import com.mogo.och.weaknet.database.repository.TaskRepository;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,8 +19,24 @@ public class BusQueryLineTaskResponse extends BaseData {
|
|||||||
|
|
||||||
public List<Result> data;
|
public List<Result> data;
|
||||||
|
|
||||||
|
public static void save2Db(@NotNull BusQueryLineTaskResponse data,long lineId) {
|
||||||
|
List<TaskDataBean> save2Db = new ArrayList<>();
|
||||||
|
TaskDataBean temp = null;
|
||||||
|
for (Result datum : data.data) {
|
||||||
|
temp = new TaskDataBean();
|
||||||
|
temp.setLineId((long)lineId);
|
||||||
|
temp.setTaskId((long)datum.id);
|
||||||
|
temp.setTaskDate(DateTimeUtil.getCurrentDateZero());
|
||||||
|
temp.setTaskStartTime(datum.taskStartTime);
|
||||||
|
temp.setTaskgetTime(DateTimeUtil.getCurrentTimeStamp());
|
||||||
|
temp.setStatus(TaskDataBean.unUse);
|
||||||
|
save2Db.add(temp);
|
||||||
|
}
|
||||||
|
TaskRepository.INSTANCE.addOrUpdate(save2Db,(long)lineId);
|
||||||
|
}
|
||||||
|
|
||||||
public static class Result {
|
public static class Result {
|
||||||
public int id;
|
public long id;
|
||||||
public long taskStartTime;
|
public long taskStartTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
package com.mogo.och.weaknet.bean;
|
package com.mogo.och.weaknet.bean;
|
||||||
|
|
||||||
import com.mogo.eagle.core.data.BaseData;
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.weaknet.database.bean.LineDataBean;
|
||||||
|
import com.mogo.och.weaknet.database.repository.LineRepository;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,9 +16,21 @@ import java.util.List;
|
|||||||
public class BusQueryLinesResponse extends BaseData {
|
public class BusQueryLinesResponse extends BaseData {
|
||||||
public List<Result> data;
|
public List<Result> data;
|
||||||
|
|
||||||
|
public static void save2Db(@NotNull BusQueryLinesResponse data) {
|
||||||
|
List<LineDataBean> save2Db = new ArrayList<>();
|
||||||
|
LineDataBean temp = null;
|
||||||
|
for (Result datum : data.data) {
|
||||||
|
temp = new LineDataBean();
|
||||||
|
temp.setLineId((long)datum.lineId);
|
||||||
|
temp.setLineName(datum.name);
|
||||||
|
save2Db.add(temp);
|
||||||
|
}
|
||||||
|
LineRepository.INSTANCE.checkAndUpdate(save2Db);
|
||||||
|
}
|
||||||
|
|
||||||
public static class Result {
|
public static class Result {
|
||||||
|
|
||||||
public int lineId;//线路id
|
public long lineId;//线路id
|
||||||
public String name;//线路名字
|
public String name;//线路名字
|
||||||
public int choose; // 1:绑定 2:未被绑定
|
public int choose; // 1:绑定 2:未被绑定
|
||||||
public String startSiteName;//始发站名称
|
public String startSiteName;//始发站名称
|
||||||
@@ -24,4 +41,6 @@ public class BusQueryLinesResponse extends BaseData {
|
|||||||
|
|
||||||
public List<BusQueryLineTaskResponse.Result> taskList;
|
public List<BusQueryLineTaskResponse.Result> taskList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import com.mogo.och.common.module.utils.DateTimeUtil;
|
|||||||
*/
|
*/
|
||||||
public class BusResetDrivingLineRequest {
|
public class BusResetDrivingLineRequest {
|
||||||
public String sn;
|
public String sn;
|
||||||
public int taskId; //切换到的线路id
|
public long taskId; //切换到的线路id
|
||||||
public long writeVersion; //更新时间戳
|
public long writeVersion; //更新时间戳
|
||||||
|
|
||||||
public BusResetDrivingLineRequest(int taskId) {
|
public BusResetDrivingLineRequest(long taskId) {
|
||||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||||
this.taskId = taskId;
|
this.taskId = taskId;
|
||||||
this.writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
this.writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package com.mogo.och.weaknet.callback;
|
|||||||
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse;
|
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse;
|
||||||
import com.mogo.och.weaknet.bean.BusQueryLinesResponse;
|
import com.mogo.och.weaknet.bean.BusQueryLinesResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: wangmingjun
|
* @author: wangmingjun
|
||||||
* @date: 2022/2/9
|
* @date: 2022/2/9
|
||||||
*/
|
*/
|
||||||
public interface IBusLinesCallback {
|
public interface IBusLinesCallback {
|
||||||
void onBusLinesChange(BusQueryLinesResponse lines);
|
void onBusLinesChange(List<BusQueryLinesResponse.Result> data);
|
||||||
void onChangeLineIdSuccess();
|
void onChangeLineIdSuccess();
|
||||||
void onBusLineTasks(BusQueryLineTaskResponse o, int position,boolean autoRefresh);
|
void onBusLineTasks(List<BusQueryLineTaskResponse.Result> o, int position,boolean autoRefresh);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class TaskDataBean(
|
|||||||
var lineId: Long? = null,
|
var lineId: Long? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务安排的时间
|
* 任务安排的日期
|
||||||
*/
|
*/
|
||||||
@ColumnInfo(name = "task_data", typeAffinity = ColumnInfo.INTEGER)
|
@ColumnInfo(name = "task_data", typeAffinity = ColumnInfo.INTEGER)
|
||||||
var taskDate: Long? = null,
|
var taskDate: Long? = null,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import androidx.room.OnConflictStrategy
|
|||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
import com.mogo.och.weaknet.database.bean.LineDataBean
|
import com.mogo.och.weaknet.database.bean.LineDataBean
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface LineDataDao {
|
interface LineDataDao {
|
||||||
@@ -22,6 +23,10 @@ interface LineDataDao {
|
|||||||
@Query("DELETE FROM ${LineDataBean.lineDataTable} WHERE line_get_time < :zeroTime")
|
@Query("DELETE FROM ${LineDataBean.lineDataTable} WHERE line_get_time < :zeroTime")
|
||||||
fun deleteWeltData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Int
|
fun deleteWeltData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Int
|
||||||
|
|
||||||
|
//查询当天插入的所有数据
|
||||||
|
@Query("SELECT * FROM ${LineDataBean.lineDataTable} WHERE line_get_time > :zeroTime")
|
||||||
|
fun loadDataRx(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Observable<List<LineDataBean>?>
|
||||||
|
|
||||||
//查询当天插入的所有数据
|
//查询当天插入的所有数据
|
||||||
@Query("SELECT * FROM ${LineDataBean.lineDataTable} WHERE line_get_time > :zeroTime")
|
@Query("SELECT * FROM ${LineDataBean.lineDataTable} WHERE line_get_time > :zeroTime")
|
||||||
fun loadData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): List<LineDataBean>?
|
fun loadData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): List<LineDataBean>?
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import androidx.room.OnConflictStrategy
|
|||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
import com.mogo.och.weaknet.database.bean.TaskDataBean
|
import com.mogo.och.weaknet.database.bean.TaskDataBean
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface TaskDataDao {
|
interface TaskDataDao {
|
||||||
@@ -31,7 +32,7 @@ interface TaskDataDao {
|
|||||||
fun queryRunningTastByLineId(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero()): List<TaskDataBean>?
|
fun queryRunningTastByLineId(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero()): List<TaskDataBean>?
|
||||||
|
|
||||||
@Query("SELECT * FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.unUse} and line_id = :lineId")
|
@Query("SELECT * FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.unUse} and line_id = :lineId")
|
||||||
fun queryUnuseTask(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero()): List<TaskDataBean>?
|
fun queryUnuseTask(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero()): Observable<List<TaskDataBean>?>
|
||||||
|
|
||||||
@Query("DELETE FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and line_id = :lineId")
|
@Query("DELETE FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and line_id = :lineId")
|
||||||
fun deleteByLineId(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero())
|
fun deleteByLineId(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero())
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.mogo.och.weaknet.database.repository
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||||
|
|
||||||
|
object DbThreadUtils {
|
||||||
|
fun runInIoThread(runable:Runnable){
|
||||||
|
if(ThreadUtils.isMainThread()){
|
||||||
|
ThreadUtils.getIoPool().submit(runable)
|
||||||
|
}else{
|
||||||
|
runable.run()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
|||||||
import com.mogo.och.weaknet.database.MyDataBase
|
import com.mogo.och.weaknet.database.MyDataBase
|
||||||
import com.mogo.och.weaknet.database.bean.LineDataBean
|
import com.mogo.och.weaknet.database.bean.LineDataBean
|
||||||
import com.mogo.och.weaknet.database.dao.LineDataDao
|
import com.mogo.och.weaknet.database.dao.LineDataDao
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import rx.Single
|
||||||
|
|
||||||
object LineRepository {
|
object LineRepository {
|
||||||
|
|
||||||
@@ -22,50 +24,56 @@ object LineRepository {
|
|||||||
/**
|
/**
|
||||||
* 读取可用线路
|
* 读取可用线路
|
||||||
*/
|
*/
|
||||||
fun queryCanUseLine(): List<LineDataBean>? {
|
fun queryCanUseLine(): Observable<List<LineDataBean>?>? {
|
||||||
return lineDao?.loadData()
|
return lineDao?.loadDataRx()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkAndUpdate(serverDatalist:List<LineDataBean>){
|
fun checkAndUpdate(serverDatalist:List<LineDataBean>){
|
||||||
// 校验数据个数
|
val runable = object :Runnable{
|
||||||
lineDao?.let { lineDao->
|
override fun run() {
|
||||||
val loadData = lineDao.loadData()
|
// 校验数据个数
|
||||||
if(loadData.isNullOrEmpty()){
|
lineDao?.let { lineDao->
|
||||||
lineDao.insert(*serverDatalist.toTypedArray())
|
val loadData = lineDao.loadData()
|
||||||
// TODO: Ui展示需要动态刷新UI去
|
if(loadData.isNullOrEmpty()){
|
||||||
return
|
lineDao.insert(*serverDatalist.toTypedArray())
|
||||||
}
|
// TODO: Ui展示需要动态刷新UI去
|
||||||
// 后台新增数据
|
return
|
||||||
val needAddDatas = serverDatalist-loadData
|
}
|
||||||
// 后台没有本地数据库有的未分配线路
|
// 后台新增数据
|
||||||
val needMinusDatas = loadData-serverDatalist
|
val needAddDatas = serverDatalist-loadData
|
||||||
|
// 后台没有本地数据库有的未分配线路
|
||||||
|
val needMinusDatas = loadData-serverDatalist
|
||||||
|
|
||||||
// TODO: Ui展示需要动态刷新UI去
|
// TODO: Ui展示需要动态刷新UI去
|
||||||
|
|
||||||
if (needAddDatas.isNotEmpty()) {
|
if (needAddDatas.isNotEmpty()) {
|
||||||
// 新增线路
|
// 新增线路
|
||||||
lineDao.insert(*needAddDatas.toTypedArray())
|
lineDao.insert(*needAddDatas.toTypedArray())
|
||||||
}
|
}
|
||||||
if (needMinusDatas.isNotEmpty()) {
|
if (needMinusDatas.isNotEmpty()) {
|
||||||
// 删除线路
|
// 删除线路
|
||||||
lineDao.delete(*needMinusDatas.toTypedArray())
|
lineDao.delete(*needMinusDatas.toTypedArray())
|
||||||
needMinusDatas.forEach { minusLine->
|
needMinusDatas.forEach { minusLine->
|
||||||
minusLine.lineId?.let { lineId->
|
minusLine.lineId?.let { lineId->
|
||||||
// 删除线路对应的站点
|
// 删除线路对应的站点
|
||||||
|
|
||||||
SiteRepository.deleteByLineId(lineId)
|
SiteRepository.deleteByLineId(lineId)
|
||||||
val runingTask = TaskRepository.queryRunningTastByLineId(lineId)
|
val runingTask = TaskRepository.queryRunningTastByLineId(lineId)
|
||||||
if(runingTask.isNullOrEmpty()){
|
if(runingTask.isNullOrEmpty()){
|
||||||
// 删除线路对应的自驾信息
|
// 删除线路对应的自驾信息
|
||||||
|
|
||||||
ContraiRepository.deleteByLineId(lineId)
|
ContraiRepository.deleteByLineId(lineId)
|
||||||
|
|
||||||
TaskRepository.deleteByLineId(lineId)
|
TaskRepository.deleteByLineId(lineId)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DbThreadUtils.runInIoThread(runable)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.mogo.och.weaknet.database.bean.LineDataBean
|
|||||||
import com.mogo.och.weaknet.database.bean.TaskDataBean
|
import com.mogo.och.weaknet.database.bean.TaskDataBean
|
||||||
import com.mogo.och.weaknet.database.dao.TaskDataDao
|
import com.mogo.och.weaknet.database.dao.TaskDataDao
|
||||||
import com.mogo.och.weaknet.database.exception.DataException
|
import com.mogo.och.weaknet.database.exception.DataException
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
object TaskRepository {
|
object TaskRepository {
|
||||||
|
|
||||||
@@ -19,41 +20,47 @@ object TaskRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun addOrUpdate(serverDateList: List<TaskDataBean>, lineId: Long?) {
|
fun addOrUpdate(serverDateList: List<TaskDataBean>, lineId: Long?) {
|
||||||
taskDataDao?.let { taskDataDao ->
|
val runable = object :Runnable {
|
||||||
val localTasks = taskDataDao.querySitesByLineId(lineId)
|
override fun run() {
|
||||||
if(localTasks==null){
|
taskDataDao?.let { taskDataDao ->
|
||||||
taskDataDao.insert(*serverDateList.toTypedArray())
|
val localTasks = taskDataDao.querySitesByLineId(lineId)
|
||||||
// TODO: Ui展示需要动态刷新UI去
|
if(localTasks==null){
|
||||||
return
|
taskDataDao.insert(*serverDateList.toTypedArray())
|
||||||
}
|
// TODO: Ui展示需要动态刷新UI去
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 后台新增数据
|
// 后台新增数据
|
||||||
val needAddDatas = serverDateList - localTasks
|
val needAddDatas = serverDateList - localTasks
|
||||||
// 后台没有本地数据库有的未分配线路
|
// 后台没有本地数据库有的未分配线路
|
||||||
val needMinusDatas = localTasks - serverDateList
|
val needMinusDatas = localTasks - serverDateList
|
||||||
|
|
||||||
// TODO: Ui展示需要动态刷新UI去
|
// TODO: Ui展示需要动态刷新UI去
|
||||||
|
|
||||||
if (needAddDatas.isNotEmpty()) {
|
if (needAddDatas.isNotEmpty()) {
|
||||||
// 新增任务
|
// 新增任务
|
||||||
taskDataDao.insert(*needAddDatas.toTypedArray())
|
taskDataDao.insert(*needAddDatas.toTypedArray())
|
||||||
}
|
}
|
||||||
if (needMinusDatas.isNotEmpty()) {
|
if (needMinusDatas.isNotEmpty()) {
|
||||||
// 删除任务
|
// 删除任务
|
||||||
taskDataDao.delete(*needMinusDatas.toTypedArray())
|
taskDataDao.delete(*needMinusDatas.toTypedArray())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DbThreadUtils.runInIoThread(runable)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取线路可用的任务
|
* 获取线路可用的任务
|
||||||
*/
|
*/
|
||||||
fun queryCanUserTask(lineId:Long):List<TaskDataBean>?{
|
fun queryCanUserTask(lineId:Long): Observable<List<TaskDataBean>?>? {
|
||||||
taskDataDao?.let { taskDataDao->
|
taskDataDao?.let { taskDataDao->
|
||||||
// 查询当天未使用的任务
|
// 查询当天未使用的任务
|
||||||
val unUseTaskS = taskDataDao.queryUnuseTask(lineId)
|
return taskDataDao.queryUnuseTask(lineId).map {
|
||||||
// 过滤调任务时间和当前时间相差10分钟的任务
|
it.filter { (System.currentTimeMillis()-it.taskStartTime!!)<10*60*1000 }
|
||||||
return unUseTaskS?.filter { (System.currentTimeMillis()-it.taskStartTime!!)<10*60*1000 }
|
}
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.mogo.och.weaknet.database.transform
|
||||||
|
|
||||||
|
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.common.module.network.interceptor.FRetryWithTime
|
||||||
|
import com.mogo.och.common.module.network.interceptor.OchCommonRetryException
|
||||||
|
import com.mogo.och.common.module.network.interceptor.RetryWithTime
|
||||||
|
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse
|
||||||
|
import com.mogo.och.weaknet.bean.BusQueryLinesResponse
|
||||||
|
import com.mogo.och.weaknet.database.bean.LineDataBean
|
||||||
|
import com.mogo.och.weaknet.database.bean.TaskDataBean
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.ObservableSource
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.functions.Function
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
|
fun <T,V> Observable<T>.transform4DataBase(transfor:Function<T, ObservableSource<V>>): Observable<V> {
|
||||||
|
return flatMap(transfor)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
}
|
||||||
|
|
||||||
|
class FRetryWithTime11 : Function<List<LineDataBean>?, ObservableSource<List<BusQueryLinesResponse.Result>>> {
|
||||||
|
override fun apply(baseData: List<LineDataBean>): ObservableSource<List<BusQueryLinesResponse.Result>> {
|
||||||
|
val result = mutableListOf<BusQueryLinesResponse.Result>()
|
||||||
|
var temp:BusQueryLinesResponse.Result? = null
|
||||||
|
baseData.forEach {
|
||||||
|
temp = BusQueryLinesResponse.Result()
|
||||||
|
temp?.lineId = it.lineId
|
||||||
|
temp?.name = it.lineName
|
||||||
|
result.add(temp!!)
|
||||||
|
}
|
||||||
|
return Observable.just(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TransformTask : Function<List<TaskDataBean>?, ObservableSource<List<BusQueryLineTaskResponse.Result>>> {
|
||||||
|
override fun apply(baseData: List<TaskDataBean>): ObservableSource<List<BusQueryLineTaskResponse.Result>> {
|
||||||
|
val result = mutableListOf<BusQueryLineTaskResponse.Result>()
|
||||||
|
var temp:BusQueryLineTaskResponse.Result? = null
|
||||||
|
baseData.forEach {
|
||||||
|
temp = BusQueryLineTaskResponse.Result()
|
||||||
|
temp?.id = it.taskId
|
||||||
|
temp?.taskStartTime = it.taskStartTime
|
||||||
|
result.add(temp!!)
|
||||||
|
}
|
||||||
|
return Observable.just(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,24 +5,36 @@ import android.content.Context
|
|||||||
import com.mogo.commons.AbsMogoApplication
|
import com.mogo.commons.AbsMogoApplication
|
||||||
import com.mogo.commons.storage.SharedPrefsMgr
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||||
import com.mogo.och.shuttle.weaknet.R
|
import com.mogo.och.shuttle.weaknet.R
|
||||||
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse
|
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse
|
||||||
import com.mogo.och.weaknet.bean.BusQueryLinesResponse
|
import com.mogo.och.weaknet.bean.BusQueryLinesResponse
|
||||||
import com.mogo.och.weaknet.bean.BusRoutesResponse
|
import com.mogo.och.weaknet.bean.BusRoutesResponse
|
||||||
import com.mogo.och.weaknet.bean.CarExecutableTaskResponse
|
import com.mogo.och.weaknet.bean.CarExecutableTaskResponse
|
||||||
import com.mogo.och.weaknet.callback.IBusLinesCallback
|
import com.mogo.och.weaknet.callback.IBusLinesCallback
|
||||||
|
import com.mogo.och.weaknet.database.bean.LineDataBean
|
||||||
import com.mogo.och.weaknet.database.repository.LineRepository
|
import com.mogo.och.weaknet.database.repository.LineRepository
|
||||||
|
import com.mogo.och.weaknet.database.repository.TaskRepository
|
||||||
|
import com.mogo.och.weaknet.database.transform.FRetryWithTime11
|
||||||
|
import com.mogo.och.weaknet.database.transform.TransformTask
|
||||||
|
import com.mogo.och.weaknet.database.transform.transform4DataBase
|
||||||
import com.mogo.och.weaknet.net.OrderServiceManager
|
import com.mogo.och.weaknet.net.OrderServiceManager
|
||||||
import com.mogo.och.weaknet.net.OrderServiceManager.queryBusLines
|
import com.mogo.och.weaknet.net.OrderServiceManager.queryBusLines
|
||||||
import com.mogo.och.weaknet.net.OrderServiceManager.queryBusTaskByLineId
|
import com.mogo.och.weaknet.net.OrderServiceManager.queryBusTaskByLineId
|
||||||
import com.mogo.och.weaknet.net.OrderServiceManager.switchLine
|
import com.mogo.och.weaknet.net.OrderServiceManager.switchLine
|
||||||
import com.mogo.och.weaknet.ui.BusSwitchLineActivity
|
import com.mogo.och.weaknet.ui.BusSwitchLineActivity
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.Observer
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: wangmingjun
|
* @author: wangmingjun
|
||||||
@@ -83,34 +95,60 @@ object BusLineModel {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun queryBusLines() {
|
fun queryBusLines() {
|
||||||
queryBusLines(mContext!!, object : OchCommonServiceCallback<BusQueryLinesResponse> {
|
|
||||||
override fun onSuccess(data: BusQueryLinesResponse) {
|
LineRepository.queryCanUseLine()
|
||||||
if (null == data && mBusLinesCallback != null) {
|
?.transform4DataBase(FRetryWithTime11())
|
||||||
mBusLinesCallback!!.onBusLinesChange(null)
|
?.subscribe(object : Observer<List<BusQueryLinesResponse.Result>> {
|
||||||
return
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
CallerLogger.d(TAG, "onSubscribe")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBusLinesCallback != null) {
|
override fun onError(e: Throwable) {
|
||||||
mBusLinesCallback!!.onBusLinesChange(data)
|
CallerLogger.d(TAG, "onError${e.printStackTrace()}")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError() {
|
override fun onComplete() {
|
||||||
if (!NetworkUtils.isConnected(mContext)) {
|
CallerLogger.d(TAG, "onComplete")
|
||||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
|
||||||
} else {
|
|
||||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFail(code: Int, failMsg: String) {
|
override fun onNext(data: List<BusQueryLinesResponse.Result>) {
|
||||||
if (!NetworkUtils.isConnected(mContext)) {
|
if (mBusLinesCallback != null) {
|
||||||
ToastUtils.showShort("网络异常,请稍后重试")
|
mBusLinesCallback!!.onBusLinesChange(data)
|
||||||
} else {
|
}
|
||||||
ToastUtils.showShort("查询所有绑定路线失败:$failMsg")
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// queryBusLines(mContext!!, object : OchCommonServiceCallback<BusQueryLinesResponse> {
|
||||||
|
// override fun onSuccess(data: BusQueryLinesResponse) {
|
||||||
|
// if (null == data && mBusLinesCallback != null) {
|
||||||
|
// mBusLinesCallback!!.onBusLinesChange(null)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (mBusLinesCallback != null) {
|
||||||
|
// mBusLinesCallback!!.onBusLinesChange(data)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// BusQueryLinesResponse.save2Db(data)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onError() {
|
||||||
|
// if (!NetworkUtils.isConnected(mContext)) {
|
||||||
|
// ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||||
|
// } else {
|
||||||
|
// ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onFail(code: Int, failMsg: String) {
|
||||||
|
// if (!NetworkUtils.isConnected(mContext)) {
|
||||||
|
// ToastUtils.showShort("网络异常,请稍后重试")
|
||||||
|
// } else {
|
||||||
|
// ToastUtils.showShort("查询所有绑定路线失败:$failMsg")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,44 +157,69 @@ object BusLineModel {
|
|||||||
* @param position 位置
|
* @param position 位置
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun queryBusLineTasksById(lineId: Int, position: Int, autoRefresh: Boolean) {
|
fun queryBusLineTasksById(lineId: Long, position: Int, autoRefresh: Boolean) {
|
||||||
queryBusTaskByLineId(
|
|
||||||
mContext!!,
|
|
||||||
lineId.toString(),
|
|
||||||
object : OchCommonServiceCallback<BusQueryLineTaskResponse> {
|
|
||||||
override fun onSuccess(data: BusQueryLineTaskResponse) {
|
|
||||||
if (null == data && mBusLinesCallback != null) {
|
|
||||||
mBusLinesCallback!!.onBusLineTasks(null, position, autoRefresh)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
TaskRepository.queryCanUserTask(lineId)
|
||||||
|
?.transform4DataBase(TransformTask())
|
||||||
|
?.subscribe(object : Observer<List<BusQueryLineTaskResponse.Result>> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
CallerLogger.d(TAG, "onSubscribe")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
CallerLogger.d(TAG, "onError${e.printStackTrace()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
CallerLogger.d(TAG, "onComplete")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(data: List<BusQueryLineTaskResponse.Result>) {
|
||||||
if (mBusLinesCallback != null) {
|
if (mBusLinesCallback != null) {
|
||||||
mBusLinesCallback!!.onBusLineTasks(data, position, autoRefresh)
|
mBusLinesCallback!!.onBusLineTasks(data, position, autoRefresh)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError() {
|
|
||||||
if (!NetworkUtils.isConnected(mContext)) {
|
|
||||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
|
||||||
} else {
|
|
||||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFail(code: Int, failMsg: String) {
|
|
||||||
if (!NetworkUtils.isConnected(mContext)) {
|
|
||||||
ToastUtils.showShort("网络异常,请稍后重试")
|
|
||||||
} else {
|
|
||||||
ToastUtils.showShort("查询所有绑定路线失败:$failMsg")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
// queryBusTaskByLineId(
|
||||||
|
// mContext!!,
|
||||||
|
// lineId.toString(),
|
||||||
|
// object : OchCommonServiceCallback<BusQueryLineTaskResponse> {
|
||||||
|
// override fun onSuccess(data: BusQueryLineTaskResponse) {
|
||||||
|
// if (null == data && mBusLinesCallback != null) {
|
||||||
|
// mBusLinesCallback!!.onBusLineTasks(null, position, autoRefresh)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (mBusLinesCallback != null) {
|
||||||
|
// mBusLinesCallback!!.onBusLineTasks(data, position, autoRefresh)
|
||||||
|
// }
|
||||||
|
// BusQueryLineTaskResponse.save2Db(data,lineId)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onError() {
|
||||||
|
// if (!NetworkUtils.isConnected(mContext)) {
|
||||||
|
// ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||||
|
// } else {
|
||||||
|
// ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onFail(code: Int, failMsg: String) {
|
||||||
|
// if (!NetworkUtils.isConnected(mContext)) {
|
||||||
|
// ToastUtils.showShort("网络异常,请稍后重试")
|
||||||
|
// } else {
|
||||||
|
// ToastUtils.showShort("查询所有绑定路线失败:$failMsg")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun commitSwitchLineId(taskId: Int, lineId: Int) {
|
fun commitSwitchLineId(taskId: Long, lineId: Long) {
|
||||||
switchLine(mContext!!, taskId, object : OchCommonServiceCallback<BusRoutesResponse> {
|
switchLine(mContext!!, taskId, object : OchCommonServiceCallback<BusRoutesResponse> {
|
||||||
override fun onSuccess(o: BusRoutesResponse) {
|
override fun onSuccess(o: BusRoutesResponse) {
|
||||||
SharedPrefsMgr.getInstance().putInt(BusSwitchLineActivity.LASTCOMMITLINEID, lineId)
|
SharedPrefsMgr.getInstance().putLong(BusSwitchLineActivity.LASTCOMMITLINEID, lineId)
|
||||||
if (mBusLinesCallback != null) {
|
if (mBusLinesCallback != null) {
|
||||||
mBusLinesCallback!!.onChangeLineIdSuccess()
|
mBusLinesCallback!!.onChangeLineIdSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import com.mogo.och.data.bean.BusStationBean;
|
|||||||
import com.mogo.och.data.bean.BusTransferData;
|
import com.mogo.och.data.bean.BusTransferData;
|
||||||
import com.mogo.och.data.manager.cache.CacheDataManager;
|
import com.mogo.och.data.manager.cache.CacheDataManager;
|
||||||
import com.mogo.och.weaknet.constant.BusConst;
|
import com.mogo.och.weaknet.constant.BusConst;
|
||||||
|
import com.mogo.och.weaknet.database.repository.SiteRepository;
|
||||||
import com.mogo.och.weaknet.net.OrderServiceManager;
|
import com.mogo.och.weaknet.net.OrderServiceManager;
|
||||||
import com.mogo.och.weaknet.util.BusSendTripInfoManager;
|
import com.mogo.och.weaknet.util.BusSendTripInfoManager;
|
||||||
import com.mogo.och.weaknet.util.ShuttleVoiceManager;
|
import com.mogo.och.weaknet.util.ShuttleVoiceManager;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ object OrderServiceManager {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun switchLine(
|
fun switchLine(
|
||||||
context: Context,
|
context: Context,
|
||||||
taskId: Int,
|
taskId: Long,
|
||||||
callback: OchCommonServiceCallback<BusRoutesResponse>?
|
callback: OchCommonServiceCallback<BusRoutesResponse>?
|
||||||
) {
|
) {
|
||||||
mService.switchLine(
|
mService.switchLine(
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.mogo.och.weaknet.model.BusLineModel;
|
|||||||
import com.mogo.och.weaknet.model.OrderModel;
|
import com.mogo.och.weaknet.model.OrderModel;
|
||||||
import com.mogo.och.weaknet.ui.BusSwitchLineView;
|
import com.mogo.och.weaknet.ui.BusSwitchLineView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
@@ -42,15 +43,10 @@ public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IB
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBusLinesChange(BusQueryLinesResponse lines) {
|
public void onBusLinesChange(List<BusQueryLinesResponse.Result> data) {
|
||||||
UiThreadHandler.post(new Runnable() {
|
if(mView!=null) {
|
||||||
@Override
|
mView.onBusLinesChange(data);
|
||||||
public void run() {
|
}
|
||||||
if(mView!=null) {
|
|
||||||
mView.onBusLinesChange(lines);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, UiThreadHandler.MODE.QUEUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,7 +66,7 @@ public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IB
|
|||||||
BusLineModel.queryBusLines();
|
BusLineModel.queryBusLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queryBusLineTasks(int lineId, int position,boolean close){
|
public void queryBusLineTasks(long lineId, int position,boolean close){
|
||||||
if(subscribe!=null&&!subscribe.isDisposed()){
|
if(subscribe!=null&&!subscribe.isDisposed()){
|
||||||
subscribe.dispose();
|
subscribe.dispose();
|
||||||
}
|
}
|
||||||
@@ -83,7 +79,7 @@ public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IB
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commitSwitchLineId(int taskId,int lineId){
|
public void commitSwitchLineId(long taskId,long lineId){
|
||||||
BusLineModel.commitSwitchLineId(taskId,lineId);
|
BusLineModel.commitSwitchLineId(taskId,lineId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +101,7 @@ public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IB
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBusLineTasks(BusQueryLineTaskResponse o, int position, boolean autoRefresh) {
|
public void onBusLineTasks(List<BusQueryLineTaskResponse.Result> o, int position, boolean autoRefresh) {
|
||||||
if(mView!=null) {
|
if(mView!=null) {
|
||||||
mView.onBusLineTasks(o,position,autoRefresh);
|
mView.onBusLineTasks(o,position,autoRefresh);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,16 +113,16 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
|||||||
* 查询返回绑定路线集合
|
* 查询返回绑定路线集合
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
override fun onBusLinesChange(data: BusQueryLinesResponse?) {
|
override fun onBusLinesChange(data: MutableList<BusQueryLinesResponse.Result>?) {
|
||||||
if (null == data) {
|
if (data.isNullOrEmpty()) {
|
||||||
showNoData(true)
|
showNoData(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val lastCommitLineid = SharedPrefsMgr.getInstance().getInt(LASTCOMMITLINEID, -1)
|
val lastCommitLineid = SharedPrefsMgr.getInstance().getLong(LASTCOMMITLINEID, -1)
|
||||||
if (data.data != null && data.data.size > 0) {
|
if (data.size > 0) {
|
||||||
showNoData(false)
|
showNoData(false)
|
||||||
mData.clear()
|
mData.clear()
|
||||||
mData.addAll(data.data)
|
mData.addAll(data)
|
||||||
mAdapter.notifyDataSetChanged()
|
mAdapter.notifyDataSetChanged()
|
||||||
if(lastCommitLineid>0){
|
if(lastCommitLineid>0){
|
||||||
mData.forEachIndexed { index, line ->
|
mData.forEachIndexed { index, line ->
|
||||||
@@ -146,7 +146,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
|||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBusLineTasks(lineTaskInfo: BusQueryLineTaskResponse?, position: Int, autoRefresh:Boolean) {
|
override fun onBusLineTasks(lineTaskInfo: List<BusQueryLineTaskResponse.Result>, position: Int, autoRefresh:Boolean) {
|
||||||
val result = mData[position]
|
val result = mData[position]
|
||||||
if (result.taskList == null) {
|
if (result.taskList == null) {
|
||||||
result.taskList = ArrayList()
|
result.taskList = ArrayList()
|
||||||
@@ -156,17 +156,16 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
|||||||
// 打开操作
|
// 打开操作
|
||||||
mAdapter.notifyItemChanged(position)
|
mAdapter.notifyItemChanged(position)
|
||||||
} else {
|
} else {
|
||||||
if (lineTaskInfo.data == null || lineTaskInfo.data.isEmpty()) {
|
if ( lineTaskInfo.isEmpty()) {
|
||||||
result.haveTask = true
|
result.haveTask = true
|
||||||
lineTaskInfo.data = ArrayList()
|
|
||||||
}
|
}
|
||||||
if (lineTaskInfo.data.size != result.taskList.size) { // 不相等有变动 重新赋值
|
if (lineTaskInfo.size != result.taskList.size) { // 不相等有变动 重新赋值
|
||||||
result.taskList.clear()
|
result.taskList.clear()
|
||||||
result.taskList.addAll(lineTaskInfo.data)
|
result.taskList.addAll(lineTaskInfo)
|
||||||
if(autoRefresh) {
|
if(autoRefresh) {
|
||||||
mAdapter.checkTaskId = -1
|
mAdapter.checkTaskId = -1
|
||||||
mAdapter.checkLineId = -1
|
mAdapter.checkLineId = -1
|
||||||
lineTaskInfo.data.forEach {
|
lineTaskInfo.forEach {
|
||||||
if (it.id == mAdapter.checkTaskId) {
|
if (it.id == mAdapter.checkTaskId) {
|
||||||
mAdapter.checkTaskId = it.id
|
mAdapter.checkTaskId = it.id
|
||||||
mAdapter.checkLineId = result.lineId
|
mAdapter.checkLineId = result.lineId
|
||||||
@@ -177,7 +176,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
|||||||
mAdapter.notifyItemChanged(position)
|
mAdapter.notifyItemChanged(position)
|
||||||
linearLayoutManager.stackFromEnd = (position==mData.size-1||position==mData.size-2)&&mData.size>6
|
linearLayoutManager.stackFromEnd = (position==mData.size-1||position==mData.size-2)&&mData.size>6
|
||||||
mLinesListView.smoothScrollToPosition(position)
|
mLinesListView.smoothScrollToPosition(position)
|
||||||
}else if(lineTaskInfo.data.isEmpty()){
|
}else if(lineTaskInfo.isEmpty()){
|
||||||
mAdapter.notifyItemChanged(position)
|
mAdapter.notifyItemChanged(position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +206,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
|||||||
}
|
}
|
||||||
//切换路线提交
|
//切换路线提交
|
||||||
if (v.id == R.id.switch_line_btn_commit) {
|
if (v.id == R.id.switch_line_btn_commit) {
|
||||||
if(mAdapter.checkLineId!=-1&&mAdapter.checkTaskId!=-1){
|
if(mAdapter.checkLineId!=-1L&&mAdapter.checkTaskId!=-1L){
|
||||||
mPresenter?.commitSwitchLineId(mAdapter.checkTaskId,mAdapter.checkLineId)
|
mPresenter?.commitSwitchLineId(mAdapter.checkTaskId,mAdapter.checkLineId)
|
||||||
}else{
|
}else{
|
||||||
ToastUtils.showLong("请选择任务")
|
ToastUtils.showLong("请选择任务")
|
||||||
|
|||||||
@@ -4,15 +4,17 @@ import com.mogo.commons.mvp.IView;
|
|||||||
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse;
|
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse;
|
||||||
import com.mogo.och.weaknet.bean.BusQueryLinesResponse;
|
import com.mogo.och.weaknet.bean.BusQueryLinesResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: wangmingjun
|
* @author: wangmingjun
|
||||||
* @date: 2022/2/10
|
* @date: 2022/2/10
|
||||||
*/
|
*/
|
||||||
public interface BusSwitchLineView extends IView {
|
public interface BusSwitchLineView extends IView {
|
||||||
|
|
||||||
void onBusLinesChange(BusQueryLinesResponse data);
|
void onBusLinesChange(List<BusQueryLinesResponse.Result> data);
|
||||||
void onChangeLineIdSuccess();
|
void onChangeLineIdSuccess();
|
||||||
|
|
||||||
void onBusLineTasks(BusQueryLineTaskResponse o, int position,boolean autoRefresh);
|
void onBusLineTasks(List<BusQueryLineTaskResponse.Result> o, int position,boolean autoRefresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ class SwitchLineAdapter(
|
|||||||
}
|
}
|
||||||
// RecyclerView设置点击事件
|
// RecyclerView设置点击事件
|
||||||
private var mItemClickListener: LineItemClickListener? = null
|
private var mItemClickListener: LineItemClickListener? = null
|
||||||
var checkLineId:Int = -1
|
var checkLineId:Long = -1
|
||||||
var checkTaskId:Int = -1
|
var checkTaskId:Long = -1
|
||||||
override fun onCreateViewHolder(
|
override fun onCreateViewHolder(
|
||||||
parent: ViewGroup,
|
parent: ViewGroup,
|
||||||
viewType: Int
|
viewType: Int
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import com.mogo.och.shuttle.weaknet.R
|
|||||||
*/
|
*/
|
||||||
class SwitchLineTaskAdapter(
|
class SwitchLineTaskAdapter(
|
||||||
private val mContext: Context,
|
private val mContext: Context,
|
||||||
private var checkTaskId:Int,
|
private var checkTaskId:Long,
|
||||||
private val mData: List<BusQueryLineTaskResponse.Result>?,
|
private val mData: List<BusQueryLineTaskResponse.Result>?,
|
||||||
private val mTaskItemClickListener: TaskItemClickListener?
|
private val mTaskItemClickListener: TaskItemClickListener?
|
||||||
) : RecyclerView.Adapter<SwitchLineTaskViewHolder>() {
|
) : RecyclerView.Adapter<SwitchLineTaskViewHolder>() {
|
||||||
|
|||||||
Reference in New Issue
Block a user