dividends_incentives_rule.go
3.4 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
package domain
import (
"time"
)
// DividendsIncentivesRule 金额激励规则实体
type DividendsIncentivesRule struct {
// 分红规则ID
DividendsIncentivesRuleId int64 `json:"dividendsIncentivesRuleId,string"`
// 关联的项目合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 推荐人抽成比例
ReferrerPercentage float64 `json:"referrerPercentage"`
// 业务员抽成比例
SalesmanPercentage float64 `json:"salesmanPercentage"`
// 分红规则激励百分点
DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"`
// 分红规则激励阶段,阶段返回时需要转换为中文数字
DividendsIncentivesStage int32 `json:"dividendsIncentivesStage"`
// 分红激励规则阶段中文表示
DividendsIncentivesStageCN string `json:"dividendsIncentivesStageCN"`
// 分红规则激励阶段结束
DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"`
// 分红规则激励阶段开始
DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"`
// 分红激励规则说明
Remarks string `json:"remarks"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
}
type DividendsIncentivesRuleRepository interface {
Save(dividendsIncentivesRule *DividendsIncentivesRule) (*DividendsIncentivesRule, error)
Remove(dividendsIncentivesRule *DividendsIncentivesRule) (*DividendsIncentivesRule, error)
FindOne(queryOptions map[string]interface{}) (*DividendsIncentivesRule, error)
Find(queryOptions map[string]interface{}) (int64, []*DividendsIncentivesRule, error)
}
func (dividendsIncentivesRule *DividendsIncentivesRule) Identify() interface{} {
if dividendsIncentivesRule.DividendsIncentivesRuleId == 0 {
return nil
}
return dividendsIncentivesRule.DividendsIncentivesRuleId
}
func (dividendsIncentivesRule *DividendsIncentivesRule) Update(data map[string]interface{}) error {
if dividendsIncentivesRuleId, ok := data["dividendsIncentivesRuleId"]; ok {
dividendsIncentivesRule.DividendsIncentivesRuleId = dividendsIncentivesRuleId.(int64)
}
if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok {
dividendsIncentivesRule.CooperationContractNumber = cooperationContractNumber.(string)
}
if referrerPercentage, ok := data["referrerPercentage"]; ok {
dividendsIncentivesRule.ReferrerPercentage = referrerPercentage.(float64)
}
if salesmanPercentage, ok := data["salesmanPercentage"]; ok {
dividendsIncentivesRule.SalesmanPercentage = salesmanPercentage.(float64)
}
if dividendsIncentivesPercentage, ok := data["dividendsIncentivesPercentage"]; ok {
dividendsIncentivesRule.DividendsIncentivesPercentage = dividendsIncentivesPercentage.(float64)
}
if dividendsIncentivesStage, ok := data["dividendsIncentivesStage"]; ok {
dividendsIncentivesRule.DividendsIncentivesStage = dividendsIncentivesStage.(int32)
}
if dividendsIncentivesStageEnd, ok := data["dividendsIncentivesStageEnd"]; ok {
dividendsIncentivesRule.DividendsIncentivesStageEnd = dividendsIncentivesStageEnd.(time.Time)
}
if dividendsIncentivesStageStart, ok := data["dividendsIncentivesStageStart"]; ok {
dividendsIncentivesRule.DividendsIncentivesStageStart = dividendsIncentivesStageStart.(time.Time)
}
dividendsIncentivesRule.UpdatedAt = time.Now()
return nil
}