package com.evloution.datas.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.ibatis.annotations.Param;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.evloution.datas.domain.Account;
import com.evloution.datas.service.AccountService;
@Controller
@RequestMapping("/accountBank")
public class AccountController {
private Logger logger = Logger.getLogger(AccountController.class);
@Autowired
private AccountService accountService;
// 首页,用来测试的
@RequestMapping(value = "/accountList", method = RequestMethod.GET)
public String accountListController() {
return "accountList";
}
// 用户登录
@RequestMapping(value = "/accountLogin", method = RequestMethod.GET)
public String accountLoginController(String userAccount, String userPassword, Model model, HttpSession session,
HttpServletRequest request) {
String zhanghao = request.getParameter("userAccount");
String password = request.getParameter("userPassword");
logger.info("输入的账号:" + zhanghao + "\t" + "输入的密码:" + password);
Account account = accountService.accountLoginService(userAccount, userPassword);
logger.info("登录时的account------>" + account);
if (account != null) {
session.setAttribute("account", account);
// mv.setViewName("accountList");
// mv.setView(new RedirectView("accountList"));
logger.info("登录成功!");
return "redirect:accountList";
}
// mv.addObject("message", "登录名或者密码错误,请重新输入");
// mv.setViewName("accountLogin"); // 重新设置view视图页面
model.addAttribute("message", "账号或密码错误,请重新输入!");
logger.info("登录失败!");
return "accountLogin";
}
// 跳转到用户注册
@RequestMapping(value = "/toAccountInsert", method = RequestMethod.GET)
public String toAccountInsertController() {
logger.info("跳转节点,利用get方式请求到添加用户页面,方法是(toAccountInsertController)");
return "accountInsert";
}
// 用户注册
@RequestMapping(value = "/accountInsert", method = RequestMethod.GET)
public String accountInsertController(Account account) {
accountService.insertUserAccount(account);
logger.info("用户添加完成用get方式请求到登录页面");
return "redirect:accountLogin";
}
// 跳转到用户存款
@RequestMapping(value = "/toAccountSave", method = RequestMethod.GET)
public String toAccountSaveController(@Param("userAccount") String userAccount) {
logger.info("跳转节点,利用get方式请求到存款页面,方法是(toAccountSaveController)");
logger.info("存款时的账号是:" + userAccount);
accountService.selectUserAccountBalanceService(userAccount);
return "accountSave";
}
// 用户存款
@RequestMapping(value = "/accountSave", method = RequestMethod.GET)
public String accountSaveController(String userAccount, Float transactionMoney, Float accountBalance) {
logger.info("存款时的账号" + userAccount);
logger.info("------------------------");
logger.info("存款时输入的钱" + transactionMoney);
accountService.userAccountSave_Service(userAccount, transactionMoney, accountBalance);
logger.info("存款完成都以get方式请求到登录页面");
return "redirect:accountList";
}
// 跳转到用户取款
@RequestMapping(value = "/toAccountDraw", method = RequestMethod.GET)
public String toAccountDrawController(@Param("userAccount") String userAccount) {
logger.info("跳转节点,利用get方式请求到取款页面,方法是(toAccountDrawController)");
logger.info("取款时的账号是:" + userAccount);
accountService.selectUserAccountBalanceService(userAccount);
return "accountDraw";
}
// 用户取款
@RequestMapping(value = "/accountDraw", method = RequestMethod.GET)
public String accountDrawController(String userAccount, Float transactionMoney, Float accountBalance) {
logger.info("取款时的账号" + userAccount);
logger.info("------------------------");
logger.info("取款时输入的钱" + transactionMoney);
accountService.userAccountDraw_Service(userAccount, transactionMoney, accountBalance);
logger.info("取款完成都以get方式请求到登录页面");
return "redirect:accountList";
}
// 查询
@RequestMapping(value = "/accountQuery", method = RequestMethod.GET)
public String accountQueryController(@Param("userAccount") String userAccount) {
logger.info("查询时的账号是:" + userAccount);
accountService.selectUserAccountBalanceService(userAccount);
return "redirect:accountList";
}
// 跳转到用户转账界面
@RequestMapping(value = "/toAccountTransfer", method = RequestMethod.GET)
public String toAccountTransferController(@Param("userAccount") String userAccount) {
logger.info("跳转节点,利用get方式请求到转账页面,方法是(toAccountTransferController)");
logger.info("转账时的账号是:" + userAccount);
// 查询账号余额
accountService.selectUserAccountBalanceService(userAccount);
return "accountTransfer";
}
// 用户转账
@RequestMapping(value = "/accountTransfer", method = RequestMethod.GET)
public String accountTransferController(String userAccount, String receivableAccount, Float transactionMoney,
Float accountBalance) {
logger.info("转账时的账号" + userAccount);
logger.info("------------------------");
logger.info("收款账号" + receivableAccount);
logger.info("------------------------");
logger.info("转账时输入的钱" + transactionMoney);
// 查询收款账号状态
// logger.info("Controller中的收款账号: " + receivableAccount);
// accountService.selectReceivablesAccount_Service(receivableAccount);
// logger.info("Controller中的收款账号-------: " + receivableAccount);
// 查询收款账号余额
accountService.selectTransferAccountBalanceService(receivableAccount);
// 转账操作
accountService.userAccountTransfer_Service(userAccount, receivableAccount, transactionMoney, accountBalance);
// 收款操作
accountService.userAccountReceivables_Service(receivableAccount, userAccount, transactionMoney, accountBalance);
logger.info("转账完成都以get方式请求到登录页面");
return "redirect:accountList";
}
/**
*
* @param 跳转到用户改密验证界面
*/
@RequestMapping(value = "/accountChangePassword_Verification", method = RequestMethod.GET)
public String toAccountChangePassword(String userAccount, String userIdNumber, String userPhone,
HttpSession session, Model model, HttpServletRequest request) {
logger.info("验证时的账号" + userAccount);
String IdNumber = request.getParameter("userIdNumber");
String Phone = request.getParameter("userPhone");
Account account = accountService.select_UserIdNumber_UserPhone_Service(userAccount);
userIdNumber = account.getUserIdNumber();
userPhone = account.getUserPhone();
if (userIdNumber.equals(IdNumber) && userPhone.equals(Phone)) {
logger.info("验证成功!请修改密码!");
return "accountChangePassword";
}
model.addAttribute("message", "输入错误,请重新输入!");
logger.info("验证失败!");
return "accountChangePassword_Verification";
}
/**
*
* @param 跳转到用户改密界面
*/
@RequestMapping(value = "/accountChangePassword", method = RequestMethod.GET)
public String accountChangePassword(String userAccount, String userPassword) {
logger.info("修改密码的账号" + userAccount);
accountService.updateAccountPassword_Service(userAccount, userPassword);
logger.info("修改成功");
return "redirect:accountList";
}
/**
*
* @param 删除用户以及记录
*/
@RequestMapping(value = "/deleteUserAccount", method = RequestMethod.GET)
public String deleteUserAccountController(String userAccount) {
logger.info("销户账号是:" + userAccount);
accountService.deleteUserAccount_
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SSM+MySql模拟银行ATM机功能(可登陆).zip (74个子文件)
BankCloudServices
account_record_table.sql 654B
src
com
evloution
datas
dao
AccountDao.java 2KB
domain
Account.java 3KB
AccountRecord.java 2KB
controller
LoginInterceptor.java 2KB
AccountController.java 8KB
service
AccountService.java 1KB
AccountServiceImpl.java 5KB
.classpath 2KB
build
classes
com
evloution
datas
dao
AccountDao.class 2KB
domain
AccountRecord.class 3KB
Account.class 3KB
controller
LoginInterceptor.class 2KB
AccountController.class 8KB
service
AccountService.class 1023B
AccountServiceImpl.class 6KB
jdbc.properties 2KB
applicationContext.xml 4KB
mybatis
bankCloudServicesMapper.xml 6KB
log4j.properties 2KB
mybatis-config.xml 2KB
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 345B
org.eclipse.core.resources.prefs 159B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.component 580B
.jsdtscope 567B
org.eclipse.jdt.core.prefs 364B
WebContent
META-INF
MANIFEST.MF 39B
WEB-INF
views
datas
accountChangePassword.jsp 639B
accountInsert.jsp 904B
accountSave.jsp 664B
accountList.jsp 1KB
accountTransfer.jsp 764B
accountDraw.jsp 664B
accountLogin.jsp 728B
accountChangePassword_Verification.jsp 756B
lib
commons-dbcp-1.2.2.jar 119KB
org.springframework.web-3.0.5.RELEASE.jar 386KB
ojdbc7.jar 3.24MB
com.springsource.org.apache.commons.logging-1.1.1.jar 60KB
org.springframework.context-3.0.5.RELEASE.jar 653KB
mybatis-3.4.0.jar 1.52MB
mybatis
commons-dbcp-1.2.2.jar 119KB
ojdbc7.jar 3.24MB
mybatis-3.4.0.jar 1.52MB
org.springframework.transaction-3.0.5.RELEASE.jar 226KB
commons-pool-1.3.jar 61KB
mybatis-spring-1.3.0.jar 52KB
org.springframework.jdbc-3.0.5.RELEASE.jar 377KB
org.springframework.asm-3.0.5.RELEASE.jar 52KB
org.springframework.transaction-3.0.5.RELEASE.jar 226KB
junit-4.8.2.jar 232KB
org.springframework.expression-3.0.5.RELEASE.jar 166KB
org.springframework.web.servlet-3.0.5.RELEASE.jar 409KB
commons-pool-1.3.jar 61KB
jstl.jar 20KB
standard.jar 384KB
org.springframework.aop-3.0.5.RELEASE.jar 314KB
mysql-connector-java-5.1.26.jar 836KB
log4j-1.2.17.jar 478KB
org.springframework.beans-3.0.5.RELEASE.jar 542KB
mybatis-spring-1.3.0.jar 52KB
org.springframework.jdbc-3.0.5.RELEASE.jar 377KB
org.springframework.core-3.0.5.RELEASE.jar 373KB
bankCloudServices-servlet.xml 2KB
web.xml 2KB
.project 917B
config
jdbc.properties 2KB
applicationContext.xml 4KB
mybatis
bankCloudServicesMapper.xml 6KB
log4j.properties 2KB
mybatis-config.xml 2KB
transaction_record_table.sql 871B
共 74 条
- 1
资源评论
- qq_2491457282019-05-27还可以,有用
- a44711742019-06-24感谢楼主分享!资源不错
Evloution_
- 粉丝: 11
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功