Java课程设计报告-企业人事管理系统设计.docx_第1页
Java课程设计报告-企业人事管理系统设计.docx_第2页
免费预览已结束,剩余34页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

java课程设计报告题目 企业人事管理系统 专业信息管理与信息系统班级信管152学号 1510402204 姓名指导教师完成时间二零一六年六月二十九日目录一、设计任务与要求21.1 设计任务与要求21.2 选题目的与意义2二、需求分析32.1 用户需求分析32.2 开发环境分析3三、系统设计43.1 系统总体设计43.2 功能模块设计43.3 类及方法的设计5四、程序实现64.1 程序流程图64.2 关键程序6五、测试运行85.1 系统测试方案85.2 系统测试运行及结果分析8六、设计体会12主要参考文献13附录:1435一、 设计任务与要求1.1 设计任务与要求根据所选课题“企业人事管理系统”,完成课程设计的分析、设计和编码,制作一个简单的管理系统,并用窗口界面实现,可以对企业员工的基本信息(员工编号、姓名、性别、联系电话、部门、职务、底薪)实现录入、修改、调用、删除。并完成课程设计报告。1.2 选题目的与意义无论企业大小,都需要进行人事管理,企业人事管理系统基于这样的要求,实现了对企业人事的基本信息管理。通过企业人事管理系统的设计过程,深刻了解掌握面向对象程序设计语言java的核心概念和特性;了解编程技术知识,会处理异常情况。了解基于swing的图形用户界面开发;掌握java应用软件的开发环境和开发过程;灵活选择程序设计思想。二、需求分析2.1 用户需求分析现在的社会是信息化的社会,随着科学技术的发展,人们越来越多的用计算机去代替和延伸脑力劳动,而且计算机能够更高效地帮助人们去处理一些事情,为了把传统的人事管理和现在用计算机技术对人事进行管理相结合,这次,我设计了这套基本的企业人事管理系统方案。 通过此系统的运用,可以满足企业人事管理的诸多需求,例如对新员工基本信息录入,对离职员工实现信息删除,对员工信息实现修改等需求。2.2 开发环境分析系统编程基于java swing的图形用户界面开发,使用windows环境下的myeclipse6.0.1软件开发。myeclipse企业级工作平台(myeclipse enterprise workbench ,简称myeclipse)是对eclipse ide的扩展,利用它我们可以在数据库和javaee的开发、发布,以及应用程序服务器的整合方面极大的提高工作效率。三、系统设计3.1 系统总体设计 该软件功能分析说明图如所示:企业人事管理系统修改员工基本信息录入员工基本信息调用员工基本信息删除员工基本信息主界面图3.1 功能分析说明3.2 功能模块设计模块功能主界面显示系统名称“企业人事管理系统”录入界面实现员工基本信息录入修改界面对员工基本信息实现修改调用界面调用信息实现查询及打印的功能删除界面删除员工基本信息表3.23.3 类及方法的设计类名方法deletedelete(file)actionperformed(actionevent)inputemployeeinputemployee(file)actionperformed(actionevent)clearmess()employeepictureemployeepicture()paintcomponent(graphics)setimage(file)inquestinquest(file)actionperformed(actionevent)clearmess()managerwindowmain(string)managerwindow()actionperformed(actionevent)modifysituationmodifysituation(file)actionperformed(actionevent)clearmess()employeegetdepartment()getimagepic()getname()getnumber()getphone()getposition()getsalary()getsex()setdepartment(string)setimagepic(file)setname(string)setnumber(string)setphone(string)setposition(string)setsalary(string)setsex(string)表 3.3四、程序实现4.1程序流程设计企业人事管理系统主界面录入员工姓名、联系电话等信息录入实现信息修改修改查询员工信息及打印删除员工信息删除调用图4.14.2关键程序public class employeepicture extends jpanel/继承图形用户界面的面板容器类public class employee implements serializable/继承有序列化功能的接口public class modifysituation extends jpanel implements actionlistener/继承负责创建监视器的类try inone=new fileinputstream(systemfile);intwo=new objectinputstream(inone); 基本信息表=(hashmap)intwo.readobject();inone.close();intwo.close(); catch(exception ee)/处理异常基本信息录入=new inputemployee (file); 基本信息修改=new modifysituation(file); 基本信息查询与打印=new inquest(file); 基本信息删除=new delete(file); pcenter.add(主界面,label); pcenter.add(录入界面,基本信息录入); pcenter.add(修改界面,基本信息修改); pcenter.add(删除界面,基本信息删除);/新建菜单并加入到容器中group=new buttongroup(); 男=new jradiobutton(男,true); 女=new jradiobutton(女,false); group.add(男); group.add(女);/新建单选按钮并添加putbutton.setbackground(color.red);/添加背景颜色image image=tool.getimage(imagefile.getabsolutepath(); g.drawimage(image,0,0,w,h,this);/实现对照片的添加filenameextensionfilter filter = new filenameextensionfilter( jpg & gif images, jpg, gif);/对filter的实现public void actionperformed(actionevent e) if(e.getsource()=查询|e.getsource()=学号)/触发事件实现调用public void actionperformed(actionevent e) if(e.getsource()=删除|e.getsource()=员工编号)/触发事件实现删除public void actionperformed(actionevent e) if(e.getsource()=开始修改|e.getsource()=员工编号)/触发事件实现修改public static void main(string args)new managerwindow(); /主类五、测试运行5.1 系统测试方案本次设计采用windows环境下的myeclipse,myeclipse包括了完备的编码、调试、测试和发布功能,极大的提高了工作效率。在myeclipse中进行测试,较为方便。5.2系统测试运行及结果分析(1)主界面:进入管理系统后,显示系统名称,点击菜单,显示其他模块选项。图5.2.1(2) 录入员工基本信息:实现对员工编号、姓名、性别、联系电话、部门选择、职务、底薪和照片的录入。图选择图片界面图图(3) 修改员工基本信息:实现对员工编号、姓名、性别、联系电话、部门选择、职务、底薪和照片的修改。图5.2.3(4) 调用员工基本信息:输入员工编号,对员工信息实现查询调用,还可以进行打印。图若输入错误编号图(5) 删除员工基本信息:输入编号实现对员工信息的删除。图若未输入编号:图(6) 退出关闭窗口时图5.2.6所有功能皆可实现,程序运行成功!六、设计体会系统设计最重要的不是创意,而是功能。设计系统是对一个人整体思维能力的、挑战自己大脑极限的工作,总是伴着某种痛苦,因为很多你想加入的系统功能和特色,经过自己检验和想象式测试,就会发现存在很多问题,于是不断的改,直到最后才发现,最简单的设定往往最有效最合理,然后再以此追加更高级的复杂设定。希望进行更多的探讨和交流.这次系统设计中遇到了一些问题,比如系统运行过程中如何完成录入、添加照片等操作,经过查阅资料和编程测试最终解决。经过一个学期的学习,我对java有了一定的初步了解,可以完成简单程序的设计,但对于较为熟练地运用还有一定的问题,在查阅资料及咨询老师后,完成了这个系统的设计,但是这个系统还不是很完善,功能还可以继续增加,使之更加完美,例如数据库的知识不是很了解,如果加入大量数据库编程,系统将会更加完善。如今社会中,计算机技术与企业管理密不可分,通过计算机系统程序的使用,使得企业管理更加方便快捷,因此企业人事管理系统比较重要,很开心能完成此程序的设计,希望程序能起到应有的作用。发现问题,提出问题,解决问题,使我从不足之处出发,寻找新的学习方向。一边实习一边探索,发现理论和实践要充分地结合,是需要扎实的基本功的,这就表明学好基础知识是理论付诸实践的前提。主要参考文献1 耿祥义.java2实用教程m. 北京:清华大学出版社. 2012.2 耿祥义.java课程设计m. 北京:清华大学出版社. 2008.附录:managerwindow.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.hashmap;publicclass managerwindow extends jframe implements actionlistener inputemployee 人事信息录入; modifysituation 基本信息修改; inquest 基本信息调用; delete 基本信息删除; jmenubar bar; jmenu filemenu; jmenuitem 录入,修改,调用,删除,主界面; hashmap基本信息=null; file file=null; cardlayout card=null; jlabel label=null; jpanel pcenter;public managerwindow()录入=new jmenuitem(录入员工基本信息);修改=new jmenuitem(修改员工基本信息);调用=new jmenuitem(调用员工基本信息);删除=new jmenuitem(删除员工基本信息);主界面=new jmenuitem(主界面);bar=new jmenubar();filemenu=new jmenu(菜单);filemenu.add(录入);filemenu.add(修改);filemenu.add(调用);filemenu.add(删除);filemenu.add(主界面);bar.add(filemenu);setjmenubar(bar);label=new jlabel(企业人事管理系统,jlabel.center);label.seticon(new imageicon(welcome.jpg);label.setfont(new font(楷体,font.bold,40);label.sethorizontaltextposition(swingconstants.center);label.setforeground(color.black);基本信息=new hashmap();录入.addactionlistener(this);修改.addactionlistener(this);调用.addactionlistener(this);删除.addactionlistener(this);主界面.addactionlistener(this);card=new cardlayout();pcenter=new jpanel();pcenter.setlayout(card); file=new file(基本信息.txt);if(!file.exists()try fileoutputstream out=newfileoutputstream(file); objectoutputstream objectout=newobjectoutputstream(out); objectout.writeobject(基本信息);objectout.close();out.close(); catch(ioexception e) 人事信息录入=new inputemployee(file);基本信息修改=new modifysituation(file);基本信息调用=new inquest(file);基本信息删除=new delete(file);pcenter.add(欢迎界面,label);pcenter.add(录入界面,人事信息录入);pcenter.add(修改界面,基本信息修改);pcenter.add(删除界面,基本信息删除);add(pcenter,borderlayout.center);validate();setvisible(true);setbounds(100,50,500,300);setdefaultcloseoperation(jframe.do_nothing_on_close);addwindowlistener(new windowadapter()publicvoid windowclosing(windowevent e)int n=joptionpane.showconfirmdialog(null,确认退出?,确认对话框”, joptionpane.yes_no_option );if(n=joptionpane.yes_option) system.exit(0); );validate(); publicvoid actionperformed(actionevent e)if(e.getsource()=录入)人事信息录入.clearmess();card.show(pcenter,录入界面); elseif(e.getsource()=修改)基本信息修改.clearmess();card.show(pcenter,修改界面); elseif(e.getsource()=调用)基本信息调用.clearmess();基本信息调用.setlocation(getbounds().width,getbounds().height);基本信息调用.setvisible(true); elseif(e.getsource()=删除)card.show(pcenter,删除界面);elseif(e.getsource()=主界面)card.show(pcenter,主界面); publicstaticvoid main(string args)new managerwindow(); employee.javaimport java.io.*;publicclass employee implements serializablestring number,name,phone,department,position,salary,sex;file imagepic;publicvoid setnumber(string number)this.number=number;public string getnumber()returnnumber;publicvoid setname(string name)=name;public string getname()returnname;publicvoid setphone(string phone)this.phone=phone;public string getphone()returnphone;publicvoid setdepartment(string department)this.department=department;public string getdepartment()returndepartment;publicvoid setposition(string position)this.position=position;public string getposition()returnposition;publicvoid setsalary(string salary)this.salary=salary;public string getsalary()returnsalary;publicvoidsetsex(string sex)this.sex=sex; public string getsex()returnsex;publicvoid setimagepic(file imagepic2) public file getimagepic() returnnull;inputemployee.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.*;import javax.swing.filechooser.*;public class inputemployee extends jpanel implements actionlistener employee 员工=null; employeepicture pic; hashmap基本信息表=null; jtextfield 员工编号,姓名,联系电话,职务,底薪; jbutton 选择照片; jcombobox 部门; jradiobutton 男,女; buttongroup group=null; jbutton 录入,重置; fileinputstream inone=null; objectinputstream intwo=null; fileoutputstream outone=null; objectoutputstream outtwo=null; file systemfile,imagepic;public inputemployee(file file)systemfile=file;pic=new employeepicture();员工编号=new jtextfield(5);姓名=new jtextfield(5);联系电话=new jtextfield(13);部门=new jcombobox();try filereader inone=new filereader(部门.txt); bufferedreader intwo= new bufferedreader(inone); string s=null;int i=0;while(s=intwo.readline()!=null)部门.additem(s);inone.close();intwo.close(); catch(ioexception exp)部门.additem(行政部);部门.additem(mpc);部门.additem(财务); 职务=new jtextfield(5);底薪=new jtextfield(5);选择照片=new jbutton(选择); group=new buttongroup();男=new jradiobutton(男,true);女=new jradiobutton(女,false); group.add(男); group.add(女);录入=new jbutton(录入);重置=new jbutton(重置);录入.addactionlistener(this);选择照片.addactionlistener(this);重置.addactionlistener(this); box box1=box.createhorizontalbox(); box1.add(new jlabel(员工编号:,jlabel.center); box1.add(员工编号); box box2=box.createhorizontalbox(); box2.add(new jlabel(姓名:,jlabel.center); box2.add(姓名); box box3=box.createhorizontalbox(); box3.add(new jlabel(性别:,jlabel.center); box3.add(男); box3.add(女); box box4=box.createhorizontalbox(); box4.add(new jlabel(联系电话:,jlabel.center); box4.add(联系电话); box box5=box.createhorizontalbox(); box5.add(new jlabel(部门:,jlabel.center); box5.add(部门); box box6=box.createhorizontalbox(); box6.add(new jlabel(职务:,jlabel.center); box6.add(职务); box box7=box.createhorizontalbox(); box7.add(new jlabel(底薪:,jlabel.center); box7.add(底薪); box boxh=box.createverticalbox(); boxh.add(box1);boxh.add(box2);boxh.add(box3);boxh.add(box4);boxh.add(box5);boxh.add(box6);boxh.add(box7);boxh.add(box.createverticalglue(); jpanel picpanel=new jpanel();picpanel.setbackground(color.gray); picpanel.add(new jlabel(选择照片:,jlabel.center); picpanel.add(选择照片); jpanel putbutton=new jpanel(); putbutton.add(录入); putbutton.add(重置); jpanel messpanel=new jpanel();messpanel.add(boxh);messpanel.setbackground(color.white);putbutton.setbackground(color.gray);setlayout(new borderlayout(); jsplitpane splitv=new jsplitpane(jsplitpane.vertical_split,picpanel,pic); jsplitpane splith=new jsplitpane(jsplitpane.horizontal_split,messpanel,splitv);add(splith,borderlayout.center);add(putbutton,borderlayout.south);validate(); public void actionperformed(actionevent ee) if(ee.getsource()=录入) string number=; number=员工编号.gettext();if(number.length()0)try inone=new fileinputstream(systemfile);intwo=new objectinputstream(inone);基本信息=(hashmap)intwo.readobject();inone.close();intwo.close(); catch(exception eee) if(基本信息表.containskey(number) string warning=该员工基本信息已存在,请到修改页面修改!; joptionpane.showmessagedialog(this,warning,警告, joptionpane.warning_message); else string m=基本信息将被录入!; int ok=joptionpane.showconfirmdialog(this,m,确认, joptionpane.yes_no_option,joptionpane.information_message);if(ok=joptionpane.yes_option) string name=姓名.gettext(); string phone=联系电话.gettext(); string department=(string)部门.getselecteditem(); string position=职务.gettext(); string salary=底薪.gettext(); string sex=null; if(男.isselected() sex=男.gettext();else sex=女.gettext();员工=new employee();员工.setnumber(number);员工.setname(name);员工.setphone(phone);员工.setdepartment(department);员工.setposition(position);员工.setsalary(salary);员工.setsex(sex);员工.setimagepic(imagepic);try outone=new fileoutputstream(systemfile);outtwo=new objectoutputstream(outone);基本信息表.put(number,员工); outtwo.writeobject(基本信息表);outtwo.close();outone.close();clearmess(); catch(exception eee) else string warning=必须要输入员工编号!; joptionpane.showmessagedialog(this,warning,警告,joptionpane.warning_message); else if(ee.getsource()=选择照片) jfilechooser chooser=new jfilechooser(); filenameextensionfilter filter = new filenameextensionfilter( jpg & gif images, jpg, gif);chooser.setfilefilter(filter);int state=chooser.showopendialog(null); file choicefile=chooser.getselectedfile();if(choicefile!=null&state=jfilechooser.approve_option)选择照片.settext(choicefile.getname();imagepic=choicefile;pic.setimage(imagepic);pic.repaint(); else if(e.getsource()=重置)clearmess(); public void clearmess()员工编号.settext(null);姓名.settext(null);联系电话.settext(null);职务.settext(null);底薪.settext(null);选择照片.settext(选择);imagepic=null;pic.setimage(imagepic);pic.repaint(); modifysituation.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.util.*;import javax.swing.filechooser.*;public class modifysituation extends jpanel implements actionlistener employeepicture pic; hashmap基本信息表=null; jtextfield 员工编号,姓名,联系电话,职务,底薪; jcombobox 部门; jbutton 选择照片; jradiobutton 男,女; buttongroup group=null; jbutton 开始修改,录入修改,重置; fileinputstream inone=null; objectinputstream intwo=null; fileoutputstream outone=null; objectoutputstream outtwo=null; file systemfile,imagepic; jcombobox oldmess; employee stu=null; public modifysituation(file file)systemfile=file;pic=new employeepicture();员工编号=new jtextfield(6);姓名=new jtextfield(6);联系电话=new jtextfield(6);部门=new jcombobox();try filereader inone=new filereader(部门.txt); bufferedreader intwo= new bufferedreader(inone); string s=null;int i=0;while(s=intwo.readline()!=null)部门.additem(s);inone.close();intwo.close(); catch(ioexception exp)部门.additem(行政部);部门.additem(mpc);部门.additem(财务); 职务=new jtextfield(6);底薪=new jtextfield(6);选择照片=new jbutton(选择);group=new buttongroup();男=new jradiobutton(男,true);女=new jradiobutton(女,false); group.add(男); group.add(女);oldmess=new jcombobox();开始修改=new jbutton(开始修改);录入修改=new jbutton(录入修改);录入修改.setenabled(false);选择照片.setenabled(false);重置=new jbutton(重置);员工编号.addactionlistener(this);开始修改.addactionlistener(this);录入修改.addactionlistener(this);重置.addactionlistener(this);选择照片.addactionlistener(this); box box1=box.createhorizontalbox(); box1.add(new jlabel(输入要修改信息的编号:,jlabel.center); box1.add(员工编号); box1.add(开始修改); box box2=box.createhorizontalbox(); box2.add(new jlabel(新)姓名:,jlabel.center); box2.add(姓名); box box3=box.createhorizontalbox(); box3.add(new jlabel(新)性别:,jlabel.center); box3.add(男); box3.add(女); box box4=box.createhorizontalbox(); box4.add(new jlabel(新)职务:,jlabel.center); box4.add(职务); box box5=box.createhorizontalbox(); box5.add(new jlabel(新)部门:,jlabel.center); box5.add(部门); box box6=box.createhorizontalbox(); box6.add(new jlabel(新)职务:,jlabel.center); box6.add(职务

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论