puzhibing
2023-08-30 34eb869e7350173ff036881fc776bc27d5be6d7a
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/OrderController.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.supersavedriving.driver.modular.system.model.DivisionRecord;
import com.supersavedriving.driver.modular.system.model.Driver;
import com.supersavedriving.driver.modular.system.model.Order;
@@ -13,6 +14,7 @@
import com.supersavedriving.driver.modular.system.util.MallBook.model.ReceiveUser;
import com.supersavedriving.driver.modular.system.util.MallBook.util.RSASignature;
import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest;
import com.supersavedriving.driver.modular.system.util.PushUtil;
import com.supersavedriving.driver.modular.system.util.rongyun.RongYunUtil;
import com.supersavedriving.driver.modular.system.util.rongyun.model.CloudRecordingCallback;
import com.supersavedriving.driver.modular.system.warpper.*;
@@ -25,6 +27,7 @@
import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,13 +61,13 @@
    private IDriverService driverService;
    @Autowired
    private RongYunUtil rongYunUtil;
    @Autowired
    private IRechargeRecordService rechargeRecordService;
    @Autowired
    private IDivisionRecordService divisionRecordService;
    @Autowired
    private PushUtil pushUtil;
@@ -265,9 +268,10 @@
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"),
            @ApiImplicitParam(value = "原因", name = "cause", required = true, dataType = "string"),
            @ApiImplicitParam(value = "phone", name = "phone", required = false, dataType = "string"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper transferOrder(Long orderId, String cause){
    public ResponseWarpper transferOrder(Long orderId, String cause,String phone){
        if(ToolUtil.isEmpty(orderId)){
            return ResponseWarpper.success(ResultUtil.paranErr("orderId"));
        }
@@ -279,12 +283,37 @@
            if(null == uid){
                return ResponseWarpper.tokenErr();
            }
            ResultUtil resultUtil = orderService.transferOrder(uid, orderId, cause);
            ResultUtil resultUtil = orderService.transferOrder(uid, orderId, cause,phone);
            return ResponseWarpper.success(resultUtil);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
        }
    }
    @ResponseBody
    @PostMapping("/api/order/transferOrderVerify")
//    @ServiceLog(name = "司机转单操作", url = "/api/order/transferOrder")
    @ApiOperation(value = "司机转单操作验证", tags = {"司机端-服务中"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "phone", name = "phone", required = false, dataType = "string"),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResponseWarpper transferOrderVerify(String phone){
        if(phone!=null && !"".equals(phone)) {
            List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("phone", phone));
            if (drivers.size() == 0) {
                return new ResponseWarpper(500,"暂无该司机,无法转单");
            } else {
                Driver driver = drivers.get(0);
                if (driver.getServerStatus() != 1) {
                    return new ResponseWarpper(500,"司机正在服务中,无法转单。");
                }
                if (driver.getStatus() != 1) {
                    return new ResponseWarpper(500,"该司机已被冻结,无法转单。");
                }
            }
        }
        return ResponseWarpper.success();
    }
@@ -646,4 +675,17 @@
            e.printStackTrace();
        }
    }
    /**
     * 管理后台调用推送
     * @param id
     * @param type
     * @param pushOrderInfoWarpper
     */
    @ResponseBody
    @PostMapping("/base/order/pushOrderInfo")
    public void pushOrderInfo(Integer id, Integer type, PushOrderInfoWarpper pushOrderInfoWarpper){
        pushUtil.pushOrderInfo(id, type, pushOrderInfoWarpper);
    }
}