From 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 28 三月 2025 19:57:56 +0800 Subject: [PATCH] 修改bug --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 52 insertions(+), 2 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java index 5bc94bc..3fba8f0 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java @@ -2,15 +2,22 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; +import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; +import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; +import com.stylefeng.guns.modular.system.model.Car; +import com.stylefeng.guns.modular.system.model.UserInfo; +import com.stylefeng.guns.modular.system.service.ICarService; import com.stylefeng.guns.modular.system.service.IOrderService; import com.stylefeng.guns.modular.system.service.IUserInfoService; import com.stylefeng.guns.modular.system.util.ChinaMobileUtil; import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; +import com.stylefeng.guns.modular.system.util.RedisUtil; import com.stylefeng.guns.modular.system.util.ResultUtil; import com.stylefeng.guns.modular.system.warpper.BaseWarpper; import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; @@ -23,6 +30,8 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; +import javax.annotation.Resource; +import java.util.HashMap; import java.util.Map; @@ -53,6 +62,12 @@ @Autowired private IOrderLogisticsService orderLogisticsService; + @Autowired + private ICarService carService; + + @Resource + private RedisUtil redisUtil; + /** * 获取预计行驶时间 @@ -64,8 +79,9 @@ * @throws Exception */ @Override - public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat) throws Exception { - DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(slat, slon, elat, elon); + public ResultUtil<BaseWarpper> queryExpectedTime(Integer uid, Double slon, Double slat, Double elon, Double elat) throws Exception { + String tripId = redisUtil.getValue("trip" + uid); + DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(slat, slon, elat, elon, tripId); Long duration = distancematrix.getDuration() / 60; BaseWarpper baseWarpper = new BaseWarpper(); baseWarpper.setMinute(duration.intValue()); @@ -135,4 +151,38 @@ } return ResultUtil.success(); } + + + /** + * 获取订单车牌信息 + * @param orderType + * @param orderId + * @return + */ + @Override + public Map<String, Object> queryOrderLicensePlate(Integer orderType, Integer orderId) { + Map<String, Object> map = new HashMap<>(); + if(orderType == 1){ + OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); + if(null != orderPrivateCar.getCarId()){ + Car car = carService.selectById(orderPrivateCar.getCarId()); + map.put("licensePlate", car.getCarLicensePlate()); + } + map.put("userName", orderPrivateCar.getPassengers()); + map.put("phone", orderPrivateCar.getPassengersPhone()); + } + if(orderType == 4){ + OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); + if(null != orderLogistics.getCarId()){ + Car car = carService.selectById(orderLogistics.getCarId()); + map.put("licensePlate", car.getCarLicensePlate()); + } + if(null != orderLogistics.getUserId()){ + UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); + map.put("userName", ToolUtil.isEmpty(userInfo.getFirstName()) ? userInfo.getNickName() : userInfo.getFirstName() + " " + userInfo.getLastName()); + map.put("phone", userInfo.getPhone()); + } + } + return map; + } } -- Gitblit v1.7.1