作者 陈志颖

fix:增加金额激励预算校验

@@ -379,14 +379,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -379,14 +379,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
379 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 379 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
380 } 380 }
381 381
382 - // 用户REST服务初始化  
383 - //var userService service.UserService  
384 - //if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {  
385 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
386 - //} else {  
387 - // userService = value  
388 - //}  
389 -  
390 // 公司REST服务初始化 382 // 公司REST服务初始化
391 var companyService service.CompanyService 383 var companyService service.CompanyService
392 if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil { 384 if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil {
@@ -89,7 +89,9 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do @@ -89,7 +89,9 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do
89 DividendsAmount: undertakerDividendsAmount, 89 DividendsAmount: undertakerDividendsAmount,
90 }) 90 })
91 } 91 }
  92 +
92 // 判断业务员在当前阶段是否已经分红 93 // 判断业务员在当前阶段是否已经分红
  94 + if undertaker.Salesman.UserId != 0 {
93 salesmanEstimated, err := dividendsEstimateDao.UserEstimated(map[string]interface{}{ 95 salesmanEstimated, err := dividendsEstimateDao.UserEstimated(map[string]interface{}{
94 "undertakerUid": undertaker.Salesman.UserId, 96 "undertakerUid": undertaker.Salesman.UserId,
95 "companyId": contract.Company.CompanyId, 97 "companyId": contract.Company.CompanyId,
@@ -121,7 +123,11 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do @@ -121,7 +123,11 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do
121 DividendsAmount: undertakerDividendsAmount, 123 DividendsAmount: undertakerDividendsAmount,
122 }) 124 })
123 } 125 }
  126 +
  127 + }
  128 +
124 // 判断关联业务员在当前阶段是否已经分红 129 // 判断关联业务员在当前阶段是否已经分红
  130 + if undertaker.Referrer.UserId != 0 {
125 referrerEstimated, err := dividendsEstimateDao.UserEstimated(map[string]interface{}{ 131 referrerEstimated, err := dividendsEstimateDao.UserEstimated(map[string]interface{}{
126 "undertakerUid": undertaker.Referrer.UserId, 132 "undertakerUid": undertaker.Referrer.UserId,
127 "companyId": contract.Company.CompanyId, 133 "companyId": contract.Company.CompanyId,
@@ -154,6 +160,7 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do @@ -154,6 +160,7 @@ func (domainService *ConfirmMoneyIncentivesEstimateService) Confirm(contract *do
154 }) 160 })
155 } 161 }
156 } 162 }
  163 + }
157 return dividendsEstimateDetails, nil 164 return dividendsEstimateDetails, nil
158 } 165 }
159 166