ATM系统(JAVA)

您所在的位置:网站首页 atm取款系统代码 ATM系统(JAVA)

ATM系统(JAVA)

2023-10-14 00:49| 来源: 网络整理| 查看: 265

概述 课程设计概述

物联网工程实训III是在数据结构、面向对象程序设计、计算机网络等课程的基础上进行的一次综合性系统开发实践,实训任务是完成一个C/S结构的ATM系统。

课程设计主要内容

本次课程设计报告的主要内容包括以下几点:

(1)对于所设计软件的需求分析。

(2)搭建开发环境、测试环境。

(3)基本功能的实现。

(4)思考总结开发过程中的问题和想法,在此基础上考虑软件的可扩展性和性能优化。

系统设计 系统技术架构

 

说明:

表示层:通过Windows应用程序实现存款、取款、转账及查询子系统功能

业务逻辑层:其中包含ATM系统及Java开发平台

数据访问层:业务逻辑层通过接口访问数据库

数据库:其中包含用户的账户信息、存款数据信息以及交易数据信息

系统功能设计

利用swing,数据库,网络编程实现银行账户的登录,退出,存款,取钱,转账。

系统类图类图综述

该类图描绘了ATM系统涉及的主要实体之间的交互,表明了ATM系统的功能。

类描述

类名:客户

类的整体描述:该类保存客户的基本信息以及对应的操作,从用户类继承而来。

属性说明:

1.属性名:姓名,属性类型:String,可见性:private

2.属性名:卡号,属性类型:String,可见性:private

操作说明:

1.操作名:登录,用于执行登录操作,可见性:public,返回类型:Boolean

2.操作名:取款,用于执行取款操作,可见性:public,返回类型:Boolean

3.操作名:存款,用于执行存款操作,可见性:public,返回类型:Boolean

4.操作名:查询余额,用于执行查询余额操作,可见性:public,返回类型:Boolean

5..操作名:转账,用于执行转账操作,可见性:public,返回类型:Boolean

6.操作名:打印报表,用于执行打印报表操作,可见性:public,返回类型:Boolean

关系说明:该类继承自用户类,与报表类,现金类,银行账户类有关联

继承说明

CommonAtmVO 继承了Serializable接口,CommonResult继承了Serializable接口,CustomerInfo继承了 Serializable,LoopReceiver继承了Thread,StrategyDepositImpl继承了IStrategy接口,StrategyLoginImpl继承了IStrategy接口,StrategyLogoutImpl继承了IStrategy接口,StrategyTransferImpl继承了IStrategy接口,StrategyTransferOutterImpl 继承了 IStrategy接口,StrategyWithdrawImpl继承了 IStrategy接口,LoginFrame继承了JFrame

类图

 

 

  数据库设计   

2.4.1 ATM机系统E-R图

 

账户实体包括:银行卡号(cardNmber)、证明号(certifyNumber)、账户人姓名(customerName)、密码(password)、余额(remainMoney)、创户日期(createDate )、银行类型(createCardBank)、账户状态(status)操作记录实体包括:记录表号(charged)(自增)、操作时间(chargeTime)、操作的金额(chargeMoney)、账户人姓名(customerName)、银行卡号(cardNumber )、操作类型(chargeType),对本次操作进行解释(取钱,存钱(活期、一年定期和两年定期),行内转账,行外转账,总利息加入余额)、余额(remainMoney),操作后账户上的余额、存款类型(savetype)操作日志信息实体包括:操作日志表编号(logid)、操作描述(loginfo)、本次操作状态(logtype)、操作日期(logtime)、操作人卡号(operateUser)、操作类型(status)利息记录实体包括:记录编号(id)、卡号(cardNumber)、利息(profit_value)、账户余额(remainMoney),没加本季利息、计算的利率(computed_profit)、计算时间(computed_time)、是否加入余额(is_computed)存款类型实体包括:存款对应的编号(id)、存款类型名称(profitName)、利率(profit)、存款天数(saveDays)

根据E-R图,制作数据库中的表如下:

(1)t_charge_record

对每次操作进行记录的表(取钱,存钱,行内转账,行外转账,总利息加入余额)

 

(2)t_customer_info

账户信息表

 

(3)t_log_info

操作日志表

 

(4)t_profit_record

利息记录表

 

(5)t_profit_type

存款类型信息

 

 

2.4.2模块算法流程图

以登陆模块为例:

 

主菜单模块:

 

存款模块:

 

取款模块:

 

转账模块:

 

系统实现 系统界面

3.1.1登录界面

登陆页面,有客户的输入账号密码的两个输入框,客户输入身份验证,验证正确无误方可登录到账户进行相关操作,否则跳出密码错误的提醒窗口,客户需重新输入密码或者直接退出。

 

3.1.2主界面

 

 

主界面,登录之后就显示账户,姓名,余额,有查询余额,存钱,转账,取款,退出,交易记录点击之后跳转到相应的界面可以进行相应的操作,如若需要再换一个账户则需要点击退出,再次登录。

3.1.3存款界面

 

存款界面,有账户,姓名,余额,存款金额,在存款金额框里输入要存的金额,之后点击确定,余额就把存入的金额加入了。

3.1.4取款界面

 

取款界面,有账户,姓名,余额,取款金额,取款密码,在取款金额框里输入要取的金额,再输入密码之后点击确定,余额就把取出的金额扣除了。

3.1.5转账界面

 

转账界面,有账号,账户名称,当前余额,对方账户,转账金额,取款密码,行内转账和行外转账两个选项,在对方账号输入要转给的账号,转账金额输入转出的金额,取款密码输入转出方的密码,提交之后钱就转出了账户转入到对方账户上了。

3.1.6交易记录界面

交易记录界面可以把每次的操作记录下来放在数据库里面。

系统程序实现

package com.simple.atm.service;

import com.simple.atm.dao.LogDao;

import com.simple.atm.dao.TransDao;

import com.simple.atm.entity.CommonResult;

import com.simple.atm.entity.LogInfo;

import com.simple.atm.util.DataGenerateUtil;

import com.simple.atm.util.StatusEnumEntity;

public class BankAtmService {

      TransDao transDao = new TransDao();

      LogDao logDao = new LogDao();

     

      public CommonResult transferBank(String fromAccountInfo,String toAccountInfo,

                    double transferMoney,String confirmPwd) {

             CommonResult commonResult = new CommonResult();

             int generateKey = -1;

             LogInfo logInfo = new LogInfo();

            

             generateKey = transDao.transferBank(fromAccountInfo, toAccountInfo, transferMoney, confirmPwd);

            

             if(generateKey > 0 ) {

                    commonResult.setMessage("行内转帐成功");

                    commonResult.setStatus(true);

                    commonResult.setId(generateKey);

                   

                    logInfo = new LogInfo("行内转帐,金额:"+transferMoney,

                                  StatusEnumEntity.getValue("SUCCESS_LOG"),

                                  DataGenerateUtil.dateStringGenerate(),

                                  fromAccountInfo,

                                  StatusEnumEntity.getValue("STATUS_INTRANSFER"));

                    logDao.recordLog(logInfo);

                   

             }else {

                    commonResult.setMessage("行内转帐失败");

                    commonResult.setStatus(false);

                    commonResult.setId(generateKey);

                   

                    logInfo = new LogInfo("行内转帐,金额:"+transferMoney,

                                  StatusEnumEntity.getValue("EXCEPTION_LOG"),

                                  DataGenerateUtil.dateStringGenerate(),

                                  fromAccountInfo,

                                  StatusEnumEntity.getValue("STATUS_INTRANSFER"));

                    logDao.recordLog(logInfo);

             }

            

             return commonResult;

      }

     

      public CommonResult transferOutterBank(String fromAccountInfo,String toAccountInfo,

                    double transferMoney,String confirmPwd) {

             CommonResult commonResult = new CommonResult();

             int generateKey = -1;

             LogInfo logInfo = new LogInfo();

            

             generateKey = transDao.transferOutterBank(fromAccountInfo, toAccountInfo, transferMoney, confirmPwd);

            

             if(generateKey > 0 ) {

                    commonResult.setMessage("跨行转帐成功");

                    commonResult.setStatus(true);

                    commonResult.setId(generateKey);

                   

                    logInfo = new LogInfo("跨行转帐,金额:"+transferMoney,

                                  StatusEnumEntity.getValue("SUCCESS_LOG"),

                                  DataGenerateUtil.dateStringGenerate(),

                                  fromAccountInfo,

                                  StatusEnumEntity.getValue("STATUS_OUTTRANSFER"));

                    logDao.recordLog(logInfo);

                   

             }else {

                    commonResult.setMessage("跨行转帐失败");

                    commonResult.setStatus(false);

                    commonResult.setId(generateKey);

                   

                    logInfo = new LogInfo("跨行转帐,金额:"+transferMoney,

                                  StatusEnumEntity.getValue("EXCEPTION_LOG"),

                                  DataGenerateUtil.dateStringGenerate(),

                                  fromAccountInfo,

                                  StatusEnumEntity.getValue("STATUS_OUTTRANSFER"));

                    logDao.recordLog(logInfo);

             }

            

             return commonResult;     

      }

      //取钱

             public CommonResult withdrawMoney(String accountInfo,double withdrawMoney) {

                    CommonResult commonResult = new CommonResult();

                    int generateKey = -1;

                    LogInfo logInfo = new LogInfo();

                    System.out.println("sssa");

                    generateKey = transDao.withdraw(accountInfo, withdrawMoney);

                    System.out.println(generateKey);

                    if(generateKey > 0 ) {

                           commonResult.setMessage("取钱成功!");

                           commonResult.setStatus(true);

                           commonResult.setId(generateKey);

                          

                           logInfo = new LogInfo("取出金额:"+ withdrawMoney,

                                         StatusEnumEntity.getValue("SUCCESS_LOG"),

                                         DataGenerateUtil.dateStringGenerate(),

                                         accountInfo,

                                         StatusEnumEntity.getValue("STATUS_WITHDRAW"));

                           logDao.recordLog(logInfo);

                          

                    }else {

                           commonResult.setMessage("取钱失败!");

                           commonResult.setStatus(false);

                           commonResult.setId(generateKey);

                          

                           logInfo = new LogInfo("存储金额:"+withdrawMoney,

                                         StatusEnumEntity.getValue("EXCEPTION_LOG"),

                                         DataGenerateUtil.dateStringGenerate(),

                                         accountInfo,

                                         StatusEnumEntity.getValue("STATUS_WITHDRAW"));

                           logDao.recordLog(logInfo);

                    }

                   

                    return commonResult;     

             }

             //存钱

                           public CommonResult depositMoney(String accountInfo,double depositMoney) {

                                  CommonResult commonResult = new CommonResult();

                                  int generateKey = -1;

                                  LogInfo logInfo = new LogInfo();

                                 

                                  generateKey = transDao.deposit(accountInfo, depositMoney);

                                 

                                  if(generateKey > 0 ) {

                                         commonResult.setMessage("存钱成功!");

                                         commonResult.setStatus(true);

                                         commonResult.setId(generateKey);

                                        

                                         logInfo = new LogInfo("存储金额:"+ depositMoney,

                                                       StatusEnumEntity.getValue("SUCCESS_LOG"),

                                                       DataGenerateUtil.dateStringGenerate(),

                                                       accountInfo,

                                                       StatusEnumEntity.getValue("STATUS_SAVE"));

                                         logDao.recordLog(logInfo);

                                        

                                  }else {

                                         commonResult.setMessage("存钱失败!");

                                         commonResult.setStatus(false);

                                         commonResult.setId(generateKey);

                                        

                                         logInfo = new LogInfo("存储金额:"+depositMoney,

                                                       StatusEnumEntity.getValue("EXCEPTION_LOG"),

                                                       DataGenerateUtil.dateStringGenerate(),

                                                       accountInfo,

                                                       StatusEnumEntity.getValue("STATUS_SAVE"));

                                         logDao.recordLog(logInfo);

                                  }

                                 

                                  return commonResult;     

                           }

}



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3