From f88507a761ae5b8f47e52b81627ca485b500431a Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 21 三月 2025 18:49:18 +0800
Subject: [PATCH] 修改bug
---
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java | 381 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 355 insertions(+), 26 deletions(-)
diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
index 18ddfba..54f88d7 100644
--- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
+++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -3,15 +3,21 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.stylefeng.guns.core.util.MD5Util;
import com.stylefeng.guns.core.util.ToolUtil;
+import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics;
+import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread;
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
+import com.stylefeng.guns.modular.smallLogistics.server.impl.OrderLogisticsSpreadService;
+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.OrderPosition;
import com.stylefeng.guns.modular.system.model.Reassign;
-import com.stylefeng.guns.modular.system.service.IDriverService;
-import com.stylefeng.guns.modular.system.service.IOrderService;
-import com.stylefeng.guns.modular.system.service.IReassignService;
+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.Tingg.model.CallbackRequest;
import com.stylefeng.guns.modular.system.util.Tingg.model.CallbackResponse;
import com.stylefeng.guns.modular.system.util.Tingg.model.Payments;
@@ -26,14 +32,15 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* 订单相关控制器
@@ -65,6 +72,18 @@
@Value("${filePath}")
private String filePath;
+
+ @Resource
+ private FleetEngineUtil fleetEngineUtil;
+
+ @Autowired
+ private IOrderPositionService orderPositionService;
+
+ @Autowired
+ private RedisUtil redisUtil;
+
+ @Autowired
+ private ICarService carService;
@@ -149,7 +168,7 @@
*/
@ResponseBody
@PostMapping("/api/order/queryMyAllOrder")
- @ApiOperation(value = "获取我的订单列表", tags = {"司机端-首页"}, notes = "")
+ @ApiOperation(value = "获取我的订单列表【2.0】", tags = {"司机端-首页"}, notes = "")
@ApiImplicitParams({
@ApiImplicitParam(value = "数据类型(1=全部,2=待支付,3=已取消,4=已完成)", name = "state", required = true, dataType = "int"),
@ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"),
@@ -230,6 +249,9 @@
}
}
+
+ @Autowired
+ private OrderLogisticsSpreadService spreadService;
/**
* 获取服务中页面订单详情
* @param orderId
@@ -238,15 +260,15 @@
*/
@ResponseBody
@PostMapping("/api/order/queryOrderInfo")
- @ApiOperation(value = "获取服务中页面订单详情", tags = {"司机端-服务中"}, notes = "")
+ @ApiOperation(value = "获取服务中页面订单详情【2.0】", tags = {"司机端-服务中"}, notes = "",response = OrderInfoWarpper.class)
@ApiImplicitParams({
@ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
@ApiImplicitParam(value = "订单类型(1=专车,4=小件物流-同城)", name = "orderType", required = true, dataType = "int"),
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
- public ResultUtil<OrderInfoWarpper> queryOrderInfo(Integer orderId, Integer orderType){
+ public ResultUtil<OrderInfoWarpper> queryOrderInfo(Integer language, Integer orderId, Integer orderType){
try {
- Map<String, Object> map = orderService.queryOrderInfo(orderId, orderType);
+ Map<String, Object> map = orderService.queryOrderInfo(language, orderId, orderType);
OrderInfoWarpper orderInfoWarpper = OrderInfoWarpper.getOrderInfoWarpper(map);
File file = new File(filePath + orderId + "_" + orderType + ".txt");
if(file.exists()){
@@ -263,6 +285,22 @@
}else{
orderInfoWarpper.setOrderPositionList("");
}
+
+ List<OrderLogisticsSpread> orderLogisticsId = spreadService.selectList(new EntityWrapper<OrderLogisticsSpread>().eq("orderLogisticsId", orderId));
+ if (!orderLogisticsId.isEmpty()){
+ double sum = 0;
+ for (OrderLogisticsSpread orderLogisticsSpread : orderLogisticsId) {
+
+ if (orderLogisticsSpread.getPayType()!=null&&orderLogisticsSpread.getPayType() == 4) {
+ Double payMoney = orderLogisticsSpread.getPayMoney();
+ sum = sum + payMoney;
+ }
+ }
+ sum = sum+orderInfoWarpper.getPayMoney();
+ orderInfoWarpper.setPayMoney(sum);
+ }
+
+
return ResultUtil.success(orderInfoWarpper);
}catch (Exception e){
e.printStackTrace();
@@ -357,13 +395,20 @@
@ApiImplicitParam(value = "当前纬度", name = "lat", required = true, dataType = "double"),
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
- public ResultUtil process(Integer orderId, Integer orderType, Integer state, Double lon, Double lat,String phone, Integer language, HttpServletRequest request){
+ public ResultUtil process(Integer orderId, Integer orderType, Integer state, Double lon, Double lat,String phone, String pickUpCode, Integer language, HttpServletRequest request){
try {
Integer uid = driverService.getUserIdFormRedis(request);
if(null == uid){
return ResultUtil.tokenErr();
}
- return orderService.process(orderId, orderType, state, uid, lon, lat, phone, language);
+ String format = String.format("uid=%s&orderId=%s&orderType=%s&state=%s", uid, orderId, orderType, state);
+ String key = MD5Util.encrypt(format);
+ String value = redisUtil.getValue(key);
+ if(ToolUtil.isNotEmpty(value) && (System.currentTimeMillis() - Long.valueOf(value)) <= 1000){
+ return ResultUtil.error(language == 1 ? "请勿重复操作" : language == 2 ? "Don't repeat the operation" : "Ne répétez pas l’opération");
+ }
+ redisUtil.setStrValue(key, System.currentTimeMillis() + "", 5);
+ return orderService.process(orderId, orderType, state, uid, lon, lat, phone, pickUpCode, language);
}catch (Exception e){
e.printStackTrace();
return ResultUtil.runErr();
@@ -417,16 +462,20 @@
@ApiOperation(value = "司机确认费用", tags = {"司机端-服务中"}, notes = "")
@ApiImplicitParams({
@ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
- @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"),
- @ApiImplicitParam(value = "支付方式(1=OK平台收款,2=其他方式收款)", name = "type", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件物流)", name = "orderType", required = true, dataType = "int"),
@ApiImplicitParam(value = "行程费用(出租车必传)", name = "travelFee", required = false, dataType = "double"),
@ApiImplicitParam(value = "停车费", name = "parkingFee", required = false, dataType = "double"),
@ApiImplicitParam(value = "过路费", name = "crossingFee", required = false, dataType = "double"),
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
- public ResultUtil confirmFees(Integer orderId, Integer orderType, Integer type, Double travelFee, Double parkingFee, Double crossingFee){
+ public ResultUtil confirmFees(Integer language, Integer orderId, Integer orderType, Integer type,
+ Double travelFee, Double parkingFee, Double crossingFee, HttpServletRequest request){
try{
- return orderService.confirmFees(orderId, orderType, type, travelFee, parkingFee, crossingFee);
+ Integer uid = driverService.getUserIdFormRedis(request);
+ if(null == uid){
+ return ResultUtil.tokenErr();
+ }
+ return orderService.confirmFees(language, orderId, orderType, type, travelFee, parkingFee, crossingFee, uid);
}catch (Exception e){
e.printStackTrace();
return ResultUtil.runErr();
@@ -481,9 +530,9 @@
@ApiImplicitParam(value = "订单类型(1=专车,2=出租车)", name = "orderType", required = true, dataType = "int"),
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
- public ResultUtil<OrderInfoWarpper> queryToBePaidPage(Integer orderId, Integer orderType){
+ public ResultUtil<OrderInfoWarpper> queryToBePaidPage(Integer language, Integer orderId, Integer orderType){
try {
- Map<String, Object> map = orderService.queryToBePaidPage(orderId, orderType);
+ Map<String, Object> map = orderService.queryToBePaidPage(language, orderId, orderType);
return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map));
}catch (Exception e){
e.printStackTrace();
@@ -500,17 +549,17 @@
*/
@ResponseBody
@PostMapping("/base/order/pushOrderState")
- public String pushOrderState(Integer orderId, Integer orderType){
+ public String pushOrderState(Integer language, Integer orderId, Integer orderType){
try {
- Map<String, Object> map = orderService.queryOrderInfo(orderId, orderType);
+ Map<String, Object> map = orderService.queryOrderInfo(language, orderId, orderType);
//更新小号绑定关系
orderService.RebindMidAxbBindSend(orderId, orderType);
- pushUtil.pushOrderReassign(Integer.valueOf(String.valueOf(map.get("driverId"))), 2,Integer.valueOf(String.valueOf(map.get("orderId"))), orderType);
+ pushUtil.pushOrderReassign(Integer.valueOf(String.valueOf(map.get("driverId"))), 2,Integer.valueOf(String.valueOf(map.get("orderId"))), orderType, "");
- pushUtil.pushOrderReassign(Integer.valueOf(String.valueOf(map.get("userId"))), 1,Integer.valueOf(String.valueOf(map.get("orderId"))), orderType);
+ pushUtil.pushOrderReassign(Integer.valueOf(String.valueOf(map.get("userId"))), 1,Integer.valueOf(String.valueOf(map.get("orderId"))), orderType, "");
pushUtil.pushOrderState(1, Integer.valueOf(String.valueOf(map.get("userId"))), Integer.valueOf(String.valueOf(map.get("orderId"))), orderType,
- Integer.valueOf(String.valueOf(map.get("orderState"))));
+ Integer.valueOf(String.valueOf(map.get("orderState"))), 0, "");
return JSON.toJSONString(ResultUtil.success());
}catch (Exception e){
e.printStackTrace();
@@ -634,7 +683,7 @@
@ApiOperation(value = "手动确认订单完成", tags = {"司机端-服务中"}, notes = "")
@ApiImplicitParams({
@ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
- @ApiImplicitParam(value = "订单类型(1=专车,2=出租车)", name = "orderType", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,4=同城小件物流)", name = "orderType", required = true, dataType = "int"),
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
public ResultUtil completeOrder(Integer orderId, Integer orderType, Integer language){
@@ -650,10 +699,10 @@
@ResponseBody
@PostMapping("/api/order/queryMoneyInfo")
- @ApiOperation(value = "获取订单费用明细", tags = {"司机端-服务中"}, notes = "")
+ @ApiOperation(value = "获取订单费用明细【2.0】", tags = {"司机端-服务中"}, notes = "")
@ApiImplicitParams({
@ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
- @ApiImplicitParam(value = "订单类型(1=专车)", name = "orderType", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "订单类型(1=专车,4=同城小件物流)", name = "orderType", required = true, dataType = "int"),
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
public ResultUtil<MoneyInfoWarpper> queryMoneyInfo(Integer orderId, Integer orderType){
@@ -666,6 +715,7 @@
}
}
+
@ResponseBody
@PostMapping("/api/order/fillInPickUpCode")
@ApiOperation(value = "验证小件物流取件码", tags = {"司机端-服务中"}, notes = "")
@@ -799,4 +849,283 @@
}
return callbackResponse;
}
+
+
+
+
+ @ResponseBody
+ @PostMapping("/api/taxi/updateEndAddress")
+ @ApiOperation(value = "处理乘客修改目的地【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "状态(2=同意,3=拒绝)", name = "status", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"),
+ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResultUtil updateEndAddress(Integer orderId, Integer orderType, Integer status){
+ if(null == orderId){
+ return ResultUtil.error("订单id不能为空");
+ }
+ if(null == orderType){
+ return ResultUtil.error("订单类型不能为空");
+ }
+ if(null == status){
+ return ResultUtil.error("状态不能为空");
+ }
+ switch (orderType){
+ case 1:
+ orderPrivateCarService.updateEndAddress(orderId, status);
+ break;
+ case 4:
+ orderLogisticsService.updateEndAddress(orderId, status);
+ break;
+ }
+ return ResultUtil.success();
+ }
+
+
+
+ @ResponseBody
+ @PostMapping("/api/taxi/getTripInfo")
+ @ApiOperation(value = "获取google行程详情【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"),
+ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResultUtil<String> getTripInfo(Integer orderId, Integer orderType){
+ try {
+ String tripId = null;
+ switch (orderType){
+ case 1:
+ OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
+ tripId = orderPrivateCar.getTripId();
+ break;
+ case 4:
+ OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId);
+ tripId = orderLogistics.getTripId();
+ break;
+ }
+ String trip = fleetEngineUtil.getTrip(tripId);
+ return ResultUtil.success(trip);
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
+
+
+ @ResponseBody
+ @PostMapping("/base/taxi/getTripInfo")
+ public ResultUtil getTripInfo(String tripId){
+ return ResultUtil.success(fleetEngineUtil.getTrip(tripId));
+ }
+
+
+
+ /**
+ * 更新google订单状态
+ * @param tripStatus
+ * @param tripId
+ * @return
+ */
+ @ResponseBody
+ @PostMapping("/base/taxi/editTripStatus")
+ public ResultUtil editTripStatus(String tripStatus, String tripId){
+ boolean b = fleetEngineUtil.updateTrip(tripStatus, null, null, tripId, null, null, null, null);
+ if(b){
+ return ResultUtil.success();
+ }
+ return ResultUtil.error("更新失败");
+ }
+
+
+ /**
+ * 上传订单经纬度
+ * @param orderPosition
+ * @return
+ */
+ @ResponseBody
+ @PostMapping("/api/order/saveOrderPosition")
+ public ResultUtil saveOrderPosition(OrderPosition orderPosition, HttpServletRequest request){
+ try {
+ Integer uid = driverService.getUserIdFormRedis(request);
+ if(null == uid){
+ return ResultUtil.tokenErr();
+ }
+ if(null != orderPosition.getOrderId()){
+ orderPosition.setDriverId(uid);
+ orderPosition.setInsertTime(new Date());
+ orderPositionService.saveData(orderPosition);
+ }
+ redisUtil.setStrValue("DRIVER" + uid, orderPosition.getLon() + "," + orderPosition.getLat(), 300);//实时位置存入redis中
+ return ResultUtil.success();
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
+
+
+
+ @ResponseBody
+ @PostMapping("/base/taxi/editGoogleTripStatus")
+ public ResultUtil editGoogleTripStatus(){
+ List<OrderPrivateCar> privateCars = orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().isNotNull("tripId"));
+ for (OrderPrivateCar privateCar : privateCars) {
+ Integer state = privateCar.getState();
+ String tripId = privateCar.getTripId();
+ String trip = fleetEngineUtil.getTrip(tripId);
+ if(ToolUtil.isNotEmpty(trip)){
+ JSONObject jsonObject = JSON.parseObject(trip);
+ String tripStatus = jsonObject.getString("tripStatus");
+ Car car = carService.selectById(privateCar.getCarId());
+ if(Arrays.asList(10, 12).contains(state) && !"CANCELED".equals(tripStatus)){
+ //修改行程信息
+ boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null);
+ if(!updateTrip){
+ for (int i = 0; i < 5; i++) {
+ updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null);
+ if(updateTrip){
+ privateCar.setIsover(1);
+ orderPrivateCarService.updateById(privateCar);
+ break;
+ }
+ try {
+ Thread.sleep(3000L);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }else{
+ privateCar.setIsover(1);
+ orderPrivateCarService.updateById(privateCar);
+ }
+ }
+ if(Arrays.asList(6, 7, 8, 9).contains(state) && !"COMPLETE".equals(tripStatus)){
+ //修改行程信息
+ boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null);
+ if(!updateTrip){
+ for (int i = 0; i < 5; i++) {
+ updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null);
+ if(updateTrip){
+ privateCar.setIsover(1);
+ orderPrivateCarService.updateById(privateCar);
+ break;
+ }
+ try {
+ Thread.sleep(3000L);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }else{
+ privateCar.setIsover(1);
+ orderPrivateCarService.updateById(privateCar);
+ }
+ }
+ }
+ }
+ List<OrderLogistics> orderLogisticsList = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().isNotNull("tripId"));
+ for (OrderLogistics orderLogistics : orderLogisticsList) {
+ Integer state = orderLogistics.getState();
+ String tripId = orderLogistics.getTripId();
+ String trip = fleetEngineUtil.getTrip(tripId);
+ if(ToolUtil.isNotEmpty(trip)){
+ JSONObject jsonObject = JSON.parseObject(trip);
+ String tripStatus = jsonObject.getString("tripStatus");
+ Car car = carService.selectById(orderLogistics.getCarId());
+ if(Arrays.asList(10, 12).contains(state) && !"CANCELED".equals(tripStatus)){
+ //修改行程信息
+ boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null);
+ if(!updateTrip){
+ for (int i = 0; i < 5; i++) {
+ updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null);
+ if(updateTrip){
+ orderLogistics.setIsover(1);
+ orderLogisticsService.updateById(orderLogistics);
+ break;
+ }
+ try {
+ Thread.sleep(3000L);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }else{
+ orderLogistics.setIsover(1);
+ orderLogisticsService.updateById(orderLogistics);
+ }
+ }
+ if(Arrays.asList(6, 7, 8, 9).contains(state) && !"COMPLETE".equals(tripStatus)){
+ //修改行程信息
+ boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null);
+ if(!updateTrip){
+ for (int i = 0; i < 5; i++) {
+ updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null);
+ if(updateTrip){
+ orderLogistics.setIsover(1);
+ orderLogisticsService.updateById(orderLogistics);
+ break;
+ }
+ try {
+ Thread.sleep(3000L);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }else{
+ orderLogistics.setIsover(1);
+ orderLogisticsService.updateById(orderLogistics);
+ }
+ }
+ }
+ }
+ return ResultUtil.success();
+ }
+
+
+ @ResponseBody
+ @PostMapping("/base/taxi/getTrips")
+ public String getTrips(String vehicleId, Integer pageSize, String pageToken){
+ return fleetEngineUtil.getTrips(vehicleId, pageSize, pageToken);
+ }
+
+ @ResponseBody
+ @GetMapping("/base/taxi/getTripsStatus")
+ public ResultUtil<List<Map<String, String>>> getTripsStatus(){
+ String pageToken = null;
+ List<Map<String, String>> list = new ArrayList<>();
+ while (true){
+ String trips = fleetEngineUtil.getTrips(null, 50, pageToken);
+ if(ToolUtil.isEmpty(trips)){
+ break;
+ }
+ JSONObject jsonObject = JSON.parseObject(trips);
+ JSONArray array = jsonObject.getJSONArray("trips");
+ if(null == array){
+ break;
+ }
+ for (int i = 0; i < array.size(); i++) {
+ JSONObject trip = array.getJSONObject(i);
+ String tripStatus = trip.getString("tripStatus");
+ String name = trip.getString("name");
+ Integer index = name.lastIndexOf("/") + 1;
+ String tripId = name.substring(index);
+
+ Map<String, String> map = new HashMap<>();
+ map.put(tripId, tripStatus);
+ list.add(map);
+ }
+
+ pageToken = jsonObject.getString("nextPageToken");
+ if(null == pageToken){
+ break;
+ }
+ }
+ return ResultUtil.success(list);
+ }
+
+
}
--
Gitblit v1.7.1