作者 陈志颖

fix:账期结算成功更新分红预算单结算状态

... ... @@ -145,7 +145,6 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
}
// 预算明细
var creditAccounts []*domain.CreditAccount
var accountDetail []*domain.AccountDetail
var settlementAmount float64
for _, dividendsEstimate := range dividendsEstimates {
... ... @@ -201,13 +200,19 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
if creditAccount, err13 := creditAccountRepository.Save(newCreditAccount); err13 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err13.Error())
} else {
creditAccounts = append(creditAccounts, creditAccount)
}
if err14 := transactionContext.CommitTransaction(); err14 != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err14.Error())
// 变更分红预算单结算状态
for i, _ := range dividendsEstimates {
dividendsEstimates[i].DividendsAccountStatus = 2
}
_, err3 := dividendsEstimateRepository.UpdateMany(dividendsEstimates)
if err3 != nil {
return nil, err3
}
if err14 := transactionContext.CommitTransaction(); err14 != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err14.Error())
}
return creditAccount, nil
}
return creditAccounts, nil
}
}
... ...