正在显示
1 个修改的文件
包含
33 行增加
和
0 行删除
@@ -2925,6 +2925,16 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ | @@ -2925,6 +2925,16 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ | ||
2925 | employeeRepository = value | 2925 | employeeRepository = value |
2926 | } | 2926 | } |
2927 | 2927 | ||
2928 | + // 兑换现金活动仓储初始化 | ||
2929 | + var exchangeCashActivityRepository domain.ExchangeActivityRepository | ||
2930 | + if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{ | ||
2931 | + "transactionContext": transactionContext, | ||
2932 | + }); err != nil { | ||
2933 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
2934 | + } else { | ||
2935 | + exchangeCashActivityRepository = value | ||
2936 | + } | ||
2937 | + | ||
2928 | // 现金池DAO初始化 | 2938 | // 现金池DAO初始化 |
2929 | var cashPoolDao *dao.CashPoolDao | 2939 | var cashPoolDao *dao.CashPoolDao |
2930 | if value, err := factory.CreateCashPoolDao(map[string]interface{}{ | 2940 | if value, err := factory.CreateCashPoolDao(map[string]interface{}{ |
@@ -2940,6 +2950,8 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ | @@ -2940,6 +2950,8 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ | ||
2940 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 2950 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
2941 | } else { | 2951 | } else { |
2942 | uidName := map[int64]interface{}{} | 2952 | uidName := map[int64]interface{}{} |
2953 | + if exchangeListRankingQuery.CompanyId != 0 { | ||
2954 | + // 根据company_id获取员工uid、姓名键值对 | ||
2943 | if _, employees, err := employeeRepository.FindAll(map[string]interface{}{ | 2955 | if _, employees, err := employeeRepository.FindAll(map[string]interface{}{ |
2944 | "companyId": exchangeListRankingQuery.CompanyId, | 2956 | "companyId": exchangeListRankingQuery.CompanyId, |
2945 | }); err != nil { | 2957 | }); err != nil { |
@@ -2949,6 +2961,27 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ | @@ -2949,6 +2961,27 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ | ||
2949 | uidName[employee.EmployeeInfo.Uid] = employee.EmployeeInfo.EmployeeName | 2961 | uidName[employee.EmployeeInfo.Uid] = employee.EmployeeInfo.EmployeeName |
2950 | } | 2962 | } |
2951 | } | 2963 | } |
2964 | + } else if exchangeListRankingQuery.ActivityId != 0 { | ||
2965 | + // 获取当前活动的company_id | ||
2966 | + activityFound, err := exchangeCashActivityRepository.FindOne(map[string]interface{}{"activityId": exchangeListRankingQuery.ActivityId}) | ||
2967 | + if err != nil { | ||
2968 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
2969 | + } | ||
2970 | + if activityFound == nil { | ||
2971 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(exchangeListRankingQuery.ActivityId))) | ||
2972 | + } | ||
2973 | + | ||
2974 | + // 根据company_id获取员工uid、姓名键值对 | ||
2975 | + if _, employees, err := employeeRepository.FindAll(map[string]interface{}{ | ||
2976 | + "companyId": activityFound.CompanyId, | ||
2977 | + }); err != nil { | ||
2978 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
2979 | + } else { | ||
2980 | + for _, employee := range employees { | ||
2981 | + uidName[employee.EmployeeInfo.Uid] = employee.EmployeeInfo.EmployeeName | ||
2982 | + } | ||
2983 | + } | ||
2984 | + } | ||
2952 | 2985 | ||
2953 | // 兑换素币清单排行榜 | 2986 | // 兑换素币清单排行榜 |
2954 | for i, _ := range exchangeCashListRankingStatistics["people"].([]struct{Uid int64; EmployeeName string; SuMoney float64; Cash float64; Ranking int}) { | 2987 | for i, _ := range exchangeCashListRankingStatistics["people"].([]struct{Uid int64; EmployeeName string; SuMoney float64; Cash float64; Ranking int}) { |
-
请 注册 或 登录 后发表评论