dividends_estimate.go
4.0 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
package domain
import "time"
const (
UNDERTAKER = iota + 1 // 承接人
REFERRER // 推荐人
SALESMAN // 业务员
)
const (
ORDER_DIVIDENDS = iota + 1 // 订单分红
RETURN_WRITE_OFF // 退货冲销
MONEY_INCENTIVES // 金额激励
)
const (
TO_BE_ACCOUNT = iota + 1 // 待结算
ACCOUNTED // 已结算
)
// DividendsEstimate 分红预算实体
type DividendsEstimate struct {
// 承接人分红预算记录ID
DividendsEstimateId int64 `json:"dividendsEstimateId,string"`
// 分红结算状态,1待结算,2已结算
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"`
// 分红类型名称
DividendsTypeName string `json:"dividendsTypeName"`
// 分红订单号或退货单号
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
// 共创项目合约编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001
CooperationContractNumber string `json:"cooperationContractNumber"`
// 分红用户(共创参与)
DividendsUser *User `json:"dividendsUser"`
// 分红阶段
DividendsStage int32 `json:"dividendsStage"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 操作人
Operator *User `json:"operator"`
// 操作时间
OperateTime time.Time `json:"operateTime"`
// 取消状态
IsCanceled bool `json:"isCanceled"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
}
type DividendsEstimateRepository interface {
Save(dividendsEstimate *DividendsEstimate) (*DividendsEstimate, error)
UpdateMany(dividendsEstimates []*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 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.CooperationContractNumber = cooperationProjectNumber.(string)
}
if isCanceled, ok := data["isCanceled"]; ok {
dividendsEstimate.IsCanceled = isCanceled.(bool)
}
return nil
}