...
|
...
|
@@ -1420,6 +1420,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
|
|
|
|
|
// 获取承接人
|
|
|
for _, undertaker := range cooperationContract.Undertakers {
|
|
|
// 将承接人填入不同分红阶段
|
|
|
for i, _ := range stageUndertakerMap {
|
|
|
stageUndertakerMap[i] = append(stageUndertakerMap[i], undertaker)
|
|
|
}
|
|
|
// 查询承接人分红预算单
|
|
|
if countDividendsEstimates, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{
|
|
|
"cooperationContractNumber": cooperationContract.CooperationContractNumber,
|
...
|
...
|
@@ -1430,17 +1434,27 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if countDividendsEstimates > 0 { // 已有分红
|
|
|
log.Logger.Info("获取承接人相关的金额激励预算信息", map[string]interface{}{
|
|
|
"dividendsEstimates": dividendsEstimates,
|
|
|
})
|
|
|
if countDividendsEstimates > 0 { // 已有分红预算
|
|
|
for _, dividendsEstimate := range dividendsEstimates {
|
|
|
if dividendsEstimate.DividendsAccountStatus == 1 || dividendsEstimate.IsCanceled { // 分红预算单状态为待结算或已取消
|
|
|
stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage], undertaker)
|
|
|
if !dividendsEstimate.IsCanceled { // 分红预算单状态为非取消状态
|
|
|
//stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage], undertaker)
|
|
|
for i, undertakerAppended := range stageUndertakerMap[dividendsEstimate.DividendsStage] {
|
|
|
if undertakerAppended.UndertakerId == undertaker.UndertakerId {
|
|
|
// 将删除点前后的元素连接起来
|
|
|
stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage][:i], stageUndertakerMap[dividendsEstimate.DividendsStage][i+1:]...)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else if countDividendsEstimates == 0 { // 未分红,可以加入任意阶段进行金额激励
|
|
|
for i, _ := range stageUndertakerMap {
|
|
|
stageUndertakerMap[i] = append(stageUndertakerMap[i], undertaker)
|
|
|
}
|
|
|
}
|
|
|
//else if countDividendsEstimates == 0 { // 未分红,可以加入任意阶段进行金额激励
|
|
|
// for i, _ := range stageUndertakerMap {
|
|
|
// stageUndertakerMap[i] = append(stageUndertakerMap[i], undertaker)
|
|
|
// }
|
|
|
//}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|