dividends_estimate.go
5.8 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package domain
import "time"
// 分红预算实体
type DividendsEstimate struct {
// 承接人分红预算记录ID
DividendsEstimateId int64 `json:"dividendsEstimateId,string"`
// 分红结算状态
DividendsAccountStatus int32 `json:"dividendsAccountStatus"`
// 分红金额
DividendsAmount float64 `json:"dividendsAmount"`
// 承接人分红预算单号
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
// 分红预算时间
DividendsEstimateTime time.Time `json:"dividendsEstimateTime"`
// 参与分红类型,1承接人,2推荐人,3关联业务员
DividendsParticipateType int32 `json:"dividendsParticipateType"`
// 分红类型,1订单分红,2退货冲销,3金额激励
DividendsType int32 `json:"dividendsType"`
// 分红订单号或退货单号
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
// 共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 分红用户
DividendsUser *User `json:"dividendsUser"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 操作人
Operator *User `json:"operator"`
// 操作时间
OperateTime time.Time `json:"operateTime"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
}
type DividendsEstimateRepository interface {
Save(dividendsEstimate *DividendsEstimate) (*DividendsEstimate, error)
Remove(dividendsEstimate *DividendsEstimate) (*DividendsEstimate, error)
FindOne(queryOptions map[string]interface{}) (*DividendsEstimate, error)
Find(queryOptions map[string]interface{}) (int64, []*DividendsEstimate, error)
}
func (dividendsEstimate *DividendsEstimate) Identify() interface{} {
if dividendsEstimate.DividendsEstimateId == 0 {
return nil
}
return dividendsEstimate.DividendsEstimateId
}
func (dividendsEstimate *DividendsEstimate) Update(data map[string]interface{}) error {
if dividendsEstimateId, ok := data["dividendsEstimateId"]; ok {
dividendsEstimate.DividendsEstimateId = dividendsEstimateId.(int64)
}
if dividendsAccountStatus, ok := data["dividendsAccountStatus"]; ok {
dividendsEstimate.DividendsAccountStatus = dividendsAccountStatus.(int32)
}
if dividendsAmount, ok := data["dividendsAmount"]; ok {
dividendsEstimate.DividendsAmount = dividendsAmount.(float64)
}
if dividendsEstimateOrderNumber, ok := data["dividendsEstimateOrderNumber"]; ok {
dividendsEstimate.DividendsEstimateOrderNumber = dividendsEstimateOrderNumber.(string)
}
if dividendsEstimateTime, ok := data["dividendsEstimateTime"]; ok {
dividendsEstimate.DividendsEstimateTime = dividendsEstimateTime.(time.Time)
}
if dividendsParticipateType, ok := data["dividendsParticipateType"]; ok {
dividendsEstimate.DividendsParticipateType = dividendsParticipateType.(int32)
}
if dividendsType, ok := data["dividendsType"]; ok {
dividendsEstimate.DividendsType = dividendsType.(int32)
}
if orderOrReturnedOrderNum, ok := data["orderOrReturnedOrderNum"]; ok {
dividendsEstimate.OrderOrReturnedOrderNum = orderOrReturnedOrderNum.(string)
}
if cooperationProjectNumber, ok := data["cooperationProjectNumber"]; ok {
dividendsEstimate.CooperationProjectNumber = cooperationProjectNumber.(string)
}
if userId, ok := data["userId"]; ok {
dividendsEstimate.DividendsUser.UserId = userId.(int64)
}
if userBaseId, ok := data["userBaseId"]; ok {
dividendsEstimate.DividendsUser.UserBaseId = userBaseId.(int64)
}
if orgId, ok := data["orgId"]; ok {
dividendsEstimate.DividendsUser.Org.OrgId = orgId.(int64)
}
if orgName, ok := data["orgName"]; ok {
dividendsEstimate.DividendsUser.Org.OrgName = orgName.(string)
}
if companyId, ok := data["companyId"]; ok {
dividendsEstimate.DividendsUser.Org.Company.CompanyId = companyId.(int64)
}
if companyLogo, ok := data["companyLogo"]; ok {
dividendsEstimate.DividendsUser.Org.Company.CompanyLogo = companyLogo.(string)
}
if companyName, ok := data["companyName"]; ok {
dividendsEstimate.DividendsUser.Org.Company.CompanyName = companyName.(string)
}
if orgs, ok := data["orgs"]; ok {
dividendsEstimate.DividendsUser.Orgs = orgs.([]*Org)
}
if departmentId, ok := data["departmentId"]; ok {
dividendsEstimate.DividendsUser.Department.DepartmentId = departmentId.(int64)
}
if departmentName, ok := data["departmentName"]; ok {
dividendsEstimate.DividendsUser.Department.DepartmentName = departmentName.(string)
}
if departmentNumber, ok := data["departmentNumber"]; ok {
dividendsEstimate.DividendsUser.Department.DepartmentNumber = departmentNumber.(string)
}
if isOrganization, ok := data["isOrganization"]; ok {
dividendsEstimate.DividendsUser.Department.IsOrganization = isOrganization.(bool)
}
if roleId, ok := data["roleId"]; ok {
dividendsEstimate.DividendsUser.Role.RoleId = roleId.(int64)
}
if roleName, ok := data["roleName"]; ok {
dividendsEstimate.DividendsUser.Role.RoleName = roleName.(string)
}
if userAvatar, ok := data["userAvatar"]; ok {
dividendsEstimate.DividendsUser.UserInfo.UserAvatar = userAvatar.(string)
}
if userEmail, ok := data["userEmail"]; ok {
dividendsEstimate.DividendsUser.UserInfo.UserEmail = userEmail.(string)
}
if userName, ok := data["userName"]; ok {
dividendsEstimate.DividendsUser.UserInfo.UserName = userName.(string)
}
if userPhone, ok := data["userPhone"]; ok {
dividendsEstimate.DividendsUser.UserInfo.UserPhone = userPhone.(string)
}
if userAccount, ok := data["userAccount"]; ok {
dividendsEstimate.DividendsUser.UserInfo.UserAccount = userAccount.(string)
}
if userType, ok := data["userType"]; ok {
dividendsEstimate.DividendsUser.UserType = userType.(int32)
}
if status, ok := data["status"]; ok {
dividendsEstimate.DividendsUser.Status = status.(int32)
}
return nil
}