|
@@ -1372,12 +1372,6 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
|
@@ -1372,12 +1372,6 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
1372
|
dividendsEstimateRepository = value
|
1372
|
dividendsEstimateRepository = value
|
1373
|
}
|
1373
|
}
|
1374
|
|
1374
|
|
1375
|
- // 阶段承接人列表
|
|
|
1376
|
- stageAndUndertaker := make([]*dto.StageAndUndertaker, 0)
|
|
|
1377
|
-
|
|
|
1378
|
- // 阶段承接人map
|
|
|
1379
|
- stageUndertakerMap := make(map[int32][]*domain.Undertaker)
|
|
|
1380
|
-
|
|
|
1381
|
// 查找共创合约
|
1375
|
// 查找共创合约
|
1382
|
searchMoneyIncentivesEstimateQuery.IncentivesType = 2
|
1376
|
searchMoneyIncentivesEstimateQuery.IncentivesType = 2
|
1383
|
if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(searchMoneyIncentivesEstimateQuery)); err != nil {
|
1377
|
if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(searchMoneyIncentivesEstimateQuery)); err != nil {
|
|
@@ -1385,9 +1379,18 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
|
@@ -1385,9 +1379,18 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
1385
|
} else {
|
1379
|
} else {
|
1386
|
var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto
|
1380
|
var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto
|
1387
|
for _, cooperationContract := range cooperationContracts {
|
1381
|
for _, cooperationContract := range cooperationContracts {
|
|
|
1382
|
+ // 阶段承接人map
|
|
|
1383
|
+ stageUndertakerMap := make(map[int32][]*domain.Undertaker)
|
|
|
1384
|
+ // 阶段承接人列表
|
|
|
1385
|
+ stageAndUndertaker := make([]*dto.StageAndUndertaker, 0)
|
|
|
1386
|
+ // 初始化阶段承接人map
|
1388
|
for _, rule := range cooperationContract.MoneyIncentivesRules {
|
1387
|
for _, rule := range cooperationContract.MoneyIncentivesRules {
|
1389
|
stageUndertakerMap[rule.MoneyIncentivesStage] = make([]*domain.Undertaker, 0)
|
1388
|
stageUndertakerMap[rule.MoneyIncentivesStage] = make([]*domain.Undertaker, 0)
|
1390
|
}
|
1389
|
}
|
|
|
1390
|
+ log.Logger.Info("阶段承接人map初始化", map[string]interface{}{
|
|
|
1391
|
+ "stageUndertakerMap": stageUndertakerMap,
|
|
|
1392
|
+ })
|
|
|
1393
|
+ // 获取承接人
|
1391
|
for _, undertaker := range cooperationContract.Undertakers {
|
1394
|
for _, undertaker := range cooperationContract.Undertakers {
|
1392
|
// 查询承接人分红预算单
|
1395
|
// 查询承接人分红预算单
|
1393
|
if countDividendsEstimates, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{
|
1396
|
if countDividendsEstimates, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{
|
|
@@ -1398,7 +1401,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
|
@@ -1398,7 +1401,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
1398
|
}); err != nil {
|
1401
|
}); err != nil {
|
1399
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1402
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1400
|
} else {
|
1403
|
} else {
|
1401
|
- if countDividendsEstimates > 0 {
|
1404
|
+ if countDividendsEstimates > 0 { // 已有分红
|
1402
|
for _, dividendsEstimate := range dividendsEstimates {
|
1405
|
for _, dividendsEstimate := range dividendsEstimates {
|
1403
|
if dividendsEstimate.DividendsAccountStatus == 1 || dividendsEstimate.IsCanceled { // 分红预算单状态为待结算或已取消
|
1406
|
if dividendsEstimate.DividendsAccountStatus == 1 || dividendsEstimate.IsCanceled { // 分红预算单状态为待结算或已取消
|
1404
|
stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage], undertaker)
|
1407
|
stageUndertakerMap[dividendsEstimate.DividendsStage] = append(stageUndertakerMap[dividendsEstimate.DividendsStage], undertaker)
|
|
@@ -1411,7 +1414,9 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
|
@@ -1411,7 +1414,9 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
1411
|
}
|
1414
|
}
|
1412
|
}
|
1415
|
}
|
1413
|
}
|
1416
|
}
|
1414
|
-
|
1417
|
+ log.Logger.Info("阶段承接人map", map[string]interface{}{
|
|
|
1418
|
+ "stageUndertakerMap": stageUndertakerMap,
|
|
|
1419
|
+ })
|
1415
|
for k, v := range stageUndertakerMap {
|
1420
|
for k, v := range stageUndertakerMap {
|
1416
|
stageAndUndertaker = append(stageAndUndertaker, &dto.StageAndUndertaker{
|
1421
|
stageAndUndertaker = append(stageAndUndertaker, &dto.StageAndUndertaker{
|
1417
|
Stage: k,
|
1422
|
Stage: k,
|
|
@@ -1425,6 +1430,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
|
@@ -1425,6 +1430,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE |
1425
|
}
|
1430
|
}
|
1426
|
moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto)
|
1431
|
moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto)
|
1427
|
}
|
1432
|
}
|
|
|
1433
|
+
|
1428
|
if err := transactionContext.CommitTransaction(); err != nil {
|
1434
|
if err := transactionContext.CommitTransaction(); err != nil {
|
1429
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
1435
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
1430
|
}
|
1436
|
}
|