作者 陈志颖

fix:金额激励分红名单

@@ -159,12 +159,16 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -159,12 +159,16 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
159 } 159 }
160 160
161 // 校验承接人是否属于承接对象,1员工,2共创用户,4公开 161 // 校验承接人是否属于承接对象,1员工,2共创用户,4公开
  162 + typeExist := false
162 if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, 3) { 163 if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, 3) {
163 for _, userType := range createCooperationContractCommand.CooperationContractUndertakerTypes { 164 for _, userType := range createCooperationContractCommand.CooperationContractUndertakerTypes {
164 - if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, undertakerDomain.UserType&userType) {  
165 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象") 165 + if utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, undertakerDomain.UserType&userType) {
  166 + typeExist = true
166 } 167 }
167 } 168 }
  169 + if !typeExist {
  170 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
  171 + }
168 } 172 }
169 173
170 // 获取推荐人 174 // 获取推荐人
@@ -1027,12 +1031,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1027,12 +1031,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1027 } 1031 }
1028 1032
1029 // 校验:判断用户类型是否属于承接对象 1033 // 校验:判断用户类型是否属于承接对象
  1034 + typeExist := false
1030 if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, 3) { // 非公开类型校验 1035 if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, 3) { // 非公开类型校验
1031 for _, userType := range cooperationContract.CooperationContractUndertakerTypes { 1036 for _, userType := range cooperationContract.CooperationContractUndertakerTypes {
1032 - if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, undertakerDomain.UserType&userType) {  
1033 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象") 1037 + if utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, undertakerDomain.UserType&userType) {
  1038 + typeExist = true
1034 } 1039 }
1035 } 1040 }
  1041 + if !typeExist {
  1042 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
  1043 + }
1036 } 1044 }
1037 1045
1038 // 获取推荐人 1046 // 获取推荐人
@@ -1432,7 +1432,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE @@ -1432,7 +1432,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE
1432 } else { 1432 } else {
1433 if countDividendsEstimates > 0 { // 已有分红 1433 if countDividendsEstimates > 0 { // 已有分红
1434 for _, dividendsEstimate := range dividendsEstimates { 1434 for _, dividendsEstimate := range dividendsEstimates {
1435 - if dividendsEstimate.DividendsAccountStatus == 1 || dividendsEstimate.IsCanceled { // 分红预算单状态为待结算或已取消 1435 + if dividendsEstimate.IsCanceled { // 分红预算单状态为已取消
1436 stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage], undertaker) 1436 stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage], undertaker)
1437 } 1437 }
1438 } 1438 }