package com.dsh.other.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.other.entity.HonorRules; import com.dsh.other.feignclient.model.StuMedalVo; import com.dsh.other.service.HonorRulesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; import java.util.Objects; @RestController @RequestMapping("") public class HonorController { @Autowired private HonorRulesService hrService; @PostMapping("/base/honor/stuHonors") public List getStuHonors(@RequestBody List honorIds){ List stuMedalVos = new ArrayList<>(); List honorRules = hrService.list(new QueryWrapper() .in("id", honorIds)); if (honorRules.size() > 0){ honorRules.forEach(hrs -> { StuMedalVo stuMedalVo = new StuMedalVo(); stuMedalVo.setLevelNum(Integer.getInteger(hrs.getLevel())); switch (hrs.getType()){ case 1: stuMedalVo.setMedalName("俱乐部之星"); break; case 2: stuMedalVo.setMedalName("运动达人"); break; case 3: stuMedalVo.setMedalName("社区之王"); break; case 4: stuMedalVo.setMedalName("深度玩家"); break; default: break; } if (!Objects.equals(hrs.getLevel(), "10")){ stuMedalVo.setNextLevel(Integer.parseInt(hrs.getLevel())+1); stuMedalVo.setUpgradeConditions(hrs.getCondition()); stuMedalVo.setIsTopLevel(2); }else { stuMedalVo.setIsTopLevel(1); } stuMedalVos.add(stuMedalVo); }); } return stuMedalVos; } }