作者 陈志颖

fix:金额激励分红承接人列表

@@ -1420,6 +1420,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE @@ -1420,6 +1420,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE
1420 1420
1421 // 获取承接人 1421 // 获取承接人
1422 for _, undertaker := range cooperationContract.Undertakers { 1422 for _, undertaker := range cooperationContract.Undertakers {
  1423 + // 将承接人填入不同分红阶段
  1424 + for i, _ := range stageUndertakerMap {
  1425 + stageUndertakerMap[i] = append(stageUndertakerMap[i], undertaker)
  1426 + }
1423 // 查询承接人分红预算单 1427 // 查询承接人分红预算单
1424 if countDividendsEstimates, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{ 1428 if countDividendsEstimates, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{
1425 "cooperationContractNumber": cooperationContract.CooperationContractNumber, 1429 "cooperationContractNumber": cooperationContract.CooperationContractNumber,
@@ -1435,15 +1439,22 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE @@ -1435,15 +1439,22 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE
1435 }) 1439 })
1436 if countDividendsEstimates > 0 { // 已有分红预算 1440 if countDividendsEstimates > 0 { // 已有分红预算
1437 for _, dividendsEstimate := range dividendsEstimates { 1441 for _, dividendsEstimate := range dividendsEstimates {
1438 - if dividendsEstimate.IsCanceled { // 分红预算单状态为已取消  
1439 - stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage], undertaker) 1442 + if !dividendsEstimate.IsCanceled { // 分红预算单状态为非取消状态
  1443 + //stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage], undertaker)
  1444 + for i, undertakerAppended := range stageUndertakerMap[dividendsEstimate.DividendsStage] {
  1445 + if undertakerAppended.UndertakerId == undertaker.UndertakerId {
  1446 + // 将删除点前后的元素连接起来
  1447 + stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage][:i], stageUndertakerMap[dividendsEstimate.DividendsStage][i+1:]...)
  1448 + }
  1449 + }
1440 } 1450 }
1441 } 1451 }
1442 - } else if countDividendsEstimates == 0 { // 未分红,可以加入任意阶段进行金额激励  
1443 - for i, _ := range stageUndertakerMap {  
1444 - stageUndertakerMap[i] = append(stageUndertakerMap[i], undertaker)  
1445 - }  
1446 } 1452 }
  1453 + //else if countDividendsEstimates == 0 { // 未分红,可以加入任意阶段进行金额激励
  1454 + // for i, _ := range stageUndertakerMap {
  1455 + // stageUndertakerMap[i] = append(stageUndertakerMap[i], undertaker)
  1456 + // }
  1457 + //}
1447 } 1458 }
1448 } 1459 }
1449 1460