package com.YuyeTech.TPlat.game.controller;

import com.YuyeTech.TPlat.VO.ResultVO;
import com.YuyeTech.TPlat.dto.LevelHonorDTO;
import com.YuyeTech.TPlat.service.*;
import com.YuyeTech.TPlat.utils.ResultVOUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @author:slambb
 * @date:2021/8/18
 */
@RestController
@RequestMapping("/reward")
@Slf4j
public class RewardController {

    @Autowired
    private UserRewardService userRewardService;

    @Autowired
    private LevelHonorService levelHonorService;

    /**
     * 获取levelJump关卡列表
     *
     * @param userId
     * @return
     */
    @GetMapping("/getAllHonorList")
    public ResultVO getLevelJumpList(@RequestParam(value = "userId") String userId) {
        List<LevelHonorDTO> levelHonorDTOList= userRewardService.findAllHonorByAndUserId(userId).stream()
                .map(e-> levelHonorService.findByHonorType(e.getHonor())).collect(Collectors.toList());
        return ResultVOUtil.success(levelHonorDTOList);
    }


}
