Pu Zhibing
3 天以前 ca73af429b960124ab9b32ccfd5572e3f1df2bc2
ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TReassignController.java
@@ -1,8 +1,10 @@
package com.stylefeng.guns.modular.system.controller.specialTrain;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.base.tips.ErrorTip;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.shiro.ShiroUser;
@@ -78,6 +80,9 @@
    @Autowired
    private ITOrderLogisticsService orderLogisticsService;
    @Autowired
    private IAppOperationLogService appOperationLogService;
@@ -296,6 +301,7 @@
            TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId());
            tOrderPrivateCar.setState(tOrderPrivateCar.getOldState());
            itOrderPrivateCarService.updateById(tOrderPrivateCar);
            appOperationLogService.addAppOperationLog(ShiroKit.getUser().getId(), "{\"type\":\"调度拒绝改派\",\"orderId\":\"" + tOrderPrivateCar.getId() + "\",\"driver\":\"" + JSON.toJSONString(tOrderPrivateCar) + "\"}");
        }else if (2 == optType){
            tReassign.setState(4);
            tReassignService.updateById(tReassign);
@@ -304,6 +310,7 @@
            TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId());
            tOrderPrivateCar.setState(10);
            itOrderPrivateCarService.updateById(tOrderPrivateCar);
            appOperationLogService.addAppOperationLog(ShiroKit.getUser().getId(), "{\"type\":\"调度取消订单\",\"orderId\":\"" + tOrderPrivateCar.getId() + "\",\"driver\":\"" + JSON.toJSONString(tOrderPrivateCar) + "\"}");
            //修改司机状态"空闲"
            TDriver driver = itDriverService.selectById(tReassign.getOriginalDriverId());
@@ -583,6 +590,11 @@
    @RequestMapping(value = "/selectDriver")
    @ResponseBody
    public Object selectDriver(@RequestParam Integer orderId,@RequestParam Integer driverId) {
        int count = itOrderPrivateCarService.selectCount(new EntityWrapper<TOrderPrivateCar>().eq("driverId", driverId)
                .in("state", Arrays.asList(2, 3, 4, 5, 6, 11)).eq("isDelete", 1));
        if(count > 0){
            throw new RuntimeException("司机正在服务中,请选择其他司机");
        }
        //修改订单
        TReassign tReassign = tReassignService.selectById(orderId);
        TOrderPrivateCar tOrderPrivateCar = itOrderPrivateCarService.selectById(tReassign.getOrderId());
@@ -602,6 +614,7 @@
        tOrderPrivateCar.setDriverId(driverId);
        tOrderPrivateCar.setCarId(nowDriver.getCarId());
        itOrderPrivateCarService.updateById(tOrderPrivateCar);
        appOperationLogService.addAppOperationLog(ShiroKit.getUser().getId(), "{\"type\":\"调度完成订单改派\",\"orderId\":\"" + tOrderPrivateCar.getId() + "\",\"driver\":\"" + JSON.toJSONString(tOrderPrivateCar) + "\"}");
        //修改专车改派订单
        tReassign.setNowDriverId(driverId);