Javaee企业人事管理系统方案
《Javaee企业人事管理系统方案》由会员分享,可在线阅读,更多相关《Javaee企业人事管理系统方案(23页珍藏版)》请在装配图网上搜索。
1、. . . . 20112012学年第二学期Java EE技术与应用课程大作业设计题目:企业人事管理系统专业:_计算机软件班级:09级 计算机一班学号: 090400421Java EE技术与应用评价标准项目容单项分值标准分值软件分析设计(1)题目明确、分析合理,有用例图530(2)功能结构分析准确,有结构图5(3)数据结构设计合理,有ER图,Sql脚本正确5(4)系统架构清晰,有相关说明5(5)开发环境和运行环境明确5(6)文档格式规5软件实现(7)功能较完整、能正确运行520(8)界面设计合理、易用、协调5(9)代码规(命名、注释、格式)5(10)程序有一定难度(至少包含四个以上数据表)5
2、总体效果(11)项目完成总体质量510(12)软件功能与技术水平5答辩(13)讲解清楚明了510(14)功能演示流畅5评语得分 企业人事管理系统系统分析在企业中,人事管理工作是非常重要的一项工作,它负责整个企业的日常人事安排,人员的人事管理等。高效的人事管理可以提高企业的市场竞争力,使企业具有更强的凝聚力和活力。人事部门的工作一般都是日常性的而且是比较繁杂的,大量重复性工作很容易导致员工工作没有新鲜感。使用人事管理系统可以让繁杂的工作电子化管理,提高人事部门员工的工作效率。总体设计1 功能模块设计企业人事管理系统站点首页员工信息员工管理用户管理用户登录用户注册2 数据库设计create dat
3、abase person;use person;create table news_category( cat_id int auto_increment primary key, cat_title varchar(50) not null);create table news_user( user_id int auto_increment primary key, user_name varchar(50) not null, user_pwd varchar(50) not null, user_right int default 1, user_pic blob);create ta
4、ble news_content( cont_id int auto_increment primary key, cat_id int not null references news_category(cat_id), cont_title varchar(200) not null, cont_content text not null, cont_pic varchar(200), cont_datetime timestamp);3 系统架构设计表示层业务逻辑层数据操作层数据库4 包和文件夹划分5 系统文件结构NetbeansJavaEEMy-SQL实体类设计Action Check
5、Action.java/* * To change this template, choose Tools | Templates * and open the template in the editor. */package person.action;/* * * author Administrator */import java.io.IOException;import java.util.List;import javax.servlet.RequestDispatcher;import javax.servlet.ServletException;import javax.se
6、rvlet.annotation.WebServlet;import javax.servlet. . Servlet;import javax.servlet. . ServletRequest;import javax.servlet. . ServletResponse;import person mon.MyFactory;import person mon.PageList;import person.iservice.ICheckService;import person.model.Check;public class CheckAction private ICheckServ
7、ice CheckService = MyFactory.createCheckService(); private final int PAGE_SIZE = 3; private Check Check; private Integer checkId; private PageList plist; private String message; private Integer pageNo; public String add() throws Exception if (CheckService.addCheck(Check) 0) message = 添加成功!返回; else m
8、essage = 添加失败!返回; return msg; public String edit() throws Exception if (CheckService.editCheck(Check) 0) message = 修改成功!返回; else message = 修改失败!返回; return msg; public String willedit() throws Exception Check=CheckService.findCheckById(checkId); return edit; public String manage() throws Exception if
9、(pageNo=null)pageNo=1; List list = CheckService.findChecks(PAGE_SIZE, pageNo); int count = CheckService.findCount(); plist = new PageList(list, count, PAGE_SIZE, pageNo, /person/CheckAction_manage.action); return manage; public String delet() throws Exception if (CheckService.deleteCheck(checkId) 0)
10、 message = 删除成功!返回; else message = 删除失败!返回; return msg; public Integer getCheckId() return checkId; public void setCheckId(Integer checkId) this.checkId = checkId; public Check getCheck() return Check; public void setCheck(Check Check) this.Check = Check; public String getMessage() return message; p
11、ublic void setMessage(String message) this.message = message; public Integer getPageNo() return pageNo; public void setPageNo(Integer pageNo) this.pageNo = pageNo; public PageList getPlist() return plist; public void setPlist(PageList plist) this.plist = plist; InfoAction.java/* * To change this tem
12、plate, choose Tools | Templates * and open the template in the editor. */package person.action;/* * * author Administrator */import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOExce
13、ption;import java.io.InputStream;import java.io.OutputStream;import java.util.Date;import java.util.List;import java.util.logging.Level;import java.util.logging.Logger;import person mon.MyFactory;import person mon.PageList;import person.iservice.IInfoService;import person.model.Info;import org.apach
14、e.struts2.ServletActionContext;/* * * author Administrator */public class InfoAction private IInfoService InfoService = MyFactory.createInfoService(); private final Integer PAGE_SIZE = 3; private File upfile; private String upfileFileName; private Info Info; private PageList plist; private Integer c
15、heckId; private String infoName; private Integer infoId; private Integer pageNo; private String message; public String manage() throws Exception if (pageNo = null) pageNo = 1; if (infoName = null) infoName = ; List list = InfoService.findInfos(checkId, infoName, PAGE_SIZE, pageNo); int count = InfoS
16、ervice.findCount(infoName); plist = new PageList(list, count, PAGE_SIZE, pageNo, /person/InfoAction!manage.action); return manage; public String browse() throws Exception if (pageNo = null) pageNo = 1; if (infoName = null) infoName = ; List list = InfoService.findInfos(checkId, infoName, PAGE_SIZE,
17、pageNo); int count = InfoService.findCount(infoName); plist = new PageList(list, count, PAGE_SIZE, pageNo, /person/InfoAction!browse.action); return browse; public String add() throws Exception System.out.println(upfile=null); String newFilename = new Date().getTime() + getExt(upfileFileName); Strin
18、g path = ServletActionContext.getServletContext().getRealPath(/upfiles); File file = new File(path + + newFilename); if(upfile!=null) copy(upfile, file); Info.setInfoDepart(newFilename); if (InfoService.addInfo(Info) 0) message = 添加成功!返回; else message = 添加失败!返回; return msg; private void copy(File sr
19、c, File dst) InputStream in = null; OutputStream out = null; try in = new BufferedInputStream(new FileInputStream(src); out = new BufferedOutputStream(new FileOutputStream(dst); byte buffer = new byte1024; int c = 0; while (c = in.read(buffer, 0, 1024) 0) out.write(buffer, 0, c); catch (Exception e)
20、 e.printStackTrace(); finally try in.close(); catch (IOException ex) try out.close(); catch (IOException ex) private String getExt(String filename) int pos = filename.lastIndexOf(.); return filename.substring(pos); public String willedit() throws Exception Info = InfoService.findInfoById(infoId); re
21、turn edit; public String show() throws Exception Info = InfoService.findInfoById(infoId); return show; public String edit() throws Exception if (InfoService.editInfo(Info) 0) message = 修改成功!返回; else message = 修改失败!返回; return msg; public String delete() throws Exception Info=InfoService.findInfoById(
22、infoId); String path = ServletActionContext.getServletContext().getRealPath(/upfiles); File file = new File(path + + Info.getInfoDepart(); if(file.exists() file.delete(); if (InfoService.deleteInfo(infoId) 0) message = 删除成功!返回; else message = 删除失败!返回; return msg; public Integer getCheckId() return c
23、heckId; public void setCheckId(Integer checkId) this.checkId = checkId; public Integer getInfoId() return infoId; public void setInfoId(Integer infoId) this.infoId = infoId; public String getContTitle() return infoName; public void setContTitle(String contTitle) this.infoName = infoName; public Info
24、 getInfo() return Info; public void setInfo(Info Info) this.Info = Info; public String getMessage() return message; public void setMessage(String message) this.message = message; public Integer getPageNo() return pageNo; public void setPageNo(Integer pageNo) this.pageNo = pageNo; public PageList get
25、Plist() return plist; public void setPlist(PageList plist) this.plist = plist; public File getUpfile() return upfile; public void setUpfile(File upfile) this.upfile = upfile; public String getUpfileFileName() return upfileFileName; public void setUpfileFileName(String upfileFileName) this.upfileFile
26、Name = upfileFileName; UserAction.java/* * To change this template, choose Tools | Templates * and open the template in the editor. */package person.action;/* * * author Administrator */import com.opensymphony.xwork2.ActionContext;import com.sun.xml.internal.messaging.saaj.util.ByteInputStream;impor
27、t java.io.ByteArrayOutputStream;import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.List;import java.util.Map;import java.util.logging.Level;import java.util.logging.Logger;import javax.servlet.ServletO
28、utputStream;import person mon.MyFactory;import person mon.PageList;import person.iservice.IUserService;import person.model.User;import org.apache.struts2.ServletActionContext;/* * * author Administrator */public class UserAction private IUserService userService = MyFactory.createUserService(); priva
29、te final Integer PAGE_SIZE = 3; private File upfile; private String upfileFileName; private User user; private PageList plist; private Integer userId; private Integer pageNo; private String message; public String manage() throws Exception if (pageNo = null) pageNo = 1; List list = userService.findUs
30、ers(PAGE_SIZE, pageNo); int count = userService.findCount(); plist = new PageList(list, count, PAGE_SIZE, pageNo, /person/UserAction_manage.action); return manage; public String login() user=userService.findUser(user.getUserName(), user.getUserPwd(); if(user!=null) Map map=ActionContext.getContext()
31、.getSession(); map.put(user, user); message=登录成功!主页; else message=登录成功!返回; return msg; public void showDepart() ServletOutputStream out = null; try ServletActionContext.getResponse().addHeader(pragma, no-cache); ServletActionContext.getResponse().addHeader(Cache-Control, no-cache); / 设置网页过期时间 Servle
32、tActionContext.getResponse().addDateHeader(Expries, 0); user = userService.findUserById(userId); byte b=user.getUserDepart(); out = ServletActionContext.getResponse().getOutputStream(); out.write(b); out.flush(); out.close(); catch (IOException ex) Logger.getLogger(UserAction.class.getName().log(Lev
33、el.SEVERE, null, ex); finally try out.close(); catch (IOException ex) Logger.getLogger(UserAction.class.getName().log(Level.SEVERE, null, ex); public String add() throws Exception if (upfile != null) InputStream in = new FileInputStream(upfile); ByteArrayOutputStream out = new ByteArrayOutputStream(
34、1024 * 1024 * 5); int c; byte b = new byte1024; while (c = in.read(b, 0, 1024) 0) out.write(b, 0, c); byte bu = out.toByteArray(); out.close(); in.close(); user.setUserDepart(bu); if (userService.addUser(user) 0) message = 注册成功!返回; else message = 注册失败!返回; return msg; public String willedit() throws
35、Exception user = userService.findUserById(userId); return edit; public String edit() throws Exception if (userService.editUser(user) 0) message = 修改成功!返回; else message = 修改失败!返回; return msg; public String delete() throws Exception if (userService.deleteUser(userId) 0) message = 删除成功!返回; else message
36、 = 删除失败!返回; return msg; public String getMessage() return message; public void setMessage(String message) this.message = message; public Integer getPageNo() return pageNo; public void setPageNo(Integer pageNo) this.pageNo = pageNo; public PageList getPlist() return plist; public void setPlist(PageLi
37、st plist) this.plist = plist; public User getUser() return user; public void setUser(User user) this.user = user; public Integer getUserId() return userId; public void setUserId(Integer userId) this.userId = userId; public File getUpfile() return upfile; public void setUpfile(File upfile) this.upfil
38、e = upfile; public String getUpfileFileName() return upfileFileName; public void setUpfileFileName(String upfileFileName) this.upfileFileName = upfileFileName; CommonCodeServlet.javapackage person mon;import com.sun.image.codec.jpeg.JPEGCodec;import com.sun.image.codec.jpeg.JPEGImageEncoder;import j
39、ava.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.image.BufferedImage;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.ServletOutputStream;import javax.servlet.annotation.WebServlet;import javax.servlet. . Servlet;import javax.servlet. .
40、 ServletRequest;import javax.servlet. . ServletResponse;import javax.servlet. . Session;WebServlet(name = CodeServlet, urlPatterns = /CodeServlet)public class CodeServlet extends Servlet private static final long serialVersionUID = 2835215498536942683L;Overrideprotected void doGet( ServletRequest re
41、quest, ServletResponse response) throws ServletException, IOException doPost(request, response);Overrideprotected void doPost( ServletRequest request, ServletResponse response) throws ServletException, IOException response.setContentType(image/jpeg);/ 设置发送给客户端的数据类型是图像/ 设置网页不缓存response.addHeader(prag
42、ma, no-cache);response.addHeader(Cache-Control, no-cache);/ 设置网页过期时间response.addDateHeader(Expries, 0);/ 在内存建立一个图像缓冲区,用于画图BufferedImage bim = new BufferedImage(54, 20,BufferedImage.TYPE_INT_RGB);Graphics g = bim.getGraphics();g.setColor(Color.green); / 设置为绿色g.fillRect(0, 0, 54, 25); / 画背景 Session se
43、ssion = request.getSession();String str = 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ;int k = (int) (Math.random() * 36);String s = str.substring(k, k + 1);k = (int) (Math.random() * 36);s = s + str.substring(k, k + 1);k = (int) (Math.random() * 36);s = s + str.substring(k, k + 1);k = (int) (Math.random()
44、* 36);s = s + str.substring(k, k + 1);session.setAttribute(code, s);/ 产生随机数g.setColor(Color.BLACK); / 设置红色g.setFont(new Font(宋体, Font.PLAIN, 16);/ 设置字体g.drawString(s.charAt(0) + , 3, 15); / 在图像上画出验证吗g.drawString(s.charAt(1) + , 15, 15); / 在图像上画出验证吗g.drawString(s.charAt(2) + , 27, 15); / 在图像上画出验证吗g.d
45、rawString(s.charAt(3) + , 39, 15); / 在图像上画出验证吗ServletOutputStream out = response.getOutputStream();/ 获取输出流/ 建立一个JPG图像生成对象JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);encoder.encode(bim);out.flush();out.close();Config.java/* * To change this template, choose Tools | Templates * and ope
46、n the template in the editor. */package person mon;import java.util.Properties;public class Config public static Properties prop = new Properties();MyException.java/* * To change this template, choose Tools | Templates * and open the template in the editor. */package person mon;public class MyException extends RuntimeException public MyException(String msg) super(msg); MyFactory.java/* * To change this template, choose Tools | Templates * and open the template in the editor. */package person mon;import person.idao.ICheckDao;import person.idao.IInfoDao;import person.idao.IUserDao;
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。