From 0f9a91a7609e6623ada0f8b5a9ee878e77e5aa32 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期五, 21 六月 2024 10:01:59 +0800 Subject: [PATCH] 修改google地图对接bug --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 47 insertions(+), 11 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java index 94d9f52..16025aa 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java @@ -11,17 +11,16 @@ import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; -import com.stylefeng.guns.modular.system.dao.CarMapper; -import com.stylefeng.guns.modular.system.dao.RegionMapper; -import com.stylefeng.guns.modular.system.dao.SystemPriceMapper; -import com.stylefeng.guns.modular.system.dao.UserInfoMapper; +import com.stylefeng.guns.modular.system.dao.*; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.*; +import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob; import com.stylefeng.guns.modular.taxi.model.OrderTaxi; +import org.apache.shiro.util.StringUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -115,6 +114,15 @@ @Resource private SystemPriceMapper systemPriceMapper; + + @Autowired + private FleetEngineUtil fleetEngineUtil; + + @Resource + private CarModelMapper carModelMapper; + + @Autowired + private ICarService carService; @@ -162,13 +170,14 @@ driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); orderLogistics.setState(2); orderLogistics.setSnatchOrderTime(new Date()); - + if(!StringUtils.hasLength(orderLogistics.getTripId())){ + orderLogistics.setTripId(UUIDUtil.getRandomCode()); + } this.updateById(orderLogistics); //修改司机为服务中 driver.setState(3); driverService.updateById(driver); - //todo 待翻译 //添加定时任务(普通任务) ReminderRules reminderRules = reminderRulesService.selectOne(new EntityWrapper<ReminderRules>().eq("companyId", driver.getCompanyId())); if(null != reminderRules){ @@ -179,13 +188,30 @@ jobDataMap.put("driverId", uid); jobDataMap.put("orderId", orderLogistics.getId()); jobDataMap.put("orderType", 4); - jobDataMap.put("describe", "您的包裹订单已超时" + m + "分钟,请抓紧!"); + jobDataMap.put("describe", language == 1 ? "您的包裹订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your delivery order is overdue for " + m + " minute(s), please go faster." : "Votre commande de livraison est en retard depuis " + m + " minute(s), veuillez aller plus vite."); QuartzUtil.addSimpleQuartzTask( new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap) , new Date(packageTimeoutReminderInterval), packageTimeoutReminderInterval, -1); } - - + + Car car = carService.selectById(orderLogistics.getCarId()); + if(!StringUtils.hasLength(car.getVehicleId())){ + car.setVehicleId(UUIDUtil.getRandomCode()); + carService.updateById(car); + } + String trip = fleetEngineUtil.getTrip(orderLogistics.getTripId()); + if(ToolUtil.isEmpty(trip)){ + String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); + if(ToolUtil.isEmpty(vehicles)){ + CarModel carModel = carModelMapper.selectById(car.getCarModelId()); + fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); + } + fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderLogistics.getTripId(), + orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); + }else{ + //开始修改行程数据 + fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); + } //推送相关代码------------------start---------------- new Thread(new Runnable() { @@ -257,19 +283,22 @@ } List<OrderLogisticsSpread> orderLogisticsId = spreadService.selectList(new EntityWrapper<OrderLogisticsSpread>().eq("orderLogisticsId", orderLogistics.getId()).eq("payType",4)); - - + + + String tripStatus = "UNKNOWN_TRIP_STATUS"; switch (state){ case 3://出发前往预约点 orderLogistics.setState(3); orderLogistics.setSetOutTime(new Date()); systemNoticeService.addSystemNotice(1, language == 1 ? "司机已出发,请耐心等待" : language == 2 ? "The driver is on the way, please wait." : "Le chauffeur est en route. Veuillez patienter.", orderLogistics.getUserId()); pushUtil.pushDriverPosition(orderId, 4); + tripStatus = "ENROUTE_TO_PICKUP"; break; case 4://到达预约点,等待客户上车 orderLogistics.setState(4); orderLogistics.setArriveTime(new Date()); systemNoticeService.addSystemNotice(1, language == 1 ? "司机已到达您设置的预约地点。" : language == 2 ? "The driver has arrived at the reserved location." : "Le chauffeur est arrivé à l'endroit prévu.", orderLogistics.getUserId()); + tripStatus = "ARRIVED_AT_PICKUP"; break; case 5://开始服务 orderLogistics.setBoardingLon(lon); @@ -278,6 +307,7 @@ orderLogistics.setBoardingTime(new Date()); orderLogistics.setState(5); orderLogistics.setStartServiceTime(new Date()); + tripStatus = "ENROUTE_TO_DROPOFF"; break; case 6://结束服务 orderLogistics.setGetoffLon(lon); @@ -286,9 +316,15 @@ orderLogistics.setGetoffTime(new Date()); orderLogistics.setEndServiceTime(new Date()); orderLogistics.setState(6); + tripStatus = "COMPLETE"; break; } this.updateById(orderLogistics); + + Driver driver = driverService.selectById(orderLogistics.getDriverId()); + Car car = carMapper.selectById(driver.getCarId()); + //修改行程数据 + fleetEngineUtil.updateTrip(tripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); // TODO: 2020/6/5 推送状态 new Thread(new Runnable() { -- Gitblit v1.7.1