正在显示
12 个修改的文件
包含
98 行增加
和
37 行删除
@@ -308,7 +308,11 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -308,7 +308,11 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
308 | } else { | 308 | } else { |
309 | cooperationModeRepository = value | 309 | cooperationModeRepository = value |
310 | } | 310 | } |
311 | - cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeNumber": createCooperationContractCommand.CooperationModeNumber}) | 311 | + cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{ |
312 | + "companyId": createCooperationContractCommand.CompanyId, | ||
313 | + "orgId": createCooperationContractCommand.OrgId, | ||
314 | + "cooperationModeNumber": createCooperationContractCommand.CooperationModeNumber, | ||
315 | + }) | ||
312 | if err != nil { | 316 | if err != nil { |
313 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在") | 317 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在") |
314 | } | 318 | } |
@@ -775,6 +775,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -775,6 +775,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
775 | OrderGoodId: orderGood.OrderGoodId, | 775 | OrderGoodId: orderGood.OrderGoodId, |
776 | OrderGoodAmount: orderGood.OrderGoodAmount, | 776 | OrderGoodAmount: orderGood.OrderGoodAmount, |
777 | PaymentStatus: int32(1), | 777 | PaymentStatus: int32(1), |
778 | + CooperationContractUndertakerId: dividendsEstimateDetail.CooperationContractUndertakerId, | ||
778 | } | 779 | } |
779 | 780 | ||
780 | dividendsEstimates = append(dividendsEstimates, dividendsEstimate) | 781 | dividendsEstimates = append(dividendsEstimates, dividendsEstimate) |
@@ -829,6 +830,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -829,6 +830,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
829 | OrderGoodId: orderGood.OrderGoodId, | 830 | OrderGoodId: orderGood.OrderGoodId, |
830 | OrderGoodAmount: orderGood.OrderGoodAmount, | 831 | OrderGoodAmount: orderGood.OrderGoodAmount, |
831 | PaymentStatus: int32(1), | 832 | PaymentStatus: int32(1), |
833 | + CooperationContractUndertakerId: dividendsReturnedEstimateDetail.CooperationContractUndertakerId, | ||
832 | } | 834 | } |
833 | 835 | ||
834 | dividendsEstimates = append(dividendsEstimates, dividendsEstimate) | 836 | dividendsEstimates = append(dividendsEstimates, dividendsEstimate) |
@@ -1169,6 +1171,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives | @@ -1169,6 +1171,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives | ||
1169 | DeletedAt: time.Time{}, | 1171 | DeletedAt: time.Time{}, |
1170 | UpdatedAt: time.Time{}, | 1172 | UpdatedAt: time.Time{}, |
1171 | PaymentStatus: int32(1), | 1173 | PaymentStatus: int32(1), |
1174 | + CooperationContractUndertakerId: dividendsEstimateDetail.CooperationContractUndertakerId, | ||
1172 | } | 1175 | } |
1173 | 1176 | ||
1174 | dividendsEstimates = append(dividendsEstimates, dividendsEstimate) | 1177 | dividendsEstimates = append(dividendsEstimates, dividendsEstimate) |
@@ -43,6 +43,8 @@ type DividendsEstimate struct { | @@ -43,6 +43,8 @@ type DividendsEstimate struct { | ||
43 | OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` | 43 | OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` |
44 | // 共创项目合约编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001 | 44 | // 共创项目合约编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001 |
45 | CooperationContractNumber string `json:"cooperationContractNumber"` | 45 | CooperationContractNumber string `json:"cooperationContractNumber"` |
46 | + // 共创合约承接人id | ||
47 | + CooperationContractUndertakerId int64 `json:"cooperationContractUndertakerId"` | ||
46 | // 分红用户(共创参与) | 48 | // 分红用户(共创参与) |
47 | DividendsUser *User `json:"dividendsUser"` | 49 | DividendsUser *User `json:"dividendsUser"` |
48 | // 分红阶段 | 50 | // 分红阶段 |
@@ -15,6 +15,7 @@ type DividendsEstimateDetail struct { | @@ -15,6 +15,7 @@ type DividendsEstimateDetail struct { | ||
15 | OrderOrReturnedOrderNumber string `json:"orderOrReturnedOrderNumber"` // 分红订单号或退货单号 | 15 | OrderOrReturnedOrderNumber string `json:"orderOrReturnedOrderNumber"` // 分红订单号或退货单号 |
16 | IsSuccessfully bool `json:"isSuccessfully"` // 是否预算成功 | 16 | IsSuccessfully bool `json:"isSuccessfully"` // 是否预算成功 |
17 | Reason string `json:"reason"` // 错误原因 | 17 | Reason string `json:"reason"` // 错误原因 |
18 | + CooperationContractUndertakerId int64 `json:"cooperationContractUndertakerId"` // 承接人记录ID | ||
18 | } | 19 | } |
19 | 20 | ||
20 | // GenerateSpecificDividendsEstimateNumber 批量生成自定义分红预算单号 | 21 | // GenerateSpecificDividendsEstimateNumber 批量生成自定义分红预算单号 |
@@ -2,7 +2,7 @@ package domain | @@ -2,7 +2,7 @@ package domain | ||
2 | 2 | ||
3 | // Undertaker 共创合约承接方值对象 | 3 | // Undertaker 共创合约承接方值对象 |
4 | type Undertaker struct { | 4 | type Undertaker struct { |
5 | - // 承接人id | 5 | + // 承接人记录ID |
6 | UndertakerId int64 `json:"undertakerId,string"` | 6 | UndertakerId int64 `json:"undertakerId,string"` |
7 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 7 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
8 | UserId int64 `json:"userId,string"` | 8 | UserId int64 `json:"userId,string"` |
@@ -20,6 +20,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | @@ -20,6 +20,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | ||
20 | var dividendsOrderRepository domain.DividendsOrderRepository // 分红订单仓储 | 20 | var dividendsOrderRepository domain.DividendsOrderRepository // 分红订单仓储 |
21 | var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository // 分红退货单仓储 | 21 | var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository // 分红退货单仓储 |
22 | var orderGoodRepository domain.OrderGoodRepository // 订单产品仓储 | 22 | var orderGoodRepository domain.OrderGoodRepository // 订单产品仓储 |
23 | + //var cooperationContactRepository domain.CooperationContractRepository // 合约仓储 | ||
23 | 24 | ||
24 | // 分红预算单仓储初始化 | 25 | // 分红预算单仓储初始化 |
25 | if repo, err := repository.NewDividendsEstimateRepository(domainService.transactionContext); err != nil { | 26 | if repo, err := repository.NewDividendsEstimateRepository(domainService.transactionContext); err != nil { |
@@ -49,6 +50,13 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | @@ -49,6 +50,13 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | ||
49 | orderGoodRepository = repo | 50 | orderGoodRepository = repo |
50 | } | 51 | } |
51 | 52 | ||
53 | + // 共创合约仓储初始化 | ||
54 | + //if repo, err := repository.NewCooperationContractRepository(domainService.transactionContext); err != nil { | ||
55 | + // return nil, err | ||
56 | + //} else { | ||
57 | + // cooperationContactRepository = repo | ||
58 | + //} | ||
59 | + | ||
52 | // 获取分红预算单 | 60 | // 获取分红预算单 |
53 | if count, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{ | 61 | if count, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{ |
54 | "dividendsEstimateIds": dividendsEstimateIds, | 62 | "dividendsEstimateIds": dividendsEstimateIds, |
@@ -61,18 +69,16 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | @@ -61,18 +69,16 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | ||
61 | for _, dividendsEstimate := range dividendsEstimates { | 69 | for _, dividendsEstimate := range dividendsEstimates { |
62 | if dividendsEstimate.DividendsType == 1 || dividendsEstimate.DividendsType == 2 { // 1.订单分红 2.退货冲销 | 70 | if dividendsEstimate.DividendsType == 1 || dividendsEstimate.DividendsType == 2 { // 1.订单分红 2.退货冲销 |
63 | // 自定义查询 | 71 | // 自定义查询 |
64 | - queryOptions := make(map[string]interface{}) | ||
65 | - | ||
66 | - queryOptions = map[string]interface{}{ | ||
67 | - "companyId": dividendsEstimate.Company.CompanyId, | ||
68 | - "orgId": dividendsEstimate.Org.OrgId, | ||
69 | - "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum, | ||
70 | - "dividendsParticipateTypes": []int32{1, 2, 3}, | ||
71 | - "offsetLimit": false, | ||
72 | - "dividendsStage": dividendsEstimate.DividendsStage, | ||
73 | - "dividendsTypes": []int32{1, 2}, | ||
74 | - } | ||
75 | 72 | ||
73 | + //queryOptions := map[string]interface{}{ | ||
74 | + // "companyId": dividendsEstimate.Company.CompanyId, | ||
75 | + // "orgId": dividendsEstimate.Org.OrgId, | ||
76 | + // "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum, | ||
77 | + // "dividendsParticipateTypes": []int32{1, 2, 3}, | ||
78 | + // "offsetLimit": false, | ||
79 | + // "dividendsStage": dividendsEstimate.DividendsStage, | ||
80 | + // "dividendsTypes": []int32{1, 2}, | ||
81 | + //} | ||
76 | //参与分红类型,1承接人,2推荐人,3关联业务员 | 82 | //参与分红类型,1承接人,2推荐人,3关联业务员 |
77 | //if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单 | 83 | //if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单 |
78 | // queryOptions = map[string]interface{}{ | 84 | // queryOptions = map[string]interface{}{ |
@@ -107,7 +113,17 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | @@ -107,7 +113,17 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | ||
107 | //} | 113 | //} |
108 | 114 | ||
109 | // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单 | 115 | // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单 |
110 | - if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(queryOptions); err2 != nil { | 116 | + if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{ |
117 | + "companyId": dividendsEstimate.Company.CompanyId, | ||
118 | + "orgId": dividendsEstimate.Org.OrgId, | ||
119 | + "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum, | ||
120 | + "dividendsParticipateTypes": []int32{1, 2, 3}, | ||
121 | + "cooperationContractNumber": dividendsEstimate.CooperationContractNumber, | ||
122 | + "offsetLimit": false, | ||
123 | + "dividendsStage": dividendsEstimate.DividendsStage, | ||
124 | + "dividendsTypes": []int32{1, 2}, | ||
125 | + "orderGoodId": dividendsEstimate.OrderGoodId, | ||
126 | + }); err2 != nil { | ||
111 | return nil, err2 | 127 | return nil, err2 |
112 | } else { | 128 | } else { |
113 | if countRelative > 0 { | 129 | if countRelative > 0 { |
@@ -125,19 +141,27 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | @@ -125,19 +141,27 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | ||
125 | } | 141 | } |
126 | } | 142 | } |
127 | } else if dividendsEstimate.DividendsType == 3 { // 3.金额激励 | 143 | } else if dividendsEstimate.DividendsType == 3 { // 3.金额激励 |
128 | - // 自定义查询 | ||
129 | - queryOptions := make(map[string]interface{}) | ||
130 | 144 | ||
131 | - queryOptions = map[string]interface{}{ | ||
132 | - "companyId": dividendsEstimate.Company.CompanyId, | ||
133 | - "orgId": dividendsEstimate.Org.OrgId, | ||
134 | - "cooperationContractNumber": dividendsEstimate.CooperationContractNumber, | ||
135 | - "dividendsParticipateTypes": []int32{1, 2, 3}, | ||
136 | - "offsetLimit": false, | ||
137 | - "dividendsStage": dividendsEstimate.DividendsStage, | ||
138 | - "dividendsType": int32(3), | ||
139 | - } | 145 | + // 查询合约 |
146 | + //cooperationContract, err3 := cooperationContactRepository.FindOne(map[string]interface{}{ | ||
147 | + // "companyId": dividendsEstimate.Company.CompanyId, | ||
148 | + // "orgId": dividendsEstimate.Org.OrgId, | ||
149 | + // "cooperationContractNumber": dividendsEstimate.CooperationContractNumber, | ||
150 | + //}) | ||
151 | + //if err3 != nil { | ||
152 | + // return nil, err3 | ||
153 | + //} | ||
140 | 154 | ||
155 | + // 自定义查询 | ||
156 | + //queryOptions := map[string]interface{}{ | ||
157 | + // "companyId": dividendsEstimate.Company.CompanyId, | ||
158 | + // "orgId": dividendsEstimate.Org.OrgId, | ||
159 | + // "cooperationContractNumber": dividendsEstimate.CooperationContractNumber, | ||
160 | + // "dividendsParticipateTypes": []int32{1, 2, 3}, | ||
161 | + // "offsetLimit": false, | ||
162 | + // "dividendsStage": dividendsEstimate.DividendsStage, | ||
163 | + // "dividendsType": int32(3), | ||
164 | + //} | ||
141 | //参与分红类型,1承接人,2推荐人,3关联业务员 | 165 | //参与分红类型,1承接人,2推荐人,3关联业务员 |
142 | //if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单 | 166 | //if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单 |
143 | // queryOptions = map[string]interface{}{ | 167 | // queryOptions = map[string]interface{}{ |
@@ -172,7 +196,16 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | @@ -172,7 +196,16 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | ||
172 | //} | 196 | //} |
173 | 197 | ||
174 | // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单 | 198 | // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单 |
175 | - if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(queryOptions); err2 != nil { | 199 | + if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{ |
200 | + "companyId": dividendsEstimate.Company.CompanyId, | ||
201 | + "orgId": dividendsEstimate.Org.OrgId, | ||
202 | + "cooperationContractNumber": dividendsEstimate.CooperationContractNumber, | ||
203 | + "cooperationContractUndertakerId": dividendsEstimate.CooperationContractUndertakerId, | ||
204 | + "dividendsParticipateTypes": []int32{1, 2, 3}, | ||
205 | + "offsetLimit": false, | ||
206 | + "dividendsStage": dividendsEstimate.DividendsStage, | ||
207 | + "dividendsType": int32(3), | ||
208 | + }); err2 != nil { | ||
176 | return nil, err2 | 209 | return nil, err2 |
177 | } else { | 210 | } else { |
178 | if countRelative > 0 { | 211 | if countRelative > 0 { |
@@ -180,9 +213,9 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | @@ -180,9 +213,9 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst | ||
180 | dividendsEstimatesRelative[i].IsCanceled = true | 213 | dividendsEstimatesRelative[i].IsCanceled = true |
181 | dividendsEstimatesRelative[i].Operator = operator | 214 | dividendsEstimatesRelative[i].Operator = operator |
182 | } | 215 | } |
183 | - dividendsEstimatesRelativeCanceled, err3 := dividendsEstimateRepository.UpdateMany(dividendsEstimatesRelative) | ||
184 | - if err3 != nil { | ||
185 | - return nil, err3 | 216 | + dividendsEstimatesRelativeCanceled, err4 := dividendsEstimateRepository.UpdateMany(dividendsEstimatesRelative) |
217 | + if err4 != nil { | ||
218 | + return nil, err4 | ||
186 | } | 219 | } |
187 | dividendsEstimatesCanceled = append(dividendsEstimatesCanceled, dividendsEstimatesRelativeCanceled...) | 220 | dividendsEstimatesCanceled = append(dividendsEstimatesCanceled, dividendsEstimatesRelativeCanceled...) |
188 | } | 221 | } |
@@ -248,6 +248,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -248,6 +248,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
248 | DividendsAmount: undertakerDividendsAmount, | 248 | DividendsAmount: undertakerDividendsAmount, |
249 | OrderOrReturnedOrderNumber: dividendsOrder.DividendsOrderNumber, | 249 | OrderOrReturnedOrderNumber: dividendsOrder.DividendsOrderNumber, |
250 | IsSuccessfully: true, | 250 | IsSuccessfully: true, |
251 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
251 | }) | 252 | }) |
252 | } | 253 | } |
253 | 254 | ||
@@ -274,6 +275,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -274,6 +275,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
274 | DividendsAmount: referrerDividendsAmount, | 275 | DividendsAmount: referrerDividendsAmount, |
275 | OrderOrReturnedOrderNumber: dividendsOrder.DividendsOrderNumber, | 276 | OrderOrReturnedOrderNumber: dividendsOrder.DividendsOrderNumber, |
276 | IsSuccessfully: true, | 277 | IsSuccessfully: true, |
278 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
277 | }) | 279 | }) |
278 | } | 280 | } |
279 | } | 281 | } |
@@ -300,6 +302,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -300,6 +302,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
300 | DividendsAmount: salesmanDividendsAmount, | 302 | DividendsAmount: salesmanDividendsAmount, |
301 | OrderOrReturnedOrderNumber: dividendsOrder.DividendsOrderNumber, | 303 | OrderOrReturnedOrderNumber: dividendsOrder.DividendsOrderNumber, |
302 | IsSuccessfully: true, | 304 | IsSuccessfully: true, |
305 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
303 | }) | 306 | }) |
304 | } | 307 | } |
305 | } | 308 | } |
@@ -369,6 +372,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -369,6 +372,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
369 | DividendsAmount: -undertakerDividendsAmount, | 372 | DividendsAmount: -undertakerDividendsAmount, |
370 | OrderOrReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber, | 373 | OrderOrReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber, |
371 | IsSuccessfully: true, | 374 | IsSuccessfully: true, |
375 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
372 | }) | 376 | }) |
373 | } | 377 | } |
374 | 378 | ||
@@ -395,6 +399,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -395,6 +399,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
395 | DividendsAmount: -referrerDividendsAmount, | 399 | DividendsAmount: -referrerDividendsAmount, |
396 | OrderOrReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber, | 400 | OrderOrReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber, |
397 | IsSuccessfully: true, | 401 | IsSuccessfully: true, |
402 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
398 | }) | 403 | }) |
399 | } | 404 | } |
400 | } | 405 | } |
@@ -422,6 +427,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -422,6 +427,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
422 | DividendsAmount: -salesmanDividendsAmount, | 427 | DividendsAmount: -salesmanDividendsAmount, |
423 | OrderOrReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber, | 428 | OrderOrReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber, |
424 | IsSuccessfully: true, | 429 | IsSuccessfully: true, |
430 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
425 | }) | 431 | }) |
426 | } | 432 | } |
427 | 433 |
@@ -64,7 +64,6 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do | @@ -64,7 +64,6 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do | ||
64 | return nil, fmt.Errorf("承接人 " + undertaker.UserName + " 已分红") | 64 | return nil, fmt.Errorf("承接人 " + undertaker.UserName + " 已分红") |
65 | } else { | 65 | } else { |
66 | undertakerDividendsAmount, _ := decimal.NewFromFloat(moneyIncentivesRuleMatched.MoneyIncentivesAmount).Float64() | 66 | undertakerDividendsAmount, _ := decimal.NewFromFloat(moneyIncentivesRuleMatched.MoneyIncentivesAmount).Float64() |
67 | - //Mul(decimal.NewFromFloat(1).Sub(decimal.NewFromFloat(moneyIncentivesRuleMatched.SalesmanPercentage).Add(decimal.NewFromFloat(moneyIncentivesRuleMatched.ReferrerPercentage)).Div(decimal.NewFromFloat(100)))).Float64() | ||
68 | dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{ | 67 | dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{ |
69 | DividendsUser: &domain.User{ | 68 | DividendsUser: &domain.User{ |
70 | UserId: undertaker.UserId, | 69 | UserId: undertaker.UserId, |
@@ -83,6 +82,7 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do | @@ -83,6 +82,7 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do | ||
83 | DividendsParticipateType: 1, | 82 | DividendsParticipateType: 1, |
84 | DividendsStage: stage, | 83 | DividendsStage: stage, |
85 | DividendsAmount: undertakerDividendsAmount, | 84 | DividendsAmount: undertakerDividendsAmount, |
85 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
86 | }) | 86 | }) |
87 | } | 87 | } |
88 | 88 | ||
@@ -117,6 +117,7 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do | @@ -117,6 +117,7 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do | ||
117 | DividendsParticipateType: 3, | 117 | DividendsParticipateType: 3, |
118 | DividendsStage: stage, | 118 | DividendsStage: stage, |
119 | DividendsAmount: undertakerDividendsAmount, | 119 | DividendsAmount: undertakerDividendsAmount, |
120 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
120 | }) | 121 | }) |
121 | } | 122 | } |
122 | 123 | ||
@@ -153,6 +154,7 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do | @@ -153,6 +154,7 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do | ||
153 | DividendsParticipateType: 2, | 154 | DividendsParticipateType: 2, |
154 | DividendsStage: stage, | 155 | DividendsStage: stage, |
155 | DividendsAmount: undertakerDividendsAmount, | 156 | DividendsAmount: undertakerDividendsAmount, |
157 | + CooperationContractUndertakerId: undertaker.UndertakerId, | ||
156 | }) | 158 | }) |
157 | } | 159 | } |
158 | } | 160 | } |
@@ -29,6 +29,8 @@ type DividendsEstimate struct { | @@ -29,6 +29,8 @@ type DividendsEstimate struct { | ||
29 | OrderOrReturnedOrderNum string `comment:"分红订单号或退货单号"` | 29 | OrderOrReturnedOrderNum string `comment:"分红订单号或退货单号"` |
30 | // 共创项目合约编号 | 30 | // 共创项目合约编号 |
31 | CooperationContractNumber string `comment:"共创项目合约编号"` | 31 | CooperationContractNumber string `comment:"共创项目合约编号"` |
32 | + // 共创合约承接人id | ||
33 | + CooperationContractUndertakerId int64 `comment:"共创合约承接人ID"` | ||
32 | // 分红用户 | 34 | // 分红用户 |
33 | DividendsUser *domain.User `comment:"分红用户"` | 35 | DividendsUser *domain.User `comment:"分红用户"` |
34 | // 分红阶段 | 36 | // 分红阶段 |
@@ -20,6 +20,7 @@ func TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel | @@ -20,6 +20,7 @@ func TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel | ||
20 | DividendsTypeName: dividendsEstimateModel.DividendsTypeName, | 20 | DividendsTypeName: dividendsEstimateModel.DividendsTypeName, |
21 | OrderOrReturnedOrderNum: dividendsEstimateModel.OrderOrReturnedOrderNum, | 21 | OrderOrReturnedOrderNum: dividendsEstimateModel.OrderOrReturnedOrderNum, |
22 | CooperationContractNumber: dividendsEstimateModel.CooperationContractNumber, | 22 | CooperationContractNumber: dividendsEstimateModel.CooperationContractNumber, |
23 | + CooperationContractUndertakerId: dividendsEstimateModel.CooperationContractUndertakerId, | ||
23 | DividendsUser: dividendsEstimateModel.DividendsUser, | 24 | DividendsUser: dividendsEstimateModel.DividendsUser, |
24 | DividendsStage: dividendsEstimateModel.DividendsStage, | 25 | DividendsStage: dividendsEstimateModel.DividendsStage, |
25 | Org: dividendsEstimateModel.Org, | 26 | Org: dividendsEstimateModel.Org, |
@@ -824,13 +824,13 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -824,13 +824,13 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
824 | } | 824 | } |
825 | } | 825 | } |
826 | // 返回新增的合约 | 826 | // 返回新增的合约 |
827 | - cooperationContractSaved, err := repository.FindOne(map[string]interface{}{ | ||
828 | - "cooperationContractId": cooperationContract.CooperationContractId, | ||
829 | - }) | ||
830 | - if err != nil { | ||
831 | - return nil, err | ||
832 | - } | ||
833 | - return cooperationContractSaved, nil | 827 | + //cooperationContractSaved, err := repository.FindOne(map[string]interface{}{ |
828 | + // "cooperationContractId": cooperationContract.CooperationContractId, | ||
829 | + //}) | ||
830 | + //if err != nil { | ||
831 | + // return nil, err | ||
832 | + //} | ||
833 | + return cooperationContract, nil | ||
834 | } | 834 | } |
835 | 835 | ||
836 | func (repository *CooperationContractRepository) UpdateOne(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) { | 836 | func (repository *CooperationContractRepository) UpdateOne(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) { |
@@ -325,6 +325,9 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte | @@ -325,6 +325,9 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte | ||
325 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { | 325 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { |
326 | query.Where("cooperation_contract_number in (?)", pg.In(v)) | 326 | query.Where("cooperation_contract_number in (?)", pg.In(v)) |
327 | } | 327 | } |
328 | + if cooperationContractUndertakerId, ok := queryOptions["cooperationContractUndertakerId"]; ok && cooperationContractUndertakerId.(int64) != 0 { | ||
329 | + query.Where("cooperation_contract_undertaker_id = ?", cooperationContractUndertakerId) | ||
330 | + } | ||
328 | if dividendsParticipateType, ok := queryOptions["dividendsParticipateType"]; ok && dividendsParticipateType.(int32) != 0 { | 331 | if dividendsParticipateType, ok := queryOptions["dividendsParticipateType"]; ok && dividendsParticipateType.(int32) != 0 { |
329 | query.Where("dividends_participate_type = ?", dividendsParticipateType) | 332 | query.Where("dividends_participate_type = ?", dividendsParticipateType) |
330 | } | 333 | } |
@@ -340,6 +343,10 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte | @@ -340,6 +343,10 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte | ||
340 | if dividendsUserId, ok := queryOptions["dividendsUserId"]; ok && dividendsUserId.(int64) != 0 { | 343 | if dividendsUserId, ok := queryOptions["dividendsUserId"]; ok && dividendsUserId.(int64) != 0 { |
341 | query.Where(`dividends_user @> '{"userId":"?"}'`, dividendsUserId) | 344 | query.Where(`dividends_user @> '{"userId":"?"}'`, dividendsUserId) |
342 | } | 345 | } |
346 | + if dividendsUserIds, ok := queryOptions["dividendsUserIds"]; ok && len(dividendsUserIds.([]int64)) > 0 { | ||
347 | + newDividendsUserIds := utils.SliceItoa(dividendsUserIds.([]int64)) | ||
348 | + query.Where("dividends_user->>'userId' in (?)", pg.In(newDividendsUserIds)) | ||
349 | + } | ||
343 | if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 { | 350 | if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 { |
344 | query.Where(`dividends_user @> '{"userBaseId":"?"}'`, userBaseId) | 351 | query.Where(`dividends_user @> '{"userBaseId":"?"}'`, userBaseId) |
345 | } | 352 | } |
-
请 注册 或 登录 后发表评论