+ * 如果{@link #serverTime}或{@link #receiveMsgTime}数据有异常,则使用{@link System#currentTimeMillis()}当做当前时间,作为容错 + * + * @return 基本相对服务端的时间戳为基准的时间 + */ + private long computeSendMsgTime() { + long sendMsgTime; + if (serverTime > 0 && receiveMsgTime > 0) { + sendMsgTime = serverTime + (SystemClock.elapsedRealtime() - receiveMsgTime); + } else { + sendMsgTime = System.currentTimeMillis(); + } + return sendMsgTime; + } } diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/entity/LocationResult.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/entity/LocationResult.java index f2fc85e..052bff0 100644 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/entity/LocationResult.java +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/entity/LocationResult.java @@ -4,7 +4,7 @@ package com.mogo.realtime.entity; import java.util.List; public -/** +/* * @author congtaowang * @since 2020/10/25 * diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/entity/WebSocketData.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/entity/WebSocketData.java new file mode 100644 index 0000000..e90a3f3 --- /dev/null +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/entity/WebSocketData.java @@ -0,0 +1,76 @@ +package com.mogo.realtime.entity; + +import java.io.Serializable; + +public class WebSocketData implements Serializable { + + private long seq; + + private int msgType; + + private String sn; + + private String data; + + private long utcTime; + + private long upUtcTime; + + private String cityCode; + + public long getSeq() { + return seq; + } + + public void setSeq(long seq) { + this.seq = seq; + } + + public int getMsgType() { + return msgType; + } + + public void setMsgType(int msgType) { + this.msgType = msgType; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public long getUtcTime() { + return utcTime; + } + + public void setUtcTime(long utcTime) { + this.utcTime = utcTime; + } + + public long getUpUtcTime() { + return upUtcTime; + } + + public void setUpUtcTime(long upUtcTime) { + this.upUtcTime = upUtcTime; + } + + public String getCityCode() { + return cityCode; + } + + public void setCityCode(String cityCode) { + this.cityCode = cityCode; + } +} diff --git a/settings.gradle b/settings.gradle index 364e7ed..278221d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,5 @@ include ':foudations:mogo-socket' -include ':modules:mogo-cloud.realtime' -include ':modules:cloud.realtime' +include ':modules:mogo-realtime' include ':modules:mogo-tanlu' include ':foudations:mogo-commons' include ':foudations:mogo-httpdns'