Java课设指导书新.doc

上传人:wux****ua 文档编号:9496487 上传时间:2020-04-06 格式:DOC 页数:93 大小:737.50KB
返回 下载 相关 举报
Java课设指导书新.doc_第1页
第1页 / 共93页
Java课设指导书新.doc_第2页
第2页 / 共93页
Java课设指导书新.doc_第3页
第3页 / 共93页
点击查看更多>>
资源描述
一、项目概述1、ktv管理系统概述ktv管理系统是指应用于ktv场所的管理软件。一个完整的ktv系统通常包括会员管理、包房管理、超市管理、仓库管理、后台管理以及运营图表管理等功能模块。主要功能包括:1) 系统登录与主控模块2) 顾客开房管理3) 顾客消费功能模块4) 顾客结账功能模块5) 系统管理模块。包括员工管理、ktv包房管理和商品管理等功能2、 ktv管理系统数据库设计采用数据库管理系统来存储和管理数据,数据库系统采用SQL Server2005.设计并创建系统数据库ktv,在数据库ktv中设计八个数据库表格。3、 工程创建与登录模块的界面设计4、 系统主控模块界面的设计与实现5、 开房模块的设计与实现6、 消费模块的设计与实现7、 结账模块的设计与实现8、 系统管理模块的设计与实现9、 系统登录与托盘的实现 二、环境运行Eclipse、SQL2005三、数据库设计表1 包房表类型表(RoomType)字段名类型含义TypeVarchar(20)包房类型,主键PeopleNumsInt包房容纳人数Pricefloat包房价格表2 包房表(Room)字段名类型含义RoomNoVarchar(10)包房编号,主键TypeVarchar(20)包房类型StateVarchar(10)包房状态,值为“空闲”或“使用”RemarksVarchar(200)包房评价表3 包房开房记录表(RoomOrder)字段名类型含义RoomOrderNoInt包房开房记录号,主键,自动生成RoomNoVarchar(10)包房编号StartTimeVarchar(20)包房开始使用时间ExpectTimeVarchar(20)包房预约时间EndTimeVarchar(20)包房结束使用时间,允许为空PrePayMoneyfloat包房预交押金PayMoneyfloat包房消费金额,允许为空表4 商品表(Goods)字段名类型含义GoodsNoVarchar(20)商品编号,主键GoodsNameVarchar(30)商品名称GoodsPricefloat商品单价表5 商品消费表 (GoodsOrder)字段名类型含义GoodsOrderint商品消费号,主键,自动生成GoodsNameVarchar(30)商品名RoomNoVarchar(10)商品消费房间号ConsumeNumint商品消费数量GoodsTotalPricefloat商品消费金额PayStateVarchar(50)商品结账状态,值为“为结账”或“已结账“字段名类型含义AcountIDint结账记录号,主键,自动生成RoomNoVarchar(20)结账包房号ConsumeMoneyfloat消费总金额CheckOutTimeVarchar(20)结账时间表 6 结账记录表(AcountCheck)表 7 员工信息表(Staff)字段名类型含义StsffNoVarchar(15)员工编号,主键JobNameVarchar(30)岗位名称NameVarchar(20)员工姓名SexVarchar(2)员工性别PhoneVarchar(11)员工电话表 8 系统用户表(Users)字段名类型含义UserNameVarchar(20)用户姓名,主键PasswordVarchar(10)用户密码UserTypeVarchar(10)用户类型,值为“管理员”或“操作员”四、功能模块1. 系统登录与主控模块2.顾客开房管理3.顾客消费功能模块4.顾客结账功能模块5.系统管理模块。包括员工管理、ktv包房管理和商品管理等功能一、 程序截图:1、登陆模块:package szpt.ktvsystem.visualclass;import java.sql.ResultSet;import java.sql.SQLException;import org.eclipse.jface.dialogs.MessageDialog;import org.eclipse.swt.layout.GridLayout;import org.eclipse.swt.graphics.Point;import org.eclipse.swt.widgets.Shell;import org.eclipse.swt.widgets.Display;import org.eclipse.swt.graphics.Image;import org.eclipse.swt.SWT;import org.eclipse.swt.widgets.Label;import org.eclipse.swt.widgets.Text;import org.eclipse.swt.widgets.Button;import org.eclipse.swt.layout.GridData;import org.eclipse.swt.graphics.Font;import szpt.ktvsystem.dataclass.CommonADO;public class KTVLongin public static Shell sShell = null; private Label label = null;private Label label3 = null;private Label label4 = null;private Text textUserName = null;private Text textPassword = null;private Button buttonLogin = null;private Button buttonExit = null;private Label label5 = null;private Label label6 = null;public KTVLongin() super();createSShell();public Shell getsShell() return sShell; public static void main(String args) Display display = Display.getDefault();KTVLongin thisClass = new KTVLongin();thisClass.createSShell();thisClass.sShell.open();while (!thisClass.sShell.isDisposed() if (!display.readAndDispatch()display.sleep();display.dispose();private void createSShell() GridData gridData21 = new GridData();gridData21.horizontalAlignment = org.eclipse.swt.layout.GridData.END;GridData gridData11 = new GridData();gridData11.horizontalAlignment = org.eclipse.swt.layout.GridData.END;GridData gridData6 = new GridData();gridData6.widthHint = 100;gridData6.heightHint = 25;GridData gridData5 = new GridData();gridData5.widthHint = 100;gridData5.heightHint = 25;GridData gridData2 = new GridData();gridData2.grabExcessHorizontalSpace = true;gridData2.grabExcessVerticalSpace = true;GridData gridData1 = new GridData();gridData1.grabExcessHorizontalSpace = true;gridData1.grabExcessVerticalSpace = true;GridData gridData = new GridData();gridData.grabExcessHorizontalSpace = true;gridData.grabExcessVerticalSpace = true;GridLayout gridLayout = new GridLayout();gridLayout.numColumns = 4;gridLayout.verticalSpacing = 15;gridLayout.horizontalSpacing = 10;sShell = new Shell(SWT.BORDER | SWT.DIALOG_TRIM);sShell.setText(KTV系统登录);sShell.setImage(newImage(Display.getCurrent(), getClass().getResourceAsStream(/images/icon.png);sShell.setLocation(new Point(250, 250);sShell.setFont(new Font(Display.getDefault(), 微软雅黑, 12, SWT.BOLD);sShell.setLayout(gridLayout);sShell.setSize(new Point(371, 260);label = new Label(sShell, SWT.NONE);label.setText( );label.setLayoutData(gridData);Label filler = new Label(sShell, SWT.NONE);Label filler7 = new Label(sShell, SWT.NONE);label6 = new Label(sShell, SWT.NONE);label6.setText( );label6.setLayoutData(gridData2);Label filler3 = new Label(sShell, SWT.NONE);label3 = new Label(sShell, SWT.NONE);label3.setText(用 户 名:);label3.setFont(new Font(Display.getDefault(), 楷体_GB2312, 18, SWT.BOLD | SWT.ITALIC);textUserName = new Text(sShell, SWT.BORDER);textUserName.setFont(new Font(Display.getDefault(), 楷体_GB2312, 12, SWT.BOLD);textUserName.setLayoutData(gridData5);Label filler11 = new Label(sShell, SWT.NONE);Label filler4 = new Label(sShell, SWT.NONE);label4 = new Label(sShell, SWT.NONE);label4.setText(密 码:);label4.setFont(new Font(Display.getDefault(), 楷体_GB2312, 18, SWT.BOLD | SWT.ITALIC);textPassword = new Text(sShell, SWT.BORDER | SWT.PASSWORD);textPassword.setFont(new Font(Display.getDefault(), 宋体, 12, SWT.BOLD);textPassword.setEchoChar(*);textPassword.setLayoutData(gridData6);Label filler10 = new Label(sShell, SWT.NONE);Label filler8 = new Label(sShell, SWT.NONE);buttonLogin = new Button(getsShell(), SWT.RIGHT);buttonLogin.setFont(new Font(Display.getDefault(), 宋体, 12, SWT.NORMAL);buttonLogin.setLayoutData(gridData11);buttonLogin.setText(登 录);buttonLogin.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) String userName=textUserName.getText().trim();String password=textPassword.getText().trim();CommonADO ado=CommonADO.getCommonADO();String queryStr=select * from Users where UserName=+userName+ and Password=+password+;ResultSet rs=ado.executeSelect(queryStr);try if(rs.next()SystemMainShell.userType=rs.getString(UserType);Shell oldShell=sShell;sShell=new SystemMainShell().getsShell();sShell.open();oldShell.close();elseMessageDialog.openInformation(sShell, 信息提示, 用户名或密码错误,请重新登录!);textUserName.setText();textPassword.setText(); catch (SQLException e1) e1.printStackTrace(); );buttonExit = new Button(sShell, SWT.NONE);buttonExit.setFont(new Font(Display.getDefault(), 宋体, 12, SWT.NORMAL);buttonExit.setLayoutData(gridData21);buttonExit.setText(退 出);buttonExit.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) System.exit(0););Label filler9 = new Label(sShell, SWT.NONE);label5 = new Label(sShell, SWT.NONE);label5.setText( );label5.setLayoutData(gridData1);sShell.setBackgroundMode(SWT.INHERIT_DEFAULT);sShell.setBackgroundImage(new Image(Display.getCurrent(), getClass().getResourceAsStream(/images/background.png);2、主控界面模块:UsersFactory:package szpt.ktvsystem.dataclass;import java.sql.ResultSet;import java.sql.SQLException;import java.util.ArrayList;import java.util.List;public class UsersFactory private List usersList = new ArrayList();public UsersFactory() CommonADO ado = CommonADO.getCommonADO();String goodsQueryStr = select * from Users;ResultSet rs = ado.executeSelect(goodsQueryStr);try while (rs.next() UsersEntity users = new UsersEntity();users.setUserName(rs.getString(UserName);users.setPassword(rs.getString(Password);users.setUserType(rs.getString(UserType);usersList.add(users); catch (SQLException e) e.printStackTrace();public List getUsersList() return usersList;UsersEntity:package szpt.ktvsystem.dataclass;public class UsersEntity private String UserName=null;private String Password=null;private String UserType=null;public String getUserName() return UserName;public void setUserName(String userName) UserName = userName;public String getPassword() return Password;public void setPassword(String password) Password = password;public String getUserType() return UserType;public void setUserType(String userType) UserType = userType;StaffFactory:package szpt.ktvsystem.dataclass;import java.sql.ResultSet;import java.sql.SQLException;import java.util.ArrayList;import java.util.List;public class StaffFactory private List googsList =new ArrayList();public StaffFactory()CommonADO ado =CommonADO.getCommonADO();String googsQueryStr=select * from Staff;ResultSet rs=ado.executeSelect(googsQueryStr);trywhile (rs.next()Staff googs=new Staff();googs.setStaffNo(rs.getString(StaffNo);googs.setJobName(rs.getString(JobName);googs.setName(rs.getString(Name);googs.setSex(rs.getString(Sex);googs.setPhone(rs.getString(Phone);googsList.add(googs);catch(SQLException e)e.printStackTrace();public List getGoogsList()return googsList;public String getGoods() / TODO Auto-generated method stubreturn null;Staff:package szpt.ktvsystem.dataclass;public class Staff public String getStaffNo() return StaffNo;public void setStaffNo(String staffNo) StaffNo = staffNo;public String getJobName() return JobName;public void setJobName(String jobName) JobName = jobName;public String getName() return Name;public void setName(String name) Name = name;public String getSex() return Sex;public void setSex(String sex) Sex = sex;public String getPhone() return Phone;public void setPhone(String phone) Phone = phone;private String StaffNo=null;private String JobName=null;private String Name=null;private String Sex=null;private String Phone=null;RoomFactory:package szpt.ktvsystem.dataclass;import java.sql.ResultSet;import java.sql.SQLException;import java.util.ArrayList;import java.util.List;public class RoomFactory private List roomsList = new ArrayList();public List getRoomsList() return roomsList;public RoomFactory() CommonADO ado = CommonADO.getCommonADO();String roomQueryStr= select * from Room;ResultSet rs = ado.executeSelect(roomQueryStr);try while (rs.next() Room room = new Room();room.setRoomNo(rs.getString(RoomNo);room.setType(rs.getString(Type);room.setState(rs.getString(State);room.setRemarks(rs.getString(Remarks);roomsList.add(room); catch (SQLException e) e.printStackTrace();public static boolean InsertDB(Room room)CommonADO con=CommonADO.getCommonADO();String querySql=select * from Room where RoomNo=+room.getRoomNo()+;String insertSql=insert into Room values(+room.getRoomNo()+,+room.getType()+,+room.getState()+,+room.getRemarks()+);ResultSet rs=con.executeSelect(querySql);try if(!rs.next()con.executeUpdate(insertSql);return true;elsereturn false; catch (SQLException e) e.printStackTrace();return false;public static void deleteDB(Room room)CommonADO con=CommonADO.getCommonADO();String delSql=delete from Room where RoomNo=+room.getRoomNo()+;con.executeUpdate(delSql);KtvRoom:package szpt.ktvsystem.dataclass;import org.eclipse.swt.custom.CLabel;import org.eclipse.swt.widgets.Composite;public class KTVRoom extends CLabelprivate Room room=null;public KTVRoom(Composite parent,int style)super(parent,style);public Room getRoom()return room;public void setRoom(Room room)this.room=room; Room:package szpt.ktvsystem.dataclass;public class Room private String RoomNo; private String Type; private String State; private String Remarks;public String getRoomNo()return RoomNo;public void setRoomNo(String roomNo)RoomNo=roomNo;public String getType()return Type;public void setType(String type)Type=type;public String getState()return State;public void setState(String state)State=state;public String getRemarks()return Remarks;public void setRemarks(String remarks)Remarks=remarks;CommonADO:package szpt.ktvsystem.dataclass;import java.sql.*;public class CommonADO private String DBDriver = null;private String url = null ;private String user = null ;private String password = null ;private Connection conn = null;private Statement stmt = null ;private ResultSet rs = null ;private static final CommonADO commoonADO = new CommonADO() ;private CommonADO() DBDriver = com.microsoft.sqlserver.jdbc.SQLServerDriver ;url = jdbc:sqlserver:/localhost:1433;DatabaseName=KTV;user = sa;password=123456;try / 1. 加载驱动 Class.forName(DBDriver); / 2. 创建数据库的连接 conn = DriverManager.getConnection(url, user, password); / 3. 创建执行SQL语句的表达式stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); catch (ClassNotFoundException e) e.printStackTrace(); catch (SQLException e) e.printStackTrace();public static CommonADO getCommonADO() return commoonADO;public ResultSet executeSelect(String sql) if(sql.toLowerCase().indexOf(select)!=-1)try rs = stmt.executeQuery(sql); catch (SQLException e) / TODO Auto-generated catch blocke.printStackTrace();return rs;public int executeUpdate(String sql)int result=0; if(sql.toLowerCase().indexOf(update)!=-1|sql.toLowerCase().indexOf(insert)!=-1|sql.toLowerCase().indexOf(delete)!=-1)try result=stmt.executeUpdate(sql); catch (SQLException e) / TODO Auto-generated catch blocke.printStackTrace();return result;public Connection getConn() return conn;public Statement getStmt() return stmt;public void closeDB() try rs.close();stmt.close();conn.close(); catch (SQLException e) e.printStackTrace();SystemMainShell:package szpt.ktvsystem.visualclass;import java.sql.ResultSet;import java.sql.SQLException;import java.text.SimpleDateFormat;import java.util.Date;import org.eclipse.jface.dialogs.MessageDialog;import org.eclipse.swt.layout.GridLayout;import org.eclipse.swt.events.MenuDetectEvent;import org.eclipse.swt.events.MenuDetectListener;import org.eclipse.swt.events.MouseEvent;import org.eclipse.swt.events.MouseListener;import org.eclipse.swt.events.SelectionAdapter;import org.eclipse.swt.events.SelectionEvent;import org.eclipse.swt.events.SelectionListener;import org.eclipse.swt.graphics.Point;import org.eclipse.swt.widgets.Shell;import org.eclipse.swt.SWT;import org.eclipse.swt.widgets.Button;import org.eclipse.swt.widgets.Menu;import org.eclipse.swt.widgets.MenuItem;import org.eclipse.swt.widgets.ToolBar;import org.eclipse.swt.widgets.Composite;import org.eclipse.swt.widgets.Label;import org.eclipse.swt.widgets.ToolTip;import org.eclipse.swt.widgets.Tray;import org.eclipse.swt.widgets.TrayItem;import org.eclipse.swt.layout.GridData;import org.eclipse.swt.widgets.Display;import org.eclipse.swt.widgets.ToolItem;import org.eclipse.swt.graphics.Image;import org.eclipse.swt.layout.FillLayout;import org.eclipse.swt.widgets.TabFolder;import org.eclipse.swt.widgets.TabItem;import org.eclipse.swt.custom.BusyIndicator;import org.eclipse.swt.custom.CLabel;import org.eclipse.swt.custom.ScrolledComposite;import szpt.ktvsystem.dataclass.CommonADO;import szpt.ktvsystem.dataclass.KTVRoom;import szpt.ktvsystem.dataclass.Room;import org.eclipse.swt.widgets.Group;import org.eclipse.swt.graphics.Font;import org.eclipse.swt.graphics.Rectangle;public class SystemMainShell private Shell sShell = null; private ToolBar toolBar = null;private Composite compositeRoomInfo = null;private Composite compositeInfo = null;private Composite compositeRoomDisplay = null;private TabFolder tabFolder = null;private Composite compositeLittle = null;private ScrolledComposite scrolledComposite1 = null;private Composite compositeLittleRooms = null;private Composite compositeMiddle = null;private ScrolledComposite scrolledComposite2 = null;private Composite compositeMiddleRooms = null;private Composite compositeLarge = null; private ScrolledComposite scrolledComposite3 = null;private Composite compositeLargeRooms = null;private Label label = null;private Label label1 = null;private Label label2 = null;private Label label3 = null;private Label label4 = null;private Label label5 = null;private Label label7 = null;private Label label8 = null;private Group group = null;private Label label20 = null;private Label label10 = null;private Label label21 = null;private Label labelRoom25 = null;private Label labelPeople = null;private Label labelStartTime = null;private Label labelExpectTime = null;private Label labelPrePayMoney = null;private Label label6 = null;private Label label9 = null;private Label labelSystemTime = null;private Date dateTime=null;private Label label11 = null;private Label label12 = null;private Label label13 = null;private Label label14 = null;private Label label15 = null;private Label labelLittleTotal = null;private Label labelMidTotal = null;private Label labelLargeTotal = null;private Label label22 = null;private Label label23 = null;private Label label24 = null;public static Label labelLittleLeft = null;public static Label labelMidLeft = null;public static Label labelLargeLeft = null;private Label label30 = null;private Label label31 = null;private Thread thread=null; public static int littleTotal=0;public static int littleLeft=0;public static int midTotal=0;public static int midLeft=0;public static int largeTotal=0;public static int largeLeft=0;public static String userType=null;private TrayItem trayItem=null;private ToolTip tip=null;private Tray tray=null;public static KTVRoom lastSelectedRoom=null;public SystemMainShell() super();createSShell();public Shell getsShell() return sShell;private void createSShell() GridLayout gridLayout = new GridLayout();gridLayout.numColumns = 3;gridLayout.verticalSpacing = 3;gridLayout.horizontalSpacing = 3;sShell = new Shell(SWT.NO_TRIM);sShell.setText(Shell);sShell.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);sShell.setLocation(new Point(0,
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 图纸专区 > 大学资料


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!