12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package myselfsrv
- import (
- "Cold_Logistic/internal/pkg/common/constant"
- "Cold_Logistic/internal/pkg/common/global"
- "Cold_Logistic/internal/server/infra/dao"
- "Cold_Logistic/internal/server/infra/models"
- "context"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/core"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/errors"
- )
- // OrderPage 寄件列表
- func (srv *MyselfService) OrderPage(ctx context.Context, req OrderPageReqVO) (res core.PageListResponse, err error) {
- dto := dao.ExpressOrderPageDTO{
- Page: req.Page,
- OrderNo: req.Search.OrderNo,
- OrderStatus: req.Search.OrderStatus,
- }
- if req.Search.SearchDateTime != "" {
- dto.PlaceOrderStartTime.Time, dto.PlaceOrderEndTime.Time = req.Search.SearchDateTime.GetRangeTime()
- } else {
- dto.PlaceOrderStartTime = req.Search.PlaceOrderStartTime
- dto.PlaceOrderEndTime = req.Search.PlaceOrderEndTime
- }
- list, total, err := srv.store.ExpressOrder().MyPage(ctx, dto)
- if err != nil {
- return res, errors.WithStackOnce(err)
- }
- res.Total = total
- res.TotalPage = total / int64(req.Page.Size)
- res.Count = len(list)
- res.List = list
- return res, nil
- }
- func (srv *MyselfService) OrderSubNo(ctx context.Context, req OrderSubNoReqVO) (res OrderSubNoRespVO, err error) {
- order := models.ExpressOrder{}
- if err = srv.store.ExpressOrder().FirstById(ctx, &order, req.OrderId); err != nil {
- return res, errors.WithStackOnce(err)
- }
- var subNo string
- if order.OrderStatus == constant.OrderStatusWaitCar {
- subNo, err = global.CommonConnectRepoInst.Redis.Get(ctx, order.OrderNo).Result()
- if err != nil {
- return res, errors.WithStackOnce(err)
- }
- }
- res.OrderSubNo = subNo
- return res, nil
- }
|