From cb5cbb5128adc1814e43780b92faab447bc70a8d Mon Sep 17 00:00:00 2001
From: yanghb <yanghb>
Date: 星期五, 21 四月 2023 11:29:03 +0800
Subject: [PATCH] 代码调整
---
DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java | 298 ++---------------------------------------------------------
1 files changed, 11 insertions(+), 287 deletions(-)
diff --git a/DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java b/DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
index 0738cac..2574128 100644
--- a/DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
+++ b/DispatchTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -4,12 +4,17 @@
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.OrderCrossCity;
import com.stylefeng.guns.modular.system.model.OrderPosition;
-import com.stylefeng.guns.modular.system.model.OrderTaxi;
-import com.stylefeng.guns.modular.system.service.*;
+import com.stylefeng.guns.modular.system.service.IDispatchService;
+import com.stylefeng.guns.modular.system.service.IOrderCrossCityService;
+import com.stylefeng.guns.modular.system.service.IOrderPositionService;
+import com.stylefeng.guns.modular.system.service.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.util.ICBCPayUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.util.SystemException;
-import com.stylefeng.guns.modular.system.warpper.*;
+import com.stylefeng.guns.modular.system.warpper.BaseWarpper;
+import com.stylefeng.guns.modular.system.warpper.OrderCrossCityWarpper;
+import com.stylefeng.guns.modular.system.warpper.OrderInfoWarpper;
+import com.stylefeng.guns.modular.system.warpper.OrderListWarpper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -19,7 +24,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
/**
* 订单相关
@@ -43,18 +50,6 @@
@Autowired
private ICBCPayUtil icbcPayUtil;
-
- @Autowired
- private IOrderTaxiService orderTaxiService;
-
- @Autowired
- private IOpenCityService openCityService;
-
- @Autowired
- private IServerCarModelService serverCarModelService;
-
- @Autowired
- private IDriverService driverService;
@@ -104,45 +99,6 @@
}
- @ResponseBody
- @PostMapping("/api/order/queryOrderList1")
- @ApiOperation(value = "1.0-获取订单列表", tags = {"调度端-订单管理"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(value = "数据类型(1=专车,2=出租车,3=跨城)", name = "type", required = true, dataType = "int"),
- @ApiImplicitParam(value = "搜索条件", name = "search", required = false, dataType = "String"),
- @ApiImplicitParam(value = "订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单)多个以逗号分隔", name = "orderSource", required = false, dataType = "string"),
- @ApiImplicitParam(value = "订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付)多个以逗号分隔", name = "state", required = false, dataType = "string"),
- @ApiImplicitParam(value = "线路id(多个以逗号分隔)", name = "lineId", required = false, dataType = "string"),
- @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"),
- @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"),
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil<List<OrderListWarpper>> queryOrderList1(Integer type, String search, String orderSource, String state, String lineId, Integer pageNum, Integer size, HttpServletRequest request){
- try {
- Integer uid = dispatchService.getUserIdFormRedis(request);
- if(null == uid){
- return ResultUtil.tokenErr();
- }
- List<Map<String, Object>> list = null;
- if(type == 1){//专车
- list = orderPrivateCarService.queryOrderList(search, orderSource, state, pageNum, size, uid);
- }
- if(type == 2){//出租车
- list = orderTaxiService.queryOrderList(search, orderSource, state, pageNum, size, uid);
- }
- if(type == 3){//跨城
- list = orderCrossCityService.queryOrderList(search, orderSource, state, lineId, pageNum, size, uid);
- }
- return ResultUtil.success(OrderListWarpper.getOrderListWarppers(list));
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
-
-
/**
* 获取订单详情
* @param orderId
@@ -164,35 +120,6 @@
map = orderPrivateCarService.queryOrderInfo(orderId);
}
if(orderType == 2){//跨城
- map = orderCrossCityService.queryOrderInfo(orderId);
- }
- return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map));
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
-
- @ResponseBody
- @PostMapping("/api/order/queryOrderInfo1")
- @ApiOperation(value = "1.0-获取订单详情", tags = {"调度端-订单管理"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
- @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil<OrderInfoWarpper> queryOrderInfo1(Integer orderId, Integer orderType){
- try {
- Map<String, Object> map = null;
- if(orderType == 1){//专车
- map = orderPrivateCarService.queryOrderInfo(orderId);
- }
- if(orderType == 2){//出租车
- map = orderTaxiService.queryOrderInfo(orderId);
- }
- if(orderType == 3){//跨城
map = orderCrossCityService.queryOrderInfo(orderId);
}
return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map));
@@ -233,34 +160,6 @@
}
- @ResponseBody
- @PostMapping("/api/order/cancelOrder1")
- @ApiOperation(value = "1.0-取消订单", tags = {"调度端-订单管理"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
- @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil cancelOrder1(Integer orderId, Integer orderType){
- try {
- if(orderType == 1){//专车
- return orderPrivateCarService.cancelOrder(orderId);
- }
- if(orderType == 2){//出租车
- return orderTaxiService.cancelOrder(orderId);
- }
- if(orderType == 3){//跨城
- return orderCrossCityService.cancelOrder(orderId);
- }
- return ResultUtil.success();
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
-
/**
* 获取订单坐标轨迹数据
* @param orderId
@@ -276,33 +175,6 @@
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
public ResultUtil<List<BaseWarpper>> queryOrderPosition(Integer orderId, Integer orderType){
- try {
- List<OrderPosition> orderPositions = orderPositionService.queryPosition(orderId, orderType);
- List<BaseWarpper> list = new ArrayList<>();
- for(OrderPosition orderPosition : orderPositions){
- BaseWarpper baseWarpper = new BaseWarpper();
- baseWarpper.setLon(Double.valueOf(orderPosition.getLon()));
- baseWarpper.setLat(Double.valueOf(orderPosition.getLat()));
- list.add(baseWarpper);
- }
- return ResultUtil.success(list);
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
-
- @ResponseBody
- @PostMapping("/api/order/queryOrderPosition1")
- @ApiOperation(value = "1.0-获取订单坐标", tags = {"调度端-订单管理"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
- @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"),
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil<List<BaseWarpper>> queryOrderPosition1(Integer orderId, Integer orderType){
try {
List<OrderPosition> orderPositions = orderPositionService.queryPosition(orderId, orderType);
List<BaseWarpper> list = new ArrayList<>();
@@ -382,154 +254,6 @@
}
}catch (Exception e){
e.printStackTrace();
- }
- }
-
-
- @ResponseBody
- @RequestMapping(value = "/api/order/getOpenCityList", method = RequestMethod.POST)
- @ApiOperation(value = "1.0-获取开通城市列表", tags = {"调度端-添加订单"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil<List<BaseWarpper>> getOpenCityList(){
- try {
- List<BaseWarpper> list = openCityService.queryOpenCity();
- return ResultUtil.success(list);
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
-
- @ResponseBody
- @PostMapping("/api/order/openCity")
- @ApiOperation(value = "判断当前是否是开通城市", tags = {"调度端-添加订单"}, notes = "open=1(是),open=2(否)")
- @ApiImplicitParams({
- @ApiImplicitParam(value = "当前定位城市code", name = "code", required = true, dataType = "String"),
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil openCity(String code){
- try {
- boolean b = openCityService.openCity(code);
- Map<String, Object> map = new HashMap<>();
- map.put("open", b ? 1 : 2);
- return ResultUtil.success(map);
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
- /**
- * 获取车型和预估价格
- * @param startLonLat
- * @param endLonLat
- * @param type
- * @return
- */
- @ResponseBody
- @PostMapping("/api/order/queryServerCarModel")
- @ApiOperation(value = "1.0-选择起点终点后获取车型和预估价格(专车)", tags = {"调度端-添加订单"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(value = "起点经纬度(103.22121,,30.26123)", name = "startLonLat", required = true, dataType = "string"),
- @ApiImplicitParam(value = "终点经纬度(103.22121,,30.26123)", name = "endLonLat", required = true, dataType = "string"),
- @ApiImplicitParam(value = "业务类型(1=专车)", name = "type", required = true, dataType = "int"),
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModel(String startLonLat, String endLonLat, Integer type){
- try {
- return serverCarModelService.queryServerCarModel(startLonLat, endLonLat, type);
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
- @ResponseBody
- @PostMapping("/api/order/getServerDriverList")
- @ApiOperation(value = "1.0-获取可服务的司机列表", tags = {"调度端-添加订单"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(value = "起点经纬度(103.22121,,30.26123)", name = "startLonLat", required = true, dataType = "string"),
- @ApiImplicitParam(value = "终点经纬度(103.22121,,30.26123)", name = "endLonLat", required = true, dataType = "string"),
- @ApiImplicitParam(value = "业务类型(1=专车,2=出租车)", name = "type", required = true, dataType = "int"),
- @ApiImplicitParam(value = "车型id", name = "carModelId", required = false, dataType = "int"),
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil<List<BaseWarpper>> getServerDriverList(String startLonLat, String endLonLat, Integer type, Integer carModelId, HttpServletRequest request){
- try {
- Integer uid = dispatchService.getUserIdFormRedis(request);
- if(null == uid){
- return ResultUtil.tokenErr();
- }
- List<BaseWarpper> serverDriverList = driverService.getServerDriverList(uid, startLonLat, endLonLat, type, carModelId);
- return ResultUtil.success(serverDriverList);
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
-
- @ResponseBody
- @PostMapping("/api/order/saveOrderPrivateCar")
- @ApiOperation(value = "1.0-专车下单", tags = {"调度端-添加订单"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(value = "服务车型id", name = "serverCarModelId", required = true, dataType = "int"),
- @ApiImplicitParam(value = "出行时间(2020-08-20 10:10)", name = "travelTime", required = true, dataType = "string"),
- @ApiImplicitParam(value = "是否预约(1=否,2=是)", name = "orderType", required = true, dataType = "int"),
- @ApiImplicitParam(value = "下单地点经度", name = "placementLon", required = true, dataType = "string"),
- @ApiImplicitParam(value = "下单地点纬度", name = "placementLat", required = true, dataType = "string"),
- @ApiImplicitParam(value = "起点经度", name = "startLon", required = true, dataType = "string"),
- @ApiImplicitParam(value = "起点纬度", name = "startLat", required = true, dataType = "string"),
- @ApiImplicitParam(value = "起点地址", name = "startAddress", required = true, dataType = "string"),
- @ApiImplicitParam(value = "终点经度", name = "endLon", required = true, dataType = "string"),
- @ApiImplicitParam(value = "终点纬度", name = "endLat", required = true, dataType = "string"),
- @ApiImplicitParam(value = "终点地址", name = "endAddress", required = true, dataType = "string"),
- @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"),
- @ApiImplicitParam(value = "乘客姓名", name = "passengers", required = true, dataType = "string"),
- @ApiImplicitParam(value = "乘客电话", name = "passengersPhone", required = true, dataType = "string"),
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil saveOrderPrivateCar(Integer serverCarModelId, Date travelTime, Integer orderType, String placementLon, String placementLat, String startLon, String startLat,
- String startAddress, String endLon, String endLat, String endAddress, String passengers, String passengersPhone, Integer driverId, HttpServletRequest request){
- try {
- Integer uid = dispatchService.getUserIdFormRedis(request);
- if(null == uid){
- return ResultUtil.tokenErr();
- }
- return orderPrivateCarService.saveOrderPrivateCar(uid, serverCarModelId, travelTime, orderType, placementLon, placementLat, startLon, startLat, startAddress, endLon, endLat, endAddress, passengers, passengersPhone, driverId);
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
- }
- }
-
-
-
-
- @ResponseBody
- @PostMapping("/api/order/taxiOrder")
- @ApiOperation(value = "1.0-出租车下单操作", tags = {"调度端-添加订单"}, notes = "")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
- })
- public ResultUtil<BaseWarpper> taxiOrder(OrderTaxiWarpper orderTaxiWarpper, HttpServletRequest request){
- try {
- OrderTaxi orderTaxi = OrderTaxiWarpper.getOrderTaxi(orderTaxiWarpper);
- Integer uid = dispatchService.getUserIdFormRedis(request);
- if(null == uid){
- return ResultUtil.tokenErr();
- }
- return orderTaxiService.taxiOrder(orderTaxi, uid);
- }catch (Exception e){
- e.printStackTrace();
- return ResultUtil.runErr();
}
}
}
--
Gitblit v1.7.1