123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- package ordersrv
- import (
- "Cold_Logistic/internal/pkg/common/constant"
- "Cold_Logistic/internal/pkg/common/global"
- "Cold_Logistic/internal/server/infra/models"
- validation "github.com/go-ozzo/ozzo-validation/v4"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/core"
- )
- type AddressVO struct {
- AddressId int `json:"addressId"` // 地址id
- Name string `json:"name"` // 姓名
- Phone string `json:"phone"` // 联系电话
- ProvinceId int `json:"provinceId"` // 省Id
- ProvinceName string `json:"provinceName"` // 省中文名
- CityId int `json:"cityId"` // 市Id
- CityName string `json:"cityName"` // 市中文名
- RegionId int `json:"regionId"` // 区Id
- RegionName string `json:"regionName"` // 区中文名
- Address string `json:"address"` // 详细地址
- IsDefault int `json:"isDefault"` // 是否默认:1-是 2-否
- }
- func (r *AddressVO) Validate() error {
- if r.AddressId > 0 {
- return nil
- }
- return validation.ValidateStruct(r,
- validation.Field(&r.Name, validation.Required),
- validation.Field(&r.Phone, validation.Required),
- validation.Field(&r.ProvinceId, validation.Required),
- validation.Field(&r.CityId, validation.Required),
- validation.Field(&r.Address, validation.Required),
- validation.Field(&r.IsDefault, validation.In(constant.YES, constant.NO)),
- )
- }
- func ConvertAddressReqVO(ent models.AddressBook) (ret AddressVO) {
- ret.AddressId = ent.Id
- ret.Name = ent.Name
- ret.Phone = ent.Phone
- ret.ProvinceId = ent.ProvinceId
- ret.ProvinceName = ent.ProvinceName
- ret.CityId = ent.CityId
- ret.CityName = ent.CityName
- ret.RegionId = ent.RegionId
- ret.RegionName = ent.RegionName
- ret.Address = ent.Address
- ret.IsDefault = ent.IsDefault
- return ret
- }
- type PlaceOrderReqVO struct {
- LogisticId int `json:"logisticId"` // 物流ID
- LogisticPid int `json:"logisticPid"` // 公司ID
- LogisticPidName string `json:"LogisticPidName"` // 公司名称
- Sender AddressVO `json:"sender"` // 寄件人
- Consignee AddressVO `json:"consignee"` // 收件人
- CargoType string `json:"cargoType"` // 货物类型
- TemperatureInterval string `json:"temperatureInterval"` // 温度区间
- CargoNumber int `json:"cargoNumber"` // 货物数量
- DeliveryCondition string `json:"deliveryCondition"` // 配送要求
- DeliveryRemark string `json:"deliveryRemark"` // 运输备注
- TimeLimit int `json:"timeLimit"` // 时效
- PickupTime models.MyTime `json:"pickupTime"` // 取货时间
- IsWeekendPickup int `json:"isWeekendPickup"` // 周末是否取货:1-是 2-否
- IsInsuredValue int `json:"isInsuredValue"` // 是否保价
- }
- func (r *PlaceOrderReqVO) Validate() error {
- return validation.ValidateStruct(r,
- validation.Field(&r.LogisticId, validation.When(r.LogisticPid <= 0, validation.Required)),
- validation.Field(&r.LogisticPid, validation.When(r.LogisticId <= 0, validation.Required)),
- validation.Field(&r.LogisticPidName, validation.When(r.LogisticPid > 0, validation.Required)),
- validation.Field(&r.Sender),
- validation.Field(&r.Consignee),
- validation.Field(&r.CargoType, validation.Required),
- validation.Field(&r.TemperatureInterval, validation.Required),
- validation.Field(&r.DeliveryCondition, validation.Required),
- validation.Field(&r.TimeLimit, validation.Required),
- validation.Field(&r.PickupTime, validation.Required),
- )
- }
- type PlaceOrderRespVO struct {
- OrderNo string
- PlaceOrderTime models.MyTime
- }
- type OrderDetailReqVO struct {
- OrderId int `json:"orderId"` // 订单ID
- }
- func (r *OrderDetailReqVO) Validate() error {
- return validation.ValidateStruct(r, validation.Field(&r.OrderId, validation.Required))
- }
- type OrderDetailRespVO struct {
- OrderId int `json:"orderId"` // 订单ID
- OrderNo string `json:"orderNo"` // 单号
- LogisticName string `json:"logisticName"` // 物流公司
- OrderStatus int `json:"orderStatus"` // 订单状态
- Sender AddressVO `json:"sender"` // 发货人
- Consignee AddressVO `json:"consigneeAddressId"` // 收货人
- CargoType string `json:"cargoType"` // 货物类型
- TemperatureInterval string `json:"temperatureInterval"` // 温度区间
- CargoNumber int `json:"cargoNumber"` // 货物数量
- DeliveryCondition string `json:"deliveryCondition"` // 配送要求
- DeliveryRemark string `json:"deliveryRemark"` // 运输备注
- TimeLimit int `json:"timeLimit"` // 时效
- PickupTime models.MyTime `json:"pickupTime"` // 取货时间
- IsWeekendPickup int `json:"isWeekendPickup"` // 周末是否取货:1-是 2-否
- IsInsuredValue int `json:"isInsuredValue"` // 是否保价
- }
- type OrderLogisticDetailReqVO struct {
- OrderId int `json:"orderId"` // 订单ID
- }
- func (r *OrderLogisticDetailReqVO) Validate() error {
- return validation.ValidateStruct(r, validation.Field(&r.OrderId, validation.Required))
- }
- type QueryExpressOrderReqVO struct {
- OrderNo string `json:"orderNo"` // 运单号
- }
- func (r *QueryExpressOrderReqVO) Validate() error {
- return validation.ValidateStruct(r, validation.Field(&r.OrderNo, validation.Required, validation.RuneLength(1, 30)))
- }
- type QueryExpressOrderRespVO struct {
- OrderId int `json:"orderId"` //
- OrderNo string `json:"orderNo"` // 单号
- OrderStatus int `json:"orderStatus"` // 订单状态
- LogisticName string `json:"logisticName"` // 物流名称
- LatestLocation LocationInfoVO `json:"LatestLocation"` // 最近一次定位信息
- }
- type OrderLogisticDetailRespVO struct {
- OrderId int `json:"orderId"` // 运单ID
- LogisticLink []LocationInfoVO `json:"logisticLink"` // 物流链
- Sender AddressVO `json:"sender"` // 发件人
- Consignee AddressVO `json:"consignee"` // 收件人
- }
- // LocationInfoVO 定位信息
- type LocationInfoVO struct {
- LocationTime models.MyTime `json:"locationTime"` // 到达时间
- Location string `json:"location"` // 位置
- ContactPerson string `json:"contactPerson"` // 联系人
- ContactPhone string `json:"contactPhone"` // 联系电话
- Extend string `json:"extend"`
- SnCode string `json:"snCode"`
- }
- type ManageOrderPageReqVO struct {
- Page core.Page `json:"page"`
- Search struct {
- OrderNo string `json:"orderNo"`
- OrderStatus int `json:"orderStatus"`
- } `json:"search"`
- }
- type AssignOrderReqVO struct {
- OrderId int `json:"orderId"` // 运单ID
- Freight int `json:"freight"` // 运费分
- Driver global.ClodAccount `json:"driver"`
- Destination string `json:"destination"` // 目的地:dest-终点 transit-中转
- }
- func (r *AssignOrderReqVO) Validate() error {
- return validation.ValidateStruct(r,
- validation.Field(&r.OrderId, validation.Required),
- validation.Field(&r.Destination, validation.Required),
- validation.Field(&r.Driver),
- )
- }
- type AssignOrderRespVO struct {
- OrderId int `json:"orderId"` // 运单ID
- }
- type WarehousePageReqVO struct {
- Page core.Page `json:"page"`
- Search struct {
- Name string `json:"name"`
- SnCode string `json:"snCode"`
- } `json:"search"`
- }
|