作者 陈志颖

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

@@ -145,7 +145,6 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred @@ -145,7 +145,6 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
145 } 145 }
146 146
147 // 预算明细 147 // 预算明细
148 - var creditAccounts []*domain.CreditAccount  
149 var accountDetail []*domain.AccountDetail 148 var accountDetail []*domain.AccountDetail
150 var settlementAmount float64 149 var settlementAmount float64
151 for _, dividendsEstimate := range dividendsEstimates { 150 for _, dividendsEstimate := range dividendsEstimates {
@@ -201,13 +200,19 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred @@ -201,13 +200,19 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
201 if creditAccount, err13 := creditAccountRepository.Save(newCreditAccount); err13 != nil { 200 if creditAccount, err13 := creditAccountRepository.Save(newCreditAccount); err13 != nil {
202 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err13.Error()) 201 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err13.Error())
203 } else { 202 } else {
204 - creditAccounts = append(creditAccounts, creditAccount)  
205 - }  
206 -  
207 - if err14 := transactionContext.CommitTransaction(); err14 != nil {  
208 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err14.Error()) 203 + // 变更分红预算单结算状态
  204 + for i, _ := range dividendsEstimates {
  205 + dividendsEstimates[i].DividendsAccountStatus = 2
  206 + }
  207 + _, err3 := dividendsEstimateRepository.UpdateMany(dividendsEstimates)
  208 + if err3 != nil {
  209 + return nil, err3
  210 + }
  211 + if err14 := transactionContext.CommitTransaction(); err14 != nil {
  212 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err14.Error())
  213 + }
  214 + return creditAccount, nil
209 } 215 }
210 - return creditAccounts, nil  
211 } 216 }
212 } 217 }
213 218