|
@@ -18,22 +18,26 @@ type OperationSuMoneyService struct { |
|
@@ -18,22 +18,26 @@ type OperationSuMoneyService struct { |
18
|
func (service *OperationSuMoneyService) Operation(uid int64, operatorUid int64, suMoney float64, operationType int, recordDescription string) (*domain.SuMoneyTransactionRecord, error) {
|
18
|
func (service *OperationSuMoneyService) Operation(uid int64, operatorUid int64, suMoney float64, operationType int, recordDescription string) (*domain.SuMoneyTransactionRecord, error) {
|
19
|
var employeeRepository domain.EmployeeRepository
|
19
|
var employeeRepository domain.EmployeeRepository
|
20
|
var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository
|
20
|
var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository
|
|
|
21
|
+
|
21
|
var employeeDao *dao.EmployeeDao
|
22
|
var employeeDao *dao.EmployeeDao
|
22
|
if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil {
|
23
|
if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil {
|
23
|
return nil, err
|
24
|
return nil, err
|
24
|
} else {
|
25
|
} else {
|
25
|
employeeRepository = repository
|
26
|
employeeRepository = repository
|
26
|
}
|
27
|
}
|
|
|
28
|
+
|
27
|
if repository, err := repository.NewSuMoneyTransactionRecordRepository(service.transactionContext); err != nil {
|
29
|
if repository, err := repository.NewSuMoneyTransactionRecordRepository(service.transactionContext); err != nil {
|
28
|
return nil, err
|
30
|
return nil, err
|
29
|
} else {
|
31
|
} else {
|
30
|
suMoneyTransactionRecordRepository = repository
|
32
|
suMoneyTransactionRecordRepository = repository
|
31
|
}
|
33
|
}
|
|
|
34
|
+
|
32
|
if dao, err := dao.NewEmployeeDao(service.transactionContext); err != nil {
|
35
|
if dao, err := dao.NewEmployeeDao(service.transactionContext); err != nil {
|
33
|
return nil, err
|
36
|
return nil, err
|
34
|
} else {
|
37
|
} else {
|
35
|
employeeDao = dao
|
38
|
employeeDao = dao
|
36
|
}
|
39
|
}
|
|
|
40
|
+
|
37
|
employee, err := employeeRepository.FindOne(map[string]interface{}{
|
41
|
employee, err := employeeRepository.FindOne(map[string]interface{}{
|
38
|
"uid": uid,
|
42
|
"uid": uid,
|
39
|
})
|
43
|
})
|