最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Java畢業(yè)設(shè)計(jì)實(shí)戰(zhàn)之在線高中考試系統(tǒng)的實(shí)現(xiàn)

 更新時(shí)間:2022年02月05日 14:21:55   作者:qq_1334611189  
這是一個(gè)使用了java+SSM+Jsp+Mysql+Maven開發(fā)的在線高中考試系統(tǒng),是一個(gè)畢業(yè)設(shè)計(jì)的實(shí)戰(zhàn)練習(xí),具有考試系統(tǒng)該有的所有功能,感興趣的朋友快來(lái)看看吧

項(xiàng)目分為前臺(tái)和后臺(tái),前臺(tái)主要為學(xué)生角色、后臺(tái)主要為管理員角色。

管理員添加試題和發(fā)布試卷,學(xué)生負(fù)責(zé)在線考試、在線查看成績(jī)和錯(cuò)題記錄列表等。

管理員功能有:年級(jí)管理、課程管理、試題管理、試卷管理、學(xué)生管理等。

運(yùn)行環(huán)境:jdk1.8、mysql5.x、eclipse、tomcat8.5\7.0、maven3.5\3.6。

統(tǒng)一管理學(xué)生 教師 管理員信息:

/**
 * 統(tǒng)一管理學(xué)生 教師 管理員信息
 */
@RestController
public class UserController {
 
    @Resource(name = "userService")
    private IUserService userService;
 
    /**
     * 查詢用戶信息
     * 先判斷用戶類型 在查詢用戶信息
     */
    @RequestMapping(value = "/user/qryUserInfo", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public Result<User> qryUserInfo() {
        return userService.qryUserInfo();
    }
 
    /**
     * 更新用戶信息
     */
    @RequestMapping(value = "/user/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public Result<User> update(HttpRequest request) {
        User user = new User();
        user.setUserId(request.getString("user_id"));
        user.setName(request.getString("name"));
        user.setSex(request.getInteger("sex"));
        user.setType(User.UserType.get(request.getInteger("type")));
        return userService.update(user, ImageUtil.stringToBytes(request.getString("user_image")));
    }
 
    /**
     * 更新用戶密碼
     */
    @RequestMapping(value = "/user/updatePwd", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public Result<User> updatePwd(HttpRequest request) {
        return userService.updatePwd(request.getString("old_pwd"), request.getString("pwd"));
    }
}

管理員控制器:

/**
 * 管理員控制器
 */
@RestController
public class AdminController {
 
    @Resource(name = "adminService")
    private IAdminService adminService;
 
    /**
     * 管理員 查詢管理員列表
     */
    @RequestMapping(value = "/admin/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public ListResult<Admin> qryPage(HttpRequest request) {
        Map<String, Object> param = new HashMap<>();
        int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
        int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
        if (request.containsKey("login_name")) {
            param.put("login_name", request.getString("login_name"));
        }
        if (request.containsKey("name")) {
            param.put("name", request.getString("name"));
        }
        return adminService.qryPage(param, pageNo, pageSize);
    }
 
    /**
     * 管理員 添加管理員
     */
    @RequestMapping(value = "/admin/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Admin> insert(HttpRequest request) {
        Admin admin = new Admin();
        admin.setLoginName(request.getString("login_name"));
        admin.setName(request.getString("admin_name"));
        admin.setPwd(request.getString("login_name"));
        admin.setSex(request.getInteger("sex"));
        admin.setUpdateTime(new Date());
        return adminService.insert(admin, ImageUtil.stringToBytes(request.getString("admin_image")));
    }
 
    /**
     * 管理員 更新管理員
     */
    @RequestMapping(value = "/admin/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Admin> update(HttpRequest request) {
        Admin admin = new Admin();
        admin.setLoginName(request.getString("login_name"));
        admin.setName(request.getString("admin_name"));
        admin.setPwd(request.getString("login_name"));
        admin.setSex(request.getInteger("sex"));
        admin.setUpdateTime(new Date());
        return adminService.update(admin, ImageUtil.stringToBytes(request.getString("admin_image")));
    }
 
    /**
     * 管理員 刪除管理員
     */
    @RequestMapping(value = "/admin/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Admin> del(HttpRequest request) {
        List<String> adminIdList = new ArrayList<>();
        JSONArray array = request.getJSONArray("admin_id_list");
        for (int i = 0; i < array.size(); i++) {
            adminIdList.add(array.getString(i));
        }
        return adminService.del(adminIdList);
    }
}

考試管理控制器:

/**
 * 考試管理控制器
 */
@RestController
public class ExamInfoController {
 
    @Resource(name = "examInfoService")
    private IExamInfoService examInfoService;
 
    /**
     * 教師 查詢考試列表
     */
    @RequestMapping(value = "/examinfo/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.teacher})
    public ListResult<ExamInfo> exam(HttpRequest request) {
        Map<String, Object> param = new HashMap<>();
        int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
        int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
        return examInfoService.qryPage(param, pageNo, pageSize);
    }
 
    /**
     * 教師 添加新的考試信息
     */
    @RequestMapping(value = "/examinfo/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.teacher})
    public Result<ExamInfo> insert(HttpRequest request) {
        ExamInfo exam = new ExamInfo();
        exam.setTestPaperId(request.getInteger("test_paper_id"));
        exam.setClassId(request.getString("class_id"));
        exam.setState(1);
        exam.setTime(request.getInteger("time"));
        exam.setEffTime(DateUtils.toDate(request.getString("eff_time"), DateConst.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI));
        exam.setExpTime(DateUtils.toDate(request.getString("exp_time"), DateConst.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI));
        exam.setUpdateTime(new Date());
        return examInfoService.insert(exam);
    }
 
    /**
     * 教師 更新考試信息
     */
    @RequestMapping(value = "/examinfo/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.teacher})
    public Result<ExamInfo> update(HttpRequest request) {
        ExamInfo exam = new ExamInfo();
        exam.setExamId(request.getInteger("exam_id"));
        exam.setTestPaperId(request.getInteger("test_paper_id"));
        exam.setClassId(request.getString("class_id"));
        exam.setState(1);
        exam.setTime(request.getInteger("time"));
        exam.setEffTime(DateUtils.toDate(request.getString("eff_time"), DateConst.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI));
        exam.setExpTime(DateUtils.toDate(request.getString("exp_time"), DateConst.DATE_TIME_FORMAT_YYYY_MM_DD_HH_MI));
        exam.setUpdateTime(new Date());
        exam.setUpdateTime(new Date());
        return examInfoService.update(exam);
    }
 
    /**
     * 教師 新建狀態(tài)的考試信息可以刪除
     */
    @RequestMapping(value = "/examinfo/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.teacher})
    public Result<ExamInfo> del(HttpRequest request) {
        List<Integer> examIdList = new ArrayList<>();
        JSONArray array = request.getJSONArray("exam_id_list");
        for (int i = 0; i < array.size(); i++) {
            examIdList.add(array.getInteger(i));
        }
        return examInfoService.del(examIdList);
    }
 
    /**
     * 教師 發(fā)布考試信息
     */
    @RequestMapping(value = "/examinfo/release", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.teacher})
    public Result<ExamInfo> updateState(HttpRequest request) {
        return examInfoService.release(request.getInteger("exam_id"));
    }
 
    /**
     * 學(xué)生 查詢考試試題分組列表
     */
    @RequestMapping(value = "/examinfo/qryExamQueGroupList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.student, RoleEnum.teacher})
    public Result<TestPaperQuestionGroup> qryExamQueGroupList(HttpRequest request) {
        return examInfoService.qryExamQueGroupList(request.getInteger("exam_id"));
    }
 
    /**
     * 學(xué)生 查詢考試試題列表
     */
    @RequestMapping(value = "/examinfo/qryExamQuestionList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.student})
    public Result<StudentExamQuestionRecord> qryExamQuestionList(HttpRequest request) {
        return examInfoService.qryExamQuestionList(request.getInteger("exam_id"), request.getString("student_id"), request.getInteger("question_group_id"));
    }
 
    /**
     * 教師 判卷查詢?cè)囶}列表
     */
    @RequestMapping(value = "/examinfo/qryMarkQueList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.teacher})
    public Result<StudentExamQuestionRecord> qryMarkQueList(HttpRequest request) {
        return examInfoService.qryMarkQueList(request.getInteger("exam_id"), request.getString("student_id"), request.getInteger("question_group_id"));
    }
 
    /**
     * 教師 記錄學(xué)生考試分?jǐn)?shù) complete
     */
    @RequestMapping(value = "/examinfo/updateQueScore", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.teacher})
    public Result<ExamInfo> updateQueScore(HttpRequest request) {
        StudentExamQuestionRecord record = new StudentExamQuestionRecord();
        record.setExamId(request.getInteger("exam_id"));
        record.setStudentId(request.getString("student_id"));
        record.setQuestionGroupId(request.getInteger("question_group_id"));
        record.setQuestionId(request.getLong("question_id"));
        record.setScore(request.getFloat("score"));
        record.setCorrect(request.getBoolean("correct"));
        return examInfoService.updateQueScore(record);
    }
 
    /**
     * 教師 完成評(píng)分
     */
    @RequestMapping(value = "/examinfo/complete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.teacher})
    public Result<ExamInfo> complete(HttpRequest request) {
        return examInfoService.complete(request.getInteger("exam_id"),
                request.getString("student_id"));
    }
 
}

登錄控制層:

@RestController
public class LoginController {
 
    @Resource(name = "loginService")
    private ILoginService loginService;
 
    /**
     * 用戶登錄調(diào)用 在登陸成功生成兩個(gè)token 同時(shí)返回各自首頁(yè)
     * * 學(xué)生 student/student
     * * 老師 teacher/teacher
     * * 管理員 admin/admin
     */
    @RequestMapping(value = "/login/login", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public Result<Token> login(HttpRequest request) {
        return loginService.login(request.getString("login_name"), request.getString("pwd"));
    }
 
    /**
     * 登錄檢查
     */
    @RequestMapping(value = "/login/check", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public Result<Token> check() {
        return new Result<>();
    }
 
    /**
     * token 續(xù)約
     */
    @RequestMapping(value = "/login/refresh", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public Result<Token> refresh(HttpRequest request) {
        String refreshToken = request.getString("refresh_token");
        String urlId = request.getString("url_id");
        Token token = TokenCache.getInstance().get(urlId);
        if(token == null){
            ExceptionHelper.error(ErrorCode.ERROR_CODE_0003);
        }
        try {
            Claims claims = TokenUtils.parseToken(refreshToken);
            if (StringUtils.isNotEmpty((String.valueOf(claims.getOrDefault("student_id", ""))))) {
                claims.put("student_id", SessionContext.get("student_id"));
            }
            if (StringUtils.isNotEmpty((String.valueOf(claims.getOrDefault("teacher_id", ""))))) {
                claims.put("teacher_id", SessionContext.get("teacher_id"));
            }
            if (StringUtils.isNotEmpty((String.valueOf(claims.getOrDefault("login_name", ""))))) {
                claims.put("login_name", SessionContext.get("login_name"));
            }
            claims.put("name", claims.get("name"));
            token.setToken(TokenUtils.createToken(claims, TokenUtils.expireTime));
            token.setRefreshToken(TokenUtils.createToken(claims, TokenUtils.long_expireTime));
            TokenCache.getInstance().add(token);
        } catch (Exception e) {
            ExceptionHelper.error(ErrorCode.ERROR_CODE_0003);
        }
        return new Result<>(token);
    }
 
    /**
     * 退出系統(tǒng)
     */
    @RequestMapping(value = "/login/exit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public Result<Token> exit(HttpRequest request) {
        String urlId = request.getString("url_id");
        if (StringUtils.isNotEmpty(urlId)) {
            TokenCache.getInstance().remove(urlId);
        }
        return new Result<>();
    }
}

到此這篇關(guān)于Java畢業(yè)設(shè)計(jì)實(shí)戰(zhàn)之在線高中考試系統(tǒng)的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Java 考試系統(tǒng)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java設(shè)計(jì)模式之享元模式示例詳解

    Java設(shè)計(jì)模式之享元模式示例詳解

    享元模式(FlyWeight?Pattern),也叫蠅量模式,運(yùn)用共享技術(shù),有效的支持大量細(xì)粒度的對(duì)象,享元模式就是池技術(shù)的重要實(shí)現(xiàn)方式。本文將通過(guò)示例詳細(xì)講解享元模式,感興趣的可以了解一下
    2022-03-03
  • SpringMVC中的表現(xiàn)層結(jié)果封裝

    SpringMVC中的表現(xiàn)層結(jié)果封裝

    這篇文章主要介紹了SpringMVC中的表現(xiàn)層結(jié)果封裝,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-11-11
  • Java?Web實(shí)現(xiàn)簡(jiǎn)易圖書管理系統(tǒng)

    Java?Web實(shí)現(xiàn)簡(jiǎn)易圖書管理系統(tǒng)

    這篇文章主要為大家詳細(xì)介紹了Java?Web實(shí)現(xiàn)簡(jiǎn)易圖書管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-09-09
  • Java實(shí)現(xiàn)拖拽列表項(xiàng)的排序功能

    Java實(shí)現(xiàn)拖拽列表項(xiàng)的排序功能

    這篇文章主要介紹了Java實(shí)現(xiàn)拖拽列表項(xiàng)的排序功能,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-02-02
  • JDK10新特性之var泛型和多個(gè)接口實(shí)現(xiàn)方法

    JDK10新特性之var泛型和多個(gè)接口實(shí)現(xiàn)方法

    這篇文章主要介紹了JDK10的新特性:var泛型和多個(gè)接口實(shí)現(xiàn)方法,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-05-05
  • 被kafka-client和springkafka版本坑到自閉及解決

    被kafka-client和springkafka版本坑到自閉及解決

    這篇文章主要介紹了被kafka-client和springkafka版本坑到自閉及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-03-03
  • Java8 日期、時(shí)間操作代碼

    Java8 日期、時(shí)間操作代碼

    在Java8之前,日期時(shí)間API一直被開發(fā)者詬病,包括:java.util.Date是可變類型,SimpleDateFormat非線程安全等問(wèn)題。故此,Java8引入了一套全新的日期時(shí)間處理API,新的API基于ISO標(biāo)準(zhǔn)日歷系統(tǒng)
    2021-09-09
  • Java基礎(chǔ)類Class使用指南

    Java基礎(chǔ)類Class使用指南

    關(guān)于通過(guò)類名訪問(wèn)class屬性,我朋友問(wèn)過(guò)好幾次了,一直沒(méi)明白這個(gè)東西到底是什么?對(duì)此,我參照網(wǎng)友們的博客,總結(jié)了一些小知識(shí),如發(fā)現(xiàn)錯(cuò)誤,希望糾正,謝謝
    2015-12-12
  • SpringBoot集成MyBatisPlus+MySQL的實(shí)現(xiàn)

    SpringBoot集成MyBatisPlus+MySQL的實(shí)現(xiàn)

    MybatisPlus是國(guó)產(chǎn)的第三方插件, 它封裝了許多常用的CURDapi,免去了我們寫mapper.xml的重復(fù)勞動(dòng),本文主要介紹了SpringBoot集成MyBatisPlus+MySQL的實(shí)現(xiàn),感興趣的可以了解一下
    2023-10-10
  • Mybatis Trim標(biāo)簽用法簡(jiǎn)單介紹

    Mybatis Trim標(biāo)簽用法簡(jiǎn)單介紹

    這篇文章主要介紹了Mybatis Trim標(biāo)簽用法,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-05-05

最新評(píng)論

济源市| 察雅县| 灵宝市| 中西区| 扎赉特旗| 舟山市| 富锦市| 绥江县| 汤阴县| 务川| 寿宁县| 邯郸县| 泰宁县| 长岭县| 同仁县| 寿光市| 潼南县| 天津市| 海丰县| 本溪| 沂源县| 西充县| 米易县| 绵竹市| 东阿县| 德化县| 乐平市| 吉首市| 依安县| 定陶县| 鄂州市| 神农架林区| 尼勒克县| 谢通门县| 略阳县| 谢通门县| 米林县| 社旗县| 阳新县| 龙泉市| 商南县|