...
|
...
|
@@ -160,6 +160,7 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var employeeDao *dao.EmployeeDao
|
|
|
if value, err := factory.CreateEmployeeDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -168,6 +169,7 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone |
|
|
} else {
|
|
|
employeeDao = value
|
|
|
}
|
|
|
|
|
|
var employeeRepository domain.EmployeeRepository
|
|
|
if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -185,6 +187,7 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone |
|
|
if employee == nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的企业员工")
|
|
|
}
|
|
|
|
|
|
if personSuMoneyStatistics, err := employeeDao.CalculatePersonSuMoney(personSuMoneyStatisticsCommand.Uid); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
@@ -196,6 +199,52 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取系统素币统计
|
|
|
*/
|
|
|
func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMoneyStatisticsCommand *command.SystemSuMoneyStatisticsCommand) (interface{}, error) {
|
|
|
if err := systemSuMoneyStatisticsCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var employeeDao *dao.EmployeeDao
|
|
|
if value, err := factory.CreateEmployeeDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
employeeDao = value
|
|
|
}
|
|
|
|
|
|
|
|
|
if systemSuMoneyStatistics, err := employeeDao.CalculateSystemExchangedCash(systemSuMoneyStatisticsCommand.CompanyId); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
//systemSuMoneyStatistics["currentSuMoney"] = employee.SuMoney
|
|
|
return systemSuMoneyStatistics, nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取系统现金统计
|
|
|
*/
|
|
|
//func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStatisticsCommand *command.SystemCashStatisticsCommand) (interface{}, error) {
|
|
|
//
|
|
|
//}
|
|
|
|
|
|
func NewStatisticsService(options map[string]interface{}) *StatisticsService {
|
|
|
newStatisticsService := &StatisticsService{}
|
|
|
return newStatisticsService
|
...
|
...
|
|