|
@@ -2,6 +2,7 @@ package service |
|
@@ -2,6 +2,7 @@ package service |
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
4
|
"github.com/linmadan/egglib-go/core/application"
|
4
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
5
|
+ "github.com/linmadan/egglib-go/utils/tool_funs"
|
5
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory"
|
6
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory"
|
6
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/statistics/command"
|
7
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/statistics/command"
|
7
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
|
8
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
|
|
@@ -271,6 +272,27 @@ func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStati |
|
@@ -271,6 +272,27 @@ func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStati |
271
|
employeeDao = value
|
272
|
employeeDao = value
|
272
|
}
|
273
|
}
|
273
|
|
274
|
|
|
|
275
|
+ // 判断现金池是否存在
|
|
|
276
|
+ var cashPoolRepository domain.CashPoolRepository
|
|
|
277
|
+ if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
|
|
|
278
|
+ "transactionContext": transactionContext,
|
|
|
279
|
+ }); err != nil {
|
|
|
280
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
281
|
+ } else {
|
|
|
282
|
+ cashPoolRepository = value
|
|
|
283
|
+ }
|
|
|
284
|
+
|
|
|
285
|
+ countCashPools, _, err := cashPoolRepository.Find(tool_funs.SimpleStructToMap(systemCashStatisticsCommand))
|
|
|
286
|
+ if err != nil {
|
|
|
287
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
288
|
+ }
|
|
|
289
|
+ if countCashPools == 0 { // 现金池为空时处理
|
|
|
290
|
+ return map[string]interface{} {
|
|
|
291
|
+ "systemExchangedCash" : 0,
|
|
|
292
|
+ "systemUnExchangeCash": 0,
|
|
|
293
|
+ }, nil
|
|
|
294
|
+ }
|
|
|
295
|
+
|
274
|
if systemCashStatistics, err := employeeDao.CalculateSystemCash(systemCashStatisticsCommand.CompanyId); err != nil {
|
296
|
if systemCashStatistics, err := employeeDao.CalculateSystemCash(systemCashStatisticsCommand.CompanyId); err != nil {
|
275
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
297
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
276
|
} else {
|
298
|
} else {
|