|
@@ -10,6 +10,7 @@ import com.zy.bms.entity.ubi.UbiInfoState;
|
|
|
import com.zy.bms.entity.ubi.UbiTcp;
|
|
|
import com.zy.bms.pojo.dto.MqttDTO;
|
|
|
import com.zy.bms.service.*;
|
|
|
+import com.zy.bms.service.lp.ILpInfoStateService;
|
|
|
import com.zy.bms.service.ubi.IUbiInfoRecordService;
|
|
|
import com.zy.bms.service.ubi.IUbiInfoStateService;
|
|
|
import com.zy.bms.service.ubi.IUbiNtripService;
|
|
@@ -51,6 +52,8 @@ public class MqttCallbackHandler {
|
|
|
private IUbiNtripService ntripSetService;
|
|
|
@Resource
|
|
|
private IUbiTcpService tcpSetService;
|
|
|
+ @Resource
|
|
|
+ private ILpInfoStateService lpInfoStateService;
|
|
|
|
|
|
/**
|
|
|
* 处理消息
|
|
@@ -159,4 +162,59 @@ public class MqttCallbackHandler {
|
|
|
tcpSetService.saveOrUpdateTcpSet(link2, openNum, IUbiTcpService.LINK_2);
|
|
|
tcpSetService.saveOrUpdateTcpSet(link3, openNum, IUbiTcpService.LINK_3);
|
|
|
}
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 路牌-基本信息上传
|
|
|
+// */
|
|
|
+// private void LP_deviceInfoHandler(String topic, MqttDTO mqttDTO) {
|
|
|
+// try {
|
|
|
+// String openNum = Constant.splitOpenNum(topic);
|
|
|
+// LpInfoState dbDevice = lpInfoStateService.getByOpenNum(openNum);
|
|
|
+// if (dbDevice == null) {
|
|
|
+// log.error("设备需要手动添加至数据库:" + openNum);
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// LpInfoState deviceLp = new LpInfoState();
|
|
|
+// Double wakeInt = mqttDTO.getDouble("sleept");
|
|
|
+// Integer thresh = mqttDTO.getInt("thresh");
|
|
|
+// //若数据库中没有设置唤醒时间和阈值则直接同步设备数据
|
|
|
+// if (dbDevice.getThresh() == null || dbDevice.getWakeInt() == null) {
|
|
|
+// deviceLp.setWakeInt(BigDecimal.valueOf(wakeInt));
|
|
|
+// deviceLp.setThresh(thresh);
|
|
|
+// } else {
|
|
|
+// //如果远程设备的(唤醒时间,阈值)与数据库的数据不一致,则发送消息更新设备的设置数据与数据库保持一致
|
|
|
+// if (!dbDevice.getWakeInt().equals(wakeInt) || !dbDevice.getThresh().equals(thresh)) {
|
|
|
+// setService.updateDevice_LP(num, dbDevice.getWakeInt(), dbDevice.getThresh());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// deviceLp.setDataType(msg.getString("datetype"));
|
|
|
+// deviceLp.setBattery(msg.getString("batterynum"));
|
|
|
+// deviceLp.setS4g(msg.getString("s4g"));
|
|
|
+// deviceLp.setX(msg.getString("x"));
|
|
|
+// deviceLp.setY(msg.getString("y"));
|
|
|
+// deviceLp.setZ(msg.getString("z"));
|
|
|
+// deviceLp.setAnglex(msg.getString("anglex"));
|
|
|
+// deviceLp.setAngley(msg.getString("angley"));
|
|
|
+// deviceLp.setAnglez(msg.getString("anglez"));
|
|
|
+// deviceLp.setTemp(msg.getString("temp"));
|
|
|
+// deviceLp.setUpdateTime(LocalDateTime.now());
|
|
|
+// //临时解决方案
|
|
|
+// if (msg.getString("lon") != null) {
|
|
|
+// deviceLp.setMode(msg.getInt("mode"));
|
|
|
+// deviceLp.setLon(msg.getString("lon"));
|
|
|
+// 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) {
|
|
|
+// log.error("路牌上传基本信息异常", e);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
}
|