yanderong
2026-07-09 8b04bf05239ca0b9941192ce7856c1948c6adbbf
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -6,12 +6,12 @@
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity;
import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService;
import com.stylefeng.guns.modular.crossCity.warpper.LineSiteWarpper;
import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityInfoWrapper;
import com.stylefeng.guns.modular.crossCity.warpper.OrderWarpper;
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.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.DriverWorkMapper;
import com.stylefeng.guns.modular.system.model.*;
@@ -24,15 +24,12 @@
import com.stylefeng.guns.modular.system.warpper.*;
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -46,6 +43,7 @@
/**
 * 订单相关控制器
 */
@Slf4j
@RestController
@RequestMapping("")
public class OrderController {
@@ -88,15 +86,7 @@
    private PayMoneyUtil payMoneyUtil;
    @Autowired
    private IOrderPrivateCarService orderPrivateCarService;
    @Autowired
    private IOrderCrossCityService orderCrossCityService;
    @Autowired
    private IOrderTaxiService orderTaxiService;
@@ -129,6 +119,7 @@
            List<Map<String, Object>> list = orderService.queryOrderList(state, pageNum, size, uid);
            return ResultUtil.success(OrderListWarpper.getOrderListWarpper(list));
        }catch (Exception e){
            log.error("获取首页订单列表异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -162,6 +153,7 @@
            List<Map<String, Object>> list = orderService.queryOrderList1(state, type, pageNum, size, uid);
            return ResultUtil.success(OrderListWarpper.getOrderListWarpper(list));
        }catch (Exception e){
            log.error("获取首页订单列表异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -197,6 +189,7 @@
            List<OrderListWarpper> listWarppers = orderService.queryMyAllOrder(state, pageNum, size, uid);
            return ResultUtil.success(listWarppers);
        }catch (Exception e){
            log.error("获取我的订单列表异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -228,6 +221,7 @@
            List<OrderListWarpper> listWarppers = orderService.queryMyAllOrder1(pageNum, size, uid);
            return ResultUtil.success(listWarppers);
        }catch (Exception e){
            log.error("获取我的订单列表异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -257,6 +251,7 @@
            Map<String, Object> map = orderService.queryPushOrder(orderId, orderType, lon, lat);
            return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map));
        }catch (Exception e){
            log.error("获取抢单界面的订单详情异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -305,6 +300,7 @@
            return orderService.grabOrder(orderId, orderType, uid);
        }catch (Exception e){
            log.error("司机抢单操作异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -357,6 +353,7 @@
            }
            return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map));
        }catch (Exception e){
            log.error("获取服务中页面订单详情异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -420,6 +417,7 @@
            return ResultUtil.success(orderWarpper);
            //return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map));
        }catch (Exception e){
            log.error("获取服务中页面订单详情异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -448,9 +446,11 @@
            if(orderType == 3){
                aDouble = aDouble * split.length;
            }
            baseWarpper.setAmount(aDouble);
            baseWarpper.setAmount(null); // todo 放心行项目,客户要求:1.改派订单系统默认成0,然后屏蔽掉后台设置改派金额入口。2.司机端代客下单屏蔽掉司机代付入口
           // baseWarpper.setAmount(aDouble);
            return ResultUtil.success(baseWarpper);
        }catch (Exception e){
            log.error("获取改派支付金额异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -465,7 +465,7 @@
     */
    @ResponseBody
    @PostMapping("/api/order/reassign")
    @ApiOperation(value = "提交改派申请", tags = {"司机端-服务中"}, notes = "")
    @ApiOperation(value = "提交改派申请(使用的)", tags = {"司机端-服务中"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,4=小件物流-同城,5=小件物流-跨城)", name = "orderType", required = true, dataType = "int"),
@@ -480,10 +480,11 @@
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            return reassignService.saveData(reassign, uid, null);
            return reassignService.saveData(reassign, uid, null,reassign.getNowDriverId());
        }catch (SystemException s){
            return ResultUtil.error(s.getMsg());
        } catch (Exception e){
            log.error("提交改派申请(使用的)异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -517,6 +518,27 @@
            return ResultUtil.runErr();
        }
    }
    @ResponseBody
    @RequestMapping(value = "/api/lineSite/queryDriverList", method = RequestMethod.POST)
    @ApiOperation(value = "根据线路id获取其他线路排班数据", tags = {"司机端-跨城"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单", name = "orderId", required = true, dataType = "String"),
            @ApiImplicitParam(value = "查询天(2020-09-03)", name = "day", required = true, dataType = "string")
    })
    public ResultUtil<List<LineSiteWarpper>> queryDriverList(String orderId){
        try {
            List<Map<String, Object>> list = reassignService.queryDriver(orderId);
            return ResultUtil.success(LineSiteWarpper.getLineSiteWarppers(list));
        } catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
@@ -676,6 +698,7 @@
        try{
            return orderService.confirmFees1(orderId, orderType, type, travelFee, additionalFee);
        }catch (Exception e){
            log.error("1.0-司机确认费用异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -718,6 +741,7 @@
                orderCrossCityService.updateById(orderCrossCity);
            }
        }catch (Exception e){
            log.error("约克多-上传录音文件异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -750,6 +774,7 @@
        try{
            return orderService.confirmFees_(orderId, orderType, type, travelFee, lon, lat);
        }catch (Exception e){
            log.error("司机确认费用(车载端)异常", e);
            e.printStackTrace();
            System.err.println(lon + "," + lat);
            return ResultUtil.runErr();
@@ -782,6 +807,7 @@
            }
            return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map));
        }catch (Exception e){
            log.error("获取待支付页详情异常", e);
            e.printStackTrace();
            return ResultUtil.runErr();
        }
@@ -826,10 +852,11 @@
            @ApiImplicitParam(value = "改派支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = false, dataType = "int"),
            @ApiImplicitParam(value = "改派原因", name = "reason", required = true, dataType = "string"),
            @ApiImplicitParam(value = "备注", name = "remark", required = false, dataType = "string"),
            @ApiImplicitParam(value = "司机id", name = "driverId", required = false, dataType = "int"),
    })
    public String reassign_(Reassign reassign, Integer uid){
    public String reassign_(Reassign reassign, Integer uid, Integer driverId){
        try {
            ResultUtil resultUtil = reassignService.saveData(reassign, uid, 3);
            ResultUtil resultUtil = reassignService.saveData(reassign, uid, 3, driverId);
            return JSON.toJSONString(resultUtil);
        }catch (SystemException s){
            return JSON.toJSONString(ResultUtil.error(s.getMsg()));
@@ -896,6 +923,30 @@
        }
    }
    @ResponseBody
    // 快捷叫车在乘客上车后,由接单司机补充目的地。
    @PostMapping("/api/order/privateCar/setDestination")
    @ApiOperation(value = "快车快捷叫车设置目的地", tags = {"司机端-服务中"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "终点经度", name = "endLon", required = true, dataType = "double"),
            @ApiImplicitParam(value = "终点纬度", name = "endLat", required = true, dataType = "double"),
            @ApiImplicitParam(value = "终点地址", name = "endAddress", required = true, dataType = "string"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil setPrivateCarDestination(Integer orderId, Double endLon, Double endLat, String endAddress, HttpServletRequest request){
        try {
            Integer uid = driverService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            return orderPrivateCarService.setDestination(orderId, uid, endLon, endLat, endAddress);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }