学士学位论文—-基于android系统的人事管理系统设计与实现.doc
目录第一章 绪论41.1 项目的来源及背景41.2 项目的功能4第二章 概要设计52.1开发工具52.2 Eclipse的开发环境52.3 运行环境52.4 项目的文档结构52.5 总体设计6第三章 人事管理系统的详细实现73.1系统的登陆界面功能模块73.1.1登陆界面的界面xml源文件73.1.2登陆界面的Java源文件93.2 构成主页面设计的功能模块113.2.1主界面的界面xml源文件113.2.2主界面的界面java源文件123.3 人员管理界面设计的功能模块133.3.1人员管理界面的界面xml源文件133.3.2人员管理界面的界面java源文件173.4部门管理功能模块233.4.1部门管理界面的界面xml源文件233.4.2部门管理界面的界面java源文件263.5 综合管理设计的功能模块303.5.1综合管理界面的界面xml源文件303.5.1综合管理界面的界面java源文件313.6工资管理设计的功能模块333.6.1 工资管理的界面xml源文件333.6.2工资管理界面的java源文件363.7管理员工资信息模块413.7.1管理员工资信息界面java源文件423.8数据库的实现利用了以下代码进行实现:43第四章 人事管理系统的系统说明与测试444.1人事管理系统的系统功能说明444.2 系统的运行流程图444.3 系统的说明454.4 使用说明49总 结50参考文献51基于Android的人事管理系统设计与实现第一章 绪论1.1 项目的来源及背景智能手机有Symbian、Windows Phone、Android、IOS、BlackBerry 10这些系统。Android系统鹤立鸡群占据着巨大的市场份额,随着人们接触的手机时间越来越长,针对Android系统的程序层出不穷。每个手机都有APK程序,是人们简单方便的使用方式,而因为Android的巨大市场份额,Android平台下的手机程序更是受到青睐。手机程序不仅操作方便,还能更快的使用,让用户在休闲的同时也能进行查询和工作。 与电脑的体积相比,手机的小巧便捷,方便的特性成为我们日常生活中必备通讯工具。拥有巨大市场空间的手机平台程序会着智能手机的普及和应用必然会迎来新一轮的热潮。在新一轮的热潮中,Android手机客户量大,所以手机程序的发展空间很可观。1.2 项目的功能Android平台下的人事管理系统方便简洁,可以对员工进行增、删、改;部门管理的增、删、改、查,工资情况和员工信息的管理查询。本文围绕着人事管理展开Java和Android的相关技术介绍,并把整个Android平台下人事管理系统的设计展示出来。 把整个人事管理系统设计分为登录模块、主控制模块、人员管理模块、工资管理模块、部门管理模块和综合管理模块。各个模块分工不同,但有有相似之处,把整个系统完善起来。设计的重点是各个模块的增、删、查、改功能,进而实现录入、修改、查询和删除的功能。第二章 概要设计2.1开发工具 现在常用的Java项目开发环境有:JBuilder、VisualAge for Java、Forte for Java, Visual Cafe、Eclipse、IDE、JCreator +J2SDK、JDK+记事本、J2SDK等等。2.2 Eclipse的开发环境 现今Eclipse应用广泛、功能强大,而且还可已按自己的需要下载各种插件来扩展它的功能,所以本设计选用的工具是Eclipse。 Eclipse 是一个开放源代码的、基于Java的可扩展开发平台。Eclipse是利用各种插件来建立开放环境从而提供框架和服务的。Eclipse 附带了一个标准的插件集,包括Java开发工具JDK。被应用最多的Java SDK就是JDK了。Java的运行环境、工具、基础类库都需要以JDK为基础2.3 运行环境Android 4.3及以上版本。2.4 项目的文档结构WindowsXP、Eclipse、Android模拟机4.3等。系统结构图 如图2.1所示: 图2.1:系统的文档结构图2.5 总体设计该设计是Android平台下的人事管理系统。包括职工信息的管理、个人工资信息的管理、部门管理和一个综合的查询功能,所有的信息都是储存在手机上的SQLite中,如果想让其可以联网真正的使用可以把数据信息转移到bmob平台上,更改以后应该可以适应简单的多用户管理。本项目管理员默认用户名是admin,密码是123456。项目默认编码GBK编译版本4.4.2本系统通过登陆界面登陆进入程序主界面。系统的测试运行图2.2登陆模块录、修、删、查部门管理添、查、修、删系统主控制模块综合管理添、改、删安全退出人员管理管理员工资信息工资管理图2.2测试运行图 该系统分为以下几个模块功能:登录模块、主控制模块、人员管理 、管理员工资信息模块、工资管理模块、综合管理模块、部门管理模块和安全退出模块。其中模块用有增删查改的功能如上测试运行图2.2所示。第三章 人事管理系统的详细实现3.1系统的登陆界面功能模块图3.1 登陆界面运行效果图3.1.1登陆界面的界面xml源文件 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="+id/textView5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> <TextView android:id="+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 欢迎进入人事管理系统 " android:textSize="23dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" > <TextView android:id="+id/Information" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="用户名:" /> <EditText android:id="+id/userName" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:hint="请输入用户名" android:inputType="textPersonName" /> </LinearLayout></LinearLayout><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:id="+id/hh" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="密 码:" /> <EditText android:id="+id/password" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:hint="请输入密码" android:inputType="textPassword" > <requestFocus /></EditText></LinearLayout> </LinearLayout><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="+id/textView8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> </LinearLayout><LinearLayout android:layout_width="306dp" android:layout_height="wrap_content" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:id="+id/textView6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> <Button android:id="+id/login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 登录 " /> <TextView android:id="+id/textView7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> <Button android:id="+id/reset2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 重置 " /> </LinearLayout></LinearLayout></LinearLayout> 3.1.2登陆界面的Java源文件 public void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.logininterface); getWindow().setBackgroundDrawableResource(R.drawable.activitybg); /引入组件 userName = (EditText)findViewById(R.id.userName); password = (EditText)findViewById(R.id.password); login=(Button)findViewById(R.id.login); reset=(Button)findViewById(R.id.reset2); title=(TextView)findViewById(R.id.textView3); title.setTextColor(Color.BLUE); final PersonDAO personDAO = new PersonDAO(this); login.setOnClickListener(new Button.OnClickListener() Intent intent=null; Overridepublic void onClick(View arg0) Person person=personDAO.findName(userName.getText().toString();if(userName.getText().toString().equals("admin")&&password.getText().toString().equals("123456")USER=userName.getText().toString();person = personDAO.findName("admin"); if(person=null)person = new Person("1130070131", "admin","男",22,"admin","学生","人事部","管理员");personDAO.add(person);intent=new Intent(LoginActivity.this, MainActivity.class);tryToast.makeText(LoginActivity.this, "正在登录,请稍等.", Toast.LENGTH_LONG).show();Thread.sleep(3000); catch (InterruptedException e) e.printStackTrace();Toast.makeText(LoginActivity.this, "登录成功!_", Toast.LENGTH_LONG).show();startActivity(intent); else if(person!=null)if(password.getText().toString().equals(person.getPassword()&& person.getPower().equals("管理员")intent=new Intent(LoginActivity.this, MainActivity.class);USER=userName.getText().toString();tryToast.makeText(LoginActivity.this, "正在登录,请稍等.", Toast.LENGTH_LONG).show();Thread.sleep(3000); catch (InterruptedException e) e.printStackTrace();Toast.makeText(LoginActivity.this, "登录成功!_", Toast.LENGTH_LONG).show();startActivity(intent);else if(password.getText().toString().equals(person.getPassword()&& person.getPower().equals("普通员工")intent=new Intent(LoginActivity.this, CommonActivity.class);USER=userName.getText().toString();tryToast.makeText(LoginActivity.this, "正在登录,请稍等.", Toast.LENGTH_LONG).show();Thread.sleep(3000); catch (InterruptedException e) e.printStackTrace();Toast.makeText(LoginActivity.this, "登录成功!_", Toast.LENGTH_LONG).show(); startActivity(intent);LoginActivity.this.finish(); elseToast.makeText(LoginActivity.this, "用户名或密码不正确!", Toast.LENGTH_LONG).show(); elseToast.makeText(LoginActivity.this, "用户名或密码不正确!", Toast.LENGTH_LONG).show(); );reset.setOnClickListener(new Button.OnClickListener()public void onClick(View arg0) userName.setText("");password.setText(""););3.2 构成主页面设计的功能模块 3.2.1主界面的界面xml源文件 <LinearLayout android:id="+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:orientation="vertical" > <Button android:id="+id/staffmanagement" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="27dp" android:text=" 人员管理 " /> <Button android:id="+id/managementInfo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 管理员工资信息 " /> <Button android:id="+id/salarymanagement" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 工资管理 " /> <Button android:id="+id/departmentmanegement" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 部门管理 " /> <Button android:id="+id/update1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 综合管理 " /> <Button android:id="+id/close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 安全退出 " /> <TextView android:id="+id/Information" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /></LinearLayout>3.2.2主界面的界面java源文件 public void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getWindow().setBackgroundDrawableResource(R.drawable.activitybg);/* 引入组件 staffmanagement=(Button)findViewById(R.id.staffmanagement); salarymanagement=(Button)findViewById(R.id.salarymanagement); departmentmanegement=(Button)findViewById(R.id.departmentmanegement) integratedManagement=(Button)findViewById(R.id.update1); managementInfo=(Button)findViewById(R.id.managementInfo); close=(Button)findViewById(R.id.close); Information=(TextView)findViewById(R.id.Information); PersonDAO personDAO = new PersonDAO(this); Person person = personDAO.findName(LoginActivity.USER); System.out.println(person); if(person!=null)Information.setText( "n姓名:"+person.getName()+"n性别:" +person.getSex() +"n年龄:"+person.getAge() +"n密码:"+person.getPassword()+"n职务:"+person.getJob()+"n部门:"+person.getDepartment(); /人员管理 staffmanagement.setOnClickListener(new Button.OnClickListener()Intent intent=null;Overridepublic void onClick(View arg0) intent=new Intent(MainActivity.this, PersonActivity.class);startActivity(intent); );/工资管理salarymanagement.setOnClickListener(new Button.OnClickListener()Intent intent=null;Overridepublic void onClick(View arg0) intent=new Intent();intent.setClass(MainActivity.this, SalaryManagement.class);startActivity(intent););/部门管理departmentmanegement.setOnClickListener(new Button.OnClickListener()Intent intent=null;Overridepublic void onClick(View arg0) intent=new Intent(MainActivity.this, DepartmentActivity.class);startActivity(intent););/综合管理integratedManagement.setOnClickListener(new Button.OnClickListener()Intent intent=null;Overridepublic void onClick(View arg0) intent=new Intent(MainActivity.this, IntegratedManagement.class);startActivity(intent););/管理员工资信息managementInfo.setOnClickListener(newButton.OnClickListener()Intent intent=null;Overridepublic void onClick(View arg0) intent=new Intent(MainActivity.this, ShowSalaryInfo.class);startActivity(intent););/安全退出close.setOnClickListener(new Button.OnClickListener()Overridepublic void onClick(View arg0) System.exit(0););3.3 人员管理界面设计的功能模块图 3.3 人员管理界面效果图3.3.1人员管理界面的界面xml源文件<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="21dp" android:orientation="horizontal" > <TextView android:id="+id/tvpassword" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="员工编号:" /> <EditText android:id="+id/ednumber" android:layout_width="70dip" android:layout_height="wrap_content" android:layout_weight="1.56" /> </LinearLayout><LinearLayout android:id="+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:layout_width="wrap_content"