|
@@ -82,66 +82,284 @@ func (cashPoolService *CashPoolService) OperationCashPool(createCashPoolCommand |
|
@@ -82,66 +82,284 @@ func (cashPoolService *CashPoolService) OperationCashPool(createCashPoolCommand |
82
|
|
82
|
|
83
|
// TODO 返回现金池
|
83
|
// TODO 返回现金池
|
84
|
func (cashPoolService *CashPoolService) CashPool(getCashPoolQuery *query.GetCashPoolQuery) (interface{}, error) {
|
84
|
func (cashPoolService *CashPoolService) CashPool(getCashPoolQuery *query.GetCashPoolQuery) (interface{}, error) {
|
|
|
85
|
+ if err := getCashPoolQuery.ValidateQuery(); err != nil {
|
|
|
86
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
87
|
+ }
|
|
|
88
|
+
|
|
|
89
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
90
|
+
|
|
|
91
|
+ if err != nil {
|
|
|
92
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
93
|
+ }
|
|
|
94
|
+
|
|
|
95
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
96
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
97
|
+ }
|
|
|
98
|
+
|
|
|
99
|
+ defer func() {
|
|
|
100
|
+ transactionContext.RollbackTransaction()
|
|
|
101
|
+ }()
|
|
|
102
|
+
|
|
|
103
|
+
|
85
|
return nil, nil
|
104
|
return nil, nil
|
86
|
}
|
105
|
}
|
87
|
|
106
|
|
88
|
// TODO 返回兑换现金活动
|
107
|
// TODO 返回兑换现金活动
|
89
|
-func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCashActivityCommand *query.ListExchangeCashActivityQuery) (interface{}, error) {
|
108
|
+func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCashActivityQuery *query.ListExchangeCashActivityQuery) (interface{}, error) {
|
|
|
109
|
+ if err := listExchangeCashActivityQuery.ValidateQuery(); err != nil {
|
|
|
110
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
111
|
+ }
|
|
|
112
|
+
|
|
|
113
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
114
|
+
|
|
|
115
|
+ if err != nil {
|
|
|
116
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
117
|
+ }
|
|
|
118
|
+
|
|
|
119
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
120
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
121
|
+ }
|
|
|
122
|
+
|
|
|
123
|
+ defer func() {
|
|
|
124
|
+ transactionContext.RollbackTransaction()
|
|
|
125
|
+ }()
|
|
|
126
|
+
|
90
|
return nil, nil
|
127
|
return nil, nil
|
91
|
}
|
128
|
}
|
92
|
|
129
|
|
93
|
// TODO 新增兑换现金活动
|
130
|
// TODO 新增兑换现金活动
|
94
|
func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchangeCashActivityCommand *command.CreateExchangeCashActivityCommand) (interface{}, error) {
|
131
|
func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchangeCashActivityCommand *command.CreateExchangeCashActivityCommand) (interface{}, error) {
|
|
|
132
|
+ if err := createExchangeCashActivityCommand.ValidateCommand(); err != nil {
|
|
|
133
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
134
|
+ }
|
|
|
135
|
+
|
|
|
136
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
137
|
+
|
|
|
138
|
+ if err != nil {
|
|
|
139
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
140
|
+ }
|
|
|
141
|
+
|
|
|
142
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
143
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
144
|
+ }
|
|
|
145
|
+
|
|
|
146
|
+ defer func() {
|
|
|
147
|
+ transactionContext.RollbackTransaction()
|
|
|
148
|
+ }()
|
|
|
149
|
+
|
95
|
return nil, nil
|
150
|
return nil, nil
|
96
|
}
|
151
|
}
|
97
|
|
152
|
|
98
|
// TODO 返回兑换现金活动列表
|
153
|
// TODO 返回兑换现金活动列表
|
99
|
func (cashPoolService *CashPoolService) ExchangeCashActivityList(listExchangeCashActivityQuery *query.ListExchangeCashActivityQuery) (interface{}, error) {
|
154
|
func (cashPoolService *CashPoolService) ExchangeCashActivityList(listExchangeCashActivityQuery *query.ListExchangeCashActivityQuery) (interface{}, error) {
|
|
|
155
|
+ if err := listExchangeCashActivityQuery.ValidateQuery(); err != nil {
|
|
|
156
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
157
|
+ }
|
|
|
158
|
+
|
|
|
159
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
160
|
+
|
|
|
161
|
+ if err != nil {
|
|
|
162
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
163
|
+ }
|
|
|
164
|
+
|
|
|
165
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
166
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
167
|
+ }
|
|
|
168
|
+
|
|
|
169
|
+ defer func() {
|
|
|
170
|
+ transactionContext.RollbackTransaction()
|
|
|
171
|
+ }()
|
|
|
172
|
+
|
100
|
return nil, nil
|
173
|
return nil, nil
|
101
|
}
|
174
|
}
|
102
|
|
175
|
|
103
|
// TODO 移除兑换现金活动
|
176
|
// TODO 移除兑换现金活动
|
104
|
func (cashPoolService *CashPoolService) RemoveExchangeCashActivity(removeExchangeCashActivityCommand *command.RemoveExchangeCashActivityCommand) (interface{}, error) {
|
177
|
func (cashPoolService *CashPoolService) RemoveExchangeCashActivity(removeExchangeCashActivityCommand *command.RemoveExchangeCashActivityCommand) (interface{}, error) {
|
|
|
178
|
+ if err := removeExchangeCashActivityCommand.ValidateCommand(); err != nil {
|
|
|
179
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
180
|
+ }
|
|
|
181
|
+
|
|
|
182
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
183
|
+
|
|
|
184
|
+ if err != nil {
|
|
|
185
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
186
|
+ }
|
|
|
187
|
+
|
|
|
188
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
189
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
190
|
+ }
|
|
|
191
|
+
|
|
|
192
|
+ defer func() {
|
|
|
193
|
+ transactionContext.RollbackTransaction()
|
|
|
194
|
+ }()
|
|
|
195
|
+
|
105
|
return nil, nil
|
196
|
return nil, nil
|
106
|
}
|
197
|
}
|
107
|
|
198
|
|
108
|
// TODO 返回兑换现金活动
|
199
|
// TODO 返回兑换现金活动
|
109
|
func (cashPoolService *CashPoolService) GetExchangeCashActivity(getExchangeCashActivityQuery *query.GetExchangeCashActivityQuery) (interface{}, error) {
|
200
|
func (cashPoolService *CashPoolService) GetExchangeCashActivity(getExchangeCashActivityQuery *query.GetExchangeCashActivityQuery) (interface{}, error) {
|
|
|
201
|
+ if err := getExchangeCashActivityQuery.ValidateQuery(); err != nil {
|
|
|
202
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
203
|
+ }
|
|
|
204
|
+
|
|
|
205
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
206
|
+
|
|
|
207
|
+ if err != nil {
|
|
|
208
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
209
|
+ }
|
|
|
210
|
+
|
|
|
211
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
212
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
213
|
+ }
|
|
|
214
|
+
|
|
|
215
|
+ defer func() {
|
|
|
216
|
+ transactionContext.RollbackTransaction()
|
|
|
217
|
+ }()
|
|
|
218
|
+
|
110
|
return nil, nil
|
219
|
return nil, nil
|
111
|
}
|
220
|
}
|
112
|
|
221
|
|
113
|
// TODO 更新兑换现金活动
|
222
|
// TODO 更新兑换现金活动
|
114
|
func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchangeCashActivityCommand *command.UpdateExchangeCashActivityCommand) (interface{}, error) {
|
223
|
func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchangeCashActivityCommand *command.UpdateExchangeCashActivityCommand) (interface{}, error) {
|
|
|
224
|
+ if err := updateExchangeCashActivityCommand.ValidateCommand(); err != nil {
|
|
|
225
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
226
|
+ }
|
|
|
227
|
+
|
|
|
228
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
229
|
+
|
|
|
230
|
+ if err != nil {
|
|
|
231
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
232
|
+ }
|
|
|
233
|
+
|
|
|
234
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
235
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
236
|
+ }
|
|
|
237
|
+
|
|
|
238
|
+ defer func() {
|
|
|
239
|
+ transactionContext.RollbackTransaction()
|
|
|
240
|
+ }()
|
|
|
241
|
+
|
115
|
return nil, nil
|
242
|
return nil, nil
|
116
|
}
|
243
|
}
|
117
|
|
244
|
|
118
|
// TODO 新建兑换现金人员
|
245
|
// TODO 新建兑换现金人员
|
119
|
func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeCashPersonCommand *command.CreateExchangeCashPersonCommand) (interface{}, error) {
|
246
|
func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeCashPersonCommand *command.CreateExchangeCashPersonCommand) (interface{}, error) {
|
|
|
247
|
+ if err := createExchangeCashPersonCommand.ValidateCommand(); err != nil {
|
|
|
248
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
249
|
+ }
|
|
|
250
|
+
|
|
|
251
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
252
|
+
|
|
|
253
|
+ if err != nil {
|
|
|
254
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
255
|
+ }
|
|
|
256
|
+
|
|
|
257
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
258
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
259
|
+ }
|
|
|
260
|
+
|
|
|
261
|
+ defer func() {
|
|
|
262
|
+ transactionContext.RollbackTransaction()
|
|
|
263
|
+ }()
|
|
|
264
|
+
|
120
|
return nil, nil
|
265
|
return nil, nil
|
121
|
}
|
266
|
}
|
122
|
|
267
|
|
123
|
// TODO 返回兑换现金人员
|
268
|
// TODO 返回兑换现金人员
|
124
|
func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPersonQuery *query.GetExchangeCashPersonQuery) (interface{}, error) {
|
269
|
func (cashPoolService *CashPoolService) GetExchangeCashPerson(getExchangeCashPersonQuery *query.GetExchangeCashPersonQuery) (interface{}, error) {
|
|
|
270
|
+ if err := getExchangeCashPersonQuery.ValidateQuery(); err != nil {
|
|
|
271
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
272
|
+ }
|
|
|
273
|
+
|
|
|
274
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
275
|
+
|
|
|
276
|
+ if err != nil {
|
|
|
277
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
278
|
+ }
|
|
|
279
|
+
|
|
|
280
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
281
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
282
|
+ }
|
|
|
283
|
+
|
|
|
284
|
+ defer func() {
|
|
|
285
|
+ transactionContext.RollbackTransaction()
|
|
|
286
|
+ }()
|
|
|
287
|
+
|
125
|
return nil, nil
|
288
|
return nil, nil
|
126
|
}
|
289
|
}
|
127
|
|
290
|
|
128
|
// TODO 返回兑换现金人员列表
|
291
|
// TODO 返回兑换现金人员列表
|
129
|
func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashPersonQuery *query.ListExchangeCashPersonQuery) (interface{}, error) {
|
292
|
func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashPersonQuery *query.ListExchangeCashPersonQuery) (interface{}, error) {
|
|
|
293
|
+ if err := listExchangeCashPersonQuery.ValidateQuery(); err != nil {
|
|
|
294
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
295
|
+ }
|
|
|
296
|
+
|
|
|
297
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
298
|
+
|
|
|
299
|
+ if err != nil {
|
|
|
300
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
301
|
+ }
|
|
|
302
|
+
|
|
|
303
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
304
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
305
|
+ }
|
|
|
306
|
+
|
|
|
307
|
+ defer func() {
|
|
|
308
|
+ transactionContext.RollbackTransaction()
|
|
|
309
|
+ }()
|
|
|
310
|
+
|
130
|
return nil, nil
|
311
|
return nil, nil
|
131
|
}
|
312
|
}
|
132
|
|
313
|
|
133
|
// TODO 移除兑换现金人员
|
314
|
// TODO 移除兑换现金人员
|
134
|
func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeCashPersonCommand *command.RemoveExchangeCashPersonCommand) (interface{}, error) {
|
315
|
func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeCashPersonCommand *command.RemoveExchangeCashPersonCommand) (interface{}, error) {
|
|
|
316
|
+ if err := removeExchangeCashPersonCommand.ValidateCommand(); err != nil {
|
|
|
317
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
318
|
+ }
|
|
|
319
|
+
|
|
|
320
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
321
|
+
|
|
|
322
|
+ if err != nil {
|
|
|
323
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
324
|
+ }
|
|
|
325
|
+
|
|
|
326
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
327
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
328
|
+ }
|
|
|
329
|
+
|
|
|
330
|
+ defer func() {
|
|
|
331
|
+ transactionContext.RollbackTransaction()
|
|
|
332
|
+ }()
|
|
|
333
|
+
|
135
|
return nil, nil
|
334
|
return nil, nil
|
136
|
}
|
335
|
}
|
137
|
|
336
|
|
138
|
// TODO 更新兑换现金人员
|
337
|
// TODO 更新兑换现金人员
|
139
|
func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeCashCommand *command.UpdateExchangeCashPersonCommand) (interface{}, error) {
|
338
|
func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeCashCommand *command.UpdateExchangeCashPersonCommand) (interface{}, error) {
|
|
|
339
|
+ if err := updateExchangeCashCommand.ValidateCommand(); err != nil {
|
|
|
340
|
+ return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
341
|
+ }
|
|
|
342
|
+
|
|
|
343
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
344
|
+
|
|
|
345
|
+ if err != nil {
|
|
|
346
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
347
|
+ }
|
|
|
348
|
+
|
|
|
349
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
350
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
351
|
+ }
|
|
|
352
|
+
|
|
|
353
|
+ defer func() {
|
|
|
354
|
+ transactionContext.RollbackTransaction()
|
|
|
355
|
+ }()
|
|
|
356
|
+
|
|
|
357
|
+ // TODO 新增流水记录
|
|
|
358
|
+
|
|
|
359
|
+
|
140
|
return nil, nil
|
360
|
return nil, nil
|
141
|
}
|
361
|
}
|
142
|
|
362
|
|
143
|
-// TODO 导入兑换现金人员
|
|
|
144
|
-
|
|
|
145
|
func NewCashPoolService(options map[string]interface{}) *CashPoolService {
|
363
|
func NewCashPoolService(options map[string]interface{}) *CashPoolService {
|
146
|
newCashPoolService := &CashPoolService{}
|
364
|
newCashPoolService := &CashPoolService{}
|
147
|
return newCashPoolService
|
365
|
return newCashPoolService
|