Commit 19848713 authored by caotao's avatar caotao

1.车辆里程异常结束问题处理。

parent 19f1338c
......@@ -67,7 +67,7 @@ public class JxiopCarIotListerServiceImpl {
// public static final ConcurrentHashMap<String, String> deviceLastInfo = new ConcurrentHashMap();
// @Async("equipAsyncExecutor")
public void processMessage(String topic, MqttMessage message) throws Exception {
public void processMessage(String topic, MqttMessage message){
logger.info("----收到物联消息::topic---------------" + topic);
logger.info("----收到物联消息::message---------------" + message);
......@@ -224,8 +224,8 @@ public class JxiopCarIotListerServiceImpl {
sendObj.put("carNum", car.getCarNum());
sendObj.put("bizOrgName", car.getBizOrgName());
sendArr.add(sendObj);
MqttMessage mqttMessage = new MqttMessage();
mqttMessage.setPayload(sendArr.toJSONString().getBytes());
// MqttMessage mqttMessage = new MqttMessage();
// mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude);
car.setLatitude(startLatitude);
if (!ObjectUtils.isEmpty(car.getMaxSpeed())) {
......@@ -250,9 +250,9 @@ public class JxiopCarIotListerServiceImpl {
}
logger.info("-----------推送车辆位置消息到到地图成功--------");
try {
emqkeeper.getMqttClient().publish("car/location", mqttMessage);
emqkeeper.getMqttClient().publish("car/location",sendArr.toJSONString().getBytes(),0,false);
} catch (MqttException e) {
throw new RuntimeException(e);
e.printStackTrace();
}
}
}
......
......@@ -506,7 +506,6 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
// 里程耗时
long takeTime = (date.getTime()) - (item.getStartTime().getTime());
// 查询车辆最新位置
// 修改0点未结束里程记录
item.setEndSpeed(v.intValue());
item.setEndTime(date);
......@@ -519,7 +518,11 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
}
item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
item.setTakeTime(takeTime);
if(travel>0.5){
this.getBaseMapper().updateById(item);
}else {
this.getBaseMapper().deleteById(item.getId());
}
log.info("-----------结束里程成功:::" + JSONObject.toJSONString(item) + "-----------------");
Car car = iCarService.getOne(new QueryWrapper<Car>().eq("iot_code", item.getIotCode()));
car.setLongitude(startLongitude);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment