Ver código fonte

心跳接口添加绝对值

wyyay 6 meses atrás
pai
commit
00dd6f764f

+ 2 - 1
vehicle-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -2235,7 +2235,8 @@ public class GeoHazardMonitorTokenController {
                     VehiclePosition vehiclePosition = vehiclePositionService.getOne(new LambdaQueryWrapper<VehiclePosition>().eq(VehiclePosition::getVehicleCode, baseTerminalLog.getTrainNum()).orderByDesc(VehiclePosition::getCreateTime).last("limit 1"));
                     VehiclePosition positionServiceOne = vehiclePositionService.getOne(new LambdaQueryWrapper<VehiclePosition>().eq(VehiclePosition::getVehicleCode, baseTerminalLog.getFrontTrainNum()).orderByDesc(VehiclePosition::getCreateTime).last("limit 1"));
                     Map<String, Object> map = new HashMap<>();
-                    map.put("frontVehicleDistance", vehiclePosition.getTravelMile()-positionServiceOne.getTravelMile());
+                    int dif= vehiclePosition.getTravelMile()-positionServiceOne.getTravelMile();
+                    map.put("frontVehicleDistance", Math.abs(dif));
                     AjaxResults1 = new AjaxResults(1, "ok", map);
                 }else {
                     AjaxResults1 = new AjaxResults(1, "ok");