123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- 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)
- }
|