order.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package manage
  2. import (
  3. "Cold_Logistic/internal/pkg/common/codex"
  4. "Cold_Logistic/internal/pkg/common/global"
  5. "Cold_Logistic/internal/server/application/ordersrv"
  6. "Cold_Logistic/internal/server/infra/dao"
  7. "github.com/gin-gonic/gin"
  8. "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/core"
  9. "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/errors"
  10. )
  11. // orderPage
  12. // @Tags 后台-订单管理
  13. // @Summary 订单列表
  14. // @Success 200 {object} swagger.PageListResponse "成功响应的结构体"
  15. // @Param req body swagger.ManageOrderPageReqVO true "请求参数"
  16. // @Accept application/json
  17. // @Router /manage/order/page [post]
  18. func (api Api) orderPage(c *gin.Context) {
  19. req := ordersrv.ManageOrderPageReqVO{}
  20. if err := c.BindJSON(&req); err != nil {
  21. core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
  22. return
  23. }
  24. srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
  25. res, err := srv.ManageOrderPage(c, req)
  26. if err != nil {
  27. core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
  28. return
  29. }
  30. core.WriteResponse(c, nil, res)
  31. }
  32. // orderDetail
  33. // @Tags 后台-订单管理
  34. // @Summary 订单详情
  35. // @Success 200 {object} ordersrv.OrderDetailRespVO "成功响应的结构体"
  36. // @Param req body ordersrv.OrderDetailReqVO true "请求参数"
  37. // @Accept application/json
  38. // @Router /manage/order/detail [post]
  39. func (api Api) orderDetail(c *gin.Context) {
  40. req := ordersrv.OrderDetailReqVO{}
  41. if err := c.BindJSON(&req); err != nil {
  42. core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
  43. return
  44. }
  45. srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
  46. res, err := srv.OrderDetail(c, req)
  47. if err != nil {
  48. core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
  49. return
  50. }
  51. core.WriteResponse(c, nil, res)
  52. }
  53. // orderLogistic
  54. // @Tags 后台-订单管理
  55. // @Summary 物流详情
  56. // @Success 200 {object} ordersrv.OrderLogisticDetailRespVO "成功响应的结构体"
  57. // @Param req body ordersrv.OrderLogisticDetailReqVO true "请求参数"
  58. // @Accept application/json
  59. // @Router /manage/order/logistic [post]
  60. func (api Api) orderLogistic(c *gin.Context) {
  61. req := ordersrv.OrderLogisticDetailReqVO{}
  62. if err := c.BindJSON(&req); err != nil {
  63. core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
  64. return
  65. }
  66. srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
  67. res, err := srv.OrderLogisticDetail(c, req)
  68. if err != nil {
  69. core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
  70. return
  71. }
  72. core.WriteResponse(c, nil, res)
  73. }
  74. // orderAssign
  75. // @Tags 后台-订单管理
  76. // @Summary 派单订单
  77. // @Success 200 {object} ordersrv.AssignOrderRespVO "成功响应的结构体"
  78. // @Param req body ordersrv.AssignOrderReqVO true "请求参数"
  79. // @Accept application/json
  80. // @Router /manage/order/assign [post]
  81. func (api Api) orderAssign(c *gin.Context) {
  82. req := ordersrv.AssignOrderReqVO{}
  83. if err := c.BindJSON(&req); err != nil {
  84. core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrBindJSON, ""))
  85. return
  86. }
  87. srv := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
  88. res, err := srv.AssignOrder(c, req)
  89. if err != nil {
  90. core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
  91. return
  92. }
  93. core.WriteResponse(c, nil, res)
  94. }