|
@@ -208,7 +208,7 @@ public class MqttCallbackHandler {
|
|
|
private void uploadDeviceInfoLPHandler(String topic, MqttMsgDto msg) {
|
|
|
try {
|
|
|
String num = topic.split("IMEI")[1];
|
|
|
- setService.getDeviceLocation_LP(num);
|
|
|
+ //setService.getDeviceLocation_LP(num);
|
|
|
DeviceLp dbDevice = deviceLpService.getByNum(num);
|
|
|
if (dbDevice == null) {
|
|
|
log.warn("设备需要手动添加至数据库:" + num);
|
|
@@ -238,6 +238,18 @@ public class MqttCallbackHandler {
|
|
|
deviceLp.setAnglez(msg.getString("anglez"));
|
|
|
deviceLp.setTemp(msg.getString("temp"));
|
|
|
deviceLp.setUpdateTime(LocalDateTime.now());
|
|
|
+ //临时解决方案
|
|
|
+ if (msg.getString("lng")!=null){
|
|
|
+ deviceLp.setMode(msg.getInt("mode"));
|
|
|
+ deviceLp.setLon(msg.getString("lng"));
|
|
|
+ deviceLp.setLat(msg.getString("lat"));
|
|
|
+ //转换后的坐标
|
|
|
+ String[] gcj = CoordTransformUtil.wgs84toGcj02(deviceLp.getLon(), deviceLp.getLat());
|
|
|
+ deviceLp.setLonGcj(gcj[0]);
|
|
|
+ deviceLp.setLatGcj(gcj[1]);
|
|
|
+ // 逆地理位置解析
|
|
|
+ deviceLp.setSite(GaoDeApiUtil.regeo(deviceLp.getLonGcj(), deviceLp.getLatGcj()));
|
|
|
+ }
|
|
|
// 保存基本信息
|
|
|
deviceLpService.updateByNum(deviceLp, num);
|
|
|
} catch (Exception e) {
|