diff --git a/modules/mogo-tanlu/build.gradle b/modules/mogo-tanlu/build.gradle index 64d7d15..24aa1b5 100644 --- a/modules/mogo-tanlu/build.gradle +++ b/modules/mogo-tanlu/build.gradle @@ -40,4 +40,7 @@ dependencies { implementation rootProject.ext.dependencies.retrofitconvertergson implementation rootProject.ext.dependencies.gson implementation rootProject.ext.dependencies.rxjava + + implementation 'com.elegant.spi:api:1.0.9' + annotationProcessor 'com.elegant.spi:compiler:1.0.3' } \ No newline at end of file diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/TestActivity.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/TestActivity.java new file mode 100644 index 0000000..8b8d006 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/TestActivity.java @@ -0,0 +1,67 @@ +package com.mogo.tanlu; + +import android.os.Bundle; +import android.os.PersistableBundle; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import com.elegant.spi.AbstractDelegateManager; +import com.mogo.tanlu.api.ILoadUpload; +import com.mogo.tanlu.api.ITanluUpload; +import com.mogo.tanlu.bean.InformationBody; +import com.mogo.tanlu.bean.UploadResult; + +/** + * @author lixiaopeng + * @description 纯测试,没有注册类 + * @since 2021/1/20 + */ +public class TestActivity extends AppCompatActivity { + +// private TanluDelegateManager testDelegateManager; + private UploadDelegateManager uploadDelegateManager; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) { + super.onCreate(savedInstanceState, persistentState); + +// testDelegateManager = new TanluDelegateManager(); + uploadDelegateManager = new UploadDelegateManager(); + } + + + //如何回调回去成功和失败, + //如何更加简化使用api + //是不是意味着使用方也需要添加spi + public class UploadDelegateManager extends AbstractDelegateManager { + public UploadDelegateManager() { + //加载实现了spi接口的自定义服务 + loadDelegates(TestActivity.this, ILoadUpload.class, new DelegateListener() { + @Override + public void onDelegate(String unit, ILoadUpload p) { + //加载成功,调用各个服务自定义show方法 TODO + p.loadUpload("F803EB2046PZD00228", new InformationBody()); + } + }); + } + } + + + //实现AbstractDelegateManager +// public class TanluDelegateManager extends AbstractDelegateManager { +// public TanluDelegateManager() { +// //加载实现了spi接口的自定义服务 +// loadDelegates(TestActivity.this, ITanluUpload.class, new DelegateListener() { +// @Override +// public void onDelegate(String unit, ITanluUpload p) { +// //加载成功,调用各个服务自定义show方法 +// p.onFailure(0); +// p.onSuccess(new UploadResult()); +// } +// }); +// } +// } + + +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/api/ILoadUpload.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/api/ILoadUpload.java new file mode 100644 index 0000000..1d40744 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/api/ILoadUpload.java @@ -0,0 +1,13 @@ +package com.mogo.tanlu.api; + + +import com.mogo.tanlu.bean.InformationBody; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public interface ILoadUpload { + void loadUpload(String sn, InformationBody informationBody); +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/api/ITanluUpload.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/api/ITanluUpload.java new file mode 100644 index 0000000..9ced506 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/api/ITanluUpload.java @@ -0,0 +1,13 @@ +package com.mogo.tanlu.api; + +import com.mogo.tanlu.bean.UploadResult; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public interface ITanluUpload { + void onSuccess(UploadResult result); + void onFailure(int code); +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/InformationBody.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/InformationBody.java new file mode 100644 index 0000000..5d9b028 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/InformationBody.java @@ -0,0 +1,248 @@ +package com.mogo.tanlu.bean; + +import java.io.Serializable; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public class InformationBody implements Serializable { + private String data; + private String addr; + private String areaCode; + private String areaName; + private String cityCode; + private String cityName; + private long generateTime; + private double lat; + private double lon; + private String provinceName; + private String sn; + private String street; + private int type; + private int uid; + private int infoType; + private int infoTimeout; + private String trafficInfoType; // 上报情报类型 + private boolean isShare; // 是否分享给附近车机 + private float direction; + private String poiType; //类型分类 + private long mainInfoId; //事件id + private float speed; //车速 + private String fromType; //上报触发来源 + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public String getAddr() { + return addr; + } + + public void setAddr(String addr) { + this.addr = addr; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getCityCode() { + return cityCode; + } + + public void setCityCode(String cityCode) { + this.cityCode = cityCode; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public long getGenerateTime() { + return generateTime; + } + + public void setGenerateTime(long generateTime) { + this.generateTime = generateTime; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public String getProvinceName() { + return provinceName; + } + + public void setProvinceName(String provinceName) { + this.provinceName = provinceName; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getUid() { + return uid; + } + + public void setUid(int uid) { + this.uid = uid; + } + + public int getInfoType() { + return infoType; + } + + public void setInfoType(int infoType) { + this.infoType = infoType; + } + + public int getInfoTimeout() { + return infoTimeout; + } + + public void setInfoTimeout(int infoTimeout) { + this.infoTimeout = infoTimeout; + } + + public String getTrafficInfoType() { + return trafficInfoType; + } + + public void setTrafficInfoType(String trafficInfoType) { + this.trafficInfoType = trafficInfoType; + } + + public boolean isShare() { + return isShare; + } + + public void setShare(boolean share) { + isShare = share; + } + + public float getDirection() { + return direction; + } + + public void setDirection(float direction) { + this.direction = direction; + } + + public String getPoiType() { + return poiType; + } + + public void setPoiType(String poiType) { + this.poiType = poiType; + } + + public long getMainInfoId() { + return mainInfoId; + } + + public void setMainInfoId(long mainInfoId) { + this.mainInfoId = mainInfoId; + } + + public float getSpeed() { + return speed; + } + + public void setSpeed(float speed) { + this.speed = speed; + } + + public String getFromType() { + return fromType; + } + + public void setFromType(String fromType) { + this.fromType = fromType; + } + + + @Override + public String toString() { + return "InformationBody{" + + "data='" + data + '\'' + + ", addr='" + addr + '\'' + + ", areaCode='" + areaCode + '\'' + + ", areaName='" + areaName + '\'' + + ", cityCode='" + cityCode + '\'' + + ", cityName='" + cityName + '\'' + + ", generateTime=" + generateTime + + ", lat=" + lat + + ", lon=" + lon + + ", provinceName='" + provinceName + '\'' + + ", sn='" + sn + '\'' + + ", street='" + street + '\'' + + ", type=" + type + + ", uid=" + uid + + ", infoType=" + infoType + + ", infoTimeout=" + infoTimeout + + ", trafficInfoType='" + trafficInfoType + '\'' + + ", isShare=" + isShare + + ", direction=" + direction + + ", poiType='" + poiType + '\'' + + ", mainInfoId=" + mainInfoId + + ", speed=" + speed + + ", fromType='" + fromType + '\'' + + '}'; + } +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerExploreWay.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerExploreWay.java new file mode 100644 index 0000000..2e93938 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerExploreWay.java @@ -0,0 +1,238 @@ +package com.mogo.tanlu.bean; + +import android.text.TextUtils; + +import com.mogo.tanlu.bean.location.MarkerLocation; + +import java.io.Serializable; +import java.util.List; +import java.util.Objects; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public class MarkerExploreWay implements Serializable { + private String infoId; + private String type;//卡片类型, + + private String poiType; + private String sn; + private MarkerLocation location;//位置信息 + private int direction;//方位角度 + private boolean canLive;//是否可直播(1为可直播,0不可直播) + private int fileType;//是图片还是视频(1视频,0图片) + private String addr;//北京市朝阳区三里屯街道108号 + private long generateTime;//时间戳 + private String cityName;//:"城市名称", + private double distance;//距离 + private MarkerUserInfo userInfo;//用户信息 + private List items;//视频地址和图片地址 + //上报类型:1-用户上报,2-后台上报 3-三方上报 + private String uploadType; + + private boolean fabulous; + + // http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443 + // 1 需要用户判断是否拥堵 进行UGC问答 + private int infoCheckNode; + + public String getAddr() { + if (TextUtils.isEmpty(addr)) { + return "未知道路"; + } + return addr; + } + + public void setAddr(String addr) { + this.addr = addr; + } + + public boolean getCanLive() { + return canLive; + } + + public void setCanLive(boolean canLive) { + this.canLive = canLive; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public float getDirection() { + return direction; + } + + public void setDirection(int direction) { + this.direction = direction; + } + + public double getDistance() { + return distance; + } + + public void setDistance(double distance) { + this.distance = distance; + } + + public double getFileType() { + return fileType; + } + + public void setFileType(int fileType) { + this.fileType = fileType; + } + + public Long getGenerateTime() { + return generateTime; + } + + public void setGenerateTime(Long generateTime) { + this.generateTime = generateTime; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public MarkerLocation getLocation() { + return location; + } + + public void setLocation(MarkerLocation location) { + this.location = location; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public MarkerUserInfo getUserInfo() { + return userInfo; + } + + public void setUserInfo(MarkerUserInfo userInfo) { + this.userInfo = userInfo; + } + + public String getInfoId() { + return infoId; + } + + public int getInfoIdInt() { + try { + return Integer.parseInt(infoId); + } catch (NumberFormatException e) { + e.printStackTrace(); + return -1; + } + } + + public void setInfoId(String infoId) { + this.infoId = infoId; + } + + public String getPoiType() { + if (TextUtils.isEmpty(poiType)) { + return "10007"; //拥堵 + } + return poiType; + } + + public void setPoiType(String poiType) { + this.poiType = poiType; + } + + public String getUploadType() { + return uploadType; + } + + public void setUploadType(String uploadType) { + this.uploadType = uploadType; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + MarkerExploreWay that = (MarkerExploreWay) o; + return Objects.equals(infoId, that.infoId) && + Objects.equals(type, that.type) && + Objects.equals(poiType, that.poiType); + } + + @Override + public int hashCode() { + return Objects.hash(infoId, type, poiType); + } + + public boolean isCanLive() { + return canLive; + } + + public void setGenerateTime(long generateTime) { + this.generateTime = generateTime; + } + + public int getInfoCheckNode() { + return infoCheckNode; + } + + public void setInfoCheckNode(int infoCheckNode) { + this.infoCheckNode = infoCheckNode; + } + + public boolean isFabulous() { + return fabulous; + } + + public void setFabulous(boolean fabulous) { + this.fabulous = fabulous; + } + + @Override + public String toString() { + return "MarkerExploreWay{" + + "infoId='" + infoId + '\'' + + ", type='" + type + '\'' + + ", poiType='" + poiType + '\'' + + ", sn='" + sn + '\'' + + ", location=" + location + + ", direction=" + direction + + ", canLive=" + canLive + + ", fileType=" + fileType + + ", addr='" + addr + '\'' + + ", generateTime=" + generateTime + + ", cityName='" + cityName + '\'' + + ", distance=" + distance + + ", userInfo=" + userInfo + + ", items=" + items + + ", uploadType='" + uploadType + '\'' + + ", fabulous=" + fabulous + + ", infoCheckNode=" + infoCheckNode + + '}'; + } + +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerExploreWayItem.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerExploreWayItem.java new file mode 100644 index 0000000..510a3cf --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerExploreWayItem.java @@ -0,0 +1,65 @@ +package com.mogo.tanlu.bean; + +import android.text.TextUtils; + +import java.io.Serializable; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public class MarkerExploreWayItem implements Serializable { + private String thumbnail; + private String url; + private String content; + private double illegalCount; + + public String getThumbnail() { + if (TextUtils.isEmpty(thumbnail)) { + return ""; + } + return thumbnail; + } + + public void setThumbnail(String thumbnail) { + this.thumbnail = thumbnail; + } + + public String getUrl() { + if (TextUtils.isEmpty(url)) { + return ""; + } + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public double getIllegalCount() { + return illegalCount; + } + + public void setIllegalCount(double illegalCount) { + this.illegalCount = illegalCount; + } + + @Override + public String toString() { + return "MarkerExploreWayItem{" + + "thumbnail='" + thumbnail + '\'' + + ", url='" + url + '\'' + + ", content='" + content + '\'' + + ", illegalCount='" + illegalCount + '\'' + + '}'; + } +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerUserInfo.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerUserInfo.java new file mode 100644 index 0000000..60f1bb2 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/MarkerUserInfo.java @@ -0,0 +1,210 @@ +package com.mogo.tanlu.bean; + +import android.text.TextUtils; + +import java.io.Serializable; +import java.util.Calendar; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public class MarkerUserInfo implements Serializable { + private String sn; + private long userId; + private String userName;//用户昵称 + private String userHead;//用户头像 + private String gender;//gender": "男|女|无(也可以0|1|2根据实际库存返回即可) + private Integer age;// 年龄段,可以为空,与车聊聊一致 + + // TODO V2X临时字段,接口出好后进行修改 + private String lastActiveweekAvgscore;//末次活跃周驾驶行为平均得分 + private String safeLabel;//车辆安全标签 + private int safeLabelType;//1老司机 2安全驾驶 3危险驾驶 + + public void setAge(Integer age) { + this.age = age; + } + + public int getAgeNumber() { + if (age != null) { + return age; + } + return -1; + } + + public String getAge() { + try { + if (getAgeNumber() >= 0) { + + Calendar cal = Calendar.getInstance(); + int year = cal.get(Calendar.YEAR); + + //2020-30=1990 + double ageDiffer = year - getAgeNumber(); + String ageStr = "" + ageDiffer; + char[] ageChars = ageStr.toCharArray(); + + //1990 + char ageChar = ageChars[2]; + + String ageString = "未设置"; + + switch (ageChar) { + case '0': + ageString = "00后"; + break; + case '1': + ageString = "10后"; + break; + case '2': + ageString = "20后"; + break; + case '3': + ageString = "30后"; + break; + case '4': + ageString = "40后"; + break; + case '5': + ageString = "50后"; + break; + case '6': + ageString = "60后"; + break; + case '7': + ageString = "70后"; + break; + case '8': + ageString = "80后"; + break; + case '9': + ageString = "90后"; + break; + } + + return ageString; + } else { + return ""; + } + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + public int getGenderValue() { + if (!TextUtils.isEmpty(gender)) { + if ("男".equals(gender)) { + return 0; + } + return 1; + } else { + return 0; + } + } + + public String getGender() { + if (TextUtils.isEmpty(gender)) { + return "未设置"; + } + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public void setGender(int gender) { + if (gender == 0) { + this.gender = "男"; + } else { + this.gender = "女"; + } + } + + public String getSn() { + if (TextUtils.isEmpty(sn)) { + return ""; + } + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public String getUserHead() { + if (TextUtils.isEmpty(userHead)) { + return ""; + } + return userHead; + } + + public void setUserHead(String userHead) { + this.userHead = userHead; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getUserName() { + if (TextUtils.isEmpty(userName)) { + return "用户未设置昵称"; + } + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public void setUserId(long userId) { + this.userId = userId; + } + + public String getLastActiveweekAvgscore() { + return lastActiveweekAvgscore; + } + + public void setLastActiveweekAvgscore(String lastActiveweekAvgscore) { + this.lastActiveweekAvgscore = lastActiveweekAvgscore; + } + + public String getSafeLabel() { + return safeLabel; + } + + public void setSafeLabel(String safeLabel) { + this.safeLabel = safeLabel; + } + + public int getSafeLabelType() { + return safeLabelType; + } + + public void setSafeLabelType(int safeLabelType) { + this.safeLabelType = safeLabelType; + } + + @Override + public String toString() { + return "MarkerUserInfo{" + + "sn='" + sn + '\'' + + ", userId=" + userId + + ", userName='" + userName + '\'' + + ", userHead='" + userHead + '\'' + + ", gender='" + gender + '\'' + + ", age=" + age + + ", lastActiveweekAvgscore='" + lastActiveweekAvgscore + '\'' + + ", safeLabel='" + safeLabel + '\'' + + ", safeLabelType=" + safeLabelType + + '}'; + } +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/RoadInfoRequest.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/RoadInfoRequest.java new file mode 100644 index 0000000..185a3ac --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/RoadInfoRequest.java @@ -0,0 +1,58 @@ +package com.mogo.tanlu.bean; + +import com.mogo.tanlu.bean.location.Location; + +import java.util.ArrayList; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public class RoadInfoRequest { + + private Location location; + private ArrayList poiTypes; + private boolean onlyFocus; + private boolean onlySameCity; + + public RoadInfoRequest(Location location, ArrayList poiTypes, boolean onlyFocus, boolean onlySameCity) { + this.location = location; + this.poiTypes = poiTypes; + this.onlyFocus = onlyFocus; + this.onlySameCity = onlySameCity; + } + + public Location getLocation() { + return location; + } + + public void setLocation(Location location) { + this.location = location; + } + + public ArrayList getPoiTypes() { + return poiTypes; + } + + public void setPoiTypes(ArrayList poiTypes) { + this.poiTypes = poiTypes; + } + + public boolean isOnlyFocus() { + return onlyFocus; + } + + public void setOnlyFocus(boolean onlyFocus) { + this.onlyFocus = onlyFocus; + } + + public boolean isOnlySameCity() { + return onlySameCity; + } + + public void setOnlySameCity(boolean onlySameCity) { + this.onlySameCity = onlySameCity; + } + +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/RoadInfos.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/RoadInfos.java index 281559b..bbe3950 100644 --- a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/RoadInfos.java +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/RoadInfos.java @@ -9,13 +9,13 @@ import java.util.List; */ public class RoadInfos { - private List data; + private List data; - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } } diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/TanluMarkerExploreWay.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/TanluMarkerExploreWay.java deleted file mode 100644 index 8a904f0..0000000 --- a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/TanluMarkerExploreWay.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.mogo.tanlu.bean; - -import java.io.Serializable; - -/** - * @author lixiaopeng - * @description - * @since 2021/1/20 - */ -public class TanluMarkerExploreWay implements Serializable { - -} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/Location.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/Location.java new file mode 100644 index 0000000..e1a3084 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/Location.java @@ -0,0 +1,29 @@ +package com.mogo.tanlu.bean.location; + +import java.io.Serializable; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public class Location implements Serializable { + private double lat; + private double lon; + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/MarkerLocation.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/MarkerLocation.java new file mode 100644 index 0000000..428444b --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/MarkerLocation.java @@ -0,0 +1,64 @@ +package com.mogo.tanlu.bean.location; + + +import android.text.TextUtils; + +import java.io.Serializable; + +/** + * @description + * + * @author lixiaopeng + * @since 2021/1/20 + */ +public class MarkerLocation implements Serializable { + private double lat;//纬度 + private double lon;//经度 + private double angle;//车头角度,可以没有 + private String address;//具体的位置信息 + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public double getAngle() { + return angle; + } + + public void setAngle(double angle) { + this.angle = angle; + } + + public String getAddress() { + if (TextUtils.isEmpty(address)) { + return ""; + } + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + return "MarkerLocation{" + + "lat=" + lat + + ", lon=" + lon + + ", angle=" + angle + + ", address='" + address + '\'' + + '}'; + } +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/MogoLocation.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/MogoLocation.java new file mode 100644 index 0000000..7085274 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/bean/location/MogoLocation.java @@ -0,0 +1,379 @@ +package com.mogo.tanlu.bean.location; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +public class MogoLocation implements Cloneable, Parcelable { + private int locType = 0; + private double latitude = 0; + private double longitude = 0; + private double altitude = 0; + private long time = 0; + private float bearing = 0; + private float accuracy = 0; + private float speed = 0; + private String cityName = ""; + private String cityCode = ""; + private String provider = ""; + private String address = ""; + private String district = ""; + private String province = ""; + private String adCode = ""; + private String locationDetail = ""; + private String poiName = ""; + private String aoiName = ""; + private int errCode = 0; + private String errInfo = ""; + private String street = ""; + private String streetNum = ""; + private String description = ""; + private String buildingId = ""; + private String floor = ""; + private int gpsAccuracyStatus = 0; + private int satellite = 0; + + public float getBearing() { + return bearing; + } + + public void setBearing( float bearing ) { + this.bearing = bearing; + } + + public float getAccuracy() { + return accuracy; + } + + public void setAccuracy( float accuracy ) { + this.accuracy = accuracy; + } + + public String getProvider() { + return provider; + } + + public void setProvider( String provider ) { + this.provider = provider; + } + + public float getSpeed() { + return speed; + } + + public void setSpeed( float speed ) { + this.speed = speed; + } + + public String getLocationDetail() { + return locationDetail; + } + + public void setLocationDetail( String locationDetail ) { + this.locationDetail = locationDetail; + } + + public String getPoiName() { + return poiName; + } + + public void setPoiName( String poiName ) { + this.poiName = poiName; + } + + public String getAoiName() { + return aoiName; + } + + public void setAoiName( String aoiName ) { + this.aoiName = aoiName; + } + + public int getErrCode() { + return errCode; + } + + public void setErrCode( int errCode ) { + this.errCode = errCode; + } + + public String getErrInfo() { + return errInfo; + } + + public void setErrInfo( String errInfo ) { + this.errInfo = errInfo; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getStreetNum() { + return streetNum; + } + + public void setStreetNum( String streetNum ) { + this.streetNum = streetNum; + } + + public String getDescription() { + return description; + } + + public void setDescription( String description ) { + this.description = description; + } + + public String getBuildingId() { + return buildingId; + } + + public void setBuildingId( String buildingId ) { + this.buildingId = buildingId; + } + + public String getFloor() { + return floor; + } + + public void setFloor( String floor ) { + this.floor = floor; + } + + public int getGpsAccuracyStatus() { + return gpsAccuracyStatus; + } + + public void setGpsAccuracyStatus( int gpsAccuracyStatus ) { + this.gpsAccuracyStatus = gpsAccuracyStatus; + } + + public int getSatellite() { + return satellite; + } + + public void setSatellite( int satellite ) { + this.satellite = satellite; + } + + public MogoLocation() { + } + + @Override + public String toString() { + return "MogoLocation{" + + "locType=" + locType + + ", latitude=" + latitude + + ", longitude=" + longitude + + ", altitude=" + altitude + + ", time=" + time + + ", bearing=" + bearing + + ", accuracy=" + accuracy + + ", speed=" + speed + + ", cityName='" + cityName + '\'' + + ", cityCode='" + cityCode + '\'' + + ", provider='" + provider + '\'' + + ", address='" + address + '\'' + + ", district='" + district + '\'' + + ", province='" + province + '\'' + + ", adCode='" + adCode + '\'' + + ", locationDetail='" + locationDetail + '\'' + + ", poiName='" + poiName + '\'' + + ", aoiName='" + aoiName + '\'' + + ", errCode=" + errCode + + ", errInfo='" + errInfo + '\'' + + ", street='" + street + '\'' + + ", streetNum='" + streetNum + '\'' + + ", description='" + description + '\'' + + ", buildingId='" + buildingId + '\'' + + ", floor='" + floor + '\'' + + ", gpsAccuracyStatus=" + gpsAccuracyStatus + + ", satellite=" + satellite + + '}'; + } + + public double getAltitude() { + return altitude; + } + + public void setAltitude( double altitude ) { + this.altitude = altitude; + } + + public String getAddress() { + return address; + } + + public void setAddress( String address ) { + this.address = address; + } + + public String getDistrict() { + return district; + } + + public void setDistrict( String district ) { + this.district = district; + } + + public String getProvince() { + return province; + } + + public void setProvince( String province ) { + this.province = province; + } + + public String getAdCode() { + return adCode; + } + + public void setAdCode( String adCode ) { + this.adCode = adCode; + } + + public int getLocType() { + return locType; + } + + public void setLocType( int locType ) { + this.locType = locType; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude( double latitude ) { + this.latitude = latitude; + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude( double longitude ) { + this.longitude = longitude; + } + + public long getTime() { + return time; + } + + public void setTime( long time ) { + this.time = time; + } + + public String getCityCode() { + return cityCode; + } + + public void setCityCode( String cityCode ) { + this.cityCode = cityCode; + } + + public String getCityName() { + return cityName; + } + + public void setCityName( String cityName ) { + this.cityName = cityName; + } + + @Override + public MogoLocation clone() { + try { + return ( MogoLocation ) super.clone(); + } catch ( CloneNotSupportedException e ) { + e.printStackTrace(); + } + return this; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags ) { + dest.writeInt( this.locType ); + dest.writeDouble( this.latitude ); + dest.writeDouble( this.longitude ); + dest.writeDouble( this.altitude ); + dest.writeLong( this.time ); + dest.writeFloat( this.bearing ); + dest.writeFloat( this.accuracy ); + dest.writeFloat( this.speed ); + dest.writeString( this.cityName ); + dest.writeString( this.cityCode ); + dest.writeString( this.provider ); + dest.writeString( this.address ); + dest.writeString( this.district ); + dest.writeString( this.province ); + dest.writeString( this.adCode ); + dest.writeString( this.locationDetail ); + dest.writeString( this.poiName ); + dest.writeString( this.aoiName ); + dest.writeInt( this.errCode ); + dest.writeString( this.errInfo ); + dest.writeString( this.street ); + dest.writeString( this.streetNum ); + dest.writeString( this.description ); + dest.writeString( this.buildingId ); + dest.writeString( this.floor ); + dest.writeInt( this.gpsAccuracyStatus ); + dest.writeInt( this.satellite ); + } + + protected MogoLocation( Parcel in ) { + this.locType = in.readInt(); + this.latitude = in.readDouble(); + this.longitude = in.readDouble(); + this.altitude = in.readDouble(); + this.time = in.readLong(); + this.bearing = in.readFloat(); + this.accuracy = in.readFloat(); + this.speed = in.readFloat(); + this.cityName = in.readString(); + this.cityCode = in.readString(); + this.provider = in.readString(); + this.address = in.readString(); + this.district = in.readString(); + this.province = in.readString(); + this.adCode = in.readString(); + this.locationDetail = in.readString(); + this.poiName = in.readString(); + this.aoiName = in.readString(); + this.errCode = in.readInt(); + this.errInfo = in.readString(); + this.street = in.readString(); + this.streetNum = in.readString(); + this.description = in.readString(); + this.buildingId = in.readString(); + this.floor = in.readString(); + this.gpsAccuracyStatus = in.readInt(); + this.satellite = in.readInt(); + } + + public static final Parcelable.Creator< MogoLocation > CREATOR = new Parcelable.Creator< MogoLocation >() { + @Override + public MogoLocation createFromParcel( Parcel source ) { + return new MogoLocation( source ); + } + + @Override + public MogoLocation[] newArray( int size ) { + return new MogoLocation[size]; + } + }; +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/impl/LoadUploadImpl.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/impl/LoadUploadImpl.java new file mode 100644 index 0000000..f298ba0 --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/impl/LoadUploadImpl.java @@ -0,0 +1,22 @@ +package com.mogo.tanlu.impl; + +import android.util.Log; + +import com.elegant.spi.annotations.Service; +import com.mogo.tanlu.api.ILoadUpload; +import com.mogo.tanlu.bean.InformationBody; + +/** + * @author lixiaopeng + * @description 请求上报 + * @since 2021/1/20 + */ +@Service(value = LoadUploadImpl.class, unit = "tanlu") +public class LoadUploadImpl implements ILoadUpload { + @Override + public void loadUpload(String sn, InformationBody informationBody) { + //TODO + Log.d("liyz", "loadUpload sn = " + sn); + + } +} diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/impl/TanluUploadImpl.java b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/impl/TanluUploadImpl.java new file mode 100644 index 0000000..5b8c96d --- /dev/null +++ b/modules/mogo-tanlu/src/main/java/com/mogo/tanlu/impl/TanluUploadImpl.java @@ -0,0 +1,27 @@ +package com.mogo.tanlu.impl; + +import android.util.Log; + +import com.elegant.spi.annotations.Service; +import com.mogo.tanlu.api.ITanluUpload; +import com.mogo.tanlu.bean.UploadResult; + +/** + * @author lixiaopeng + * @description + * @since 2021/1/20 + */ +@Service(value = ITanluUpload.class, unit = "tanlu") +public class TanluUploadImpl implements ITanluUpload { + + @Override + public void onSuccess(UploadResult result) { + Log.d("liyz", "onSuccess ----->"); + } + + @Override + public void onFailure(int code) { + Log.e("liyz", "onFailure ----->"); + } + +}