基于Java的在線考試系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)(優(yōu)秀畢業(yè)設(shè)計(jì))

這套基于Java在線考試系統(tǒng)是我的優(yōu)秀畢業(yè)設(shè)計(jì)作品,當(dāng)初是團(tuán)隊(duì)開(kāi)發(fā)出來(lái)的,花了兩個(gè)月時(shí)間。從系統(tǒng)設(shè)計(jì)到開(kāi)發(fā)成功都花了團(tuán)隊(duì)很多的心血。
在線考試系統(tǒng)實(shí)現(xiàn)了包含題庫(kù)編輯、抽題組卷、試題分析、在線考試等模塊的Web考試系統(tǒng)。在線考試系統(tǒng)一直以來(lái)就畢業(yè)設(shè)計(jì)的熱門選題,難度也算是比較高的畢設(shè)項(xiàng)目了。對(duì)學(xué)生的技術(shù)水平要求高,工作量也比較大。
在線考試系統(tǒng)已經(jīng)實(shí)現(xiàn)的主要功能有:
1、在線考試(包含限定時(shí)間設(shè)置),支持選擇題、填空題、判斷題三種題型,自動(dòng)判分
2、選擇題、填空題、判斷題及用戶信息的文本文件數(shù)據(jù)的Web導(dǎo)入
3、用戶注冊(cè)、登錄、修改密碼、基本信息管理
4、按照一定給分策略進(jìn)行抽題和組卷,支持“固定組卷” 和“隨機(jī)組卷”兩種方式
5、按照內(nèi)容、知識(shí)點(diǎn)、答案等搜索題庫(kù),題目及分?jǐn)?shù)的統(tǒng)計(jì)
6、章節(jié)知識(shí)點(diǎn)的分層和樹(shù)狀展示
7、管理廣播消息的推送、系統(tǒng)設(shè)置的修改

項(xiàng)目是基于Java+Tomca+Mysql開(kāi)發(fā)的,部署簡(jiǎn)單,代碼注釋詳細(xì)易懂。
下面看下在線考試系統(tǒng)數(shù)據(jù)庫(kù)表設(shè)計(jì)


在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述

登錄代碼

package cn.lynu.lyq.java_exam.actions;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import cn.lynu.lyq.java_exam.dao.StudentDao;
import cn.lynu.lyq.java_exam.entity.Student;
@Component("userLogin")
@Scope("prototype")
public class UserLoginAction extends ActionSupport {
    private static final long serialVersionUID = 5090548832375142158L;
    private final static Logger logger = LoggerFactory.getLogger(UserLoginAction.class);
    
    private String registerNo;
    private String password;
    private String username;
    @Resource
    private StudentDao studentDao;

    public String getRegisterNo() {
        return registerNo;
    }
    public void setRegisterNo(String registerNo) {
        this.registerNo = registerNo;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public String execute() throws Exception {
        logger.info("用戶登陸");
        Student stu = studentDao.findByRegNoAndPassword(registerNo, password);
        if(stu!=null){
            username=stu.getName();
            ActionContext ctx=ActionContext.getContext();
            ctx.getSession().put("USER_INFO", stu);
        }else{
            this.addActionError("學(xué)號(hào)或密碼錯(cuò)誤,請(qǐng)重新輸入!");
        }
        return SUCCESS;
    }
    
    public String logout() throws Exception{
        logger.info("用戶退出登陸");
        ActionContext ctx=ActionContext.getContext();
        ctx.getSession().remove("USER_INFO");
        this.addActionMessage("退出登陸成功!");
        return SUCCESS;
    }
}

成績(jī)功能代碼

package cn.lynu.lyq.java_exam.actions;
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.lang.ArrayUtils;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.StandardChartTheme;
import org.jfree.chart.labels.ItemLabelAnchor;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.general.DatasetUtilities;
import org.jfree.ui.TextAnchor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import cn.lynu.lyq.java_exam.common.ExamPhase;
import cn.lynu.lyq.java_exam.dao.ExamDao;
import cn.lynu.lyq.java_exam.dao.StudentDao;
import cn.lynu.lyq.java_exam.dao.StudentExamScoreDao;
import cn.lynu.lyq.java_exam.entity.Student;
import cn.lynu.lyq.java_exam.entity.StudentExamScore;
import cn.lynu.lyq.java_exam.misc.CustomColorBarRenderer;

@Component("scoresBarChart")
@Scope("prototype")
public class ScoresBarChartAction extends ActionSupport {
    private static final long serialVersionUID = 2217462899746164125L;
    private final static Logger logger = LoggerFactory.getLogger(ScoresBarChartAction.class);
    
    private JFreeChart chart;
    @Resource
    private StudentDao studentDao;
    @Resource
    private ExamDao examDao;
    @Resource
    private StudentExamScoreDao studentExamScoreDao;

    public JFreeChart getChart() {
        return chart;
    }

    public void setChart(JFreeChart chart) {
        this.chart = chart;
    }

    @Override
    public String execute() throws Exception {
//      double[][] data = new double[][] { { 90 , 80 , 77 , 85 } };
//      String[] rowKeys = {""};
//      String[] columnKeys = { "張三", "李四", "王二", "馬六" };
        
        ActionContext ctx =ActionContext.getContext();
        String classSearch=ctx.getParameters().get("classSearch").getValue();
        String examNameSearch=ctx.getParameters().get("examNameSearch").getValue();
        logger.debug("classSearch=["+classSearch+"]");
        logger.debug("examNameSearch=["+examNameSearch+"]");
        
//      Student theStudent =(Student)ctx.getSession().get("USER_INFO");
//      List<Student> stuList = studentDao.findByGrade(theStudent.getGrade());
        List<String> examNameList = examDao.findAllDistinctExamName();
        if(!examNameSearch.equals("")){
            examNameSearch=examNameList.get(Integer.parseInt(examNameSearch)-1);
        }else{
            examNameSearch=examNameList.get(0);
        }
        List<StudentExamScore> list1 = studentExamScoreDao.findByClassIdAndExamNameAndExamPhase(classSearch,examNameSearch,
                ExamPhase.FINAL_SCORED.getChineseName());
        List<String> stuNameList = new ArrayList<>();
        List<Double> scoreList = new ArrayList<>();
        
        for(StudentExamScore examScore:list1){
            scoreList.add((double)examScore.getScore());
            Student stu = studentDao.findById(examScore.getStudent().getId());
            stuNameList.add(stu.getName());
        }
        
        String[] stuNameArray = (String[])stuNameList.toArray(new String[stuNameList.size()]);
        Double[] integerScoreArray = (Double[])scoreList.toArray(new Double[scoreList.size()]);
        double[] scoreArray = ArrayUtils.toPrimitive(integerScoreArray);
        
        //排序
        int[] index = new int[scoreArray.length];//原始下標(biāo)數(shù)組
        for(int i=0; i<scoreArray.length; i++){
            index[i] = i;
        }
        sortWithIndex(scoreArray,index);
        //根據(jù)分?jǐn)?shù)排序,重新排列姓名數(shù)組
        String[] stuNameArraySorted = new String[stuNameArray.length];
        for(int i=0; i<stuNameArray.length; i++){
            stuNameArraySorted[i] = stuNameArray[index[i]];
        }
        
        double[][] data = new double[][] { scoreArray };
        String[] rowKeys = {""};
        String[] columnKeys = stuNameArraySorted;
//      logger.debug(">>>>>>>>>>學(xué)生名列表:"+Arrays.toString(stuNameArraySorted));
//      logger.debug(">>>>>>>>>>學(xué)生名length:"+stuNameArraySorted.length);
//      logger.debug(">>>>>>>>>>分?jǐn)?shù)列表:"+Arrays.toString(scoreArray));
//      logger.debug(">>>>>>>>>>分?jǐn)?shù)length"+scoreArray.length);
        
        CategoryDataset dataset = DatasetUtilities.createCategoryDataset(rowKeys, columnKeys, data);

        // 創(chuàng)建主題樣式
        StandardChartTheme standardChartTheme = new StandardChartTheme("CN");
        // 設(shè)置標(biāo)題字體
        standardChartTheme.setExtraLargeFont(new Font("SimHei", Font.BOLD, 20));
        // 設(shè)置圖例的字體
        standardChartTheme.setRegularFont(new Font("Microsoft YaHei", Font.PLAIN, 15));
        // 設(shè)置軸向的字體
        standardChartTheme.setLargeFont(new Font("Microsoft YaHei", Font.PLAIN, 15));
        
        standardChartTheme.setSmallFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
        // 應(yīng)用主題樣式
        ChartFactory.setChartTheme(standardChartTheme);

        chart = ChartFactory.createBarChart3D("成績(jī)分布圖", "姓名", "成績(jī)", dataset, PlotOrientation.HORIZONTAL, false,
                false, false);
        CategoryPlot plot = chart.getCategoryPlot();// 獲得圖表區(qū)域?qū)ο?        CustomColorBarRenderer renderer = new CustomColorBarRenderer();
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); 
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
                ItemLabelAnchor.OUTSIDE4, TextAnchor.BASELINE_RIGHT));
        renderer.setItemLabelAnchorOffset(25D);
        renderer.setBaseItemLabelsVisible(true);  
        plot.setRenderer(renderer);
        return SUCCESS;
    }
    
    /*
     * 冒泡排序 并返回 排序?qū)?yīng)的原始下標(biāo)
     */
    public void sortWithIndex(double[] array, int[] index){
//      index = new int[array.length];//原始下標(biāo)數(shù)組
//      for(int i=0; i<array.length; i++){
//          index[i] = i;
//      }
        for(int i=0; i<array.length; i++){//冒泡輪次i
            for(int j=0; j<array.length-i-1; j++){//參與比較的數(shù)組下標(biāo)j
                if(array[j]<array[j+1]){
                    double tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                    
                    int tmp2 = index[j];
                    index[j] = index[j+1];
                    index[j+1] = tmp2;
                }
            }
        }
    }
    
}

需要可以加微信(LGY178888)了解下!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 網(wǎng)上閱卷系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn) 概述 隨著教育改革的不斷深化和發(fā)展,人們對(duì)信息技術(shù)與教育系統(tǒng)整合的要求越來(lái)越迫切. 傳統(tǒng)...
    Bobby0322閱讀 6,588評(píng)論 1 7
  • 我有一個(gè)習(xí)慣 將所寫的硬筆書法 選擇好點(diǎn)的收入記冊(cè) 下面將幾幅 硬筆書法供同行好友審閱 誠(chéng)請(qǐng)同行人士 提出寶貴意見(jiàn)...
    老武家閱讀 503評(píng)論 3 4
  • 對(duì)愉愉要注意引導(dǎo),她開(kāi)始知道婆婆公公,舅舅,還有樂(lè)樂(lè)能帶給她歡樂(lè)。當(dāng)她感受到媽媽難過(guò),或者情緒不好,她主動(dòng)去做了中...
    煒靈閱讀 336評(píng)論 0 0
  • 最近打算記錄一下python的一些基礎(chǔ)知識(shí),可能比較零散,回頭再重新整理。 yaml語(yǔ)法很簡(jiǎn)單,結(jié)構(gòu)通過(guò)空格縮進(jìn)來(lái)...
    AK蝸牛閱讀 331評(píng)論 0 1
  • 你看見(jiàn)我后眼神就瞬間移開(kāi),每天都這樣。你我在現(xiàn)實(shí)的深淵背道而馳什么的,經(jīng)常的了。 哥那時(shí)候在假裝恨著你...
    淡寒川閱讀 384評(píng)論 0 0

友情鏈接更多精彩內(nèi)容