123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- package public
- import (
- "Cold_Logistic/internal/pkg/common/codex"
- "Cold_Logistic/internal/pkg/common/global"
- "Cold_Logistic/internal/server/application/devicesrv"
- "Cold_Logistic/internal/server/application/ordersrv"
- "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"
- )
- // queryExpressOrder
- // @Tags 公开接口不登录
- // @BasePath /clodLogistic/app/api/v1
- // @Summary 查运单
- // @Success 200 {object} ordersrv.QueryExpressOrderRespVO
- // @Fail 400 {object} swagger.BaseResponse
- // @Param req body ordersrv.QueryExpressOrderReqVO true "运单号"
- // @Accept application/json
- // @Authorization Bearer
- // @Router /app/public/queryOrder [post]
- func (api Api) queryExpressOrder(c *gin.Context) {
- req := ordersrv.QueryExpressOrderReqVO{}
- 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 := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.QueryExpressOrder(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // logisticDetail
- // @Tags 公开接口不登录
- // @BasePath /clodLogistic/app/api/v1
- // @Summary 物流详情
- // @Success 200 {object} ordersrv.OrderLogisticDetailRespVO
- // @Param req body ordersrv.OrderLogisticDetailReqVO true "订单id"
- // @Accept application/json
- // @Router /app/public/logisticDetail [post]
- func (api Api) logisticDetail(c *gin.Context) {
- req := ordersrv.OrderLogisticDetailReqVO{}
- 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 := ordersrv.NewOrderService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.OrderLogisticDetail(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // logisticDetail
- // @Tags 公开接口不登录
- // @BasePath /clodLogistic/app/api/v1
- // @Summary 设备探头列表
- // @Success 200 {object} devicesrv.DeviceSensorListRespVO
- // @Param req body devicesrv.DeviceSensorListReqVO true "SN"
- // @Accept application/json
- // @Router /app/public/deviceSensorList [post]
- func (api Api) deviceSensorList(c *gin.Context) {
- req := devicesrv.DeviceSensorListReqVO{}
- 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 := devicesrv.NewDeviceService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.DeviceSensorList(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
- // logisticDetail
- // @Tags 公开接口不登录
- // @Summary 设备数据列表
- // @Success 200 {} swagger.PageListResponse
- // @Param req body swagger.SnDataListReqVO true "SN数据"
- // @Accept application/json
- // @Router /app/public/sensorDataList [post]
- func (api Api) snDataList(c *gin.Context) {
- req := devicesrv.SnDataListReqVO{}
- 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 := devicesrv.NewDeviceService(dao.NewDataStore(global.CommonConnectRepoInst.StoreDB))
- res, err := srv.SnDataList(c, req)
- if err != nil {
- core.WriteErrResponse(c, errors.WithCodeOnce(err, codex.ErrQueryFailed, ""))
- return
- }
- core.WriteResponse(c, nil, res)
- }
|