From 45f8febad90601cdcad0b754e8a79da11d2d3561 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期五, 21 六月 2024 10:01:06 +0800 Subject: [PATCH] 修改google地图对接bug --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java index bbcb17b..0d97fbf 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java @@ -49,6 +49,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; +import org.springframework.util.StringUtils; import org.springframework.web.client.RestTemplate; import javax.annotation.Resource; @@ -354,25 +355,29 @@ orderPrivateCar.setIsReassign(1); orderPrivateCar.setIsDelete(1); + orderPrivateCar.setTripId(UUIDUtil.getRandomCode()); this.insert(orderPrivateCar); - Integer vehicleId = null; + String vehicleId = null; if(null != orderPrivateCar.getDriverId()){ Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); - vehicleId = driver.getCarId(); + Car car = carMapper.selectById(driver.getCarId()); + if(!StringUtils.hasLength(car.getVehicleId())){ + car.setVehicleId(UUIDUtil.getRandomCode()); + carMapper.updateById(car); + } //查询车辆信息,没有则创建信息 - String vehicles = fleetEngineUtil.getVehicles(vehicleId); + String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); if(ToolUtil.isEmpty(vehicles)){ - Car car = carService.selectById(vehicleId); CarModel carModel = carModelMapper.selectById(car.getCarModelId()); - fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), driver.getCarId()); - fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), driver.getCarId()); + fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); + fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); } } //创建行程数据 - fleetEngineUtil.createTrip(vehicleId, 1, 1, orderPrivateCar.getId(), + fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); @@ -495,6 +500,7 @@ BaseWarpper baseWarpper = new BaseWarpper(); baseWarpper.setState(orderPrivateCar.getState()); baseWarpper.setId(orderPrivateCar.getId()); + baseWarpper.setContent(orderPrivateCar.getTripId()); return ResultUtil.success(baseWarpper); } @@ -718,7 +724,7 @@ } //修改行程信息 - fleetEngineUtil.updateTrip("CANCELED", null, null, 1, orderPrivateCar.getId(), null, null, null, null); + fleetEngineUtil.updateTrip("CANCELED", null, null, orderPrivateCar.getTripId(), null, null, null, null); //添加消息 -- Gitblit v1.7.1