Java课设指导书新_第1页
Java课设指导书新_第2页
Java课设指导书新_第3页
Java课设指导书新_第4页
Java课设指导书新_第5页
已阅读5页,还剩87页未读 继续免费阅读

下载本文档

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

文档简介

1、一、项目概述1、ktv管理系统概述ktv管理系统是指应用于ktv场所的管理软件。一个完整的ktv系统通常包括会员管理、包房管理、超市管理、仓库管理、后台管理以及运营图表管理等功能模块。主要功能包括:系统登录与主控模块顾客开房管理顾客消费功能模块顾客结账功能模块系统管理模块。包括员工管理、ktv包房管理和商品管理等功能ktv管理系统数据库设计采用数据库管理系统来存储和管理数据,数据库系统采用SQL Server2005.设计并创建系统数据库ktv,在数据库ktv中设计八个数据库表格。工程创建与登录模块的界面设计系统主控模块界面的设计与实现开房模块的设计与实现消费模块的设计与实现结账模块的设计与实

2、现系统管理模块的设计与实现系统登录与托盘的实现 二、环境运行Eclipse、SQL2005三、数据库设计表1 包房表类型表(RoomType)字段名类型含义TypeVarchar(20)包房类型,主键PeopleNumsInt包房容纳人数Pricefloat包房价格表2 包房表(Room)字段名类型含义RoomNoVarchar(10)包房编号,主键TypeVarchar(20)包房类型StateVarchar(10)包房状态,值为“空闲”或“使用”RemarksVarchar(200)包房评价表3 包房开房记录表(RoomOrder)字段名类型含义RoomOrderNoInt包房开房记录号,

3、主键,自动生成RoomNoVarchar(10)包房编号StartTimeVarchar(20)包房开始使用时间ExpectTimeVarchar(20)包房预约时间EndTimeVarchar(20)包房结束使用时间,允许为空PrePayMoneyfloat包房预交押金PayMoneyfloat包房消费金额,允许为空表4 商品表(Goods)字段名类型含义GoodsNoVarchar(20)商品编号,主键GoodsNameVarchar(30)商品名称GoodsPricefloat商品单价表5 商品消费表 (GoodsOrder)字段名类型含义GoodsOrderint商品消费号,主键,自动

4、生成GoodsNameVarchar(30)商品名RoomNoVarchar(10)商品消费房间号ConsumeNumint商品消费数量GoodsTotalPricefloat商品消费金额PayStateVarchar(50)商品结账状态,值为“为结账”或“已结账“字段名类型含义AcountIDint结账记录号,主键,自动生成RoomNoVarchar(20)结账包房号ConsumeMoneyfloat消费总金额CheckOutTimeVarchar(20)结账时间表 6 结账记录表(AcountCheck)表 7 员工信息表(Staff)字段名类型含义StsffNoVarchar(15)员工

5、编号,主键JobNameVarchar(30)岗位名称NameVarchar(20)员工姓名SexVarchar(2)员工性别PhoneVarchar(11)员工电话表 8 系统用户表(Users)字段名类型含义UserNameVarchar(20)用户姓名,主键PasswordVarchar(10)用户密码UserTypeVarchar(10)用户类型,值为“管理员”或“操作员”四、功能模块系统登录与主控模块2.顾客开房管理3.顾客消费功能模块4.顾客结账功能模块5.系统管理模块。包括员工管理、ktv包房管理和商品管理等功能程序截图:1、登陆模块:package szpt.ktvsystem

6、.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.graphic

7、s.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

8、 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

9、 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.readAndDis

10、patch()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

11、= 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 = ne

12、w 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.vertical

13、Spacing = 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(),

14、 微软雅黑, 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.s

15、etText( );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 F

16、ont(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

17、.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.NO

18、NE);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.ecl

19、ipse.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(r

20、s.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.printStackT

21、race(); );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.

22、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().getResou

23、rceAsStream(/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 =

24、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);us

25、ersList.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 U

26、serName;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

27、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;Res

28、ultSet 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(SQLExcepti

29、on 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;publi

30、c 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

31、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;impor

32、t 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() Roo

33、m 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.getCommonAD

34、O();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 fal

35、se; 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.CLa

36、bel;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

37、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 v

38、oid 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 = nul

39、l ;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

40、;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.pr

41、intStackTrace(); 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.printSta

42、ckTrace();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();r

43、eturn 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.SQLExcep

44、tion;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.ecli

45、pse.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.widget

46、s.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.

47、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

48、 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.sw

49、t.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 tabFold

50、er = 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 Comp

51、osite 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

52、 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 = nul

53、l;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 =

54、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 L

55、abel 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

56、 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 GridL

57、ayout();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, 0);createToolBar();Label filler27 = new La

58、bel(sShell, SWT.NONE);createCompositeRoomInfo();createCompositeRoomDisplay();sShell.setLayout(gridLayout);Label filler26 = new Label(sShell, SWT.NONE);createCompositeInfo();sShell.setSize(new Point(800, 600);createTray();private void createToolBar() GridData gridData = new GridData();gridData.height

59、Hint = 80;gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;gridData.horizontalSpan = 2;toolBar = new ToolBar(sShell, SWT.NONE);toolBar.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);toolBar.setLayoutData(gridData);ToolItem toolItemCheckIn =

60、new ToolItem(toolBar, SWT.PUSH);toolItemCheckIn.setText(顾客开房);toolItemCheckIn.setToolTipText(CheckIn);toolItemCheckIn.setImage(new Image(Display.getCurrent(), getClass().getResourceAsStream(/images/checkin.png);toolItemCheckIn.addSelectionListener(new org.eclipse.swt.events.SelectionListener() publi

温馨提示

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

评论

0/150

提交评论