作者 yangfu
@@ -36,13 +36,13 @@ type CreateCooperationContractCommand struct { @@ -36,13 +36,13 @@ type CreateCooperationContractCommand struct {
36 // 业务员抽成比例 36 // 业务员抽成比例
37 SalesmanPercentage float64 `json:"salesmanPercentage"` 37 SalesmanPercentage float64 `json:"salesmanPercentage"`
38 // 分红规则激励百分点 38 // 分红规则激励百分点
39 - DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"` 39 + DividendsPercentage float64 `json:"dividendsPercentage"`
40 // 分红规则激励阶段, 40 // 分红规则激励阶段,
41 - DividendsIncentivesStage int `json:"dividendsIncentivesStage,string,"` 41 + DividendsStage int `json:"dividendsStage"`
42 // 分红规则激励阶段结束 42 // 分红规则激励阶段结束
43 - DividendsIncentivesStageEnd int `json:"dividendsIncentivesStageEnd"` 43 + DividendsStageEnd int `json:"dividendsStageEnd"`
44 // 分红规则激励阶段开始 44 // 分红规则激励阶段开始
45 - DividendsIncentivesStageStart int `json:"dividendsIncentivesStageStart"` 45 + DividendsStageStart int `json:"dividendsStageStart"`
46 } `json:"dividendsIncentivesRules"` 46 } `json:"dividendsIncentivesRules"`
47 // 金额激励规则列表 47 // 金额激励规则列表
48 MoneyIncentivesRules []struct { 48 MoneyIncentivesRules []struct {
@@ -31,6 +31,7 @@ type UpdateCooperationContractCommand struct { @@ -31,6 +31,7 @@ type UpdateCooperationContractCommand struct {
31 } `json:"cooperationContract"` 31 } `json:"cooperationContract"`
32 // 业绩分红激励规则列表 32 // 业绩分红激励规则列表
33 DividendsIncentivesRules []struct { 33 DividendsIncentivesRules []struct {
  34 + DividendsIncentivesRuleId string `json:"dividendsIncentivesRuleId"`
34 // 关联的项目合约编号 35 // 关联的项目合约编号
35 CooperationContractNumber string `json:"cooperationContractNumber"` 36 CooperationContractNumber string `json:"cooperationContractNumber"`
36 // 推荐人抽成比例 37 // 推荐人抽成比例
@@ -57,7 +57,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon @@ -57,7 +57,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon
57 } 57 }
58 58
59 type MoneyIncentivesRule struct { 59 type MoneyIncentivesRule struct {
60 - MoneyIncentivesRuleId int `json:"moneyIncentivesRuleId"` 60 + MoneyIncentivesRuleId int `json:"moneyIncentivesRuleId,string"`
61 CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的共创合约编号 61 CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的共创合约编号
62 MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"` // 激励金额 62 MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"` // 激励金额
63 MoneyIncentivesStage int `json:"moneyIncentivesStage"` // 金额激励阶段 63 MoneyIncentivesStage int `json:"moneyIncentivesStage"` // 金额激励阶段
@@ -67,14 +67,14 @@ type MoneyIncentivesRule struct { @@ -67,14 +67,14 @@ type MoneyIncentivesRule struct {
67 } 67 }
68 68
69 type DividendsIncentivesRule struct { 69 type DividendsIncentivesRule struct {
70 - DividendsIncentivesRuleId int `json:"dividendsIncentivesRuleId"`  
71 - CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的项目合约编号  
72 - ReferrerPercentage float64 `json:"referrerPercentage"` // 推荐人抽成比例  
73 - SalesmanPercentage float64 `json:"salesmanPercentage"` // 业务员抽成比例  
74 - DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"` // 分红规则激励百分点  
75 - DividendsIncentivesStage int `json:"dividendsIncentivesStage,string"` // 分红规则激励阶段,  
76 - DividendsIncentivesStageEnd int64 `json:"dividendsIncentivesStageEnd"` // 分红规则激励阶段结束  
77 - DividendsIncentivesStageStart int64 `json:"dividendsIncentivesStageStart"` // 分红规则激励阶段开始 70 + DividendsIncentivesRuleId int `json:"dividendsIncentivesRuleId,string"`
  71 + CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的项目合约编号
  72 + ReferrerPercentage float64 `json:"referrerPercentage"` // 推荐人抽成比例
  73 + SalesmanPercentage float64 `json:"salesmanPercentage"` // 业务员抽成比例
  74 + DividendsPercentage float64 `json:"dividendsPercentage"` // 分红规则激励百分点
  75 + DividendsStage int `json:"dividendsStage,string"` // 分红规则激励阶段,
  76 + DividendsStageEnd int64 `json:"dividendsStageEnd"` // 分红规则激励阶段结束
  77 + DividendsStageStart int64 `json:"dividendsStageStart"` // 分红规则激励阶段开始
78 } 78 }
79 79
80 type Relevant struct { 80 type Relevant struct {
@@ -84,14 +84,21 @@ type Relevant struct { @@ -84,14 +84,21 @@ type Relevant struct {
84 } 84 }
85 85
86 type ContractUndertaker struct { 86 type ContractUndertaker struct {
87 - UndertakerId int `json:"undertakerId,string"` 87 + UndertakerId int `json:"undertakerId,string,"`
88 Attachment []domain.Attachment `json:"attachment"` 88 Attachment []domain.Attachment `json:"attachment"`
89 Department domain.Department `json:"department"` 89 Department domain.Department `json:"department"`
90 HasReferrer bool `json:"hasReferrer"` 90 HasReferrer bool `json:"hasReferrer"`
91 HasSalesman bool `json:"hasSalesman"` 91 HasSalesman bool `json:"hasSalesman"`
92 - ReferrerUser domain.UserInfo `json:"referrerUser"`  
93 - SalesmanUser domain.UserInfo `json:"salesmanUser"`  
94 - UserInfo domain.UserInfo `json:"userInfo"` 92 + ReferrerUser struct {
  93 + UserId int `json:"userId,string"`
  94 + UserInfo domain.UserInfo `json:"userInfo"`
  95 + } `json:"referrerUser"`
  96 + SalesmanUser struct {
  97 + UserId int `json:"userId,string"`
  98 + UserInfo domain.UserInfo `json:"userInfo"`
  99 + }
  100 + UserId int `json:"userId,string"`
  101 + UserInfo domain.UserInfo `json:"userInfo"`
95 } 102 }
96 type CooperationContractInfo struct { 103 type CooperationContractInfo struct {
97 CooperationContract CooperationContractItem `json:"cooperationContract"` 104 CooperationContract CooperationContractItem `json:"cooperationContract"`
@@ -126,14 +133,14 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon @@ -126,14 +133,14 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
126 133
127 for _, v := range param.DividendsIncentivesRules { 134 for _, v := range param.DividendsIncentivesRules {
128 r := DividendsIncentivesRule{ 135 r := DividendsIncentivesRule{
129 - DividendsIncentivesRuleId: v.DividendsIncentivesRuleId,  
130 - CooperationContractNumber: v.CooperationContractNumber,  
131 - ReferrerPercentage: v.ReferrerPercentage,  
132 - SalesmanPercentage: v.SalesmanPercentage,  
133 - DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,  
134 - DividendsIncentivesStage: v.DividendsIncentivesStage,  
135 - DividendsIncentivesStageEnd: v.DividendsIncentivesStageEnd.UnixNano() / 1e6,  
136 - DividendsIncentivesStageStart: v.DividendsIncentivesStageStart.UnixNano() / 1e6, 136 + DividendsIncentivesRuleId: v.DividendsIncentivesRuleId,
  137 + CooperationContractNumber: v.CooperationContractNumber,
  138 + ReferrerPercentage: v.ReferrerPercentage,
  139 + SalesmanPercentage: v.SalesmanPercentage,
  140 + DividendsPercentage: v.DividendsIncentivesPercentage,
  141 + DividendsStage: v.DividendsIncentivesStage,
  142 + DividendsStageEnd: v.DividendsIncentivesStageEnd.UnixNano() / 1e6,
  143 + DividendsStageStart: v.DividendsIncentivesStageStart.UnixNano() / 1e6,
137 } 144 }
138 dividendsIncentivesRules = append(dividendsIncentivesRules, r) 145 dividendsIncentivesRules = append(dividendsIncentivesRules, r)
139 } 146 }
@@ -152,33 +159,35 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon @@ -152,33 +159,35 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
152 } 159 }
153 160
154 for _, v := range param.Undertakers { 161 for _, v := range param.Undertakers {
  162 + attachment := v.ContractAttachment
  163 + if len(attachment) == 0 {
  164 + attachment = []domain.Attachment{}
  165 + }
155 u := ContractUndertaker{ 166 u := ContractUndertaker{
156 - Attachment: v.ContractAttachment, 167 + Attachment: attachment,
157 Department: domain.Department{ 168 Department: domain.Department{
158 DepartmentNumber: v.Department.DepartmentNumber, 169 DepartmentNumber: v.Department.DepartmentNumber,
159 DepartmentId: int(v.Department.DepartmentId), 170 DepartmentId: int(v.Department.DepartmentId),
160 DepartmentName: v.Department.DepartmentName, 171 DepartmentName: v.Department.DepartmentName,
161 }, 172 },
162 - HasReferrer: v.Referrer.UserId > 0,  
163 - HasSalesman: v.Salesman.UserId > 0,  
164 - ReferrerUser: domain.UserInfo{  
165 - UsersName: v.Referrer.UserInfo.UserName,  
166 - Phone: v.Referrer.UserInfo.UserPhone,  
167 - UsersId: v.Referrer.UserId,  
168 - // UserCode :v.  
169 - },  
170 - SalesmanUser: domain.UserInfo{  
171 - UsersName: v.Salesman.UserInfo.UserName,  
172 - UsersId: v.Salesman.UserId,  
173 - Phone: v.Salesman.UserInfo.UserPhone,  
174 - }, 173 + HasReferrer: v.Referrer.UserId > 0,
  174 + HasSalesman: v.Salesman.UserId > 0,
175 UndertakerId: v.UndertakerId, 175 UndertakerId: v.UndertakerId,
  176 + UserId: v.UserId,
176 UserInfo: domain.UserInfo{ 177 UserInfo: domain.UserInfo{
177 UsersName: v.UserInfo.UserName, 178 UsersName: v.UserInfo.UserName,
178 UsersId: v.UserId, 179 UsersId: v.UserId,
179 Phone: v.UserInfo.UserPhone, 180 Phone: v.UserInfo.UserPhone,
180 }, 181 },
181 } 182 }
  183 + u.SalesmanUser.UserId = v.Salesman.UserId
  184 + u.SalesmanUser.UserInfo.UsersId = v.Salesman.UserId
  185 + u.SalesmanUser.UserInfo.UsersName = v.Salesman.UserInfo.UserName
  186 + u.SalesmanUser.UserInfo.Phone = v.Salesman.UserInfo.UserPhone
  187 + u.ReferrerUser.UserId = v.Referrer.UserId
  188 + u.ReferrerUser.UserInfo.UsersId = v.Referrer.UserId
  189 + u.ReferrerUser.UserInfo.UsersName = v.Referrer.UserInfo.UserName
  190 + u.ReferrerUser.UserInfo.Phone = v.Referrer.UserInfo.UserPhone
182 contractUndertaker = append(contractUndertaker, u) 191 contractUndertaker = append(contractUndertaker, u)
183 } 192 }
184 undertakerTypesUncheckedAvailable := param.UndertakerTypesUncheckedAvailable 193 undertakerTypesUncheckedAvailable := param.UndertakerTypesUncheckedAvailable
@@ -26,10 +26,10 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -26,10 +26,10 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
26 CooperationContractNumber: v.CooperationContractNumber, 26 CooperationContractNumber: v.CooperationContractNumber,
27 ReferrerPercentage: v.ReferrerPercentage, 27 ReferrerPercentage: v.ReferrerPercentage,
28 SalesmanPercentage: v.SalesmanPercentage, 28 SalesmanPercentage: v.SalesmanPercentage,
29 - DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,  
30 - DividendsIncentivesStage: v.DividendsIncentivesStage,  
31 - DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsIncentivesStageEnd/1e3), 0),  
32 - DividendsIncentivesStageStart: time.Unix(int64(v.DividendsIncentivesStageStart/1e3), 0), 29 + DividendsIncentivesPercentage: v.DividendsPercentage,
  30 + DividendsIncentivesStage: v.DividendsStage,
  31 + DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsStageEnd/1e3), 0),
  32 + DividendsIncentivesStageStart: time.Unix(int64(v.DividendsStageStart/1e3), 0),
33 } 33 }
34 rules1 = append(rules1, r) 34 rules1 = append(rules1, r)
35 } 35 }
@@ -39,42 +39,31 @@ func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDivi @@ -39,42 +39,31 @@ func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDivi
39 39
40 //金额激励列表 40 //金额激励列表
41 type DividendsEstimateMoneyItem struct { 41 type DividendsEstimateMoneyItem struct {
42 - CooperationContractName string `json:"cooperationContractName"` //合约名称  
43 - CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码  
44 - CooperationMode struct {  
45 - CooperationModeId int `json:"cooperationModeId"`  
46 - CooperationModeName string `json:"cooperationModeName"`  
47 - CooperationModeNumber string `json:"cooperationModeNumber"`  
48 - } `json:"cooperationMode"` //共创模式  
49 - CreatedAt int64 `json:"createdAt"` //合约建立时间  
50 - Department struct {  
51 - DepartmentId int `json:"departmentId"` 42 + CooperationContractId int `json:"cooperationContractId,string"` // 共创合约ID
  43 + CooperationContractName string `json:"cooperationContractName"` //合约名称
  44 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码
  45 + CooperationModeName string `json:"cooperationModeName"`
  46 + CreatedAt int64 `json:"createdAt"` //合约建立时间
  47 + Department struct {
  48 + DepartmentId int `json:"departmentId,string"`
52 DepartmentName string `json:"departmentName"` 49 DepartmentName string `json:"departmentName"`
53 } `json:"department"` //发起部门 50 } `json:"department"` //发起部门
54 - CooperationContractSponsor struct {  
55 - UserId int `json:"userId"`  
56 - UserBaseId int `json:"userBaseId"`  
57 - UsersName string `json:"userName"`  
58 - Phone string `json:"phone"`  
59 - } `json:"cooperationContractSponsor"` //合约发起人 51 + CooperationContractSponsorName string `json:"cooperationContractSponsorName"`
60 } 52 }
61 53
62 func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividendsEstimateSearchMoney) []DividendsEstimateMoneyItem { 54 func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividendsEstimateSearchMoney) []DividendsEstimateMoneyItem {
63 var listdata []DividendsEstimateMoneyItem 55 var listdata []DividendsEstimateMoneyItem
64 for _, v := range param.Grid.List { 56 for _, v := range param.Grid.List {
65 item := DividendsEstimateMoneyItem{ 57 item := DividendsEstimateMoneyItem{
  58 + CooperationContractId: v.CooperationContractId,
66 CooperationContractName: v.CooperationContractName, 59 CooperationContractName: v.CooperationContractName,
67 CooperationContractNumber: v.CooperationContractNumber, 60 CooperationContractNumber: v.CooperationContractNumber,
68 - CreatedAt: v.CreatedAt.Unix(), 61 + CreatedAt: v.CreatedAt.UnixNano() / 1e6,
  62 + CooperationModeName: v.CooperationContractName,
69 } 63 }
70 - item.CooperationMode.CooperationModeId = v.CooperationMode.CooperationModeId  
71 - item.CooperationMode.CooperationModeName = v.CooperationMode.CooperationModeName  
72 - item.CooperationMode.CooperationModeNumber = v.CooperationMode.CooperationModeNumber  
73 item.Department.DepartmentId = v.Department.DepartmentId 64 item.Department.DepartmentId = v.Department.DepartmentId
74 item.Department.DepartmentName = v.Department.DepartmentName 65 item.Department.DepartmentName = v.Department.DepartmentName
75 - item.CooperationContractSponsor.UserId = v.CooperationContractSponsor.UserId  
76 - item.CooperationContractSponsor.Phone = v.CooperationContractSponsor.UserInfo.Phone  
77 - item.CooperationContractSponsor.UsersName = v.CooperationContractSponsor.UserInfo.UsersName 66 + item.CooperationContractSponsorName = v.CooperationContractName
78 listdata = append(listdata, item) 67 listdata = append(listdata, item)
79 } 68 }
80 return listdata 69 return listdata
@@ -96,29 +96,17 @@ type ( @@ -96,29 +96,17 @@ type (
96 Grid struct { 96 Grid struct {
97 Total int `json:"total"` 97 Total int `json:"total"`
98 List []struct { 98 List []struct {
99 - CooperationContractName string `json:"cooperationContractName"` //合约名称  
100 - CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码  
101 - DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` //订单编号  
102 - CooperationMode struct {  
103 - CooperationModeId int `json:"cooperationModeId"`  
104 - CooperationModeName string `json:"cooperationModeName"`  
105 - CooperationModeNumber string `json:"cooperationModeNumber"`  
106 - } `json:"cooperationMode"` //共创模式  
107 - CreatedAt time.Time `json:"createdAt"` //合约建立时间  
108 - Department struct {  
109 - DepartmentId int `json:"departmentId"` 99 + CooperationContractId int `json:"cooperationContractId,string"` // 共创合约ID
  100 + CooperationContractName string `json:"cooperationContractName"` //合约名称
  101 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码
  102 + CooperationModeName string `json:"cooperationMode"`
  103 + CreatedAt time.Time `json:"createdAt"` //合约建立时间
  104 + Department struct {
  105 + DepartmentId int `json:"departmentId,string"`
110 DepartmentName string `json:"departmentName"` 106 DepartmentName string `json:"departmentName"`
111 } `json:"department"` //发起部门 107 } `json:"department"` //发起部门
112 - CooperationContractSponsor struct {  
113 - UserId int `json:"userId"`  
114 - UserBaseId int `json:"userBaseId"`  
115 - UserInfo struct {  
116 - UsersName string `json:"userName"`  
117 - Phone string `json:"phone"`  
118 - UsersId int `json:"userId,string,"`  
119 - UserCode string `json:"userCode"`  
120 - } `json:"userInfo"`  
121 - } `json:"cooperationContractSponsor"` //合约发起人 108 + // 共创合约发起人
  109 + CooperationContractSponsorName string `json:"cooperationContractSponsor"`
122 } `json:"list"` 110 } `json:"list"`
123 } `json:"grid"` 111 } `json:"grid"`
124 } 112 }