...
|
...
|
@@ -47,7 +47,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
|
|
|
}
|
|
|
if cooperationContract == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.CooperationContractNumber))
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("共创合约%s不存在", orderGood.CooperationContractNumber))
|
|
|
}
|
|
|
if orderGood.DividendsOrderNumber != "" {
|
|
|
// 获取分红订单
|
...
|
...
|
@@ -60,7 +60,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单不存在")
|
|
|
}
|
|
|
if dividendsOrder == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsOrderNumber))
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("分红订单%s不存在", orderGood.DividendsOrderNumber))
|
|
|
}
|
|
|
// 匹配分红规则
|
|
|
var dividendsIncentivesRuleMatched *domain.DividendsIncentivesRule
|
...
|
...
|
@@ -79,7 +79,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
for _, undertaker := range cooperationContract.Undertakers {
|
|
|
// 添加承接人分红预算信息详情
|
|
|
// TODO 使用decimal提高精度
|
|
|
undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage / 100
|
|
|
undertakerDividendsAmount := orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage / 100
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
|
|
UserId: undertaker.UserId,
|
...
|
...
|
@@ -90,7 +90,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
Roles: undertaker.Roles,
|
|
|
UserInfo: undertaker.UserInfo,
|
|
|
UserType: undertaker.UserType,
|
|
|
UserName: undertaker.UserName,
|
|
|
UserName: undertaker.UserInfo.UserName,
|
|
|
UserPhone: undertaker.UserPhone,
|
|
|
Status: undertaker.Status,
|
|
|
Company: undertaker.Company,
|
...
|
...
|
@@ -101,7 +101,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
})
|
|
|
// 添加推荐人分红预算信息详情
|
|
|
if undertaker.Referrer != nil {
|
|
|
referrerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.ReferrerPercentage / 100
|
|
|
referrerDividendsAmount := orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.ReferrerPercentage / 100
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
|
|
UserId: undertaker.Referrer.UserId,
|
...
|
...
|
@@ -112,7 +112,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
Roles: undertaker.Referrer.Roles,
|
|
|
UserInfo: undertaker.Referrer.UserInfo,
|
|
|
UserType: undertaker.Referrer.UserType,
|
|
|
UserName: undertaker.Referrer.UserName,
|
|
|
UserName: undertaker.Referrer.UserInfo.UserName,
|
|
|
UserPhone: undertaker.Referrer.UserPhone,
|
|
|
Company: undertaker.Referrer.Company,
|
|
|
},
|
...
|
...
|
@@ -123,7 +123,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
}
|
|
|
// 添加关联业务员分红预算信息详情
|
|
|
if undertaker.Salesman != nil {
|
|
|
salesmanDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.SalesmanPercentage / 100
|
|
|
salesmanDividendsAmount := orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.SalesmanPercentage / 100
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
|
|
UserId: undertaker.Salesman.UserId,
|
...
|
...
|
@@ -134,7 +134,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
Roles: undertaker.Salesman.Roles,
|
|
|
UserInfo: undertaker.Salesman.UserInfo,
|
|
|
UserType: undertaker.Salesman.UserType,
|
|
|
UserName: undertaker.Salesman.UserName,
|
|
|
UserName: undertaker.Salesman.UserInfo.UserName,
|
|
|
UserPhone: undertaker.Salesman.UserPhone,
|
|
|
Company: undertaker.Salesman.Company,
|
|
|
},
|
...
|
...
|
@@ -177,7 +177,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
Roles: undertaker.Roles,
|
|
|
UserInfo: undertaker.UserInfo,
|
|
|
UserType: undertaker.UserType,
|
|
|
UserName: undertaker.UserName,
|
|
|
UserName: undertaker.UserInfo.UserName,
|
|
|
UserPhone: undertaker.UserPhone,
|
|
|
Status: undertaker.Status,
|
|
|
Company: undertaker.Company,
|
...
|
...
|
@@ -199,7 +199,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
Roles: undertaker.Referrer.Roles,
|
|
|
UserInfo: undertaker.Referrer.UserInfo,
|
|
|
UserType: undertaker.Referrer.UserType,
|
|
|
UserName: undertaker.Referrer.UserName,
|
|
|
UserName: undertaker.Referrer.UserInfo.UserName,
|
|
|
UserPhone: undertaker.Referrer.UserPhone,
|
|
|
Company: undertaker.Referrer.Company,
|
|
|
},
|
...
|
...
|
@@ -221,7 +221,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
Roles: undertaker.Salesman.Roles,
|
|
|
UserInfo: undertaker.Salesman.UserInfo,
|
|
|
UserType: undertaker.Salesman.UserType,
|
|
|
UserName: undertaker.Salesman.UserName,
|
|
|
UserName: undertaker.Salesman.UserInfo.UserName,
|
|
|
UserPhone: undertaker.Salesman.UserPhone,
|
|
|
Company: undertaker.Salesman.Company,
|
|
|
},
|
...
|
...
|
|