order_bestshop.go
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package domain
import "time"
//OrderBestShop 来源海鲜干货的订单
type OrderBestShop struct {
Id int64 `json:"id"`
//订单编号
OrderCode string `json:"orderCode"`
//下单时间
OrderTime string `json:"orderTime"`
//订单状态
OrderState int8 `json:"orderState"`
//发货状态
DeliveryState int8 `json:"deliveryState"`
//买家名称
BuyerName string `json:"buyerName"`
//买家电话
BuyerPhone string `json:"buyerPhone"`
//买家地址
BuyerAddress string `json:"buyerAddress"`
//买家备注
BuyerRemark string `json:"buyerRemark"`
//
BuyerId int64 `json:"buyerId"`
//商品总数
OrderCount int `json:"orderCount"`
//d订单总额
OrderAmount float64 `json:"orderAmount"`
//发货时间
DeliveryTime string `json:"deliveryTime"`
//创建时间
CreateTime time.Time `json:"createTime"`
PartnerId int64 `json:"partnerId"`
Goods []OrderGoodBestShop `json:"goods"`
//是否将数据同步到 order_base ,order_good
IsCopy bool `json:"isCopy"`
CompanyId int64 `json:"companyId"`
}
func (order OrderBestShop) CopyToOrderBase(o *OrderBase) {
o.Buyer = Buyer{
BuyerName: order.BuyerName,
ContactInfo: order.BuyerPhone,
ShippingAddress: order.BuyerAddress,
Remark: order.BuyerRemark,
}
o.DataFrom = OrderDataFrom{
Platform: OrderDataFromBestShop,
DataId: order.Id,
}
o.OrderCode = order.OrderCode
o.OrderCompute.PlanOrderAmount = order.OrderAmount
o.OrderCompute.PlanOrderCount = order.OrderCount
o.DeliveryTime, _ = time.Parse("2006-01-02 15:04:05", order.DeliveryTime)
return
}
type OrderBestshopFindOneQuery struct {
OrderId int64
}
type OrderBestshopRepository interface {
Add(order *OrderBestShop) error
Edit(order *OrderBestShop) error
FindOne(qureyOptions OrderBestshopFindOneQuery) (*OrderBestShop, error)
}
//OrderGoodBestShop 订单明细
type OrderGoodBestShop struct {
Id int64 `json:"id"`
//订单id
OrderId int64 `json:"orderId"`
//货品编号
Sn string `json:"sn"`
//商品编号
Bn string `json:"bn"`
//货品名称
Name string `json:"name"`
//单价
Price float64 `json:"price"`
//货品数量
Nums int `json:"nums"`
//订单总价
Amount float64 `json:"amount"`
}
func (good OrderGoodBestShop) CopyToOrderGood(g *OrderGood) {
g.DataFrom = OrderDataFrom{
Platform: OrderDataFromBestShop,
DataId: good.Id,
}
g.GoodName = good.Name
g.Price = good.Price
g.PlanGoodNumber = good.Nums
g.GoodCompute.PlanAmount = good.Amount
return
}
type OrderGoodBestshopFindQuery struct {
OrderId int64
}
type OrderGoodBestshopRepository interface {
Add(order *OrderGoodBestShop) error
Find(qureyOptions OrderGoodBestshopFindQuery) ([]OrderGoodBestShop, error)
}