作者 陈志颖

fix:兑换素币清单榜单总榜活动榜判断

... ... @@ -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,13 +2950,36 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
uidName := map[int64]interface{}{}
if _, employees, err := employeeRepository.FindAll(map[string]interface{}{
"companyId": exchangeListRankingQuery.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
if exchangeListRankingQuery.CompanyId != 0 {
// 根据company_id获取员工uid、姓名键值对
if _, employees, err := employeeRepository.FindAll(map[string]interface{}{
"companyId": exchangeListRankingQuery.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
}
}
} 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
}
}
}
... ...