...
|
...
|
@@ -2925,6 +2925,16 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ |
|
|
employeeRepository = value
|
|
|
}
|
|
|
|
|
|
// 兑换现金活动仓储初始化
|
|
|
var exchangeCashActivityRepository domain.ExchangeActivityRepository
|
|
|
if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
exchangeCashActivityRepository = value
|
|
|
}
|
|
|
|
|
|
// 现金池DAO初始化
|
|
|
var cashPoolDao *dao.CashPoolDao
|
|
|
if value, err := factory.CreateCashPoolDao(map[string]interface{}{
|
...
|
...
|
@@ -2940,6 +2950,8 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
uidName := map[int64]interface{}{}
|
|
|
if exchangeListRankingQuery.CompanyId != 0 {
|
|
|
// 根据company_id获取员工uid、姓名键值对
|
|
|
if _, employees, err := employeeRepository.FindAll(map[string]interface{}{
|
|
|
"companyId": exchangeListRankingQuery.CompanyId,
|
|
|
}); err != nil {
|
...
|
...
|
@@ -2949,6 +2961,27 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ |
|
|
uidName[employee.EmployeeInfo.Uid] = employee.EmployeeInfo.EmployeeName
|
|
|
}
|
|
|
}
|
|
|
} else if exchangeListRankingQuery.ActivityId != 0 {
|
|
|
// 获取当前活动的company_id
|
|
|
activityFound, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": exchangeListRankingQuery.ActivityId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if activityFound == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(exchangeListRankingQuery.ActivityId)))
|
|
|
}
|
|
|
|
|
|
// 根据company_id获取员工uid、姓名键值对
|
|
|
if _, employees, err := employeeRepository.FindAll(map[string]interface{}{
|
|
|
"companyId": activityFound.CompanyId,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
for _, employee := range employees {
|
|
|
uidName[employee.EmployeeInfo.Uid] = employee.EmployeeInfo.EmployeeName
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 兑换素币清单排行榜
|
|
|
for i, _ := range exchangeCashListRankingStatistics["people"].([]struct{Uid int64; EmployeeName string; SuMoney float64; Cash float64; Ranking int}) {
|
...
|
...
|
|