作者 陈志颖

fix:修复现金池投入现金问题

@@ -361,7 +361,7 @@ func (statisticsService *StatisticsService) EmployeesContributionsStatistics(emp @@ -361,7 +361,7 @@ func (statisticsService *StatisticsService) EmployeesContributionsStatistics(emp
361 } 361 }
362 } 362 }
363 363
364 -// TODO 员工排行榜统计 364 +// 员工排行榜统计
365 func (statisticsService *StatisticsService) EmployeesRankingListStatistics(employeesRankingListStatisticsCommand *command.EmployeesRankingListStatisticsCommand) (interface{}, error) { 365 func (statisticsService *StatisticsService) EmployeesRankingListStatistics(employeesRankingListStatisticsCommand *command.EmployeesRankingListStatisticsCommand) (interface{}, error) {
366 if err := employeesRankingListStatisticsCommand.ValidateCommand(); err != nil { 366 if err := employeesRankingListStatisticsCommand.ValidateCommand(); err != nil {
367 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 367 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
@@ -57,7 +57,6 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -57,7 +57,6 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
57 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的公司id") 57 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的公司id")
58 } 58 }
59 59
60 - // 获取平台素币兑换情况  
61 var employeeDao *dao.EmployeeDao 60 var employeeDao *dao.EmployeeDao
62 if value, err := factory.CreateEmployeeDao(map[string]interface{}{ 61 if value, err := factory.CreateEmployeeDao(map[string]interface{}{
63 "transactionContext": transactionContext, 62 "transactionContext": transactionContext,
@@ -66,7 +65,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -66,7 +65,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
66 } else { 65 } else {
67 employeeDao = value 66 employeeDao = value
68 } 67 }
69 - 68 + // 获取平台素币兑换情况
70 systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(createCashPoolCommand.CompanyId) 69 systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(createCashPoolCommand.CompanyId)
71 if err != nil { 70 if err != nil {
72 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 71 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -93,7 +92,6 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co @@ -93,7 +92,6 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
93 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 92 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
94 } 93 }
95 94
96 - // 新建现金池  
97 newCashPool := &domain.CashPool{ 95 newCashPool := &domain.CashPool{
98 CompanyId: createCashPoolCommand.CompanyId, 96 CompanyId: createCashPoolCommand.CompanyId,
99 Cash: createCashPoolCommand.Cash, 97 Cash: createCashPoolCommand.Cash,
@@ -1028,9 +1026,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP @@ -1028,9 +1026,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP
1028 exchangeCashPersonListRepository = value 1026 exchangeCashPersonListRepository = value
1029 } 1027 }
1030 1028
1031 - fmt.Print(listExchangeCashPersonQuery, "\n")  
1032 -  
1033 - // TODO 返回兑换现金活动总榜 1029 + // 返回兑换现金活动总榜
1034 if listExchangeCashPersonQuery.ExchangeCashActivityId == 0 && listExchangeCashPersonQuery.CompanyId != 0 { 1030 if listExchangeCashPersonQuery.ExchangeCashActivityId == 0 && listExchangeCashPersonQuery.CompanyId != 0 {
1035 // 找到该公司下的所有活动id 1031 // 找到该公司下的所有活动id
1036 var exchangeActivityRepository domain.ExchangeActivityRepository 1032 var exchangeActivityRepository domain.ExchangeActivityRepository
@@ -1042,7 +1038,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP @@ -1042,7 +1038,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP
1042 exchangeActivityRepository = value 1038 exchangeActivityRepository = value
1043 } 1039 }
1044 1040
1045 - // TODO 需要改为获取所有活动,去除分页  
1046 if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{ 1041 if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{
1047 "companyId": listExchangeCashPersonQuery.CompanyId, 1042 "companyId": listExchangeCashPersonQuery.CompanyId,
1048 }); err != nil { 1043 }); err != nil {
@@ -156,7 +156,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf @@ -156,7 +156,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf
156 // 系统未兑换现金 156 // 系统未兑换现金
157 cashPool := new(models.CashPool) 157 cashPool := new(models.CashPool)
158 if err := tx.Model(cashPool). 158 if err := tx.Model(cashPool).
159 - ColumnExpr("exchanged_cash"). 159 + Column("exchanged_cash").
160 Where("cash_pool.company_id = ?", companyId). 160 Where("cash_pool.company_id = ?", companyId).
161 Order("id DESC"). 161 Order("id DESC").
162 Limit(1). 162 Limit(1).
@@ -164,7 +164,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf @@ -164,7 +164,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf
164 return nil, err 164 return nil, err
165 } 165 }
166 if err := tx.Model(cashPool). 166 if err := tx.Model(cashPool).
167 - ColumnExpr("un_exchange_cash"). 167 + Column("un_exchange_cash").
168 Where("cash_pool.company_id = ?", companyId). 168 Where("cash_pool.company_id = ?", companyId).
169 Order("id DESC"). 169 Order("id DESC").
170 Limit(1). 170 Limit(1).