xx学院学员评优评奖管理系统

时间:2023-03-09 15:51:19
xx学院学员评优评奖管理系统

之前帮助一个同学做的一个评优评奖管理系统,该系统主要用于学校学生评优评先使用。

系统采用java开发,数据库是mysql。

下面简单讲诉一下该系统的设计:

一. 系统设计

1.1 系统目标设计

  在对现有系统和现状认真调查分析的基础上,明确了学员信息管理工作本身存在的问题和建立管理信息系统的初步要求,进一步研究确定新系统的目标如下:

  1、管理员能够实现对学员信息的添加、修改、删除、查询等操作,对干教用户的添加、修改、删除等操作。

  2、干教能够在一定的权限内对所有学员成绩的查询,平时量化成绩查询,所有干教的信息的查询等,对自己信息进行更新,登陆密码的修改。

  3、学员可以在自己的权限内对自己成绩的查询,已经课程、个人信息的查询所获荣誉查询,平时量化分数查询,登陆密码的修改等相关操作。

  4、按照管理信息系统的原理和方法,采用成熟的信息技术和手段,支持学员管理的全过程,提高教务工作效率。

  5、针对现代计算机广泛应用的情况以及数据的封闭性*海警学院学员评优评奖管理系统基于Windows系统研制、设计和开发。

  6、考虑经费等原因,系统使用一台PC机和现有的软件以节省资金,降低成本。

1.2 系统功能分析

  本系统适用于*xx学院以及其他同类军事院校,其功能主要分为五大类:
   1.   用户管理:用于对用户的添加,赋予不同权限及对用户的修改及查询。
   2.   课程管理:用于对个个课程的开放和修改。
   3.   成绩管理:用于对成绩的查询。
   4.   学员信息管理:添加、删除、修改学员信息。
   5.   学员平时量化成绩管理:管理学员平时量化成绩,包括体能,作风,日常表现
   6.   教师信息管理:对授课教师、课程等信息的添加、修改等。
   7.   评优评先决策: 根据学员成绩自动完成评优评先的初步决策

二、系统实现

2.1 登陆端

xx学院学员评优评奖管理系统

登陆界面主要代码:

 package wyf.cgq;
import java.awt.*;
public class Login extends JFrame implements ActionListener
{
private String host;
//声明Connection引用、Statement对象引用与结果集引用
private Connection conn;
private Statement stmt;
private ResultSet rs;
private Image image=new ImageIcon("res/logo2.jpg").getImage();
//JPanel panel = new BackgroundPanel(image);
private JPanel jp=new BackgroundPanel(image);//创建用来存放空间的容器
private JLabel jl3=new JLabel("");//正在登陆提示标签
//创建主机地址、端口号、用户名和密码输入框
private JTextField hostport=new JTextField();
private JTextField hostaddress=new JTextField();
private JTextField jtf=new JTextField();
private JPasswordField jpwf=new JPasswordField();
private JRadioButton radioButton = new JRadioButton("普通学员",true);
private JRadioButton radioButton_1 = new JRadioButton("管理人员");
private JRadioButton[] jrbArray=//创建单选按钮数组
{
radioButton,
radioButton_1
};
//创建组
private ButtonGroup bg=new ButtonGroup();
//创建操作按钮
private JButton jb1=new JButton("登 陆");
private JButton jb2=new JButton("重 置");
private final JPanel panel_1 = new JPanel();
private final JPanel panel_2 = new JPanel();
//构造器
public Login()
{
radioButton_1.setBackground(Color.CYAN);
radioButton_1.setSize(100, 15);
radioButton_1.setLocation(170, 190);
radioButton.setSize(100, 15);
radioButton.setLocation(60, 190);
radioButton.setBackground(Color.MAGENTA);
this.addListener();
initialFrame();//初始化界面
}
public void addListener(){
this.jb1.addActionListener(this);//为登陆按钮注册监听器
this.jb2.addActionListener(this);//为重置按钮注册监听器
this.jtf.addActionListener(this);//为用户名文本框注册监听器
this.jpwf.addActionListener(this);//为用户名密码框注册监听器
jp.add(hostaddress);
this.hostaddress.addActionListener(this);//为主机地址文本框注册监听器
jp.add(hostport);
this.hostport.addActionListener(this);//为端口号文本框注册监听器
}
public void initialFrame()
{
//设为空布局
jp.setLayout(null);
this.jtf.setBounds(170,100,130,25);
this.jp.add(jtf);
this.jpwf.setBounds(170,150,130,25);
this.jpwf.setEchoChar('*');
this.jp.add(jpwf);
this.bg.add(jrbArray[0]);
this.bg.add(jrbArray[1]);
this.jrbArray[0].setBounds(40,180,100,25);
this.jp.add(jrbArray[0]);
this.jrbArray[1].setBounds(145,180,100,25);
this.jp.add(jrbArray[1]);
this.jb1.setBounds(40,280,100,30);
this.jp.add(jb1);
this.jb2.setBounds(184,280,100,30);
this.jp.add(jb2);
this.jl3.setBounds(40,245,150,25);
this.jp.add(jl3);
getContentPane().add(jp);
this.hostport.setBounds(0,0,0,0);
this.hostport.setText("3306");
this.hostaddress.setBounds(0,0,0,0);
//将填写姓名的文本框设为默认焦点
this.hostaddress.requestFocus(true);
this.hostaddress.setText("127.0.0.1");
panel_2.setBackground(SystemColor.menu);
panel_2.setBounds(40, 100, 100, 25); jp.add(panel_2);
panel_2.setLayout(null); JLabel lblNewLabel = new JLabel("\u767B\u9646\u540D");
lblNewLabel.setBounds(0, 0, 100, 25);
panel_2.add(lblNewLabel);
lblNewLabel.setForeground(Color.RED);
lblNewLabel.setFont(new Font("华文楷体", Font.PLAIN, 24));
lblNewLabel.setBackground(Color.WHITE);
panel_1.setBounds(40, 150, 100, 25); jp.add(panel_1);
panel_1.setLayout(null); JLabel label = new JLabel("\u5BC6 \u7801");
label.setBounds(0, 0, 100, 25);
panel_1.add(label);
label.setForeground(Color.RED);
label.setFont(new Font("华文楷体", Font.PLAIN, 24));
label.setBackground(SystemColor.menu); JPanel panel = new JPanel();
panel.setBackground(SystemColor.activeCaption);
panel.setBounds(10, 10, 451, 54);
jp.add(panel);
panel.setLayout(null); JLabel label_1 = new JLabel("\u516C\u5B89\u6D77\u8B66\u5B66\u9662\u5B66\u5458\u8BC4\u4F18\u8BC4\u5956\u7BA1\u7406\u7CFB\u7EDF");
label_1.setBounds(0, 0, 451, 54);
panel.add(label_1);
label_1.setForeground(SystemColor.desktop);
label_1.setFont(new Font("华文楷体", Font.PLAIN, 28));
label_1.setBackground(Color.WHITE);
//设置窗口的标题、大小、位置以及可见性
this.setTitle("登陆");
Image image=new ImageIcon("ico.gif").getImage();
this.setIconImage(image);
this.setResizable(false);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int centerX=screenSize.width/2;
int centerY=screenSize.height/2;
int w=300;//本窗体宽度
int h=320;//本窗体高度
this.setBounds(centerX-w/2,centerY-h/2-100,477,400);//设置窗体出现在屏幕*
this.setVisible(true);
}
//实现ActionListener接口中的方法
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==this.jb1)
{//按下登陆按钮
this.jl3.setText("正 在 验 证 , 请 稍 候. . . . .");//设置提示信息
//获取用户输入的主机地址、端口号、用户名与密码
String hostadd=this.hostaddress.getText().trim();
if(hostadd.equals("")){
JOptionPane.showMessageDialog(this,"请输入主机地址","错误",
JOptionPane.ERROR_MESSAGE);
jl3.setText("");return;
}
String port=this.hostport.getText();
if(port.equals("")){
JOptionPane.showMessageDialog(this,"请输入端口号","错误",
JOptionPane.ERROR_MESSAGE);
jl3.setText("");return;
}
this.host=hostadd+":"+port;
String name=this.jtf.getText().trim();
if(name.equals("")){
JOptionPane.showMessageDialog(this,"请输入用户名","错误",
JOptionPane.ERROR_MESSAGE);
jl3.setText("");return;
}
String pwd=this.jpwf.getText().trim();
if(pwd.equals("")){
JOptionPane.showMessageDialog(this,"请输入密码","错误",
JOptionPane.ERROR_MESSAGE);
jl3.setText("");return;
}
int type=this.jrbArray[0].isSelected()?0:1;//获取登陆类型
try{ //初始化连接
this.initialConnection();
if(type==0){//普通学员登陆
//创建sql语句并查询
String sql="select * from user_stu where "+
"stu_id='"+name+"' and pwd='"+pwd+"'";
rs=stmt.executeQuery(sql);
if(rs.next()){
new StuClient(name,host);//创建学员客户短窗口
this.dispose();//关闭登陆窗口并释放资源
}
else{//弹出错误提示窗口
JOptionPane.showMessageDialog(this,"用户名或密码错误","错误",
JOptionPane.ERROR_MESSAGE);
jl3.setText("");
}
this.closeConn();//关闭连接,语句及结果集
}
else{//教师登陆
//创建sql语句并查询
String sql="select coll_id from user_teacher where "+
"uid='"+name+"' and pwd='"+pwd+"'";
rs=stmt.executeQuery(sql);
if(rs.next()){
String coll_id=rs.getString(1);
new TeacherClient(coll_id,host);//创建教师客户端窗口
this.dispose();//关闭登陆窗口并释放资源
}
else{//弹出错误提示窗口
JOptionPane.showMessageDialog(this,"用户名或密码错误","错误",
JOptionPane.ERROR_MESSAGE);
jl3.setText("");
}
this.closeConn(); //关闭连接,语句及结果集
}
}
catch(SQLException ea){ea.printStackTrace();}
}
else if(e.getSource()==this.jb2){//按下重置按钮,清空输入信息
this.jtf.setText("");
this.jpwf.setText("");
}
else if(e.getSource()==jtf){//当输入用户名并回车时
this.jpwf.requestFocus(true);
}
else if(e.getSource()==jpwf){//当输入密码并回车时
this.jb1.requestFocus(true);
}
else if(e.getSource()==this.hostaddress){//当输入主机地址并回车时
this.hostport.requestFocus(true);
}
else if(e.getSource()==this.hostport){//当输入端口号并回车时
this.jtf.requestFocus(true);
}
}
//自定义的初始化数据库连接的方法
public void initialConnection()
{
try
{//加载驱动,创建Connection及Statement
Class.forName("org.gjt.mm.mysql.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/pypx?useUnicode=true&characterEncoding=utf8", "root","root");
stmt=conn.createStatement();
}
catch(SQLException e)
{
JOptionPane.showMessageDialog(this,"连接失败,请检查主机地址是否正确","错误",JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
}
//初始化的关闭数据库连接的方法
public void closeConn()
{
try
{
if(rs!=null)
{
rs.close();
}
if(stmt!=null)
{
stmt.close();
}
if(conn!=null)
{
conn.close();
}
}
catch(SQLException e)
{
e.printStackTrace();
}
}
public static void main(String args[])
{
//创建登陆窗体对象
Login login=new Login();
}
}

2.2  学员端

学员端主界面主要是方便学员查看自己的成绩,学员可以通过这个界面查看自己平时成绩,量化分数,获得荣誉等信息。界面如下:

xx学院学员评优评奖管理系统

主要实现代码展示

package wyf.cgq;
import java.util.*;
public class StuClient extends JFrame
{
private String host;
//声明标志学员学号的变量
private String stu_id;
//创建树的各个节点
private DefaultMutableTreeNode dmtnRoot=new DefaultMutableTreeNode(new MyNode("操作选项","0"));
private DefaultMutableTreeNode dmtn1=new DefaultMutableTreeNode(new MyNode("系统选项","1"));
private DefaultMutableTreeNode dmtn2=new DefaultMutableTreeNode(new MyNode("个人基本信息","2"));
private DefaultMutableTreeNode dmtn3=new DefaultMutableTreeNode(new MyNode("学员选课","3"));
private DefaultMutableTreeNode dmtn4=new DefaultMutableTreeNode(new MyNode("成绩查询","4"));
private DefaultMutableTreeNode dmtn5=new DefaultMutableTreeNode(new MyNode("平时量化","5"));
private DefaultMutableTreeNode dmtn6=new DefaultMutableTreeNode(new MyNode("体能考核","6"));
private DefaultMutableTreeNode dmtn7=new DefaultMutableTreeNode(new MyNode("获得荣誉","7"));
private DefaultMutableTreeNode dmtn8=new DefaultMutableTreeNode(new MyNode("评选先进办法","8"));
//
private DefaultMutableTreeNode dmtn11=new DefaultMutableTreeNode(new MyNode("退出","11"));
private DefaultMutableTreeNode dmtn13=new DefaultMutableTreeNode(new MyNode("密码修改","13"));
//
private DefaultMutableTreeNode dmtn31=new DefaultMutableTreeNode(new MyNode("选课","31"));
private DefaultMutableTreeNode dmtn32=new DefaultMutableTreeNode(new MyNode("课表显示","32"));
//
private DefaultMutableTreeNode dmtn41=new DefaultMutableTreeNode(new MyNode("已修课程成绩","41"));
private DefaultMutableTreeNode dmtn42=new DefaultMutableTreeNode(new MyNode("不及格课程成绩","42"));
//评选先进子节点
private DefaultMutableTreeNode dmtn81=new DefaultMutableTreeNode(new MyNode("优秀毕业生评选办法","81"));
private DefaultMutableTreeNode dmtn82=new DefaultMutableTreeNode(new MyNode("优秀学员评选办法","82"));
private DefaultMutableTreeNode dmtn83=new DefaultMutableTreeNode(new MyNode("嘉奖评选办法","83")); //创建根节点
private DefaultTreeModel dtm=new DefaultTreeModel(dmtnRoot);
//创建树状列表控件
private JTree jtree=new JTree(dtm);
private JScrollPane jspz=new JScrollPane(jtree);
//创建存放个功能模块面板
private Image image=new ImageIcon("res/bg.jpg").getImage();
//JPanel panel = new BackgroundPanel(image);
private JPanel jpy=new BackgroundPanel(image);
private JSplitPane jsp1=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,jspz,jpy);
//声明卡片布局的引用
private CardLayout cl;
//生命欢迎页面
private Welcome welcome;
//声明个功能模块的引用
//选课模块的引用
private ChoseCourse chosecourse;
//课表显示模块的引用
private CourseTable coursetable;
//学员成绩查询页面
private StuGrade stugrade;
//不及格成绩查询页面
private StuFailGrade stufailgrade;
//基本信息查询页面
private StuInfo stuinfo;
//密码更改页面
private ChangePwd changepwd;
//优等生说明界面
private Yxbys yxbys;
//优秀学员
private Yxxy yxxy;
//嘉奖
private Jj jj;
//构造器
public StuClient(String stu_id,String host)
{
this.host=host;
this.stu_id=stu_id;
//初始化树状列表控件
this.initialTree();
//初始化个功能模块面板
this.initialPane();
//初始化主功能面板,其他面板都一卡
//片布局的形式存在与该面板
this.initialJpy();
//为控件注册监听器
this.addListener();
//初始化窗体
this.initialFrame();
}
//主面板的初始化方法
public void initialJpy()
{//将各功能模块以卡片布局的形式存入主面板
jpy.setLayout(new CardLayout());
cl=(CardLayout)jpy.getLayout();
jpy.add(welcome,"welcome");
welcome.setBackground(Color.red);
jpy.add(welcome,"welcome");
jpy.add(chosecourse,"chosecourse");
jpy.add(coursetable,"coursetable");
jpy.add(stugrade,"stugrade");
jpy.add(stufailgrade,"stufailgrade");
jpy.add(stuinfo,"stuinfo");
jpy.add(changepwd,"changepwd");
jpy.add(yxbys,"yxbys");
jpy.add(yxxy,"yxxy");
jpy.add(jj,"jj");
}
//初始化各功能模块的方法
public void initialPane()
{
welcome=new Welcome("学员成绩管理系统");
chosecourse=new ChoseCourse(stu_id,host);
coursetable=new CourseTable(stu_id,host);
stugrade=new StuGrade(stu_id,host);
stufailgrade=new StuFailGrade(stu_id,host);
stuinfo=new StuInfo(stu_id,host);
changepwd=new ChangePwd(stu_id,host);
yxbys=new Yxbys();
yxxy=new Yxxy();
jj=new Jj();
}
//初始化树状列表控件的方法
public void initialTree()
{
dmtnRoot.add(dmtn1);
dmtnRoot.add(dmtn2);
dmtnRoot.add(dmtn3);
dmtnRoot.add(dmtn4);
dmtnRoot.add(dmtn5);
dmtnRoot.add(dmtn6);
dmtnRoot.add(dmtn7);
dmtnRoot.add(dmtn8);
dmtn1.add(dmtn11);
dmtn1.add(dmtn13);
dmtn3.add(dmtn31);
dmtn3.add(dmtn32);
dmtn4.add(dmtn41);
dmtn4.add(dmtn42);
dmtn8.add(dmtn81);
dmtn8.add(dmtn82);
dmtn8.add(dmtn83);
jtree.setToggleClickCount(1);
}
//为树状列表控件注册鼠标事件监听器的方法
public void addListener()
{
jtree.addMouseListener(
new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
DefaultMutableTreeNode dmtntemp=(DefaultMutableTreeNode)jtree.getLastSelectedPathComponent();
MyNode mynode=(MyNode)dmtntemp.getUserObject();
String id=mynode.getId();
//根据id值显示不同的卡片
if(id.equals("0"))
{
cl.show(jpy,"welcome");
}
else if(id.equals("11"))
{
int i=JOptionPane.showConfirmDialog(jpy,"您确认要退出出系统吗?","询问",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
if(i==0)
{
System.exit(0);
} }
else if(id.equals("13"))
{
cl.show(jpy,"changepwd");
changepwd.setFocus();
}
else if(id.equals("2"))
{
cl.show(jpy,"stuinfo");
}
else if(id.equals("31"))
{
cl.show(jpy,"chosecourse");
}
else if(id.equals("32"))
{
//在显示之后立即更新数据
cl.show(jpy,"coursetable");
coursetable.initialData();
coursetable.updataview();
}
else if(id.equals("41"))
{
cl.show(jpy,"stugrade");
}
else if(id.equals("42"))
{
cl.show(jpy,"stufailgrade");
}else if(id.equals("81"))
{
cl.show(jpy,"yxbys");
}else if(id.equals("82")){
cl.show(jpy,"yxxy");
}else if(id.equals("83")){
cl.show(jpy,"jj");
} }
}
);
}
//初始化窗体的方法
public void initialFrame()
{
this.add(jsp1);
jsp1.setDividerLocation(200);
jsp1.setDividerSize(4);
//设置窗体的标题、大小及其可见性
this.setTitle("学员自主查询客户端");
Image image=new ImageIcon("ico.gif").getImage();
this.setIconImage(image);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int centerX=screenSize.width/2;
int centerY=screenSize.height/2;
int w=900;//本窗体宽度
int h=650;//本窗体高度
this.setBounds(centerX-w/2,centerY-h/2-30,w,h);//设置窗体出现在屏幕*
this.setVisible(true);
//窗体全屏
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
//自定义的初始化树节点的数据对象的类
class MyNode
{
private String values;
private String id;
public MyNode(String values,String id)
{
this.values=values;
this.id=id;
}
public String toString()
{
return this.values;
}
public String getId()
{
return this.id;
}
}
}

2.3 *端

xx学院学员评优评奖管理系统

(注:本系统为工作室成品,有全套资料,需要可联系)

技术交流QQ群:439261058

商务合作加QQ:1215714557