软件实习报告

计算机学院

软件实习报告

时间:2014.10.05           

 

第二篇:软件生产实习报告终稿

软件生产实习报告

学 号: 专 业:班级:08计算机1班

姓 名:

指导老师:文一凭

可行性研究和计划

1. 可行性研究目的

可行性研究的目的是为了对问题进行研究,以最小的代价在最短的时间内确定问题是否可解

经过对此项目进行详细调查研究,初拟系统实现报告,对软件开发中将要面临的问题及其解决方案进行初步设计及合理安排。明确开发风险及其所带来的经济效益。本报告经审核后,交软件经理审查。

技术可行性分析

3.1系统简要描述

该系统分为系统管理员、经理、职员三种省份登录。管理员可以实现对员工信息的录入、查询、保存、修改、删除、本用户密码修改。经理可以实现对员工信息的录入、查询、本用户密码修改。职员可以实现对自己用户密码的修改和自己信息的查看。通过上述不同身份授予不同的权限,完成公司员工信息的管理。通过采用java语言和oracle数据库可以实现该系统所需功能,所以在技术上该系统是可行的。

需要分析

1. 系统目标

本系统预计将实现如下的功能:登录功能、注册功能、密码修改功能、录入记录功能、修改记录功能、删除记录功能、查询记录功能、以及清空记录功能等等。

2. 系统功能需求

本系统的用户需注册后才能进行登录,登录后用户可以对员工信息、员工工工资的查看、添加、修改、清空与删除等操作。

2.1功能划分

本系统共分为注册模块、登录模块、员工工资处理、员工信息处理、关于系统模块、主界面模块。

概要设计

1、数据库的概念设计

员工信息管理系统,该系统涉及的实体集有:

用户实体集: 具有属性密码、用户名、身份。

员工信息实体集:具有属性员工编号、员工姓名、性别、入职时间、所在部门、职位、工资、家庭住址和联系电话。

一个员工可管理多个用户,一个员工信息可以被多个用户查看。所以员工和员工信息的关系是M:N。

2 将概念模型转换为关系模型

2.1将E-R模型转换为关系模型

(1)用户实体集可以转换为关系:

userpeople (username, userpassword,usertype)

username表示用户名,userpassword表示用户密码,usertype表示用户身份。

(2)员工信息实体集可以转换为关系:

Employee(employee_no,employee_name,employee_sex,department_name,job_name,hiredate,salary,telephone,address)

employee_no表示员工编号,employee_name表示员工姓名,employee_sex表示员工性别,department_name表示员工归属部门,,job_name表示员工职位,salary表示员工工资,hiredate表示员工雇用日期,telephone表示员工联系电话,address表示员工家庭住址。

2.2数据库结构设计

把关系模型转换为表结构:

--雇员表:

if employee exsit;

drop table employee;

create table employeeyy(

employee_no varchar(6) not null,--雇员编号

employee_name varchar(20) not null,--雇员姓名

employee_sex varchar(4),--雇员性别

department_name varchar(20),--所属部门

job_name varchar(20),--职位

hiredate date,--入职时间

salary number(8,2),--薪水

telephone varchar(15),--联系电话

address varchar(20)--家庭住址

);

--用户表:

if userpeople exsit;

drop table userpeple;

create table userpeople(

username varchar(20) primary key,

userpassword varchar(20),

usertype varchar(10)

);

详细设计

1. 系统功能模块图

2. 各模块详细设计

登录模块:使用LoginFrame类,用LoginAction类对该事件做监听。 主窗体模块:使用PeronManageSystemMainFrame类。 注册模块:使用EmployeeRegistPanel类,用EmployeeRegistAction类对注册事件做监听。 查询模块:使用EmployeeFindPanel类,用EmployeeFindAction类对查询事件做监听。 修改模块:使用EmployeeUpdatePanel类,用EmployeeUpdateAction类对修改事件做监听。

保存模块:使用ExportEmployeeInfo类。

模块所需其他类:使用CenterWindow类保证窗体居中显示。使用CheckInputValue类保证输入数据合法。

软件生产实习报告终稿

心得体会

通过这次课程设计,让我更加了解了java以及数据库的相关知识,同时也培养了自己解决问题的能力。增加了工作以及学习的积极性。通过这次课程设计对自己今后的工作和学习都有较大的促进的作用。

1. 数据库连接代码

package cn.edu.mon;

import java.io.File;

import java.io.FileInputStream;

import java.io.IOException;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import java.util.Properties;

/**

* 该类是用来完成各种应用处理程序与oracle数据库的连接建立

* @author Administrator * */

public class DbConnection {

/** * @param args */

public static void main(String[] args) {

if(getDbConnection() != null){

System.out.println("数据库连接成功");

}else{

System.out.println("数据库连接失败");

}

}

/** * 根据定义的数据库连接信息与数据库建立连接 * @return */

public static Connection getConnection() {

Connection con = null;

try {

// 定义数据库驱动程序名称

String driver = "oracle.jdbc.driver.OracleDriver";

// 定义jdbc url

String url = "jdbc:oracle:thin:localhost:1521:orcl";

String user = "system";

String pwd = "system";

//通过反射机制根据给定的驱动程序名找到与其对应的类并立即构造该类的实例对象 Class.forName(driver);

//通过驱动程序管理器根据给定的url等信息与特定的数据库建立连接

con = DriverManager.getConnection(url,user,pwd);

} catch (SQLException e) {

System.out.println("sql异常:= "+e.getMessage());

} catch (ClassNotFoundException e) {

System.out.println("驱动程序加载异常:= "+e.getMessage());

}

return con;

}

/*** 根据文件信息与特定的数据库建立连接 * @return */

public static Connection getDbConnection(){

Connection con = null;

try{

Properties pro = getProperties();

String driver = pro.getProperty("driver");

String url = pro.getProperty("url");

String user = pro.getProperty("user");

String pwd = pro.getProperty("pwd");

Class.forName(driver);

con = DriverManager.getConnection(url,user,pwd);

}catch(Exception e){

System.out.println("数据库连接建立异常:= " + e.getMessage()); }

return con;

}

/*** 读取文件中保存的数据库连接配置信息 * @return */

public static Properties getProperties(){

Properties pro = new Properties();

try{

pro.load(new FileInputStream(new File("db.properties")));

}catch(IOException e){

System.out.println("属性文件读取异常:= "+e.getMessage());

}

return pro;

}

}

2. 员工信息注册部分代码

package cn.edu.prj.control.employee;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

import javax.swing.JTable;

import javax.swing.table.DefaultTableModel;

import cn.edu.prj.dao.employee.EmployeeDao;

import cn.edu.prj.dao.employee.impl.EmployeeDaoImpl;

import cn.edu.prj.exception.EmployeeException;

import cn.edu.prj.view.panel.EmployeeRegistPanel;

import cn.edu.prj.vo.EmployeeVo;

public class EmployeeAction implements ActionListener{

private EmployeeRegistPanel regist;

public EmployeeAction(EmployeeRegistPanel regist){

this.regist = regist;

}

public void actionPerformed(ActionEvent e){

String name = e.getActionCommand();

if(name.equals("确定")){

if (regist.checkEmployeeValue()) {

EmployeeVo value = regist.getInputEmployeeValue();

EmployeeDao dao = new EmployeeDaoImpl();

try {

if(dao.registEmployee(value)){

JTable table = regist.getTable();

DefaultTableModel model = (DefaultTableModel)table.getModel(); Object[] data =

{value.getEmployeeNo(),value.getEmployeeName(),value.getEmployeeSex(),

value.getDepartmentName(),value.getJobName(),value.getHireDate(), new

Double(value.getSalary()),value.getTelephone(),value.getAddress()}; model.addRow(data);

JOptionPane.showMessageDialog(null, "雇员注册成功");

}else{

JOptionPane.showMessageDialog(null, "雇员注册失败");

}

} catch (EmployeeException e1) {

JOptionPane.showMessageDialog(null, e1.getMessage());

}

}

}

}

}

3. 员工信息查找部分代码

package cn.edu.prj.control.employee;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.util.Iterator;

import java.util.Vector;

import javax.swing.ButtonGroup;

import javax.swing.JOptionPane;

import javax.swing.JTable;

import javax.swing.GroupLayout.Group;

import javax.swing.table.DefaultTableModel;

import cn.edu.mon.DbSql;

import cn.edu.prj.dao.employee.EmployeeDao;

import cn.edu.prj.dao.employee.impl.EmployeeDaoImpl;

import cn.edu.prj.exception.EmployeeException;

import cn.edu.mon.InputTable;

import cn.edu.prj.view.panel.EmployeeFindPanel;

import cn.edu.prj.vo.EmployeeVo;

public class EmployeeFindAction implements ActionListener {

private EmployeeFindPanel find;

public EmployeeFindAction(EmployeeFindPanel find) {

this.find = find;

}

public Vector getcheckByno(){

Vector v=null;

String temp = find.buildNoTxt().getText();

EmployeeDao dao = new EmployeeDaoImpl();

try {

v = dao.findEmployeeByConfirm(temp,DbSql.BY_EMP_NO); } catch (EmployeeException e1) {

JOptionPane.showMessageDialog(null, e1.getMessage()); }

return v;

}

public Vector getcheckBydeptname(){

Vector v=null;

String temp =(String) find.buildDeptBox().getSelectedItem(); EmployeeDao dao = new EmployeeDaoImpl();

try {

v = dao.findEmployeeByConfirm(temp,DbSql.BY_DEPT_NAME);

} catch (EmployeeException e1) {

JOptionPane.showMessageDialog(null, e1.getMessage()); }

return v;

}

public Vector getcheckByjobname(){

Vector v=null;

String temp=(String)find.buildJobBox().getSelectedItem();

EmployeeDao dao=new EmployeeDaoImpl();

try {

v = dao.findEmployeeByConfirm(temp,DbSql.BY_JOB_NAME);

} catch (EmployeeException e1) {

JOptionPane.showMessageDialog(null, e1.getMessage());

}

return v;

}

public void actionPerformed(ActionEvent e) {

String name = e.getActionCommand();

if(name.equals("查询全部员工信息")){

EmployeeDaoImpl dao=new EmployeeDaoImpl();

try {

Vector vc=dao.findAll(DbSql.FIND_EMPLOYEE);

InputTable.inputTable(vc, find);

} catch (EmployeeException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

if (name.equals("查询")) {

if (find.buildNoCheck().isSelected()) {

InputTable.inputTable(getcheckByno(), find);

}

if(find.buildDeptCheck().isSelected()){

InputTable.inputTable(getcheckBydeptname(), find);

}

if(find.buildJobCheck().isSelected()){

InputTable.inputTable(getcheckByjobname(), find);

}

if(find.buildDeptCheck().isSelected()&&find.buildJobCheck().isSelected()){ Vector v=null;

boolean flag=true;

String temp1=(String)find.buildJobBox().getSelectedItem();

String temp2=(String)find.buildDeptBox().getSelectedItem();

EmployeeDaoImpl dao=new EmployeeDaoImpl();

try {

v =

dao.findEmployeeByConfirmTwo(temp2,temp1,DbSql.BY_JOB_NAME_DEPARTMENT_NAME); } catch (EmployeeException e1) {

flag=false;

JTable table = find.getTable();

DefaultTableModel model = (DefaultTableModel) table.getModel(); int row = table.getRowCount();

for(int i = row -1; i >=0;i--){

model.removeRow(i);

}

JOptionPane.showMessageDialog(null, e1.getMessage());

}

if(flag==true){

InputTable.inputTable(v, find);

}

}

if(find.buildNoCheck().isSelected()&&find.buildDeptCheck().isSelected()&&find.buildJobCheck().isSelected()){

InputTable.inputTable(getcheckByno(), find);

}

if(find.buildNoCheck().isSelected()&&find.buildDeptCheck().isSelected()){ InputTable.inputTable(getcheckByno(), find);

}

if(find.buildNoCheck().isSelected()&&find.buildJobCheck().isSelected()){ InputTable.inputTable(getcheckByno(), find);

}

}

if(name.equals("模糊查询")){

//System.out.println(".............");

ButtonGroup group = new ButtonGroup();

if ((find.getJobbuton().getSelectedObjects())!=null) {

//System.out.println("daozheli");

boolean flag=true;

Vector v=null;

String temp=find.buildjobTxt().getText().trim();

EmployeeDaoImpl dao=new EmployeeDaoImpl();

try {

v =

dao.findEmployeeByConfirmMohu(temp,DbSql.BY_LIKE_JOB_NAME);

// System.out.println(v);

if(v==null){

flag=false;

JOptionPane.showMessageDialog(null, "没有相关记录!");

}

} catch (EmployeeException e1) {

JTable table = find.getTable();

DefaultTableModel model = (DefaultTableModel) table.getModel(); int row = table.getRowCount();

for(int i = row -1; i >=0;i--){

model.removeRow(i);

}

JOptionPane.showMessageDialog(null, e1.getMessage());

}

if(flag==true){

InputTable.inputTable(v, find);

}

}

if(find.getHiredatebuton().getSelectedObjects()!=null){

System.out.println(".............");

Vector v=null;

String temp=find.buildhiredateTxt().getText().trim(); EmployeeDaoImpl dao=new EmployeeDaoImpl();

try {

v =

dao.findEmployeeByConfirmMohu(temp,DbSql.BY_LIKE_HIREDATA);

//System.out.println("+===="+v);

} catch (EmployeeException e1) {

JTable table = find.getTable();

DefaultTableModel model = (DefaultTableModel)

table.getModel();

int row = table.getRowCount();

for(int i = row -1; i >=0;i--){

model.removeRow(i);

}

JOptionPane.showMessageDialog(null, e1.getMessage()); }

InputTable.inputTable(v, find);

}

if(find.getSalbuton().getSelectedObjects()!=null){

//System.out.println(".............");

Vector v=null;

// System.out.println(find.buildsalTxt().getText());

String temp=find.buildsalTxt().getText().trim();

//System.out.println(temp);

EmployeeDaoImpl dao=new EmployeeDaoImpl();

try {

v =

dao.findEmployeeByConfirmMohu(temp,DbSql.BY_LIKE_SALARY);

//System.out.println(v);

} catch (EmployeeException e1) {

JTable table = find.getTable();

DefaultTableModel model = (DefaultTableModel)

table.getModel();

int row = table.getRowCount();

for(int i = row -1; i >=0;i--){

model.removeRow(i);

}

JOptionPane.showMessageDialog(null, e1.getMessage()); }

InputTable.inputTable(v, find);

}

}

相关推荐