信用卡在线管理系统(32页DOC).docx
《信用卡在线管理系统(32页DOC).docx》由会员分享,可在线阅读,更多相关《信用卡在线管理系统(32页DOC).docx(33页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、最新资料推荐合肥学院计算机科学与技术系课程设计报告20122013学年第一学期课程Java课程设计课程设计名称信用卡在线管理系统专业班级11计本(4)班姓名黄伟指导教师张贯虹 胡春玲2013年1月一. 需求分析1、课程设计名称及内容课程设计名称:信用卡在线管理系统设计内容:设计一个信用卡管理系统,实现基于网络管理信用卡信息。2、任务和要求系统用户分为管理员、注册用户和普通用户。a) 提供注册功能,系统的访问者可以注册成为注册用户,注册信息包括卡号、密码和其他个人信息。注册用户没有任何操作权限,必须经管理员审批通过后成为普通用户才有权操作。新注册的用户,卡上初始金额为0。b) 普通用户可以执行现
2、金转入、现金转出、个人信息修改、余额查询和交易记录查询功能。c) 用户可以录入转入金额和转出金额,当转出金额大于信用卡的余额时,须判断透支金额是否在本卡的信用额度内(信用额度由管理员设定),如果在则允许透支,否则拒绝支出。d) 当信用卡发生透支后,在20天内不计利息,20天后按每天1%计算利息,当透支金额+透支利息超过本卡的信用额度,则本卡自动转入“黑名单”(利息继续计算),不再允许进行现金转出操作。e) 普通用户可以随时查看卡内余额。f) 普通用户可以按时间段查看交易记录,包括转入、转出和透支情况。g) 管理员可以审核注册用户,设定用户信用额度,批准成为普通用户。h) 管理员可以查看系统内的
3、黑名单,包括卡号和透支额度。二. 设计1数据库设计思想:(1)数据库的设计:我们使用的数据库是Microsoft SQL 2005。创建record和user表:create database card;use card;create table record(id int not null primary key ,fromId varchar(100) not null,toId varchar(50) not null,money float not null,tradetime datetime);create table user1 (id varchar(50) primary k
4、ey not null,password varchar(50) not null,name varchar(100) not null,type int ,money float ,credit float ,overdraft float ,blacklist int );、交易表用户表(2)对数据库的操作Insert主要时用来对数据库进行插入操作,例如在record表中插入一条记录为,public boolean insert ( Record record )String sql = insert into record(id,fromId,toId,money,tradetime)
5、values(?,?,?,?,?);try PreparedStatement pre = conn.prepareStatement(sql);Calendar calendar=Calendar.getInstance();calendar.setTime(record.getTradetime();pre.setInt(1 , record.getId();pre.setString(2 , record.getFromId();pre.setString(3 , record.getToId();pre.setDouble(4 , record.getMoney();pre.setDa
6、te(5 , record.getTradetime();pre.execute();return true; catch (SQLException e) e.printStackTrace();return false;Delete是多数据表中的记录加以删除,例如对user表中的记录删除操作为:public boolean delete ( User user )String sql = delete from user where id=?;try PreparedStatement pre = conn.prepareStatement(sql);pre.setString(1, us
7、er.getId();pre.execute();return true; catch (SQLException e) e.printStackTrace();return false;Update是对数据库中的信息加以修改!findAll是查找数据库中的所有记录!findById是通过用户给定的id好来对数据库进行扫描,查找出所有与输入的id相匹配的信息!同时也可以根据其他的关键字对数据库进行查找查找,例如是否是黑名单,是否已经有透支额了等等,具体的实现见代码!2.java程序的设计:主要以下几个包:-bean -User表示的是user表中的一条记录 -Record表示的是record表
8、中的一条记录 -ChangePasswordBean是对修改密码时的所有属性的封装 -zhucBean是在新用户注册时的一条记录,主要包括属性id ,password ,name ;以及set和get方法!-dao -DBConnection用于连接数据库-RecordDAO接口是封装对数据表Record的操作-UserDAO接口是封装对数据表User的操作 -exception -inputChangePasswordInfoNotRightException是用来显示输入的修改密码的出错的信息!-InputGetNumNotRightException是用户输入的取款金额不合法异常-Inp
9、utSetNumNotRightException是用户输入的存款金额不合法异常-LoginInfoNotRightException 是用户登陆是的不合法异常 -imp -RecordDAOImp是对接口RecordDAO中的方法的实现。 -UserDAOImp是对接口UserDAO中方法的实现。-service -ChangePasswordService是对修改密码服务中可能出现的不正常信息加以分类并且予以处理。 -GetService是对用户输入的取款信息的不正常信息加以分类并且予以处理。 - LoginService是对用户在登陆时输入信息的不正常信息加以分类并且予以处理。 - Se
10、tService是对用户输入的存款信息的不正常信息加以分类并且予以处理。- view - ChangePasswordFrame是修改密码的操作界面。- GetFrame是用户进行取款操作的界面。- GuanlFram是管理员进行操作的界面。- LoginView是登陆主界面。- PtFram是普通用户的操作界面。- SetFrame是用户进行存款操作的界面。- zhucFram是新注册用户进行注册的界面。a.登陆时主界面设计public class LoginView extends JFrame implements ActionListenerprivate JButton adminL
11、oginButton;private JButton zhucButton;private JButton loginButton;private JTextField idField;private JPasswordField passwordField;private JLabel showMessageLabel;private String title=登陆;private JPanel panel=null;/protected ImageIcon icon;public LoginView()/窗口属性设置this.setBounds(250, 80, 550,600); /ic
12、on=new ImageIcon(img/1.jpg);panel=new JPanel();panel.setLayout(null);panel.setBounds(250, 80, 600,650);/创建相应的组件adminLoginButton=new JButton(管理员登陆);JLabel welcomeLabel=new JLabel(欢迎使用信用卡网上管理模拟系统);showMessageLabel=new JLabel();JLabel nameLabel=new JLabel(账号);JLabel passwordLabel=new JLabel(密码);idField
13、=new JTextField();passwordField=new JPasswordField();zhucButton=new JButton(注册);loginButton=new JButton(登陆);/button.setIcon(new ImageIcon(button.getToolkit().getImage(F:MyEclipseabcdefgatmicon.png);/组件属性设置adminLoginButton.setBounds(390, 340, 120, 25);showMessageLabel.setBounds(100, 500, 500, 30);wel
14、comeLabel.setFont(new Font(隶书,Font.BOLD,30);welcomeLabel.setBounds(20, 50, 500, 60);nameLabel.setBounds(170,240,60,30);passwordLabel.setBounds(170, 290, 60, 30);idField.setBounds(205, 240, 180, 25);passwordField.setBounds(205, 290, 180, 25);zhucButton.setBounds(205, 340,60,25);loginButton.setBounds(
15、305, 340,60,25);passwordField.setEchoChar(*);/ 注册监听器adminLoginButton.addActionListener(this);zhucButton.addActionListener(this);loginButton.addActionListener(this);passwordField.addActionListener(this);/向面板中添加各个组件panel.add(adminLoginButton);panel.add(showMessageLabel);panel.add(welcomeLabel);panel.a
16、dd(nameLabel);panel.add(passwordLabel);panel.add(idField);panel.add(passwordField);panel.add(zhucButton);panel.add(loginButton);this.add(panel);this.addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)System.exit(0););this.setResizable(false);this.setVisible(true);/* * 事件处理
17、*/public void actionPerformed(ActionEvent e) if(JButton)e.getSource()=zhucButton)new zhucFram(新用户注册界面);else if(JButton)e.getSource()=loginButton)UserDAOImp userDao=new UserDAOImp();User user=new User();LoginService loginService=new LoginService();user.setId(idField.getText().trim();user.setPassword(
18、String.valueOf(passwordField.getPassword();User user1=userDao.findByIdAndPassword(user);System.out.println(user=+user.getPassword();try loginService.checkLoginInfo(user1);/用户登陆成功后得主界面new PtFram(用户登陆成功后的操作界面,user.getId().setVisible(true);this.setVisible(false);System.out.println(ghghj);JOptionPane.sh
19、owMessageDialog(null,登陆成功!,JOptionPane.DEFAULT_OPTION); catch (LoginInfoNotRightException e1)e1.printStackTrace();System.out.println(e.toString();showMessageLabel.setText(e.toString();else if(e.getSource()=adminLoginButton)if(admin.equals(idField.getText()&admin.equals(String.valueOf(passwordField.g
20、etPassword()/管理员注册成功后的主界面new GuanlFram( 管理员登陆成功后的操作界面).setVisible(true);this.setVisible(false); else showMessageLabel.setText(账号错或者密码错,请查找后重新登陆!);idField.setText(null);passwordField.setText(null);主界面截图:b.注册新用户界面public class zhucFram extends JFrame implements ActionListener Box basebox,box1,box2;Butt
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 信用卡 在线 管理 系统 32 DOC
限制150内