dto.go
3.9 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
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type DividendsOrder struct {
Company struct {
CompanyID int `json:"companyId,string"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
CustomerName string `json:"customerName"` //客户名字
DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime int64 `json:"dividendTime"` //分红订单分红时间
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderID int `json:"dividendsOrderId,string,"` //分红订单
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OrderTime int64 `json:"orderTime"` //订单日日期 13位毫秒输出
Org struct {
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
} `json:"org"`
Region struct {
RegionName string `json:"regionName"`
RegionNumber string `json:"regionNumber"`
} `json:"region"`
Remarks string `json:"remarks"`
Goods []DividendsOrderGoods `json:"goods"`
Returned bool `json:"returned"`
AuthFlag bool `json:"authFlag"`
}
type DividendsOrderGoods struct {
// 订单产品
OrderGoodId int64 `json:"orderGoodId,string"`
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
}
func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder, operatorOrgId int64) *DividendsOrder {
goods := []DividendsOrderGoods{}
for _, v := range param.Goods {
good := DividendsOrderGoods{
OrderGoodId: v.OrderGoodId,
CooperationContractNumber: v.CooperationContractNumber,
DividendsOrderNumber: v.DividendsOrderNumber,
OrderGoodAmount: v.OrderGoodAmount,
OrderGoodExpense: v.OrderGoodExpense,
OrderGoodName: v.OrderGoodName,
OrderGoodPrice: v.OrderGoodPrice,
OrderGoodQuantity: v.OrderGoodQuantity,
OrderGoodDividendsStatus: v.OrderGoodDividendsStatus,
}
goods = append(goods, good)
}
data := DividendsOrder{
Company: param.Company,
CustomerName: param.CustomerName,
DividendStatus: param.DividendStatus,
DividendTime: param.DividendTime.UnixNano() / 1e6,
DividendsOrderAmount: param.DividendsOrderAmount,
DividendsOrderID: param.DividendsOrderID,
DividendsOrderNumber: param.DividendsOrderNumber,
DividendsOriginalOrderNum: param.DividendsOriginalOrderNum,
OrderTime: param.OrderTime.UnixNano() / 1e6, //转为毫米输出
Org: param.Org,
Region: param.Region,
Remarks: param.Remarks,
Goods: goods,
Returned: param.Returned,
AuthFlag: param.Org.OrgID == int(operatorOrgId),
}
return &data
}