基于javaweb+mysql的ssm+maven赛事打分系统(java+ssm+layui+maven+mysql+jsp)

基于javaweb+mysql的ssm+maven赛事打分系统(java+ssm+layui+maven+mysql+jsp)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SSM+Maven赛事打分系统(java+ssm+layui+maven+mysql+jsp)

项目介绍

赛事评分系统,SSM框架。该项目分管理员、裁判、选手三个用户角色。

管理员主要功能: 首页、选手管理、裁判管理、赛事管理 裁判主要功能: 首页、评分; 选手主要功能: 首页、报名赛事、查看成绩;

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 5.7版本; 7.lombok插件 注:必须安装,否则会报错

技术栈

  1. 后端:Spring SpringMVC MyBatis 2. 前端:Layui

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 将项目中database.properties配置文件中的数据库配置改为自己的配置; 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 4. 运行项目,输入localhost:8080/xxx 登录

    //添加 裁判
    @RequestMapping("/addJudgeAjax")
    @ResponseBody
    public String addJudgeAjax(@RequestParam Map map) {
        System.out.println(map);

        String jid = (String) map.get("jid");
        String jname = (String) map.get("jname");
        String jage = (String) map.get("jage");
        String jsex = (String) map.get("jsex");
        System.out.println(jid + " " + jname + " " + jage + " " + jsex);
        //默认密码
        String password = "123456";
        //判断裁判、选手 写入 user表
        if (jid.contains("P")) {
            System.out.println("注册选手");
            int registerPlayer = loginService.addUser(new User(jid, password));
            if (registerPlayer > 0) {
                System.out.println("注册选手成功!");
            }
        } else if (jid.contains("J")) {
            System.out.println("注册裁判");
            int registerPlayer = loginService.addUser(new User(jid, password));
            if (registerPlayer > 0) {
                System.out.println("注册裁判成功!");
            }
        } else if (jid.equals("admin")) {
            System.out.println("管理员");
        } else {

        }
        //添加 裁判
        int result = judgeService.addJudgeAjax(new Judge(jid, jname, jage, jsex));
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }
    }

    //裁判打分
    @RequestMapping("/mark")
    @ResponseBody
    public String mark(@RequestParam Map map) {
        System.out.println("进入 后台 ==== 打分");
        String pid = (String) map.get("pid");
        String item = (String) map.get("mid");
        String jid = (String) map.get("jid");
        String score = (String) map.get("score");
        System.out.println("分数是:" + score + item + jid + pid);
        int result = judgeService.mark(new Mark(score, item, jid, pid));
        if (result > 0) {
     * 添加赛事
     */
    @RequestMapping(value = "/addMatchAjax", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String addMatchAjax(@RequestParam Map map) {
        //System.out.println(map);

        String mid = (String) map.get("mid");
        String mname = (String) map.get("mname");
        String mtime = (String) map.get("mtime");

        DateTime parseDate = DateUtil.parse(mtime, "yyyy-MM-dd");
        java.sql.Date mtimeDate = new java.sql.Date(parseDate.getTime());
        System.out.println("类型" + mtimeDate.getClass().getName());
        System.out.println("mid=" + mid + "mname=" + mname + "mtime=" + mtimeDate);
        int result = matchService.addMatchAjax(new Match(mid, mname, mtimeDate));
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }

    }

    //选手报名赛事
    @RequestMapping(value = "/signInMatch", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String signInMatch(@RequestParam Map map) {
        System.out.println(map);
        String pid = (String) map.get("pid");
        String saishi = (String) map.get("saishi");
        String properties = (String) map.get("properties");
        System.out.println("pid " + pid + " saishi:" + saishi + "性质:" + properties);
        int result = matchService.signInMatch(new SignUp(pid, saishi, properties));
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }
    }

    /***
     *查看已报名
     */
    @RequestMapping(value = "/alreadySignIn", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String alreadySignIn(@RequestParam Map map) {
        JSONObject object = new JSONObject();

        String pid = (String) map.get("pid");
        System.out.println("选手:" + pid + "选择的赛事");
                System.out.println("注册裁判成功!");
            }
        } else if (pid.equals("admin")) {
            System.out.println("管理员");
        } else {

        }
        //添加 选手信息
        int result = playService.addPlayAjax(new Player(pid, pname, page, psex));
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }
    }

    /**
     * 报名赛事
     */
    @RequestMapping("/signMatch")
    public String signMatch() {
        List<Match> allMatch = matchService.getAllMatch();
        System.out.println(allMatch);
        return "pages/playerSignInMatch";
    }

    /**
     * 查看分数
     */
    @RequestMapping("/viewScore")
    public String viewScore() {
        return "pages/playerViewScore";
    }

    //获取选手编号 为评分做准备
    @RequestMapping(value = "/getPlayerSignInMatchAlready")
    @ResponseBody
    public String getPlayerSignInMatchAlready() {
        System.out.println("进入 评分 ajax");
        List allPid = new ArrayList();

        //modelAndViewm.setViewName("/pages/judgeMarkPlayer");
        //获取所有学生 编号
        List<Player> allPlayer = playService.getAllPlayer();
        for (int i = 0; i < allPlayer.size(); i++) {
            Player player = allPlayer.get(i);
            allPid.add(player.getPid());
        }
        System.out.println("所有的学生编号:" + allPid);
        //modelAndViewm.addObject("allPid",allPid);
        JSONArray array = JSONArray.parseArray(JSON.toJSONString(allPid));
        System.out.println(array.toJSONString());

        return array.toJSONString();

@Controller
@RequestMapping("/match")
public class MatchController {

    @Autowired
    MatchServiceImpl matchService;

    /**
     * 跳转到 赛事界面
     */
    @RequestMapping("/toMatchPage")
    public String toMatchPage() {
        return "/pages/match";
    }

    /**
     * 获取所有赛事 admin页面展示
     */
    @RequestMapping(value = "/getAllMatch", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String getAllMatch() {
        //阿里巴巴的json数据格式交互
        JSONObject object = new JSONObject();
        object.put("code", 200);//原来是 code : 0
        object.put("msg", "");
        object.put("data", matchService.getAllMatch());
        object.put("count", matchService.getAllMatch().size());

        System.out.println("数据库数据:" + matchService.getAllMatch().toString());
        return object.toJSONString();
    }

    /**
     * 获取赛事 ajax 下拉列表
     */
    @RequestMapping(value = "/getAllMatchAjax", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String getAllMatchAjax() {
        List<Match> allMatch = matchService.getAllMatch();
        JSONArray array = JSONArray.parseArray(JSON.toJSONString(allMatch));
        System.out.println(array.toJSONString());

        return array.toJSONString();
    }

    /**
     * 删除操作 异步请求
     */

@Controller
@RequestMapping("/match")
public class MatchController {

    @Autowired
    MatchServiceImpl matchService;

    /**
     * 跳转到 赛事界面
     */
    @RequestMapping("/toMatchPage")
    public String toMatchPage() {
        return "/pages/match";
    }

    /**
     * 获取所有赛事 admin页面展示
     */
    @RequestMapping(value = "/getAllMatch", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String getAllMatch() {
        //阿里巴巴的json数据格式交互
        JSONObject object = new JSONObject();
        object.put("code", 200);//原来是 code : 0
        object.put("msg", "");
        object.put("data", matchService.getAllMatch());
        object.put("count", matchService.getAllMatch().size());

        System.out.println("数据库数据:" + matchService.getAllMatch().toString());
        return object.toJSONString();
    }

    /**
     * 获取赛事 ajax 下拉列表
     */
    @RequestMapping(value = "/getAllMatchAjax", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String getAllMatchAjax() {
        List<Match> allMatch = matchService.getAllMatch();
        JSONArray array = JSONArray.parseArray(JSON.toJSONString(allMatch));
        System.out.println(array.toJSONString());

        return array.toJSONString();
    }

     */
    @RequestMapping(value = "/getAllMatchAjax", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String getAllMatchAjax() {
        List<Match> allMatch = matchService.getAllMatch();
        JSONArray array = JSONArray.parseArray(JSON.toJSONString(allMatch));
        System.out.println(array.toJSONString());

        return array.toJSONString();
    }

    /**
     * 删除操作 异步请求
     */
    @RequestMapping("/deleteMatchById")
    @ResponseBody
    public String deleteMatchById(@RequestParam Map map) {
        int currentMatchId = Integer.parseInt((String) map.get("index"));
        int result = matchService.deleteMatchById(currentMatchId);
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }
    }

    /**
     * 添加赛事
     */
    @RequestMapping(value = "/addMatchAjax", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String addMatchAjax(@RequestParam Map map) {
        //System.out.println(map);

        String mid = (String) map.get("mid");
        String mname = (String) map.get("mname");
        String mtime = (String) map.get("mtime");

        DateTime parseDate = DateUtil.parse(mtime, "yyyy-MM-dd");
        java.sql.Date mtimeDate = new java.sql.Date(parseDate.getTime());
        System.out.println("类型" + mtimeDate.getClass().getName());
        System.out.println("mid=" + mid + "mname=" + mname + "mtime=" + mtimeDate);
        int result = matchService.addMatchAjax(new Match(mid, mname, mtimeDate));
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }

    }

    //选手报名赛事
            return "redirect:/login.jsp";
        } else {
            System.out.println("当前用户:" + session.getAttribute(CurrentUser.CURRENT_USER));
            return "redirect:/login.jsp";
        }

    }

}

@Controller
@RequestMapping("/judge")
public class JudgeController {

    @Autowired
    JudgeServiceImpl judgeService;
    @Autowired
    LoginServiceImpl loginService;

    /**
     * 跳转 裁判页面
     */
    @RequestMapping("/toJudgePage")
    public String toJudgePage() {
        return "/pages/judge";
    }


        DateTime parseDate = DateUtil.parse(mtime, "yyyy-MM-dd");
        java.sql.Date mtimeDate = new java.sql.Date(parseDate.getTime());
        System.out.println("类型" + mtimeDate.getClass().getName());
        System.out.println("mid=" + mid + "mname=" + mname + "mtime=" + mtimeDate);
        int result = matchService.addMatchAjax(new Match(mid, mname, mtimeDate));
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }

    }

    //选手报名赛事
    @RequestMapping(value = "/signInMatch", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String signInMatch(@RequestParam Map map) {
        System.out.println(map);
        String pid = (String) map.get("pid");
        String saishi = (String) map.get("saishi");
        String properties = (String) map.get("properties");
        System.out.println("pid " + pid + " saishi:" + saishi + "性质:" + properties);
        int result = matchService.signInMatch(new SignUp(pid, saishi, properties));
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }
    }

    /***
     *查看已报名
     */
    @RequestMapping(value = "/alreadySignIn", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String alreadySignIn(@RequestParam Map map) {
        JSONObject object = new JSONObject();

        String pid = (String) map.get("pid");
        System.out.println("选手:" + pid + "选择的赛事");
        List<SignUp> signUpList = matchService.alreadySignIn(pid);
        object.put("code", 200);//原来是 code : 0
        object.put("msg", "");
        object.put("data", signUpList);
        object.put("count", signUpList.size());

    //判断用户
    public String LoginRoute(String account, String password, HttpSession session) {
        User loginUser = loginService.getUser(account);
        if (loginUser != null) {
            if (!loginUser.getPwd().equals(password)) {
                return "error";
            } else {
                session.setAttribute(CurrentUser.CURRENT_USER, loginUser);
                System.out.println("session放入" + loginUser.getAccount());
                return "1";
            }
        } else {
            return "error";
        }
    }

    /**
     * 注册用户
     */
    @RequestMapping("/register")
    @ResponseBody
    public String Register(@RequestParam Map user) {
        String loginuser = (String) user.get("user");
        String password = (String) user.get("pwd");

        System.out.println(user.get("user"));
        System.out.println(user.get("pwd"));

        User newUser = new User((String) user.get("user"), (String) user.get("pwd"));
        int result = loginService.addUser(newUser);
        //添加成功 返回 大于0
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }
    }

    /**
        System.out.println("前端数据:" + resultList);

        return object.toJSONString();
    }

    //去除最高分
    public static List RangeScore(List list) {
        System.out.println("是否为空:" + list.isEmpty());
        if (!list.isEmpty()) {
            System.out.println("*********************************");
            System.out.println("之前:" + list);
            list.remove(list.get(0));//去除最低分
            list.remove(list.size() - 1);//去除最高分
            System.out.println("之后:" + list);
            return list;
        } else {
            return new ArrayList();
        }
    }

    //求和 算出平均分
    public static Double getAverage(List list) {
        double total = 0;//总分
        double average = 0;//平均分
        for (int i = 0; i < list.size(); i++) {
            total += new Double((String) list.get(i));
        }
        //算出最后 得分
        average = total / list.size();
        Double result = Double.valueOf(String.format("%.1f", average));//保留2为小数
        logger.debug("最后得分:" + result);

        return result;
    }

    //求得所有学生的排名
    @RequestMapping("/getALLScore")
    public String getALLScore() {
        String ALL[] = {"p101", "P102", "P103", "P104", "P105"};
        for (int i = 0; i < ALL.length; i++) {
            Range(ALL[i]);
        String pid = (String) map.get("pid");
        System.out.println("选手:" + pid + "选择的赛事");
        List<SignUp> signUpList = matchService.alreadySignIn(pid);
        object.put("code", 200);//原来是 code : 0
        object.put("msg", "");
        object.put("data", signUpList);
        object.put("count", signUpList.size());

        System.out.println("已报名:" + signUpList);
        return object.toJSONString();
    }
}

@Controller
public class LoginController {

    @Autowired
    LoginServiceImpl loginService;
    @Autowired
    JudgeServiceImpl judgeService;
    @Autowired
    PlayServiceImpl playService;

    /**
     * 登录验证
        System.out.println("之后:" + sortScore);
        double total = 0;

        for (int i = 0; i < sortScore.size(); i++) {
            total += new Double((String) sortScore.get(i));
        }
        //算出最后 得分
        average = total / sortScore.size();
        Double result = Double.valueOf(String.format("%.1f", average));//保留2为小数
        System.out.println("最后得分:" + result);

        logger.error("这是idebug  ");

        List<Mark> scoreList = new ArrayList();//返回前端数据
        scoreList.add(new Mark(item, result));
        //阿里巴巴的json数据格式交互
        JSONObject object = new JSONObject();
        object.put("code", 200);//原来是 code : 0
        object.put("msg", "");
        object.put("data", scoreList);
        object.put("count", scoreList.size());
        System.out.println("前端数据:" + scoreList);

        return object.toJSONString();
    }

    /**
     * 查看分数
     * 去除 最高分 最低分
     * 得到 最后分数
     */
    @RequestMapping("/getPlayerScore")
    @ResponseBody
    public String getPlayerScore(@RequestParam Map map) {
        List TiCaoTotal = new ArrayList();
        List TiaoShuiTotal = new ArrayList();
        List WuShuTotal = new ArrayList();

        List<Mark> playerScore = playService.getPlayerScore((String) map.get("pid"));
        logger.error(playerScore.toString());
        for (int i = 0; i < playerScore.size(); i++) {
            if (playerScore.get(i).getItem().equals("体操")) {
                //得分
                String tiCaoScore = playerScore.get(i).getScore();
                TiCaoTotal.add(tiCaoScore);
            } else if (playerScore.get(i).getItem().equals("跳水")) {
                //得分
                String tiCaoScore = playerScore.get(i).getScore();
                TiaoShuiTotal.add(tiCaoScore);
            } else if (playerScore.get(i).getItem().equals("武术")) {
                //得分
                String tiCaoScore = playerScore.get(i).getScore();
                WuShuTotal.add(tiCaoScore);
        logger.error("体操" + TiCaoTotal.toString());
        logger.error("跳水" + TiaoShuiTotal.toString());
        logger.error("武术" + WuShuTotal.toString());

        logger.debug("体操平均分:" + getAverage(RangeScore(TiCaoTotal)));
        logger.debug("跳水平均分:" + getAverage(RangeScore(TiaoShuiTotal)));
        logger.debug("武术平均分:" + getAverage(RangeScore(WuShuTotal)));*/

        List<Mark> ResultScore = new ArrayList();//返回前端数据
        ResultScore.add(new Mark("体操", getAverage(RangeScore(TiCaoTotal))));
        ResultScore.add(new Mark("跳水", getAverage(RangeScore(TiaoShuiTotal))));
        ResultScore.add(new Mark("武术", getAverage(RangeScore(WuShuTotal))));

        //存放 所有选手的分数
        List allTiCao = new ArrayList();
        List allTiaoShui = new ArrayList();
        List allWuShu = new ArrayList();

        System.out.println("所有分数:" + ResultScore);
        List resultList = new ArrayList();
        for (int i = 0; i < ResultScore.size(); i++) {
            if (!ResultScore.get(i).getAverage().isNaN()) {
                //System.out.println(ResultScore.get(i).getItem()+"*****"+ResultScore.get(i).getAverage());
                resultList.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));
                if (ResultScore.get(i).getItem().equals("体操")) {
                    allTiCao.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));
                } else if (ResultScore.get(i).getItem().equals("跳水")) {
                    allTiaoShui.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));
                } else if (ResultScore.get(i).getItem().equals("武术")) {
                    allWuShu.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));

                }
            }
        }
        System.out.println("************************************************");
        logger.error(allTiCao.toString());
        logger.error(allTiaoShui.toString());
        logger.error(allWuShu.toString());

        //阿里巴巴的json数据格式交互
        JSONObject object = new JSONObject();

        object.put("code", 200);//原来是 code : 0
        List resultList = new ArrayList();
        for (int i = 0; i < ResultScore.size(); i++) {
            if (!ResultScore.get(i).getAverage().isNaN()) {
                //System.out.println(ResultScore.get(i).getItem()+"*****"+ResultScore.get(i).getAverage());
                resultList.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));
            }
        }
        System.out.println("************************************************");

        //阿里巴巴的json数据格式交互
        JSONObject object = new JSONObject();

        object.put("code", 200);//原来是 code : 0
        object.put("msg", "");
        object.put("data", resultList);
        object.put("count", resultList.size());
        System.out.println("前端数据:" + resultList);

        return object.toJSONString();
    }

    //去除最高分
    public static List RangeScore(List list) {
        System.out.println("是否为空:" + list.isEmpty());
        if (!list.isEmpty()) {
            System.out.println("*********************************");
            System.out.println("之前:" + list);
            list.remove(list.get(0));//去除最低分
            list.remove(list.size() - 1);//去除最高分
            System.out.println("之后:" + list);
            return list;
        } else {
            return new ArrayList();
        }
    }

    //求和 算出平均分
    public static Double getAverage(List list) {
        double total = 0;//总分
        double average = 0;//平均分
        for (int i = 0; i < list.size(); i++) {
            total += new Double((String) list.get(i));
        }
     * 获取所有裁判
     */
    @RequestMapping(value = "/getAllJudge", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String getAllJudge() {
        //阿里巴巴的json数据格式交互
        JSONObject object = new JSONObject();
        object.put("code", 200);//原来是 code : 0
        object.put("msg", "");
        object.put("data", judgeService.getAllJudge());
        object.put("count", judgeService.getAllJudge().size());

        System.out.println("数据库数据:" + judgeService.getAllJudge().toString());
        return object.toJSONString();
    }

    /**
     * 根异步请求 删除裁判
     */
    @RequestMapping("/deleteJudgeById")
    @ResponseBody
    public String deleteJudgeById(@RequestParam Map map) {
        String currentJudge = (String) map.get("index");
        int result = judgeService.deleteJudgeById(currentJudge);
        if (result > 0) {
            return "1";
        } else {
            return "error";
        }
    }

    //添加 裁判
    @RequestMapping("/addJudgeAjax")
    @ResponseBody
    public String addJudgeAjax(@RequestParam Map map) {
        System.out.println(map);

        String jid = (String) map.get("jid");
        String jname = (String) map.get("jname");
        String jage = (String) map.get("jage");
        String jsex = (String) map.get("jsex");
        System.out.println(jid + " " + jname + " " + jage + " " + jsex);
        //默认密码
        String password = "123456";
        //判断裁判、选手 写入 user表
        if (jid.contains("P")) {
            System.out.println("注册选手");
            int registerPlayer = loginService.addUser(new User(jid, password));
            if (registerPlayer > 0) {
                System.out.println("注册选手成功!");
            }
        List allTiCao = new ArrayList();
        List allTiaoShui = new ArrayList();
        List allWuShu = new ArrayList();

        System.out.println("所有分数:" + ResultScore);
        List resultList = new ArrayList();
        for (int i = 0; i < ResultScore.size(); i++) {
            if (!ResultScore.get(i).getAverage().isNaN()) {
                //System.out.println(ResultScore.get(i).getItem()+"*****"+ResultScore.get(i).getAverage());
                resultList.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));
                if (ResultScore.get(i).getItem().equals("体操")) {
                    allTiCao.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));
                } else if (ResultScore.get(i).getItem().equals("跳水")) {
                    allTiaoShui.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));
                } else if (ResultScore.get(i).getItem().equals("武术")) {
                    allWuShu.add(new Mark(ResultScore.get(i).getItem(), ResultScore.get(i).getAverage()));

                }
            }
        }
        System.out.println("************************************************");
        logger.error(allTiCao.toString());
        logger.error(allTiaoShui.toString());
        logger.error(allWuShu.toString());

        //阿里巴巴的json数据格式交互
        JSONObject object = new JSONObject();

        object.put("code", 200);//原来是 code : 0
        object.put("msg", "");
        object.put("data", resultList);
        object.put("count", resultList.size());
        System.out.println("前端数据:" + resultList);

    }

}

            total += new Double((String) list.get(i));
        }
        //算出最后 得分
        average = total / list.size();
        Double result = Double.valueOf(String.format("%.1f", average));//保留2为小数
        logger.debug("最后得分:" + result);

        return result;
    }

    //求得所有学生的排名
    @RequestMapping("/getALLScore")
    public String getALLScore() {
        String ALL[] = {"p101", "P102", "P103", "P104", "P105"};
        for (int i = 0; i < ALL.length; i++) {
            Range(ALL[i]);
        }
        return "kong";
    }

    //求得分数
    public void Range(String pid) {

        List<Mark> playerScore = playService.getPlayerScore(pid);
        logger.error(playerScore.toString());
        for (int i = 0; i < playerScore.size(); i++) {
            if (playerScore.get(i).getItem().equals("体操")) {
                //得分
                String tiCaoScore = playerScore.get(i).getScore();
                TiCaoTotal.add(tiCaoScore);
            } else if (playerScore.get(i).getItem().equals("跳水")) {
                //得分
                String tiCaoScore = playerScore.get(i).getScore();
                TiaoShuiTotal.add(tiCaoScore);
            } else if (playerScore.get(i).getItem().equals("武术")) {
                //得分
                String tiCaoScore = playerScore.get(i).getScore();
                WuShuTotal.add(tiCaoScore);
            }
        }
        //排序
        Collections.sort(TiCaoTotal);
        Collections.sort(TiaoShuiTotal);
        Collections.sort(WuShuTotal);
/*        logger.error("排序之后的:");
        logger.error("体操" + TiCaoTotal.toString());
        logger.error("跳水" + TiaoShuiTotal.toString());

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值