From 99a09049fcddd4e0ea9184340c45c11939ebb8da Mon Sep 17 00:00:00 2001 From: bxb Date: Fri, 10 Feb 2023 18:43:34 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E5=92=8C?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/och/sweeper/bean/BaseResponse.java | 31 ++ .../mogo/och/sweeper/bean/SubStartRequest.kt | 9 + .../och/sweeper/bean/SweeperMainTaskBean.kt | 14 + .../och/sweeper/bean/SweeperRoutesResult.java | 69 ---- .../och/sweeper/bean/SweeperSubTaskBean.kt | 18 ++ .../bean/SweeperSubTaskDetailBean.java | 301 ++++++++++++++++++ .../och/sweeper/bean/SweeperTaskBean.java | 162 ---------- .../com/mogo/och/sweeper/bean/TaskInfoBean.kt | 3 - .../callback/IRefreshSweeperTaskCallback.java | 18 -- .../sweeper/callback/ISweeperTaskCallback.kt | 37 +++ .../och/sweeper/constant/SubTaskTypeEnum.kt | 9 + .../och/sweeper/constant/TaskMenuTypeEnum.kt | 10 - .../och/sweeper/constant/TaskStatusEnum.kt | 12 + .../och/sweeper/net/ISweeperApiService.java | 90 +++++- .../sweeper/net/ISweeperServiceCallback.java | 15 - .../sweeper/net/SweeperServiceManager.java | 65 ---- .../och/sweeper/net/SweeperServiceManager.kt | 133 ++++++++ 17 files changed, 652 insertions(+), 344 deletions(-) create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/BaseResponse.java create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SubStartRequest.kt create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperMainTaskBean.kt delete mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperRoutesResult.java create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperSubTaskBean.kt create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperSubTaskDetailBean.java delete mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperTaskBean.java delete mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/TaskInfoBean.kt delete mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/callback/IRefreshSweeperTaskCallback.java create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/callback/ISweeperTaskCallback.kt create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/SubTaskTypeEnum.kt delete mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/TaskMenuTypeEnum.kt create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/TaskStatusEnum.kt delete mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/ISweeperServiceCallback.java delete mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/SweeperServiceManager.java create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/SweeperServiceManager.kt diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/BaseResponse.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/BaseResponse.java new file mode 100644 index 0000000000..d13c872662 --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/BaseResponse.java @@ -0,0 +1,31 @@ +package com.mogo.och.sweeper.bean; + +import com.mogo.eagle.core.data.BaseData; + +public class BaseResponse extends BaseData { + private T data; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } +} diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SubStartRequest.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SubStartRequest.kt new file mode 100644 index 0000000000..2caa0c7236 --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SubStartRequest.kt @@ -0,0 +1,9 @@ +package com.mogo.och.sweeper.bean + +import com.mogo.cloud.passport.MoGoAiCloudClientConfig + +data class SubStartRequest( + var carSn:String=MoGoAiCloudClientConfig.getInstance().sn, + var taskId:Int, + var startTime:Long + ) \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperMainTaskBean.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperMainTaskBean.kt new file mode 100644 index 0000000000..ccb548653a --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperMainTaskBean.kt @@ -0,0 +1,14 @@ +package com.mogo.och.sweeper.bean + +/** + * + * 清扫车任务信息 + * + * @author tongchenfei + */ +data class SweeperMainTaskBean( + var mainTaskId:Int = 0, + var mainTaskName: String? = null, + var subTaskTotal:Int = 0, + var mainTaskStartTime: Long = 0 + ) \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperRoutesResult.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperRoutesResult.java deleted file mode 100644 index cc1abd083e..0000000000 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperRoutesResult.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.mogo.och.sweeper.bean; - -import java.util.List; - -/** - * 网约车小巴路线接口返回接口数据封装 - * - * @author tongchenfei - */ -public class SweeperRoutesResult { - private List sites; - private int lineId; - private String name; - private int lineType; //线路类型,0:环形 - private String description; - private int status; - - //线路轨迹相关字段 - public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“” - public String csvFileMd5 = ""; //轨迹文件md5,默认“” - public String txtFileUrl = ""; //打点文件下载的cos url,默认“” - public String txtFileMd5 = ""; //轨迹文件md5,默认“” - public long contrailSaveTime; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖 - public String carModel = ""; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题 - public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url,默认“” - public String csvFileMd5DPQP = ""; //轨迹文件md5,默认“” - public String txtFileUrlDPQP = ""; //打点文件下载的cos url,默认“” - public String txtFileMd5DPQP = ""; //轨迹文件md5,默认“” - public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖 - - public int getLineId() { - return lineId; - } - - public String getName() { - return name; - } - - public List getSites() { - return sites; - } - - public void setSite(List site) { - this.sites = sites; - } - - @Override - public String toString() { - return "BusRoutesResult{" + - "sites=" + sites + - ", lineId=" + lineId + - ", name='" + name + '\'' + - ", lineType=" + lineType + - ", description='" + description + '\'' + - ", status=" + status + - ", csvFileUrl='" + csvFileUrl + '\'' + - ", csvFileMd5='" + csvFileMd5 + '\'' + - ", txtFileUrl='" + txtFileUrl + '\'' + - ", txtFileMd5='" + txtFileMd5 + '\'' + - ", contrailSaveTime=" + contrailSaveTime + - ", carModel='" + carModel + '\'' + - ", csvFileUrlDPQP='" + csvFileUrlDPQP + '\'' + - ", csvFileMd5DPQP='" + csvFileMd5DPQP + '\'' + - ", txtFileUrlDPQP='" + txtFileUrlDPQP + '\'' + - ", txtFileMd5DPQP='" + txtFileMd5DPQP + '\'' + - ", contrailSaveTimeDPQP=" + contrailSaveTimeDPQP + - '}'; - } -} diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperSubTaskBean.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperSubTaskBean.kt new file mode 100644 index 0000000000..e211fa0edd --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperSubTaskBean.kt @@ -0,0 +1,18 @@ +package com.mogo.och.sweeper.bean + +/** + * 子任务信息 + */ +data class SweeperSubTaskBean(var taskId:Int?, + var taskName:String?, + var taskStartTime:Long?, + var subList:MutableList?) +data class SubInfo( + var taskId: Int = 0, + var taskName: String?, + var mileage: Int = 0, + var taskStatus: Int,// 状态1未执行 2执行中 3结束 4跳过 + var taskType: Int,//1自动驾驶 2人工驾驶 + var timeSpent: Long = 0, + var sort: Int = 0, +) \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperSubTaskDetailBean.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperSubTaskDetailBean.java new file mode 100644 index 0000000000..04c203693b --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperSubTaskDetailBean.java @@ -0,0 +1,301 @@ +package com.mogo.och.sweeper.bean; + +public class SweeperSubTaskDetailBean { + private int id; //子任务id + private int lineId; //线路id + private String lineName;//线路名称 + private int sort; + private int status; + private String startSiteId; //子任务起点id + private String startSiteName; //子任务起点名称 + private double startSiteLon; //子任务起点高德经度 + private double startSiteLat; //子任务起点高德纬度 + private double startSiteWgs64Lon;//子任务起点高精经度 + private double startSiteWgs64Lat;//子任务起点高精纬度 + private String endSiteId;//子任务终点id + private String endSiteName;//子任务终点名称 + private double endSiteLon; //子任务终点高德经度 + private double endSiteLat;//子任务终点高德纬度 + private double endSiteWgs64Lon;//子任务终点高精经度 + private double endSiteWgs64Lat;//子任务终点高精纬度 + private String brand; //品牌 + private String carModel; //车辆型号 + private String csvFileUrl = ""; //轨迹文件csv文件url地址 + private String csvFileMd5 = ""; //轨迹文件csv md5 + private String csvFileName = "";//轨迹文件cvs名称 + private String txtFileUrl = ""; //轨迹文件txt url地址 + private String txtFileMd5 = ""; //轨迹文件txt md5 + private String txtFileName; //轨迹文件txt名称 + private long contrailSaveTime; + private String contrailFileType; //轨迹文件类型 + private String publishStatus;//发布状态 1发布 2未发布 3 发布中 + private String csvFileUrlDPQP = ""; //轨迹文件下载的cos url,默认“” + private String csvFileMd5DPQP = ""; //轨迹文件md5,默认“” + private String txtFileUrlDPQP = ""; //打点文件下载的cos url,默认“” + private String txtFileMd5DPQP = ""; //轨迹文件md5,默认“” + private long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖 + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getLineId() { + return lineId; + } + + public void setLineId(int lineId) { + this.lineId = lineId; + } + + public String getLineName() { + return lineName; + } + + public void setLineName(String lineName) { + this.lineName = lineName; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getStartSiteId() { + return startSiteId; + } + + public void setStartSiteId(String startSiteId) { + this.startSiteId = startSiteId; + } + + public String getStartSiteName() { + return startSiteName; + } + + public void setStartSiteName(String startSiteName) { + this.startSiteName = startSiteName; + } + + public double getStartSiteLon() { + return startSiteLon; + } + + public void setStartSiteLon(double startSiteLon) { + this.startSiteLon = startSiteLon; + } + + public double getStartSiteLat() { + return startSiteLat; + } + + public void setStartSiteLat(double startSiteLat) { + this.startSiteLat = startSiteLat; + } + + public double getStartSiteWgs64Lon() { + return startSiteWgs64Lon; + } + + public void setStartSiteWgs64Lon(double startSiteWgs64Lon) { + this.startSiteWgs64Lon = startSiteWgs64Lon; + } + + public double getStartSiteWgs64Lat() { + return startSiteWgs64Lat; + } + + public void setStartSiteWgs64Lat(double startSiteWgs64Lat) { + this.startSiteWgs64Lat = startSiteWgs64Lat; + } + + public String getEndSiteId() { + return endSiteId; + } + + public void setEndSiteId(String endSiteId) { + this.endSiteId = endSiteId; + } + + public String getEndSiteName() { + return endSiteName; + } + + public void setEndSiteName(String endSiteName) { + this.endSiteName = endSiteName; + } + + public double getEndSiteLon() { + return endSiteLon; + } + + public void setEndSiteLon(double endSiteLon) { + this.endSiteLon = endSiteLon; + } + + public double getEndSiteLat() { + return endSiteLat; + } + + public void setEndSiteLat(double endSiteLat) { + this.endSiteLat = endSiteLat; + } + + public double getEndSiteWgs64Lon() { + return endSiteWgs64Lon; + } + + public void setEndSiteWgs64Lon(double endSiteWgs64Lon) { + this.endSiteWgs64Lon = endSiteWgs64Lon; + } + + public double getEndSiteWgs64Lat() { + return endSiteWgs64Lat; + } + + public void setEndSiteWgs64Lat(double endSiteWgs64Lat) { + this.endSiteWgs64Lat = endSiteWgs64Lat; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getCarModel() { + return carModel; + } + + public void setCarModel(String carModel) { + this.carModel = carModel; + } + + public String getCsvFileUrl() { + return csvFileUrl; + } + + public void setCsvFileUrl(String csvFileUrl) { + this.csvFileUrl = csvFileUrl; + } + + public String getCsvFileMd5() { + return csvFileMd5; + } + + public void setCsvFileMd5(String csvFileMd5) { + this.csvFileMd5 = csvFileMd5; + } + + public String getCsvFileName() { + return csvFileName; + } + + public void setCsvFileName(String csvFileName) { + this.csvFileName = csvFileName; + } + + public String getTxtFileUrl() { + return txtFileUrl; + } + + public void setTxtFileUrl(String txtFileUrl) { + this.txtFileUrl = txtFileUrl; + } + + public String getTxtFileMd5() { + return txtFileMd5; + } + + public void setTxtFileMd5(String txtFileMd5) { + this.txtFileMd5 = txtFileMd5; + } + + public String getTxtFileName() { + return txtFileName; + } + + public void setTxtFileName(String txtFileName) { + this.txtFileName = txtFileName; + } + + public String getContrailFileType() { + return contrailFileType; + } + + public void setContrailFileType(String contrailFileType) { + this.contrailFileType = contrailFileType; + } + + public String getPublishStatus() { + return publishStatus; + } + + public void setPublishStatus(String publishStatus) { + this.publishStatus = publishStatus; + } + + public long getContrailSaveTime() { + return contrailSaveTime; + } + + public void setContrailSaveTime(long contrailSaveTime) { + this.contrailSaveTime = contrailSaveTime; + } + + public String getCsvFileUrlDPQP() { + return csvFileUrlDPQP; + } + + public void setCsvFileUrlDPQP(String csvFileUrlDPQP) { + this.csvFileUrlDPQP = csvFileUrlDPQP; + } + + public String getCsvFileMd5DPQP() { + return csvFileMd5DPQP; + } + + public void setCsvFileMd5DPQP(String csvFileMd5DPQP) { + this.csvFileMd5DPQP = csvFileMd5DPQP; + } + + public String getTxtFileUrlDPQP() { + return txtFileUrlDPQP; + } + + public void setTxtFileUrlDPQP(String txtFileUrlDPQP) { + this.txtFileUrlDPQP = txtFileUrlDPQP; + } + + public String getTxtFileMd5DPQP() { + return txtFileMd5DPQP; + } + + public void setTxtFileMd5DPQP(String txtFileMd5DPQP) { + this.txtFileMd5DPQP = txtFileMd5DPQP; + } + + public long getContrailSaveTimeDPQP() { + return contrailSaveTimeDPQP; + } + + public void setContrailSaveTimeDPQP(long contrailSaveTimeDPQP) { + this.contrailSaveTimeDPQP = contrailSaveTimeDPQP; + } +} diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperTaskBean.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperTaskBean.java deleted file mode 100644 index 43aebfc1db..0000000000 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/SweeperTaskBean.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.mogo.och.sweeper.bean; - -/** - * 单个网约车小巴车站信息 - * - * @author tongchenfei - */ -public class SweeperTaskBean { -// private int lineId; -// private int siteId; -// private String siteName; -// private String cityCode; -// private String areaCode; -// private String areaName; -// private double lat; -// private double lon; -// private String siteDesc; -// private int siteState; -// private int isCurrentSite;// @see OchBusConst 是否是当前站 1:是 2:下一站 0:普通站 -// private int siteColor; -// private String peoples; -// private int ifStop; // 是否需要停靠、1需要、0不需要 - - - private String name; - private String description; - private String cityCode; - private double lon; //高精坐标 - private double lat; //高精坐标 - private int businessType; //站点类型,9:taxi,10:bus - private double gcjLon; //高德 - private double gcjLat; //高德 - private int status; - private int siteId; - private int seq; - private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站 - private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠 - private boolean leaving; - - public double getGcjLon() { - return gcjLon; - } - - public double getGcjLat() { - return gcjLat; - } - - public void setName(String name) { - this.name = name; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setCityCode(String cityCode) { - this.cityCode = cityCode; - } - - public void setLon(double lon) { - this.lon = lon; - } - - public void setLat(double lat) { - this.lat = lat; - } - - public void setBusinessType(int businessType) { - this.businessType = businessType; - } - - public void setStatus(int status) { - this.status = status; - } - - public void setSiteId(int siteId) { - this.siteId = siteId; - } - - public void setSeq(int seq) { - this.seq = seq; - } - - public void setDrivingStatus(int drivingStatus) { - this.drivingStatus = drivingStatus; - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public String getCityCode() { - return cityCode; - } - - - public int getBusinessType() { - return businessType; - } - - public int getStatus() { - return status; - } - - public int getSiteId() { - return siteId; - } - - public int getSeq() { - return seq; - } - - public int getDrivingStatus() { - return drivingStatus; - } - - public double getLon() { - return lon; - } - - public double getLat() { - return lat; - } - - public void setIfStop(int ifStop) { - this.ifStop = ifStop; - } - - public int getIfStop() { - return ifStop; - } - - public void setLeaving(boolean leaving) { - this.leaving = leaving; - } - - public boolean isLeaving() { - return leaving; - } - - @Override - public String toString() { - return "BusStationBean{" + - "name='" + name + '\'' + - ", description='" + description + '\'' + - ", cityCode='" + cityCode + '\'' + - ", lon=" + lon + - ", lat=" + lat + - ", businessType=" + businessType + - ", status=" + status + - ", siteId=" + siteId + - ", seq=" + seq + - ", drivingStatus=" + drivingStatus + - ", ifStop=" + ifStop + - ", leaving=" + leaving + - '}'; - } -} diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/TaskInfoBean.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/TaskInfoBean.kt deleted file mode 100644 index 55a443224b..0000000000 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/bean/TaskInfoBean.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.mogo.och.sweeper.bean - -data class TaskInfoBean(var taskId: Int, var taskName: String, var taskType: Int) \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/callback/IRefreshSweeperTaskCallback.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/callback/IRefreshSweeperTaskCallback.java deleted file mode 100644 index d376980b1c..0000000000 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/callback/IRefreshSweeperTaskCallback.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mogo.och.sweeper.callback; - -import com.mogo.och.sweeper.bean.SweeperTaskBean; - -import java.util.List; - -/** - * @author: wangmingjun - * @date: 2021/10/22 - */ -public interface IRefreshSweeperTaskCallback { - - void updateSweeperTaskStatus(String lineName, List taskList, int currentTask,boolean isFinishedSubTask); - /** - * 结束清理一遍、选择任务后清理一遍 - */ - void clearSweeperTasksMarkers(); -} diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/callback/ISweeperTaskCallback.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/callback/ISweeperTaskCallback.kt new file mode 100644 index 0000000000..fb0976d5e8 --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/callback/ISweeperTaskCallback.kt @@ -0,0 +1,37 @@ +package com.mogo.och.sweeper.callback + +import com.mogo.och.sweeper.bean.SweeperMainTaskBean +import com.mogo.och.sweeper.bean.SweeperSubTaskBean +import com.mogo.och.sweeper.constant.TaskStatusEnum + +/** + * @author: wangmingjun + * @date: 2021/10/22 + */ +interface ISweeperTaskCallback { + /** + * 获取主任务列表 + */ + fun setMainTaskList(mainTaskBeanList: MutableList?) + + /** + * 获取子任务列表 + */ + fun setSubTaskBean(subTaskBean: SweeperSubTaskBean?) + + /** + * 更新子任务状态 + */ + fun updateSubTaskStatus(typeEnum: TaskStatusEnum, isLastSubTask: Boolean) + + /** + * 主任务重置 + */ + fun setMainTaskReset(isSuccess: Boolean) + + /** + * 空数据展示 + * @param type + */ + fun emptyDataUI(type: Int) +} \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/SubTaskTypeEnum.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/SubTaskTypeEnum.kt new file mode 100644 index 0000000000..9946b8b2ef --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/SubTaskTypeEnum.kt @@ -0,0 +1,9 @@ +package com.mogo.och.sweeper.constant + +/** + * 任务类型 + */ +enum class SubTaskTypeEnum(val code: Int) { + AUTOPILOT_SUBTYPE(1),//自动驾驶子任务 + MANUAL_DRIVING_SUBTYPE(2),//人工驾驶 +} \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/TaskMenuTypeEnum.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/TaskMenuTypeEnum.kt deleted file mode 100644 index 562a71002f..0000000000 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/TaskMenuTypeEnum.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.mogo.och.sweeper.constant - -/** - * 当前任务操作菜单 - */ -enum class TaskMenuTypeEnum(val code: Int) { - JUMP_OVER_TASK( 1),//跳过任务 - END_TASK( 2),//结束任务 - CANCEL_TASK( 3);//取消 -} \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/TaskStatusEnum.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/TaskStatusEnum.kt new file mode 100644 index 0000000000..e8663ac751 --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/TaskStatusEnum.kt @@ -0,0 +1,12 @@ +package com.mogo.och.sweeper.constant + +/** + * 当前任务操作菜单 + */ +enum class TaskStatusEnum(val code: Int) { + JUMP_OVER_SUBTASK( 1),//跳过子任务 + END_TASK( 2),//结束主任务 + CANCEL_TASK( 3),//取消 + START_SUBTASK(4),//开始子任务 + END_SUBTASK(4),//结束子任务 +} \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/ISweeperApiService.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/ISweeperApiService.java index 0425ae88e6..7101b93325 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/ISweeperApiService.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/ISweeperApiService.java @@ -1,19 +1,105 @@ package com.mogo.och.sweeper.net; +import com.mogo.och.sweeper.bean.BaseResponse; +import com.mogo.och.sweeper.bean.SubInfo; +import com.mogo.och.sweeper.bean.SubStartRequest; +import com.mogo.och.sweeper.bean.SweeperSubTaskBean; +import com.mogo.och.sweeper.bean.SweeperMainTaskBean; +import com.mogo.och.sweeper.bean.SweeperSubTaskDetailBean; -import com.mogo.eagle.core.data.BaseData; -import com.mogo.och.sweeper.bean.SweeperRoutePlanningUpdateReqBean; +import java.util.List; import io.reactivex.Observable; import retrofit2.http.Body; +import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.POST; +import retrofit2.http.Query; /** * 清扫车相关接口 */ public interface ISweeperApiService { + /** + * 获取当前正在执行的任务 + * @param appId + * @param ticket + * @param carSn + * @return + */ + @GET("/och-sweep/api/task/v1/currentTask") + Observable> getCurrentTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("carSn") String carSn); + /** + * 清扫车任务列表 + * @param appId + * @param ticket + * @param carSn + * @return + */ + @GET("/och-sweep/api/task/v1/mainTaskList") + Observable>> getMainTaskList(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("carSn") String carSn); + /** + * 清扫车子任务列表 + * @param appId + * @param ticket + * @param sn + * @param taskId + * @return + */ + @GET("/och-sweep/api/task/v1/subTaskList") + Observable>> getSubTaskList(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("carSn") String sn, @Query("taskId") int taskId); + /** + * 子任务详情 包括子任务轨迹信息 + * @param appId + * @param ticket + * @param carSn + * @return + */ + @GET("/och-sweep/api/task/v1/subTaskInfo") + Observable> getSubTaskDetail(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("carSn") String carSn ,@Query("taskId") int taskId); + + /** + * 子任务开始 + * @param appId + * @param ticket + * @param subStartRequest + * @return + */ + @Headers({"Content-type:application/json;charset=UTF-8"}) + @POST("/och-sweep/api/task/v1/subTaskStart") + Observable> subTaskStart(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SubStartRequest subStartRequest); + + /** + * 子任务结束 + * @param appId + * @param ticket + * @param subStartRequest + * @return + */ + @Headers({"Content-type:application/json;charset=UTF-8"}) + @POST("/och-sweep/api/task/v1/sutTaskEnd") + Observable> subTaskEnd(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SubStartRequest subStartRequest); + /** + * 子任务跳过 + * @param appId + * @param ticket + * @param subStartRequest + * @return + */ + @Headers({"Content-type:application/json;charset=UTF-8"}) + @POST("/och-sweep/api/task/v1/subTaskSkip") + Observable> subTaskSkip(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SubStartRequest subStartRequest); + + /** + * 主任务重置 + * @param appId + * @param ticket + * @param taskId + * @return + */ + @GET("/och-sweep/api/task/v1/mainTaskReset") + Observable> mainTaskReset(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("taskId") int taskId); } diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/ISweeperServiceCallback.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/ISweeperServiceCallback.java deleted file mode 100644 index 0a57b49d1e..0000000000 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/ISweeperServiceCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.och.sweeper.net; - -/** - * @author: wangmingjun - * @date: 2021/10/20 - */ -public interface ISweeperServiceCallback< T >{ - void onSuccess(T o); - - void onFail(String failMsg); - - default void onError() { - - } -} diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/SweeperServiceManager.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/SweeperServiceManager.java deleted file mode 100644 index 59cf2ece83..0000000000 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/SweeperServiceManager.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.mogo.och.sweeper.net; - -import android.content.Context; - -import com.mogo.eagle.core.data.BaseData; -import com.mogo.eagle.core.network.MoGoRetrofitFactory; -import com.mogo.eagle.core.network.RequestOptions; -import com.mogo.eagle.core.network.SubscribeImpl; -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; -import com.mogo.och.sweeper.constant.SweeperConst; - -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS; - -/** - * @author: wangmingjun - * @date: 2021/10/20 - */ -public class SweeperServiceManager { - - private static final String TAG = SweeperServiceManager.class.getSimpleName(); - - private final ISweeperApiService mService; - - private static final class SingletonHolder { - private static final SweeperServiceManager INSTANCE = new SweeperServiceManager(); - } - - public static SweeperServiceManager getInstance(){ - return SingletonHolder.INSTANCE; - } - - private SweeperServiceManager(){ - mService = MoGoRetrofitFactory.getInstance(SweeperConst.getBaseUrl()).create(ISweeperApiService.class); - } - private SubscribeImpl getSubscribeImpl(Context context, ISweeperServiceCallback callback, String apiName){ - return new SubscribeImpl(RequestOptions.create(context)){ - @Override - public void onSuccess(T o) { - super.onSuccess(o); - CallerLogger.INSTANCE.e(M_BUS + TAG,apiName + ": onSuccess() " + o.msg); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - CallerLogger.INSTANCE.e(M_BUS + TAG,apiName + ": onError() " +"msg="+ message+" code="+code); - if (callback != null) { - callback.onFail("msg="+ message+" code="+code); - } - } - - @Override - public void onError(Throwable e) { - super.onError(e); - CallerLogger.INSTANCE.e(M_BUS + TAG,apiName + ": onError() " +" e="+e.getMessage()); - if (callback != null) { - callback.onFail(e.getMessage()); - } - } - }; - } -} diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/SweeperServiceManager.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/SweeperServiceManager.kt new file mode 100644 index 0000000000..de52ae2af0 --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/net/SweeperServiceManager.kt @@ -0,0 +1,133 @@ +package com.mogo.och.sweeper.net + +import android.content.Context +import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.network.MoGoRetrofitFactory +import com.mogo.och.common.module.biz.network.OchCommonServiceCallback +import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl +import com.mogo.och.common.module.biz.network.interceptor.transformTry +import com.mogo.och.sweeper.bean.* +import com.mogo.och.sweeper.constant.SweeperConst.Companion.getBaseUrl + +object SweeperServiceManager { + private val mService: ISweeperApiService = MoGoRetrofitFactory.getInstance(getBaseUrl()).create( + ISweeperApiService::class.java + ) + + /** + * 获取当前正在执行的任务 + */ + @JvmStatic + fun getCurrentTask(context: Context, callback: OchCommonServiceCallback>?) { + mService.getCurrentTask( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + MoGoAiCloudClientConfig.getInstance().token, + MoGoAiCloudClientConfig.getInstance().sn + ) + .transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "getCurrentTask")) + } + + /** + * 获取主任务列表 + */ + @JvmStatic + fun getMainTaskList(context: Context, callback: OchCommonServiceCallback>>?) { + mService.getMainTaskList( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + MoGoAiCloudClientConfig.getInstance().token, + MoGoAiCloudClientConfig.getInstance().sn + ) + .transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "getMainTaskList")) + } + + /** + * 获取子任务列表 + */ + @JvmStatic + fun getSubTaskList(taskId: Int, context: Context, callback: OchCommonServiceCallback>>?) { + mService.getSubTaskList( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + MoGoAiCloudClientConfig.getInstance().token, + MoGoAiCloudClientConfig.getInstance().sn, + taskId + ) + .transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "getSubTaskList")) + } + + /** + * 获取子任务详情包括轨迹文件信息 + */ + @JvmStatic + fun getSubTaskDetail(subTaskId: Int, context: Context, callback: OchCommonServiceCallback>?) { + mService.getSubTaskDetail( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + MoGoAiCloudClientConfig.getInstance().token, + MoGoAiCloudClientConfig.getInstance().sn, + subTaskId + ) + .transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "getSubTaskList")) + } + + /** + * 子任务开始上报 + */ + @JvmStatic + fun subTaskStart(subTaskId: Int,context: Context, callback: OchCommonServiceCallback>?) { + val subStartRequest = SubStartRequest(MoGoAiCloudClientConfig.getInstance().sn, subTaskId, System.currentTimeMillis()) + mService.subTaskStart( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + MoGoAiCloudClientConfig.getInstance().token, + subStartRequest + ) + .transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "subTaskStart")) + } + + /** + * 子任务结束上报 + */ + @JvmStatic + fun subTaskEnd(subTaskId: Int,context: Context, callback: OchCommonServiceCallback>?) { + val subStartRequest = SubStartRequest(MoGoAiCloudClientConfig.getInstance().sn, subTaskId, System.currentTimeMillis()) + mService.subTaskEnd( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + MoGoAiCloudClientConfig.getInstance().token, + subStartRequest + ) + .transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "subTaskEnd")) + } + + /** + * 子任务跳过上报 + */ + @JvmStatic + fun subTaskSkip(subTaskId: Int,context: Context, callback: OchCommonServiceCallback>?) { + val subStartRequest = SubStartRequest(MoGoAiCloudClientConfig.getInstance().sn, subTaskId, System.currentTimeMillis()) + mService.subTaskSkip( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + MoGoAiCloudClientConfig.getInstance().token, + subStartRequest + ) + .transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "subTaskSkip")) + } + + /** + * 主任务重置 + */ + @JvmStatic + fun mainTaskReset(taskId: Int,context: Context, callback: OchCommonServiceCallback>?) { + mService.mainTaskReset( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + MoGoAiCloudClientConfig.getInstance().token, + taskId + ) + .transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "mainTaskReset")) + } +} \ No newline at end of file