|
@@ -36,40 +36,34 @@ public class LpHandlers {
|
|
|
* 基本信息上传
|
|
|
*/
|
|
|
public void deviceInfoHandler(String openNum, MqttDTO mqttDTO) {
|
|
|
- try {
|
|
|
- LpInfoState local = lpInfoStateService.getByOpenNum(openNum);
|
|
|
-
|
|
|
- LpInfoRecord record = TransformEntity.tsf2LpInfoRecord(openNum, mqttDTO);
|
|
|
- lpInfoRecordService.save(record);
|
|
|
-
|
|
|
- LpInfoState remote = BeanUtil.cast(record, LpInfoState.class);
|
|
|
- remote.setUpdateTime(record.getUploadTime());
|
|
|
-
|
|
|
- if (local == null) {
|
|
|
- lpInfoStateService.save(remote);
|
|
|
- return;
|
|
|
- }
|
|
|
- setWakeAndThreshLp(openNum, local, remote);
|
|
|
-
|
|
|
- lpInfoStateService.update(remote, new QueryWrapper<LpInfoState>().eq("open_num", openNum));
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("路牌上传基本信息异常", e);
|
|
|
+
|
|
|
+ LpInfoState local = lpInfoStateService.getByOpenNum(openNum);
|
|
|
+
|
|
|
+ LpInfoRecord record = TransformEntity.tsf2LpInfoRecord(openNum, mqttDTO);
|
|
|
+
|
|
|
+ lpInfoRecordService.save(record);
|
|
|
+
|
|
|
+ LpInfoState remote = BeanUtil.cast(record, LpInfoState.class);
|
|
|
+ remote.setUpdateTime(record.getUploadTime());
|
|
|
+
|
|
|
+ if (local == null) {
|
|
|
+ lpInfoStateService.save(remote);
|
|
|
+ return;
|
|
|
}
|
|
|
+ setWakeAndThreshLp(openNum, local, remote);
|
|
|
+
|
|
|
+ updateLpInfoStateService(openNum, remote);
|
|
|
}
|
|
|
|
|
|
|
|
|
* 定位信息上传
|
|
|
*/
|
|
|
public void deviceLocationHandler(String openNum, MqttDTO mqttDTO) {
|
|
|
- try {
|
|
|
- LpInfoState device = TransformEntity.tsf2LpInfoState(openNum, mqttDTO);
|
|
|
-
|
|
|
- device.setUpdateLocationFlag(0);
|
|
|
-
|
|
|
- lpInfoStateService.update(device, new QueryWrapper<LpInfoState>().eq("open_num", openNum));
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("路牌上传位置信息异常", e);
|
|
|
- }
|
|
|
+ LpInfoState device = TransformEntity.tsf2LpInfoStateLocation(openNum, mqttDTO);
|
|
|
+
|
|
|
+ device.setUpdateLocationFlag(0);
|
|
|
+
|
|
|
+ updateLpInfoStateService(openNum, device);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -96,4 +90,13 @@ public class LpHandlers {
|
|
|
dto.setSetf((dto.getWakeInt() != null || dto.getThresh() != null) ? Constant.STATUS.TRUE : Constant.STATUS.FALSE);
|
|
|
postMqttMsgService.setWakeAndThreshLp(dto);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * 更新状态信息
|
|
|
+ */
|
|
|
+ private void updateLpInfoStateService(String openNum, LpInfoState lpInfoState) {
|
|
|
+
|
|
|
+ lpInfoState.setOpenNum(null);
|
|
|
+ lpInfoStateService.update(lpInfoState, new QueryWrapper<LpInfoState>().eq("open_num", openNum));
|
|
|
+ }
|
|
|
}
|