...
|
...
|
@@ -604,10 +604,51 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
|
|
// 初始化确认金额激励分红预算领域服务
|
|
|
var confirmMoneyIncentivesEstimateService service.ConfirmMoneyIncentivesEstimateService
|
|
|
if value, err := factory.CreateConfirmMoneyIncentivesEstimateService(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
confirmMoneyIncentivesEstimateService = value
|
|
|
_ = confirmMoneyIncentivesEstimateService.Subscribe(&subscriber.DividendsEstimateSubscriber{
|
|
|
TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 共创合约仓储初始化
|
|
|
var cooperationContractRepository domain.CooperationContractRepository
|
|
|
if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
cooperationContractRepository = value
|
|
|
}
|
|
|
|
|
|
cooperationContractId, _ := strconv.ParseInt(confirmMoneyIncentivesEstimateCommand.CooperationContractId, 10, 64)
|
|
|
undertakerUIDs, _ := utils.SliceAtoi(confirmMoneyIncentivesEstimateCommand.UndertakerUids)
|
|
|
|
|
|
// 获取共创合约
|
|
|
cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": cooperationContractId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if cooperationContract == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationContractId, 10)))
|
|
|
}
|
|
|
|
|
|
// 共创合约预算
|
|
|
if dividendsEstimateDetails, err2 := confirmMoneyIncentivesEstimateService.Confirm(cooperationContract, int64(confirmMoneyIncentivesEstimateCommand.DividendsIncentivesStage), undertakerUIDs); err2 != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error())
|
|
|
} else {
|
|
|
if err3 := transactionContext.CommitTransaction(); err3 != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return dividendsEstimateDetails, nil
|
|
|
}
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
// GetDividendsEstimate 返回分红预算单详情
|
...
|
...
|
|