...
|
...
|
@@ -170,6 +170,7 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone |
|
|
employeeDao = value
|
|
|
}
|
|
|
|
|
|
// 企业员工资源库
|
|
|
var employeeRepository domain.EmployeeRepository
|
|
|
if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -178,6 +179,8 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone |
|
|
} else {
|
|
|
employeeRepository = value
|
|
|
}
|
|
|
|
|
|
// 判断企业员工是否有效
|
|
|
employee, err := employeeRepository.FindOne(map[string]interface{}{
|
|
|
"uid": personSuMoneyStatisticsCommand.Uid,
|
|
|
})
|
...
|
...
|
@@ -188,6 +191,7 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone |
|
|
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 {
|
...
|
...
|
@@ -199,7 +203,7 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 系统素币统计
|
|
|
// TODO 系统素币统计
|
|
|
func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMoneyStatisticsCommand *command.SystemSuMoneyStatisticsCommand) (interface{}, error) {
|
|
|
if err := systemSuMoneyStatisticsCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -214,15 +218,35 @@ func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMone |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
var cashPoolDao *dao.CashPoolDao
|
|
|
if value, err := factory.CreateCashPoolDao(map[string]interface{}{
|
|
|
|
|
|
//var cashPoolDao *dao.CashPoolDao
|
|
|
//if value, err := factory.CreateCashPoolDao(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// cashPoolDao = value
|
|
|
//}
|
|
|
|
|
|
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())
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
} else {
|
|
|
cashPoolDao = value
|
|
|
employeeDao = value
|
|
|
}
|
|
|
if systemSuMoneyStatistics, err := cashPoolDao.CalculateSystemCash(systemSuMoneyStatisticsCommand.CompanyId); err != nil {
|
|
|
|
|
|
//var employeeRepository domain.EmployeeRepository
|
|
|
//if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// employeeRepository = value
|
|
|
//}
|
|
|
|
|
|
if systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(systemSuMoneyStatisticsCommand.CompanyId); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
...
|
...
|
@@ -232,7 +256,7 @@ func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMone |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 系统现金统计
|
|
|
// TODO 系统现金统计
|
|
|
func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStatisticsCommand *command.SystemCashStatisticsCommand) (interface{}, error) {
|
|
|
if err := systemCashStatisticsCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -247,15 +271,26 @@ func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStati |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
var cashPoolDao *dao.CashPoolDao
|
|
|
if value, err := factory.CreateCashPoolDao(map[string]interface{}{
|
|
|
|
|
|
//var cashPoolDao *dao.CashPoolDao
|
|
|
//if value, err := factory.CreateCashPoolDao(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// cashPoolDao = value
|
|
|
//}
|
|
|
|
|
|
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())
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
} else {
|
|
|
cashPoolDao = value
|
|
|
employeeDao = value
|
|
|
}
|
|
|
if systemCashStatistics, err := cashPoolDao.CalculateSystemCash(systemCashStatisticsCommand.CompanyId); err != nil {
|
|
|
|
|
|
if systemCashStatistics, err := employeeDao.CalculateSystemCash(systemCashStatisticsCommand.CompanyId); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
...
|
...
|
|