|
@@ -10,6 +10,7 @@ import ( |
|
@@ -10,6 +10,7 @@ import ( |
10
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
|
10
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
|
11
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
|
11
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
|
12
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
|
12
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
|
|
|
13
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
13
|
"strconv"
|
14
|
"strconv"
|
14
|
"time"
|
15
|
"time"
|
15
|
)
|
16
|
)
|
|
@@ -169,6 +170,7 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat |
|
@@ -169,6 +170,7 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat |
169
|
defer func() {
|
170
|
defer func() {
|
170
|
_ = transactionContext.RollbackTransaction()
|
171
|
_ = transactionContext.RollbackTransaction()
|
171
|
}()
|
172
|
}()
|
|
|
173
|
+ // 分红预算仓储初始化
|
172
|
var dividendsEstimateRepository domain.DividendsEstimateRepository
|
174
|
var dividendsEstimateRepository domain.DividendsEstimateRepository
|
173
|
if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
|
175
|
if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
|
174
|
"transactionContext": transactionContext,
|
176
|
"transactionContext": transactionContext,
|
|
@@ -216,10 +218,37 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs |
|
@@ -216,10 +218,37 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs |
216
|
defer func() {
|
218
|
defer func() {
|
217
|
_ = transactionContext.RollbackTransaction()
|
219
|
_ = transactionContext.RollbackTransaction()
|
218
|
}()
|
220
|
}()
|
219
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
220
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
221
|
+ // 分红预算仓储初始化
|
|
|
222
|
+ var dividendsEstimateRepository domain.DividendsEstimateRepository
|
|
|
223
|
+ if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
|
|
|
224
|
+ "transactionContext": transactionContext,
|
|
|
225
|
+ }); err != nil {
|
|
|
226
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
227
|
+ } else {
|
|
|
228
|
+ dividendsEstimateRepository = value
|
|
|
229
|
+ }
|
|
|
230
|
+ dividendsEstimateIds, _ := utils.SliceAtoi(batchCancelEstimateCommand.DividendsEstimateIds)
|
|
|
231
|
+ if count, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{
|
|
|
232
|
+ "dividendsEstimateIds": dividendsEstimateIds,
|
|
|
233
|
+ }); err != nil {
|
|
|
234
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
235
|
+ } else {
|
|
|
236
|
+ if count > 0 {
|
|
|
237
|
+ for i, _ := range dividendsEstimates {
|
|
|
238
|
+ dividendsEstimates[i].IsCanceled = true
|
|
|
239
|
+ }
|
|
|
240
|
+ dividendsEstimatesCanceled, err := dividendsEstimateRepository.UpdateMany(dividendsEstimates)
|
|
|
241
|
+ if err != nil {
|
|
|
242
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
243
|
+ }
|
|
|
244
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
245
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
246
|
+ }
|
|
|
247
|
+ return dividendsEstimatesCanceled, nil
|
|
|
248
|
+ } else {
|
|
|
249
|
+ return map[string]interface{}{}, nil
|
|
|
250
|
+ }
|
221
|
}
|
251
|
}
|
222
|
- return nil, nil
|
|
|
223
|
}
|
252
|
}
|
224
|
|
253
|
|
225
|
// CreateDividendsEstimate 创建分红预算单 (预留)
|
254
|
// CreateDividendsEstimate 创建分红预算单 (预留)
|