|
|
@ -577,18 +577,28 @@ public class DeviceMessageProcessor { |
|
|
detector.setOnlineStatus(OnlineStatusType.ONLINE.getType()); |
|
|
detector.setOnlineStatus(OnlineStatusType.ONLINE.getType()); |
|
|
|
|
|
|
|
|
String[] split = numbersString.split(","); |
|
|
String[] split = numbersString.split(","); |
|
|
if (split.length != 3) { |
|
|
|
|
|
log.error("数据格式错误:{}", payload); |
|
|
|
|
|
|
|
|
if (split.length < 3) { |
|
|
|
|
|
log.error("数据格式错误:输入字符串格式不正确:{}", payload); |
|
|
return detector; |
|
|
return detector; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int finalGpsType = 0; // 默认值设为 0 (GPS)
|
|
|
|
|
|
|
|
|
|
|
|
if (split.length >= 4) { |
|
|
|
|
|
finalGpsType = Integer.parseInt(split[3].trim()); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
int oldTypeValue = Integer.parseInt(split[2].trim()); |
|
|
|
|
|
finalGpsType = (oldTypeValue == 0) ? 0 : 2; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Map<String, Double> wgs84ToGcj02 = CoordinateTransferUtils.wgs84ToGcj02(Double.parseDouble(split[0]), Double.parseDouble(split[1])); |
|
|
Map<String, Double> wgs84ToGcj02 = CoordinateTransferUtils.wgs84ToGcj02(Double.parseDouble(split[0]), Double.parseDouble(split[1])); |
|
|
|
|
|
|
|
|
Double lon = wgs84ToGcj02.get("lon"); |
|
|
Double lon = wgs84ToGcj02.get("lon"); |
|
|
Double lat = wgs84ToGcj02.get("lat"); |
|
|
Double lat = wgs84ToGcj02.get("lat"); |
|
|
detector.setLongitude(lon); |
|
|
detector.setLongitude(lon); |
|
|
detector.setLatitude(lat); |
|
|
detector.setLatitude(lat); |
|
|
String type = split[2]; |
|
|
|
|
|
detector.setGpsType(Integer.parseInt(type)); |
|
|
|
|
|
|
|
|
detector.setGpsType(finalGpsType); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return detector; |
|
|
return detector; |
|
|
|