...
|
...
|
@@ -117,21 +117,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
continue
|
|
|
}
|
|
|
|
|
|
// 校验合约关联的项目是否已结束
|
|
|
//if cooperationProject.Status == 2 {
|
|
|
// dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
// DividendsUser: nil,
|
|
|
// DividendsParticipateType: 0,
|
|
|
// DividendsStage: 0,
|
|
|
// DividendsAmount: 0,
|
|
|
// OrderOrReturnedOrderNumber: orderGood.DividendsOrderNumber,
|
|
|
// IsSuccessfully: false,
|
|
|
// Reason: "共创项目" + orderGood.CooperationContractNumber + "已结束",
|
|
|
// })
|
|
|
// continue
|
|
|
// //return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("共创项目%s已结束", cooperationContract.CooperationProjectNumber))
|
|
|
//}
|
|
|
|
|
|
if orderGood.DividendsOrderNumber != "" { // 获取分红订单
|
|
|
// 获取分红订单
|
|
|
dividendsOrder, err2 := dividendsOrderRepository.FindOne(map[string]interface{}{
|
...
|
...
|
@@ -190,6 +175,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
if dividendsIncentivesRuleMatched != nil {
|
|
|
for _, undertaker := range cooperationContract.Undertakers {
|
|
|
// 添加承接人分红预算信息详情
|
|
|
if dividendsIncentivesRuleMatched.DividendsIncentivesPercentage > 0 {
|
|
|
undertakerDividendsAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodAmount).Mul(decimal.NewFromFloat(dividendsIncentivesRuleMatched.DividendsIncentivesPercentage).Div(decimal.NewFromFloat(100))).Float64()
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
...
|
...
|
@@ -212,8 +198,11 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
OrderOrReturnedOrderNumber: dividendsOrder.DividendsOrderNumber,
|
|
|
IsSuccessfully: true,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 添加推荐人分红预算信息详情
|
|
|
if undertaker.Referrer != nil {
|
|
|
if dividendsIncentivesRuleMatched.ReferrerPercentage > 0 {
|
|
|
referrerDividendsAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodAmount).Mul(decimal.NewFromFloat(dividendsIncentivesRuleMatched.ReferrerPercentage).Div(decimal.NewFromFloat(100))).Float64()
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
...
|
...
|
@@ -236,8 +225,10 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
IsSuccessfully: true,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
// 添加关联业务员分红预算信息详情
|
|
|
if undertaker.Salesman != nil {
|
|
|
if dividendsIncentivesRuleMatched.SalesmanPercentage > 0 {
|
|
|
salesmanDividendsAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodAmount).Mul(decimal.NewFromFloat(dividendsIncentivesRuleMatched.SalesmanPercentage).Div(decimal.NewFromFloat(100))).Float64()
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
...
|
...
|
@@ -262,6 +253,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else if orderGood.DividendsReturnedOrderNumber != "" { // 获取退货单
|
|
|
dividendsReturnedOrder, err3 := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{
|
|
|
"dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber,
|
...
|
...
|
@@ -304,6 +296,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
// 计算分红
|
|
|
for _, undertaker := range cooperationContract.Undertakers {
|
|
|
// 添加承接人分红退货预算信息详情
|
|
|
if dividendsIncentivesRuleMatched.DividendsIncentivesPercentage > 0 {
|
|
|
undertakerDividendsAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodAmount).Mul(decimal.NewFromFloat(dividendsIncentivesRuleMatched.DividendsIncentivesPercentage).Div(decimal.NewFromFloat(100))).Float64()
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
...
|
...
|
@@ -326,8 +319,11 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
OrderOrReturnedOrderNumber: dividendsReturnedOrder.DividendsOrderNumber,
|
|
|
IsSuccessfully: true,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 添加推荐人分红退货预算信息详情
|
|
|
if undertaker.Referrer != nil {
|
|
|
if dividendsIncentivesRuleMatched.ReferrerPercentage > 0 {
|
|
|
referrerDividendsAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodAmount).Mul(decimal.NewFromFloat(dividendsIncentivesRuleMatched.ReferrerPercentage).Div(decimal.NewFromFloat(100))).Float64()
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
...
|
...
|
@@ -350,8 +346,11 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
IsSuccessfully: true,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 添加关联业务员分红退货预算信息详情
|
|
|
if undertaker.Salesman != nil {
|
|
|
if dividendsIncentivesRuleMatched.SalesmanPercentage > 0 {
|
|
|
salesmanDividendsAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodAmount).Mul(decimal.NewFromFloat(dividendsIncentivesRuleMatched.SalesmanPercentage).Div(decimal.NewFromFloat(100))).Float64()
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
...
|
...
|
@@ -374,6 +373,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
IsSuccessfully: true,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|