作者 陈志颖

feat:分红预算领域服务调整

@@ -372,6 +372,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -372,6 +372,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
372 _ = transactionContext.RollbackTransaction() 372 _ = transactionContext.RollbackTransaction()
373 }() 373 }()
374 374
  375 + orderGoodIds, _ := utils.SliceAtoi(confirmDividendsIncentivesEstimateCommand.OrderGoodIds)
  376 +
375 // 用户REST服务初始化 377 // 用户REST服务初始化
376 //var userService service.UserService 378 //var userService service.UserService
377 //if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil { 379 //if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
@@ -476,7 +478,9 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -476,7 +478,9 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
476 } 478 }
477 479
478 // 获取订单产品 480 // 获取订单产品
479 - if _, orderGoods, err := orderGoodRepository.Find(tool_funs.SimpleStructToMap(confirmDividendsIncentivesEstimateCommand)); err != nil { 481 + if _, orderGoods, err := orderGoodRepository.Find(map[string]interface{}{
  482 + "orderGoodIds": orderGoodIds,
  483 + }); err != nil {
480 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 484 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
481 } else { 485 } else {
482 var dividendsEstimates []*domain.DividendsEstimate 486 var dividendsEstimates []*domain.DividendsEstimate
@@ -68,6 +68,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -68,6 +68,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
68 } 68 }
69 } 69 }
70 // 计算分红 70 // 计算分红
  71 + if dividendsIncentivesRuleMatched != nil {
71 for _, undertaker := range cooperationContract.Undertakers { 72 for _, undertaker := range cooperationContract.Undertakers {
72 // 添加承接人分红预算信息详情 73 // 添加承接人分红预算信息详情
73 undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage 74 undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage
@@ -135,6 +136,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -135,6 +136,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
135 }) 136 })
136 } 137 }
137 } 138 }
  139 + }
138 } else if orderGood.DividendsReturnedOrderNumber != "" { // 获取分红退货单 140 } else if orderGood.DividendsReturnedOrderNumber != "" { // 获取分红退货单
139 dividendsReturnedOrder, err3 := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{ 141 dividendsReturnedOrder, err3 := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{
140 "dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber, 142 "dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber,