|
@@ -31,6 +31,17 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand * |
|
@@ -31,6 +31,17 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand * |
31
|
transactionContext.RollbackTransaction()
|
31
|
transactionContext.RollbackTransaction()
|
32
|
}()
|
32
|
}()
|
33
|
|
33
|
|
|
|
34
|
+ // 员工仓储初始化
|
|
|
35
|
+ var employeeRepository domain.EmployeeRepository
|
|
|
36
|
+ if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
|
|
|
37
|
+ "transactionContext": transactionContext,
|
|
|
38
|
+ }); err != nil {
|
|
|
39
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
40
|
+ } else {
|
|
|
41
|
+ employeeRepository = value
|
|
|
42
|
+ }
|
|
|
43
|
+
|
|
|
44
|
+ // 操作素币服务初始化
|
34
|
var operationSuMoneyService service.OperationSuMoneyService
|
45
|
var operationSuMoneyService service.OperationSuMoneyService
|
35
|
if value, err := factory.CreateOperationSuMoneyService(map[string]interface{}{
|
46
|
if value, err := factory.CreateOperationSuMoneyService(map[string]interface{}{
|
36
|
"transactionContext": transactionContext,
|
47
|
"transactionContext": transactionContext,
|
|
@@ -40,7 +51,18 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand * |
|
@@ -40,7 +51,18 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand * |
40
|
operationSuMoneyService = value
|
51
|
operationSuMoneyService = value
|
41
|
}
|
52
|
}
|
42
|
|
53
|
|
43
|
-
|
54
|
+ // 判断当前员工是否有效
|
|
|
55
|
+ getEmployee := map[string]interface{}{
|
|
|
56
|
+ "uid": operationSuMoneyCommand.Uid,
|
|
|
57
|
+ "status": 1,
|
|
|
58
|
+ }
|
|
|
59
|
+ employeeFound, err := employeeRepository.FindOne(getEmployee)
|
|
|
60
|
+ if err != nil {
|
|
|
61
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
62
|
+ }
|
|
|
63
|
+ if employeeFound == nil {
|
|
|
64
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的员工")
|
|
|
65
|
+ }
|
44
|
|
66
|
|
45
|
if task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription); err != nil {
|
67
|
if task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription); err != nil {
|
46
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
68
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|