package insider import ( "Cold_Logistic/internal/pkg/common/codex" "Cold_Logistic/internal/pkg/common/global" "Cold_Logistic/internal/server/application/driversrv" "Cold_Logistic/internal/server/infra/dao" "github.com/gin-gonic/gin" "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/core" "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/errors" ) // carInfo // @Tags 司机 // @Summary 车辆信息 // @Success 200 {object} driversrv.DriverCarInfoRespVO "成功响应的结构体" // @Accept application/json // @Router /app/driver/carInfo [post] func (api Api) carInfo(c *gin.Context) { srv := driversrv.NewDriverService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.DriverCarInfo(c) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) } // taskPage // @Tags 司机 // @Summary 司机任务列表 // @Success 200 {object} swagger.PageListResponse "成功响应的结构体" // @Param req body swagger.TaskPageReqVO true "请求参数" // @Accept application/json // @Router /app/driver/taskPage [post] func (api Api) taskPage(c *gin.Context) { req := driversrv.TaskPageReqVO{} if err := c.BindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } if err := req.Validate(); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrParamValidate, "")) return } srv := driversrv.NewDriverService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.TaskPage(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) } // orderIntoCar // @Tags 司机 // @Summary 装车 // @Success 200 {object} driversrv.OrderIntoCarRespVO "成功响应的结构体" // @Param req body driversrv.OrderIntoCarReqVO true "请求参数" // @Accept application/json // @Router /app/driver/orderIntoCar [post] func (api Api) orderIntoCar(c *gin.Context) { req := driversrv.OrderIntoCarReqVO{} if err := c.ShouldBindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } if err := req.Validate(); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrParamValidate, "")) return } srv := driversrv.NewDriverService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.OrderIntoCar(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) } // orderIntoCar // @Tags 司机 // @Summary 扫码装车 // @Success 200 {object} driversrv.OrderIntoCarRespVO "成功响应的结构体" // @Param req body driversrv.ScanIntoReqVO true "请求参数" // @Accept application/json // @Router /app/driver/scanIntoCar [post] func (api Api) scanIntoCar(c *gin.Context) { req := driversrv.ScanIntoReqVO{} if err := c.ShouldBindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } if err := req.Validate(); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrParamValidate, "")) return } srv := driversrv.NewDriverService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.ScanIntoCar(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) } // orderIntoCar // @Tags 司机 // @Summary 签收 // @Success 200 {object} driversrv.SignReceiptRespVO "成功响应的结构体" // @Param req body driversrv.ScanIntoReqVO true "请求参数" // @failure 400 {string} codex.ErrBindJSON "error" // @Accept application/json // @Router /app/driver/signReceipt [post] func (api Api) signReceipt(c *gin.Context) { req := driversrv.ScanIntoReqVO{} if err := c.ShouldBindJSON(&req); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, "")) return } if err := req.Validate(); err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrParamValidate, "")) return } srv := driversrv.NewDriverService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB)) res, err := srv.SignReceipt(c, req) if err != nil { core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, "")) return } core.WriteResponse(c, nil, res) }