学生为学校教研室开发技能大赛评分系统

简介: 学生为学校教研室开发技能大赛评分系统

项目编号:BS-GX-009


开发工具:IDEA /Eclipse


数据库:MYSQL5.7+Redis


前端开发:Layui+Bootstrap


后端开发:SSM开发框架


功能需求:


总共分为三个阶段


第一个阶段是:教研室比赛阶段(同一个教研室的老师比赛),同一学院下多个教研室分别选取该教研室分数高的数人晋级到第二阶段:学院比赛。


第二个阶段是:学院比赛阶段:从第一阶段晋级过来的老师中选取分数最高的数名代表学院参加第三阶段(总决赛)比赛


第三个阶段是:总决赛:从第二阶段晋级来的选手比赛,排名,选出冠军、亚军、季军。


该管理系统主要实现以下几个主要功能:


1、教研室比赛(线上比赛)阶段主要内容:


(1)教师注册,登录、退出功能;


(2)教师个人信息管理;


(3)教师报名功能;(不是所有注册过的老师都会报名只有报名之后才是选手)


(4)教师上传参赛视频功能;


(5)评委打分功能;(每个评委给某一场比赛的选手打分 数据库表:比赛ID 选手ID 评委ID 分数)


(6)管理员登录、查看老师信息(包括上传的视频)  修改老师分数(把评委打的分计算得到的值(十个评委去掉最高分和最低分剩下的取平均值)录入)


(7)晋级功能。(第1阶段选取成绩最高的数名选手晋级到第2阶段学院比赛)


2、学院比赛(线下比赛)阶段主要内容:


(1)评委打分(每个评委给某一场比赛的选手打分 数据库表:比赛ID 选手ID 评委ID 分数)


(2)管理员登录、查看老师信息 修改老师分数(把评委打的分计算得到的值(十个评委去掉最高分和最低分剩下的取平均值)录入)


(3)晋级功能。(第2阶段选取成绩最高的数名选手晋级到第3阶段学院比赛)


3、学校决赛(线下比赛)主要内容:


(1)评委打分(每个评委给某一场比赛的选手打分 数据库表:比赛ID 选手ID 评委ID 分数)


(2)管理员登录、查看老师信息 修改老师分数(把评委打的分计算得到的值(十个评委去掉最高分和最低分剩下的取平均值)录入)


(3)排名 选出冠军、亚军、季军


下面展示一下系统的部分实现功能:

image.png

参赛用户登陆:

image.png

image.png

报名参赛:

image.png

image.png

报名成功后上传视频:

image.png

评委登陆系统开始打分:所有评委进入系统为每个作品打分

image.png

image.png

image.png

image.png

image.png

管理员登陆:

image.png

image.png

晋级管理:可以分阶段管理,依次是教研室,学校,学院决赛。主要根据各评委打分生成平均分进行排名

image.png

image.png

前端主页可以查看各阶段比较排名结果:

image.png

系统核心实现代码:

package controller;
import com.alibaba.fastjson.JSON;
import entity.Response;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.LoginService;
@Controller
@RequestMapping(value = "login")
public class LoginController {
    @Autowired
    private LoginService loginService;
    @ResponseBody
    @RequestMapping(value = "login.do")
    public Response login(String  userName,String password){
        User user = loginService.login(userName,password);
        Response res = new Response();
        if (user != null){
            Integer flag = loginService.loginStatus(user);
            if (flag == 1){
                res.setMessage("登陆成功!");
                user.setIslogin(true);
                res.setTag(true);
                res.setUser(user);
            }
        }else {
            res.setMessage("登录失败,请检查账号或密码是否正确!");
            res.setTag(false);
        }
        return res;
    }
    @ResponseBody
    @RequestMapping(value = "register.do")
    public Response register(User user){
        Response res = new Response();
        System.out.println("data=>"+user+user.getName()+user.getPhonenum());
        Integer flag = loginService.checkUser(user.getUsername(),user.getPhonenum());
        if (flag == 1){
            res.setTag(false);
            res.setMessage("该用户已注册!");
        }else {
            User userInfo = loginService.register(user);
            if (userInfo != null) {
                res.setTag(true);
                res.setMessage("账号注册成功!");
                res.setUser(userInfo);
            }else {
                res.setTag(false);
                res.setMessage("账号注册失败!");
            }
        }
        return res;
    }
    @ResponseBody
    @RequestMapping(value = "logout.do")
    public Response logout(String id){
        Response res =  new Response();
        int flag = loginService.logout(id);
        if (flag == 1){
            res.setTag(true);
            res.setMessage("账号退出登录成功!");
        }else {
            res.setTag(false);
            res.setMessage("退出登录失败!请联系管理员");
        }
        return res;
    }
    @ResponseBody
    @RequestMapping(value = "updateUserInfo.do")
    public Response updateUserInfo(User user){
        Response res = new Response();
        int flag = loginService.updateUser(user);
        if (flag == 1){
            res.setMessage("资料修改成功!");
            res.setUser(loginService.getUserInfo(user.getId()));
            res.setTag(true);
        }else {
            res.setMessage("资料修改失败!");
            res.setTag(false);
        }
        return res;
    }
}
package controller;
import entity.Match;
import entity.ResponseJSON;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import service.DateTimeService;
import service.MatchService;
import util.DateUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@Controller
@RequestMapping("file")
public class VideoController {
    String path = "D:\\uploadFiles\\";
    @Autowired
    private MatchService matchService;
    @Autowired
    private DateTimeService dateTimeService;
    @RequestMapping(value="upload.do")
    @ResponseBody
    public ResponseJSON upload(MultipartHttpServletRequest request) {
        String deadLine = dateTimeService.getDeadLine();
        // 获取文件map集合
        Map<String, MultipartFile> fileMap = request.getFileMap();
        MultipartFile file1 = fileMap.get("file");
        String mediaType = file1.getContentType();
        ResponseJSON rsp = new ResponseJSON();
        String[] un = request.getParameterMap().get("id");
        String[] ftl = request.getParameterMap().get("mediaType");
        String playerId = un[0];
        if (file1.isEmpty()) {
            rsp.setTag(false);
            rsp.setMessage("上传文件不能为空");
        } else {
            String originalFilename = file1.getOriginalFilename();
            try {
                // 创建要上传的路
//                File fdir = new File("/home/uploadFiles");
        File fdir = new File(path);
                if (!fdir.exists()) {
                    fdir.mkdirs();
                }
                // 文件上传到路径下
                FileUtils.copyInputStreamToFile(file1.getInputStream(), new File(fdir, originalFilename));
                // coding
                rsp.setTag(true);
                rsp.setMessage("上传文件成功");
            } catch (Exception e) {
                rsp.setTag(false);
                rsp.setMessage("上传文件失败");
            }
        }
        Match req = new Match();
        req.setPlayerid(playerId);
        req.setVideourl(file1.getOriginalFilename());
        req.setMediaType(mediaType);
        if(matchService.fileIsExist(req)>0) {
            File file = new File(matchService.getFileUrl(req).getVideourl());// 读取
            file.delete();
            int flag = matchService.uploadVideo(req);
            if (flag == 1) {
                rsp.setMessage("上传文件成功,已覆盖源文件");
            }
        }else {
            Match match = new Match();
            String filePath = file1.getOriginalFilename();
            match.setVideourl(filePath);
            match.setPlayerid(playerId);
            match.setMediaType(mediaType);
            matchService.uploadVideo(match);
            Date date = new Date();
            SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
            matchService.uploadVideo(match);
        }
        return rsp;
    }
    @RequestMapping(value="download",produces = "application/json;charset=UTF-8")
    @ResponseBody
    public ResponseJSON download(HttpServletRequest request, HttpServletResponse response)  {
        String fn = request.getParameter("fileName").toString();
        ResponseJSON rsp = new ResponseJSON();
        //模拟文件,myfile.txt为需要下载的文件
//        String path = "/home/uploadFiles/"+fn;
        String paths = path + fn;
        System.out.println(paths+"下载路径");
        //获取输入流
        InputStream bis;
        try {
            bis = new BufferedInputStream(new FileInputStream(new File(paths)));
            System.out.println("获取file成功");
            String filename = URLEncoder.encode(fn,"UTF-8");
            //设置文件下载头
            response.addHeader("Content-Disposition", "attachment;filename=" + filename);
            //1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
//          response.setContentType("multipart/form-data");
            response.setContentType("application/json;charset=UTF-8");
            BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
            System.out.println("开始转成流");
            int len = 0;
            while((len = bis.read()) != -1){
                out.write(len);
                out.flush();
            }
            out.close();
            rsp.setTag(true);
            rsp.setMessage("下载文件成功");
        } catch (IOException e) {
            rsp.setTag(false);
            rsp.setMessage("下载文件失败");
        }
        return rsp;
    }
}
package controller;
import entity.Judges;
import entity.Match;
import entity.Response;
import entity.ResponseJSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.JudgeService;
import java.util.List;
@Controller
@RequestMapping(value = "judge")
public class JudgeController {
    @Autowired
    private JudgeService judgeService;
    @ResponseBody
    @RequestMapping(value = "rateMatch")
    public ResponseJSON rateMatch(Judges match){
        ResponseJSON res = new ResponseJSON();
        int flag = judgeService.getVideoMenu(match);
        if (flag == 0) {
            res.setMessage("打分失败!");
            res.setTag(true);
        }else {
            res.setMessage("打分成功!");
            res.setTag(true);
        }
        return res;
    }
    @ResponseBody
    @RequestMapping(value = "checkScored")
    public ResponseJSON checkScored(Judges match){
        ResponseJSON res = new ResponseJSON();
        return res;
    }
    @ResponseBody
    @RequestMapping(value = "calculationAverage")
    public ResponseJSON calculationAverage(String matchId,String playerId,String adminId){
        ResponseJSON res = new ResponseJSON();
        int flag = judgeService.checkAdmin(adminId);
        int judgeNum =judgeService.checkJudged(matchId,playerId);
        if (flag == 0){
            res.setTag(false);
            res.setMessage("您没有权限录入分数");
        }
        if (judgeNum < 3 ){
            res.setTag(false);
            res.setMessage("评分尚未完成!");
        }else {
            int updated = judgeService.updateTotalScore(matchId,playerId);
            if (updated == 1){
                res.setTag(true);
                res.setMessage("修改分数完成!");
            }else {
                res.setTag(false);
                res.setMessage("更新总分失败!");
            }
            int ended = judgeService.checkMatchEnd(matchId);
            if (ended == 0){
                String level = judgeService.getCurrentLevel(matchId);
                if (level.equals("已结束")){
                    res.setTag(true);
                    res.setMessage("已决出关亚季军!");
                }else {
                    int promote = judgeService.updatePromotion(matchId, level);
                    if (promote == 1) {
                        res.setMessage("所有参赛人员总分已产生,该场比赛结果已产生!");
                        res.setTag(true);
                    } else {
                        res.setMessage("所有参赛人员总分已产生,该场比赛结果产生失败,请联系管理员!");
                        res.setTag(false);
                    }
                }
            }
        }
        return res;
    }
}
相关文章
|
开发工具 git Python
彻底解决 git push 的【pack exceeds maximum allowed size】
彻底解决 git push 的【pack exceeds maximum allowed size】
1523 0
|
8月前
|
前端开发 Java Spring
springMVC前后端请求参数绑定和传递
通过上述配置和示例,您可以在 Spring MVC 中实现前后端请求参数的绑定和数据传递。无论是简单的基础数据类型还是复杂的对象,Spring MVC 都提供了简洁且强大的支持,使得开发过程更加高效和易于维护。
245 23
|
算法 Unix Linux
什么是sqfs文件格式?
sqfs,Squash file system,压缩文件系统,.sqfs表示压缩文件系统的文件类型,可引导文件或引用用于UNIX的可引导磁盘映像的文件。
425 5
|
11月前
|
存储 缓存 Docker
docker中挂载数据卷到容器
【10月更文挑战第16天】
295 3
|
缓存 负载均衡 网络协议
什么是云解析DNS和普通的DNS解析有何区别
什么是云解析DNS和普通的DNS解析有何区别
955 15
|
关系型数据库 MySQL 应用服务中间件
配置docker阿里云镜像地址
配置docker阿里云镜像地址
|
机器学习/深度学习 算法
基于PSO粒子群优化的CNN-LSTM的时间序列回归预测matlab仿真
**算法预览图省略** - **软件版本**: MATLAB 2022a - **核心代码片段**略 - **PSO-CNN-LSTM概览**: 结合深度学习与优化,解决复杂时间序列预测。 - **CNN**利用卷积捕获时间序列的空间特征。 - **LSTM**通过门控机制处理长序列依赖,避免梯度问题。 - **流程**: 1. 初始化粒子群,每个粒子对应CNN-LSTM参数。 2. 训练模型,以验证集MSE评估适应度。 3. 使用PSO更新粒子参数,寻找最佳配置。 4. 迭代优化直到满足停止条件,如最大迭代次数或找到优良解。
Python使用asyncio包实现异步编程方式
异步编程是一种编程范式,用于处理程序中需要等待异步操作完成后才能继续执行的情况。 异步编程允许程序在执行耗时的操作时不被阻塞,而是在等待操作完成时继续执行其他任务。 这对于处理诸如文件 I/O、网络请求、定时器等需要等待的操作非常有用。
|
Ubuntu Linux 芯片
史上最全的LED点灯程序—使用STM32、FPGA、Linux点亮你的LED灯
不知道小伙伴们点亮过多少板子的LED灯,有很多小伙伴留言说讲一下stm32、fpga、liunx他们之间有什么不同,不同点很多,口说无凭,今天就来点亮一下stm32、fpga和liunx板子的led灯,大家大致看一下点灯流程和点灯环境以及点灯流程,就能大概的了解一下三者的区别,可以有选择的去学习!
548 0
史上最全的LED点灯程序—使用STM32、FPGA、Linux点亮你的LED灯