作者 陈志颖

refactor:优化确定金额激励预算服务

... ... @@ -724,7 +724,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives
Org: organization,
Company: company,
Operator: nil,
OperateTime: time.Now(),
OperateTime: time.Time{},
IsCanceled: false,
CreatedAt: time.Now(),
DeletedAt: time.Time{},
... ... @@ -732,13 +732,12 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives
}
dividendsEstimates = append(dividendsEstimates, dividendsEstimate)
}
var dividendsEstimatesSaved []*domain.DividendsEstimate
for _, dividendsEstimate := range dividendsEstimates {
if dividendsEstimateSaved, err := dividendsEstimateRepository.Save(dividendsEstimate); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
dividendsEstimatesSaved = append(dividendsEstimatesSaved, dividendsEstimateSaved)
}
dividendsEstimatesSaved, err := dividendsEstimateRepository.SaveMany(dividendsEstimates)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if confirmMoneyIncentivesEstimateCommand.Action == 1 { // 只预算,不入库
return dividendsEstimatesSaved, nil
... ...