作者 陈志颖

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

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