• 银行排号系统的设计与实现



    **源码获取方式:** [https://blog.csdn.net/WEB_DC/article/details/125330334](https://blog.csdn.net/WEB_DC/article/details/125330334)

    一、项目设计

    1. 模块设计

    在这里插入图片描述
    该系统功能从服务器端和客户端角度来说可分以下两大模块,具体每一个模块又分为几个小模块:

    (1) 服务器端

    1)取号功能:打开服务器与终端进行通信。由于把服务器设置到了用户的一端,所以在服务器端进行取号,然后把号存到数据库中。

    2)统计功能:数据访问层从数据库中查出所有取票人数和等待人数在服务器端界面显示。

    3)删除功能:删除当前取票顾客的排号。

    4)查询功能:顾客可以从此处了解到所有顾客的取票情况及被处理状况。

    5)通知功能:从服务器端获得排号,通过服务器端通知用户于工作台办理业务。

    (2) 客户端

    同一时刻允许多个工作台办理业务。用户通过在服务器端的通知功能知道去哪个工作台办理业务,工作台显示正在为哪个号码的用户办理业务。

    1) 登录功能:业务员从此处登录,业务员的姓名,密码是事先录入数据库的。

    2) 叫号功能:业务员点击处理按钮触发事件发送信息给服务器,服务器从数据库拿到号票,返回给业务员进行业务处理。

    3)统计功能:数据访问层从数据库查询总取票人数和查询未处理人数在业务端显示。

    4) 删除功能:业务员可以删除数据库中所有的记录,也可以选择删除某条记录。

    5) 查询功能:业务员可以查询所有顾客的取票情况及业务员对号票的处理情况,这块主要为了能够及时掌握顾客取票信息及业务员处理情况。

    2. 实现效果

    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述

    在这里插入图片描述
    ![在这里插入图片描述](https://img-blog.csdnimg.cn/8e0b78631e87451ba550517f611605e8.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21hdGhvcl9zaW5vcg==,在这里插入图片描述
    size_16,color_FFFFFF,t_70)

    二、部分源码

    部分代码示例:

    package demo;
    
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.util.List;
    import java.util.Properties;
    
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    
    import pojo.Customer;
    import pojo.Work;
    
    import common.exception.transaction.BeanFactory;
    
    import dao.ICustomerDao;
    import dao.IWorkDao;
    
    /**
     * *号普通业务网柜台UI
     * @author KAdmin
     *
     */
    public class ProcessClient {
    	private JFrame f;
    
    	private Container c;
    
    	private JButton startBtn;
    
    	private JButton nextBtn;
    
    	private JButton stopBtn;
    
    	private JLabel lbl;
    	
    	// 柜台ID号
    	private int id;
    
    	private PrintWriter pw;
    
    	private BufferedReader br;
    
    	private Socket socket;
    
    	private JMenuItem ct;
    
    	private JMenuItem c2;
    
    	private JMenuItem c3;
    
    	private JMenuItem drop;
    
    	private JMenu dropCu;
    
    	private JMenuItem About;
    
    	private JMenuItem dropVip;
    
    	private JMenuItem dropNormal;
    
    	private String name;
    
    	private JMenuItem firstProcess;
    
    	private JMenuItem workProcess;
    
    	public ProcessClient(int id) {
    		this.id = id;
    
    		if (id == 1)
    			f = new JFrame("1号vip专柜");
    		else
    			f = new JFrame(id + "号普通业务柜台");
    
    		f.setBounds(id * 300 - 100, 80, 300, 200);
    		f.addWindowListener(new WorkClose());
    		c = f.getContentPane();
    
    		Properties pro = new Properties();
    		FileInputStream fis;
    		try {
    			fis = new FileInputStream("src/peizhi.properties");
    			pro.load(fis);
    			name = pro.getProperty("name");
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    
    		JMenuBar menuBar = new JMenuBar();
    		JMenu count = new JMenu("统计");
    		JMenu delete = new JMenu("移除");
    		JMenu first = new JMenu("显示");
    		JMenu AboutMenu = new JMenu("关于");
    
    		menuBar.add(count);
    		menuBar.add(delete);
    		menuBar.add(first);
    		menuBar.add(AboutMenu);
    
    		ct = new JMenuItem("总取票数");
    		JMenu c1 = new JMenu("未处理票数");
    		c2 = new JMenuItem("vip用户");
    		c3 = new JMenuItem("普通用户");
    
    		count.add(ct);
    		count.add(c1);
    		c1.add(c2);
    		c1.add(c3);
    
    		drop = new JMenuItem("移除所有");
    		dropCu = new JMenu("选择移除");
    		dropVip = new JMenuItem("vip");
    		dropNormal = new JMenuItem("Normal");
    
    		delete.add(drop);
    		delete.add(dropCu);
    		dropCu.add(dropVip);
    		dropCu.add(dropNormal);
    
    		firstProcess = new JMenuItem("顾客显示");
    		workProcess = new JMenuItem("员工处理显示");
    		first.add(firstProcess);
    		first.add(workProcess);
    
    		About = new JMenuItem("版本");
    		AboutMenu.add(About);
    
    		f.setJMenuBar(menuBar);
    
    		lbl = new JLabel();
    		startBtn = new JButton("开始受理");
    		nextBtn = new JButton("下一位顾客");
    		stopBtn = new JButton("停止受理");
    		nextBtn.setEnabled(false);
    		stopBtn.setEnabled(false);
    
    		JPanel p = new JPanel();
    		p.add(startBtn);
    		p.add(nextBtn);
    		p.add(stopBtn);
    		c.add(lbl, BorderLayout.CENTER);
    		c.add(p, BorderLayout.SOUTH);
    
    		MyActionListener listener = new MyActionListener();
    		startBtn.addActionListener(listener);
    		nextBtn.addActionListener(listener);
    		stopBtn.addActionListener(listener);
    		ct.addActionListener(listener);
    		c2.addActionListener(listener);
    		c3.addActionListener(listener);
    		drop.addActionListener(listener);
    		dropVip.addActionListener(listener);
    		dropNormal.addActionListener(listener);
    		firstProcess.addActionListener(listener);
    		workProcess.addActionListener(listener);
    		About.addActionListener(listener);
    
    		f.setVisible(true);
    
    		init();
    	}
    
    	public void init() {
    		try {
    			socket = new Socket("localhost", 2000);
    
    			br = new BufferedReader(new InputStreamReader(socket
    					.getInputStream()));
    			pw = new PrintWriter(socket.getOutputStream(), true);
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    
    	}
    
    	class MyActionListener implements ActionListener {
    		public void actionPerformed(ActionEvent e) {
    			
    			if (e.getSource() == startBtn || e.getSource() == nextBtn
    					|| e.getSource() == stopBtn) {
    				startBtn.setEnabled(false);
    				nextBtn.setEnabled(true);
    				stopBtn.setEnabled(true);
    
    				try {
    
    					// vip 业务
    					if (id == 1){
    						pw.println("vip" + id);
    						ICustomerDao dao = (ICustomerDao) BeanFactory
    								.getPojo("customerDao");
    						IWorkDao workdao = (IWorkDao) BeanFactory
    								.getPojo("workDao");
    
    						int num = Integer.parseInt(br.readLine());
    						if (num > 0) {
    							Work work = new Work(1, 1, num);
    							workdao.saveWork(work);
    							
    							// 更新处理kallen
    							Customer customer = new Customer(num, 1);
    							dao.update(customer);
    							
    							List<Customer> list = dao.findUprocess(1);
    							int num1 = list.size();
    							lbl.setText("正在为Vip业务" + num + "号顾客办理业务!" + "还有"
    									+ num1 + "人等待");
    
    						} else {
    							lbl.setText("没有客户需被处理");
    
    							stopBtn.setEnabled(false);
    							nextBtn.setEnabled(false);
    							startBtn.setEnabled(true);
    
    						}
    					}
    
    					
    					// 普通业务
    					if (id != 1) {
    
    						pw.println("normals" + id);
    						String temp = br.readLine();
    						int index = 0;
    						int num = 0;
    
    						if ((index = temp.indexOf("vip")) != -1) {
    
    							ICustomerDao dao = (ICustomerDao) BeanFactory
    									.getPojo("customerDao");
    							IWorkDao workdao = (IWorkDao) BeanFactory
    									.getPojo("workDao");
    
    							num = Integer.parseInt(temp.substring(index + 3));
    
    							if (num > 0) {
    
    								Work work = new Work(id, 1, num);
    								workdao.saveWork(work);
    
    								List<Customer> list = dao.findUprocess(1);
    								int num1 = list.size();
    
    								lbl.setText("正在为Vip业务" + num + "号顾客办理业务!"
    										+ "还有" + num1 + "人等待");
    
    							} else {
    								lbl.setText("没有客户需被处理");
    								stopBtn.setEnabled(false);
    								nextBtn.setEnabled(false);
    								startBtn.setEnabled(true);
    							}
    
    						} else if ((index = temp.indexOf("normals")) != -1) {
    
    							ICustomerDao dao = (ICustomerDao) BeanFactory
    									.getPojo("customerDao");
    							IWorkDao workdao = (IWorkDao) BeanFactory
    									.getPojo("workDao");
    
    							num = Integer.parseInt(temp.substring(index + 7));
    
    							if (num > 0) {
    								// 处理业务
    								Work work = new Work(id, 2, num);
    								workdao.saveWork(work);
    								
    								// 更新处理kallen
    								Customer customer = new Customer(num, 2);
    								dao.update(customer);
    								
    								// 查找未处理的记录
    								List<Customer> list = dao.findUprocess(2);
    								int num1 = list.size();
    								// num1--;
    								// System.out.println(num1);
    
    								lbl.setText("正在为普通业务" + num + "号顾客办理业务!" + "还有"
    										+ num1 + "人等待");
    
    							} else {
    								lbl.setText("没有客户需被处理");
    								stopBtn.setEnabled(false);
    								nextBtn.setEnabled(false);
    								startBtn.setEnabled(true);
    							}
    
    						}
    					}
    				} catch (IOException ex) {
    					ex.printStackTrace();
    				}
    
    				if (e.getSource() == stopBtn) {
    					startBtn.setEnabled(true);
    					nextBtn.setEnabled(false);
    					stopBtn.setEnabled(false);
    				}
    			}
    
    			if (e.getSource() == ct) {
    				ICustomerDao dao = (ICustomerDao) BeanFactory
    						.getPojo("customerDao");
    				List<Customer> list = dao.loadAllUsers();
    				int num = list.size();
    				lbl.setText("总取票人数为:" + num);
    			}
    			if (e.getSource() == c2) {
    				ICustomerDao dao = (ICustomerDao) BeanFactory
    						.getPojo("customerDao");
    				List<Customer> list = dao.findUprocess(1);
    				int num = list.size();
    				lbl.setText("未处理的vip用户为:" + num);
    				if (num == 0)
    					lbl.setText("没有人等待");
    			}
    			if (e.getSource() == c3) {
    				ICustomerDao dao = (ICustomerDao) BeanFactory
    						.getPojo("customerDao");
    				List<Customer> list = dao.findUprocess(2);
    				int num = list.size();
    
    				lbl.setText("未处理的普通用户为:" + num);
    				if (num == 0)
    					lbl.setText("没有人等待");
    			}
    			if (e.getSource() == drop) {
    				ICustomerDao dao = (ICustomerDao) BeanFactory
    						.getPojo("customerDao");
    				dao.delete(1);
    				dao.delete(2);
    				int num = dao.findAllCustomer(1);
    				int num1 = dao.findAllCustomer(2);
    				if ((num + num1) == 0)
    					lbl.setText("已删除");
    				else
    					lbl.setText("删除失败");
    			}
    			if (e.getSource() == dropVip) {
    				ICustomerDao dao = (ICustomerDao) BeanFactory
    						.getPojo("customerDao");
    				String panel = JOptionPane.showInputDialog("输入号票编号");
    
    				try {
    					if (panel == null) {
    						throw new Exception("b");
    					}
    					int num = Integer.valueOf(panel);
    					dao.deleteRecord(1, num);
    					Customer customer = dao.findCustomer(num, 1);
    					if (customer == null)
    						lbl.setText("已删除");
    					else
    						lbl.setText("删除失败");
    
    				} catch (Exception e1) {
    					e1.getMessage();
    				}
    
    			}
    			if (e.getSource() == dropNormal) {
    				ICustomerDao dao = (ICustomerDao) BeanFactory
    						.getPojo("customerDao");
    				String panel = JOptionPane.showInputDialog("输入号票编号");
    				try {
    
    					if (panel == null) {
    						throw new Exception("不能为空");
    					}
    					int num = Integer.valueOf(panel);
    					dao.deleteRecord(2, num);
    					Customer customer = dao.findCustomer(num, 1);
    					if (customer == null)
    						lbl.setText("已删除");
    					else
    						lbl.setText("删除失败");
    				} catch (Exception e1) {
    					e1.getMessage();
    				}
    			}
    			if (e.getSource() == firstProcess) {
    				// ICustomerDao
    				// dao=(ICustomerDao)BeanFactory.getPojo("customerDao");
    				new TableDemo();
    			}
    			// 员工处理显示
    			if (e.getSource() == workProcess) {
    				new TableWorkDemo();
    			}
    			if (e.getSource() == About) {
    				JOptionPane.showOptionDialog(null, "产品名称:" + name + "\n"
    						+ "程序设计者: 韩超 \n" + "山西大学商务学院所有\n", "关于JNotePad",
    						JOptionPane.DEFAULT_OPTION,
    						JOptionPane.INFORMATION_MESSAGE, null, null, null);
    			}
    
    		};
    
    	}
    
    	class WorkClose extends WindowAdapter {
    		public void windowClosing(WindowEvent e) {
    			pw.println("end");
    			System.exit(0);
    		}
    	};
    
    	/*
    	 * public static void main(String args[]) { new
    	 * ProcessClient(Integer.parseInt(args[0])); }
    	 */
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425
    • 426
    • 427
    • 428
    • 429
    • 430
    • 431

    项目源码

    源码获取方式:
    https://blog.csdn.net/WEB_DC/article/details/125330334

  • 相关阅读:
    如何选择正确的SSL证书?
    探索设计模式:观察者模式
    Flink概述
    计算机毕业设计ssm+vue基本微信小程序的电影票务系统-电影票预订系统
    MySQL知识总结 (十) 一条 SQL 的执行过程详解
    Vue学习之--------脚手架的分析、Ref属性、Props配置(2022/7/28)
    vue3早已具备抛弃虚拟DOM的能力了
    寻找链表相交结点问题
    基于JAVA+SpringMVC+MYSQL的汽车4S店管理系统
    Spring AOP框架
  • 原文地址:https://blog.csdn.net/WEB_DC/article/details/125423023