李丹M人事管理系统_第1页
李丹M人事管理系统_第2页
李丹M人事管理系统_第3页
李丹M人事管理系统_第4页
李丹M人事管理系统_第5页
已阅读5页,还剩32页未读 继续免费阅读

下载本文档

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

文档简介

M人事管理系统JAVA程序设计课程设计报告课题:mini人事管理系统姓名:学号:201214同组姓名:专业班级:网工指导教师:设计时间:2014年6月17日目录一系统描述...............................................1(一)前言...............................................1(二)开发系统的功能介绍.................................1二分析与设计...............................................2(一)功能模块划分.......................................2(二)数据库结构描述.....................................2(三)各个模块实现方法描述.............................3(四)测试数据及期望结果.................................3三源代码...................................................5(一)主页面设计........................................5(二)记录添加界面的开发设计.............................11(三)上班登记子系统开发设计.............................13(四)信息统计页面的设计开发.............................15四系统测试................................................18五总结..................................................21(一)实验心得..........................................21(二)参考文献..........................................22一.系统描述(一)前言随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人们深刻认识,它已进入人类社会的各个领域并发挥着越来越重要的作用。作为计算机应用的一部分,使用计算机对人事信息进行管理,具有着手工管理所无法比拟的优点.例如:本低等。这些优点能够极大地提高人事理的效率,也是企业的科学化、正规化管理,高素质的管理人员,而且也需要信息化工具进行辅助软件系统来于小型的企事业单位,不啻于“杀鸡用牛刀,因此小型的的软件对于这种单位自然有十分重要作用。(二)开发系统的功能介绍1.上班登记子系统上班登记子系统主要对所有员工的上班信息进行登记,包括员工的工号、员班时间信息的记录2.下班登记子系统班时间信息的记录。3.请假登记子系统请假登记子系统主要对所有员工的请假信息进行登记,包括员工的工号、员假时间信息的记录。4.信息统计子系统5.记录添加子系统时间和备注。二.分析与设计总结到一块。大家一起研究错误出在哪里,该怎么改正这些错误。(一)功能模块划分本系统分为如下的几大模块:Mini人事管理系统上班登记请假登记退出系统(二)数据库结构描述在这个MINImysqlmysql每个子系统里面读取的数据部分不同。设计的表如下:如表一列名数据类型可否允空长度工号数值型否50姓名字符型否50上班时间日期型否30下班时间日期型否30请假时间日期型是30备注字符型是50(三)各个模块实现方法描述1)上班登记模块描述(负责人:李丹)上班登记子系统主要包括一个上班信息统计界面和一个上班信息添加界面。不符合要求,可以将此条记录删除。上班信息添加界面主要是员工工号、员工姓名、相应时间和相关备注信息。可以根据信息添加界面上的系统时间指示来填入相应的时间。其流程图为:(四)测试数据及期望结果登录界面,各种情况。时也许还需要返回初始阶段。期望结果:比方说,员工A3:00来上班,点击上班登记,手动添加上班记的全部记录。三.源代码(一)主页面的设计开发packagemanpowersystem;importjavax.swing.*;importjava.awt.event.*;importjava.awt.*;importcom.borland.jbcl.layout.*;importjavax.swing.event.*;/***<p>Title:</p>*<p>Description:</p>*<p>Copyright:Copyright(c)2003</p>*<p>Company:</p>*@authornotattributable*@version1.0*/publicclassMainFrameextendsJFrame{privateImageIconfmImage;//主框架面板代码文件声明的属性和变量XYLayoutxYLayout1=newXYLayout();JButtonjTitleButton=newJButton();JButtonjOnWorkButton=newJButton();JButtonjOffWorkButton=newJButton();JButtonjLeaveWorkButton=newJButton();JButtonjStaticButton=newJButton();JButtonjExitButton=newJButton();publicMainFrame(){try{jbInit();addWindowListener(newWindowAdapter(){//窗口事件监听publicvoidwindowClosing(WindowEvente){dispose();//销毁窗口}});}catch(Exceptione){e.printStackTrace();}}publicstaticvoidmain(String[]args){MainFramemainFrame=newMainFrame();mainFrame.validate();mainFrame.setLocation(200,150);mainFrame.setSize(600,480);mainFrame.setVisible(true);mainFrame.pack();}privatevoidjbInit()throwsException{fmImage=newImageIcon(manpowersystem.MainFrame.class.getResource("Fengmian.png"));jTitleButton.setBackground(newColor(210,138,177));jTitleButton.setIcon(fmImage);jTitleButton.setFocusable(false);//此按钮的聚焦作用失效xYLayout1.setWidth(540);xYLayout1.setHeight(407);this.getContentPane().setBackground(newColor(210,138,177));this.setLocale(java.util.Locale.getDefault());this.setResizable(true);this.setTitle("Mini人事管理系统");this.addWindowListener(newMainFrame_this_windowAdapter(this));this.getContentPane().setLayout(xYLayout1);jOnWorkButton.setBackground(newColor(212,158,217));jOnWorkButton.setFont(newjava.awt.Font("DialogInput",1,16));jOnWorkButton.setText("上班登记");jOnWorkButton.addActionListener(newMainFrame_jOnWorkButton_actionAdapter(this));jOnWorkButton.addHierarchyBoundsListener(newMainFrame_jOnWorkButton_hierarchyBoundsAdapter(this));OffWorkButton.setBackground(newColor(212,158,217));jOffWorkButton.setFont(newjava.awt.Font("DialogInput",1,16));jOffWorkButton.setText("下班登记");jOffWorkButton.addActionListener(newMainFrame_jOffWorkButton_actionAdapter(this));jOffWorkButton.addAncestorListener(newMainFrame_jOffWorkButton_ancestorAdapter(this));jLeaveWorkButton.setBackground(newColor(212,158,217));jLeaveWorkButton.setFont(newjava.awt.Font("DialogInput",1,16));jLeaveWorkButton.setText("请假登记");jLeaveWorkButton.addActionListener(newMainFrame_jLeaveWorkButton_actionAdapter(this));jLeaveWorkButton.addAncestorListener(newMainFrame_jLeaveWorkButton_ancestorAdapter(this));jStaticButton.setBackground(newColor(212,158,217));jStaticButton.setFont(newjava.awt.Font("DialogInput",1,16));jStaticButton.setText("统计情况");jStaticButton.addActionListener(newMainFrame_jStaticButton_actionAdapter(this));jStaticButton.addAncestorListener(newMainFrame_jStaticButton_ancestorAdapter(this));jExitButton.setBackground(newColor(212,158,217));jExitButton.setFont(newjava.awt.Font("DialogInput",1,16));jExitButton.setText("退出系统");jExitButton.addActionListener(newMainFrame_jExitButton_actionAdapter(this));jExitButton.addAncestorListener(newMainFrame_jExitButton_ancestorAdapter(this));this.getContentPane().add(jTitleButton,newXYConstraints(0,0,358,409));this.getContentPane().add(jOnWorkButton,newXYConstraints(393,35,115,45));this.getContentPane().add(jOffWorkButton,newXYConstraints(393,109,115,45));this.getContentPane().add(jLeaveWorkButton,newXYConstraints(393,184,115,45));this.getContentPane().add(jStaticButton,newXYConstraints(393,258,115,45));this.getContentPane().add(jExitButton,newXYConstraints(393,332,115,45));this.setResizable(false);}voidthis_windowClosed(WindowEvente){System.exit(0);}voidjOnWorkButton_ancestorMoved(HierarchyEvente){}voidjOffWorkButton_ancestorMoved(AncestorEvente){}voidjLeaveWorkButton_ancestorMoved(AncestorEvente){}voidjStaticButton_ancestorMoved(AncestorEvente){}voidjExitButton_ancestorMoved(AncestorEvente){}voidjExitButton_actionPerformed(ActionEvente){System.exit(0);}//退出系统按钮的事件处理voidjOnWorkButton_actionPerformed(ActionEvente){OnWorkPanelonWorkPanel=newOnWorkPanel();onWorkPanel.setVisible(true);}//上班登记按钮的事件处理voidjOffWorkButton_actionPerformed(ActionEvente){OffWorkPaneloffWorkPanel=newOffWorkPanel();offWorkPanel.setVisible(true);}//下班登记按钮的事件处理voidjLeaveWorkButton_actionPerformed(ActionEvente){LeaveWorkPanelleaveWorkPanel=newLeaveWorkPanel();leaveWorkPanel.setVisible(true);}//请假登记按钮的事件处理voidjStaticButton_actionPerformed(ActionEvente){StaticPanelstaticPanel=newStaticPanel();staticPanel.setVisible(true);}//统计情况按钮的事件处理}ClassMainFrame_this_windowAdapterextendsjava.awt.event.WindowAdapter{MainFrameadaptee;MainFrame_this_windowAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidwindowClosed(WindowEvente){adaptee.this_windowClosed(e);}}classMainFrame_jOnWorkButton_hierarchyBoundsAdapterextendsjava.awt.event.HierarchyBoundsAdapter{MainFrameadaptee;MainFrame_jOnWorkButton_hierarchyBoundsAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidancestorMoved(HierarchyEvente){adaptee.jOnWorkButton_ancestorMoved(e);}}classMainFrame_jOffWorkButton_ancestorAdapterimplementsjavax.swing.event.AncestorListener{MainFrameadaptee;MainFrame_jOffWorkButton_ancestorAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidancestorAdded(AncestorEvente){}publicvoidancestorRemoved(AncestorEvente){}publicvoidancestorMoved(AncestorEvente){adaptee.jOffWorkButton_ancestorMoved(e);}}classMainFrame_jLeaveWorkButton_ancestorAdapterimplementsjavax.swing.event.AncestorListener{MainFrameadaptee;MainFrame_jLeaveWorkButton_ancestorAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidancestorAdded(AncestorEvente){}publicvoidancestorRemoved(AncestorEvente){}publicvoidancestorMoved(AncestorEvente){adaptee.jLeaveWorkButton_ancestorMoved(e);}}classMainFrame_jStaticButton_ancestorAdapterimplementsjavax.swing.event.AncestorListener{MainFrameadaptee;MainFrame_jStaticButton_ancestorAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidancestorAdded(AncestorEvente){}publicvoidancestorRemoved(AncestorEvente){}publicvoidancestorMoved(AncestorEvente){adaptee.jStaticButton_ancestorMoved(e);}}classMainFrame_jExitButton_ancestorAdapterimplementsjavax.swing.event.AncestorListener{MainFrameadaptee;MainFrame_jExitButton_ancestorAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidancestorAdded(AncestorEvente){}publicvoidancestorRemoved(AncestorEvente){}publicvoidancestorMoved(AncestorEvente){adaptee.jExitButton_ancestorMoved(e);}}classMainFrame_jExitButton_actionAdapterimplementsjava.awt.event.ActionListener{MainFrameadaptee;MainFrame_jExitButton_actionAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidactionPerformed(ActionEvente){adaptee.jExitButton_actionPerformed(e);}}classMainFrame_jOnWorkButton_actionAdapterimplementsjava.awt.event.ActionListener{MainFrameadaptee;MainFrame_jOnWorkButton_actionAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidactionPerformed(ActionEvente){adaptee.jOnWorkButton_actionPerformed(e);}}classMainFrame_jOffWorkButton_actionAdapterimplementsjava.awt.event.ActionListener{MainFrameadaptee;MainFrame_jOffWorkButton_actionAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidactionPerformed(ActionEvente){adaptee.jOffWorkButton_actionPerformed(e);}}classMainFrame_jLeaveWorkButton_actionAdapterimplementsjava.awt.event.ActionListener{MainFrameadaptee;MainFrame_jLeaveWorkButton_actionAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidactionPerformed(ActionEvente){adaptee.jLeaveWorkButton_actionPerformed(e);}}classMainFrame_jStaticButton_actionAdapterimplementsjava.awt.event.ActionListener{MainFrameadaptee;MainFrame_jStaticButton_actionAdapter(MainFrameadaptee){this.adaptee=adaptee;}publicvoidactionPerformed(ActionEvente){adaptee.jStaticButton_actionPerformed(e);}}(二)记录添加界面的开发设计packagemanpowersystem;/***<p>Title:</p>*<p>Description:</p>*<p>Copyright:Copyright(c)2003</p>*<p>Company:</p>*@authornotattributable*@version1.0*/importjava.io.*;importjava.util.*;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.event.*;importjavax.swing.border.*;importjavax.swing.table.*;publicclassRecordItem{privateStringstrEmployeeID;privateStringstrEmployeeName;privateStringstrOnWorkTime;privateStringstrOffWorkTime;privateStringstrLeaveWorkTime;privateStringstrDescribe;publicRecordItem(){strEmployeeID=newString("");strEmployeeName=newString("");strOnWorkTime=newString("");strOffWorkTime=newString("");strLeaveWorkTime=newString("");strDescribe=newString("");}publicvoidSetOnworkItem(StringstrEmployeeID,StringstrEmployeeName,StringstrOnWorkTime,StringstrDescribe){this.strEmployeeID=strEmployeeID;this.strEmployeeName=strEmployeeName;this.strOnWorkTime=strOnWorkTime;this.strDescribe=strDescribe;}publicvoidSetOffworkItem(StringstrEmployeeID,StringstrEmployeeName,StringstrOffWorkTime,StringstrDescribe){this.strEmployeeID=strEmployeeID;this.strEmployeeName=strEmployeeName;this.strOffWorkTime=strOffWorkTime;this.strDescribe=strDescribe;}publicvoidSetLeaveworkItem(StringstrEmployeeID,StringstrEmployeeName,StringstrLeaveWorkTime,StringstrDescribe){this.strEmployeeID=strEmployeeID;this.strEmployeeName=strEmployeeName;this.strLeaveWorkTime=strLeaveWorkTime;this.strDescribe=strDescribe;}publicStringGetEmployeeID(){returnstrEmployeeID;}publicStringGetEmployeeName(){returnstrEmployeeName;}publicStringGetOnWorkTime(){returnstrOnWorkTime;}publicStringGetOffWorkTime(){returnstrOffWorkTime;}publicStringGetLeaveWorkTime(){returnstrLeaveWorkTime;}publicStringGetDescribe(){returnstrDescribe;}publicvoidSetEmployeeID(StringstrEmployeeID){this.strEmployeeID=strEmployeeID;}publicvoidSetEmployeeName(StringstrEmployeeName){this.strEmployeeName=strEmployeeName;}publicvoidSetOnWorkTime(StringstrOnWorkTime){this.strOnWorkTime=strOnWorkTime;}publicvoidSetOffWorkTime(StringstrOffWorkTime){this.strOffWorkTime=strOffWorkTime;}publicvoidSetLeaveWorkTime(StringstrLeaveWorkTime){this.strLeaveWorkTime=strLeaveWorkTime;}publicvoidSetDescribe(StringstrDescribe){this.strDescribe=strDescribe;}}(三)上班登记子系统开发设计packagemanpowersystem;/***<p>Title:</p>*<p>Description:</p>*<p>Copyright:Copyright(c)2003</p>*<p>Company:</p>*@authornotattributable*@version1.0*/importjava.io.*;importjava.util.*;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.event.*;importjavax.swing.border.*;importjavax.swing.table.*;importjava.util.*;importcom.borland.jbcl.layout.*;publicclassOnWorkPanelextendsTablePanel{String[]arrField={"工号","姓名","上班时间","备注"};publicOnWorkPanel(){tableModel=newDefaultTableModel(arrData,arrField);jRecordTable=newJTable(tableModel);jTableScrollPane.getViewport().add(jRecordTable,null);UpdateRecord();//更新表格this.setTitle("上班登记页面");}publicvoidAddRecord(){OnWorkRecordPanerecordPane=newOnWorkRecordPane();recordPane.setSize(630,300);recordPane.setLocation(230,100);recordPane.setVisible(true);recordPane.setResizable(false);recordPane.validate();UpdateRecord();//更新表格}publicvoidDelRecord(){jTableScrollPane.getViewport().add(jRecordTable,null);intRow=jRecordTable.getSelectedRow();if(intRow==-1)return;try{database.DeleteData(tableModel.getValueAt(intRow,0).toStri());}catch(Exceptione){e.printStackTrace();}UpdateRecord();//更新表格}publicvoidUpdateRecord(){Object[][]arrTmp={};//设定表格的字段tableModel=newDefaultTableModel(arrTmp,arrField);jRecordTable=newJTable(tableModel);jTableScrollPane.getViewport().add(jRecordTable,null);try{RecordItem[]result=newRecordItem[100];for(intj=0;j<100;j++)result[j]=newRecordItem();result=database.AccessData();for(inti=0;i<result.length;i++){Objectnewdata[]={result[i].GetEmployeeID(),result[i].GetEmployeeName(),result[i].GetOnWorkTime(),result[i].GetDescribe()};StringstrTmp=result[i].GetOnWorkTime();if(strTmp.trim().length()==0)continue;tableModel.addRow(newdata);}}catch(Exceptione){e.printStackTrace();}}}publicclassOnWorkRecordPaneextendsRecordPane{publicOnWorkRecordPane(){}publicvoidRestoreRecord(){StringstrTmp=jEmployeeIDTextField.getText();if(strTmp.trim().length()==0){this.dispose();return;}item.SetOnworkItem(jEmployeeIDTextField.getText(),jEmployeeNameTextField.getText(),jDateTimeTextField.getText(),jReasonTextField.getText());try{database.StoreData(item);}catch(Exceptione){e.printStackTrace();}this.dispose();}}(四)信息统计页面的设计开发packagemanpowersystem;importjava.util.*;importjava.awt.*;importjavax.swing.*;publicclassClockextendsJPanelimplementsRunnable{booleankeepRunning=true;intlastxs=0,lastys=0,lastxm=0,lastym=0,lastxh=0,lastyh=0;Datedummy=newDate();Stringlastdate=dummy.toLocaleString();StringmyName;publicClock(StringinName){myName=newString(inName);}publicvoidplotpoints(intx0,inty0,intx,inty,Graphicsg){g.drawLine(x0+x,y0+y,x0+x,y0+y);g.drawLine(x0+y,y0+x,x0+y,y0+x);g.drawLine(x0+y,y0-x,x0+y,y0-x);g.drawLine(x0+x,y0-y,x0+x,y0-y);g.drawLine(x0-x,y0-y,x0-x,y0-y);g.drawLine(x0-y,y0-x,x0-y,y0-x);g.drawLine(x0-y,y0+x,x0-y,y0+x);g.drawLine(x0-x,y0+y,x0-x,y0+y);}publicvoidcircle(intx0,inty0,intr,Graphicsg){intx,y;floatd;x=0;y=r;d=5/4-r;plotpoints(x0,y0,x,y,g);while(y>x){if(d<0){d=d+2*x+3;x++;}else{d=d+2*(x-y)+5;x++;y--;}plotpoints(x0,y0,x,y,g);}}publicvoidpaintComponent(Graphicsg){super.paintComponent(g);intxh,yh,xm,ym,xs,ys,s,m,h,xcenter,ycenter;Stringtoday;Datedat=newDate();s=dat.getSeconds();m=dat.getMinutes();h=dat.getHours();today=dat.toLocaleString();xcenter=getWidth()/2;ycenter=getHeight()/2-10;xs=(int)(Math.cos(s*3.14f/30-3.14f/2)*35+xcenter);ys=(int)(Math.sin(s*3.14f/30-3.14f/2)*35+ycenter);xm=(int)(Math.cos(m*3.14f/30-3.14f/2)

温馨提示

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

评论

0/150

提交评论