|
@@ -23,7 +23,7 @@ import java.util.Map;
|
|
|
public class TransformEntity {
|
|
|
|
|
|
|
|
|
- * 普适性 - 心跳包记录
|
|
|
+ * 普适型 - 心跳包记录
|
|
|
*/
|
|
|
public static UbiInfoRecord tsf2UbiInfoRecord(String openNum, MqttDTO dto) {
|
|
|
UbiInfoRecord result = new UbiInfoRecord();
|
|
@@ -36,10 +36,12 @@ public class TransformEntity {
|
|
|
result.setLon(dto.getDouble("lon"));
|
|
|
result.setVersion(dto.getString("version"));
|
|
|
result.setUploadTime(dto.getDate("timee"));
|
|
|
-
|
|
|
- double[] gcj = CoordTransformUtil.wgs84toGcj02(result.getLon(), result.getLat());
|
|
|
- result.setLonGcj(gcj[0]);
|
|
|
- result.setLatGcj(gcj[1]);
|
|
|
+ if (result.getLat() != null && result.getLon() != null) {
|
|
|
+
|
|
|
+ double[] gcj = CoordTransformUtil.wgs84toGcj02(result.getLon(), result.getLat());
|
|
|
+ result.setLonGcj(gcj[0]);
|
|
|
+ result.setLatGcj(gcj[1]);
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -104,12 +106,14 @@ public class TransformEntity {
|
|
|
result.setMode(dto.getInt("mode"));
|
|
|
result.setLon(lon);
|
|
|
result.setLat(lat);
|
|
|
-
|
|
|
- double[] gcj = CoordTransformUtil.wgs84toGcj02(lon, lat);
|
|
|
- result.setLonGcj(gcj[0]);
|
|
|
- result.setLatGcj(gcj[1]);
|
|
|
-
|
|
|
- result.setSite(GaoDeApiUtil.regeo(lon.toString(), lat.toString()));
|
|
|
+ if (lon != null && lat != null) {
|
|
|
+
|
|
|
+ double[] gcj = CoordTransformUtil.wgs84toGcj02(lon, lat);
|
|
|
+ result.setLonGcj(gcj[0]);
|
|
|
+ result.setLatGcj(gcj[1]);
|
|
|
+
|
|
|
+ result.setSite(GaoDeApiUtil.regeo(result.getLonGcj().toString(), result.getLatGcj().toString()));
|
|
|
+ }
|
|
|
result.setUpdateTime(LocalDateTime.now());
|
|
|
return result;
|
|
|
}
|