package com.hopu.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.hopu.dao.AccountDao;
import com.hopu.model.Account;
import com.hopu.model.Customer;
import com.opensymphony.xwork2.ActionContext;
@Controller
@Scope("prototype")
@Namespace("/user")
@ParentPackage("struts-default")
public class AccountAction {
@Autowired
private AccountDao dao;
/***
* 存款(数据回显)
*/
@Action(value = "update1", results = { @Result(name = "a", location = "/jsp/4.jsp") })
public String update1() {
HttpServletRequest request = ServletActionContext.getRequest();
String aid = request.getParameter("aid");
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list", list);
return "a";
}
/***
* 取款(数据回显)
*/
@Action(value = "update2", results = { @Result(name = "a", location = "/jsp/5.jsp") })
public String update2() {
HttpServletRequest request = ServletActionContext.getRequest();
String aid = request.getParameter("aid");
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list", list);
return "a";
}
/***
*转账(数据回显)
*/
@Action(value = "update3", results = { @Result(name = "a", location = "/jsp/6.jsp") })
public String update3() {
HttpServletRequest request = ServletActionContext.getRequest();
String aid = request.getParameter("aid");
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list",list);
//查账户表的全部账户
List<Account> list4 = dao.findAll(aid);
ActionContext.getContext().getValueStack().set("list4",list4);
return "a";
}
/***
*存款(修改)
*/
@Action(value = "update4", results = { @Result(name = "a", location = "/jsp/4.jsp") })
public String update4() {
HttpServletRequest request = ServletActionContext.getRequest();
String aid = request.getParameter("aid");
String cid = request.getParameter("cid");
String astate = request.getParameter("astate");
String apassword = request.getParameter("apassword");
//输入金额
String d1 = request.getParameter("d1");
//实际金额
String d2 = request.getParameter("d2");
double abalance1= Double.parseDouble(d1)+Double.parseDouble(d2);
String abalance= ""+abalance1;
Account account = new Account(Long.parseLong(aid), Long.parseLong(cid), Integer.parseInt(astate), Integer.parseInt(apassword),Double.parseDouble(abalance));
dao.update2(account);
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list",list);
//存入金额
ActionContext.getContext().getValueStack().set("d1",d1);
//当前余额
ActionContext.getContext().getValueStack().set("abalance",abalance);
ActionContext.getContext().getValueStack().set("u1","已成功存入");
ActionContext.getContext().getValueStack().set("u2","元,当前账户余额为");
ActionContext.getContext().getValueStack().set("u3","元");
return "a";
}
/***
*取款(修改)
*/
@Action(value = "update5", results = { @Result(name = "a", location = "/jsp/5.jsp") })
public String update5() {
HttpServletRequest request = ServletActionContext.getRequest();
String aid = request.getParameter("aid");
String cid = request.getParameter("cid");
String astate = request.getParameter("astate");
String apassword = request.getParameter("apassword");
//取出金额
String d1 = request.getParameter("d1");
//实际金额
String d2 = request.getParameter("d2");
if(Double.parseDouble(d1)<=Double.parseDouble(d2)){
double abalance1= Double.parseDouble(d2)-Double.parseDouble(d1);
String abalance= ""+abalance1;
Account account = new Account(Long.parseLong(aid), Long.parseLong(cid), Integer.parseInt(astate), Integer.parseInt(apassword),Double.parseDouble(abalance));
dao.update2(account);
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list",list);
//取出金额
ActionContext.getContext().getValueStack().set("d1",d1);
//当前余额
ActionContext.getContext().getValueStack().set("abalance",abalance);
ActionContext.getContext().getValueStack().set("u1","已成功取出");
ActionContext.getContext().getValueStack().set("u2","元,当前账户余额为");
ActionContext.getContext().getValueStack().set("u3","元");
}else{
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list",list);
ActionContext.getContext().getValueStack().set("u4","账户余额不足,请重新输入");
}
return "a";
}
/***
*转账(修改)
*/
@Action(value = "update6", results = { @Result(name = "a", location = "/jsp/6.jsp") })
public String update6() {
HttpServletRequest request = ServletActionContext.getRequest();
String aid = request.getParameter("aid");
String cid = request.getParameter("cid");
String astate = request.getParameter("astate");
String apassword = request.getParameter("apassword");
//输入金额
String d1 = request.getParameter("d1");
//实际金额
String d2 = request.getParameter("d2");
if(astate.equals(""+1)){
if(Double.parseDouble(d2)>Double.parseDouble(d1)){
double abalance1= Double.parseDouble(d2)-Double.parseDouble(d1);
//将double类型转换为String
String abalance= ""+abalance1;
Account account = new Account(Long.parseLong(aid), Long.parseLong(cid), Integer.parseInt(astate), Integer.parseInt(apassword),Double.parseDouble(abalance));
dao.update2(account);
/**
* 转入账户余额修改
*/
//String aid1 = request.getParameter("aid1");
//findAllA(aid1);
//查该条aid下的那一条数据
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list",list);
//存入金额
ActionContext.getContext().getValueStack().set("d1",d1);
//当前余额
ActionContext.getContext().getValueStack().set("abalance",abalance);
ActionContext.getContext().getValueStack().set("u1","已成功转账");
ActionContext.getContext().getValueStack().set("u2","元,当前账户余额为");
ActionContext.getContext().getValueStack().set("u3","元");
//查账户表的全部账户
List<Account> list4 = dao.findAll(aid);
ActionContext.getContext().getValueStack().set("list4",list4);
}else{
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list",list);
ActionContext.getContext().getValueStack().set("u4","账户余额不足,请重新输入");
//查账户表的全部账户
List<Account> list4 = dao.findAll(aid);
ActionContext.getContext().getValueStack().set("list4",list4);
}
}else{
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list",list);
ActionContext.getContext().getValueStack().set("u5","对方账户以被冻结,请查证后重新输入");
//查账户表的全部账户
List<Account> list4 = dao.findAll(aid);
ActionContext.getContext().getValueStack().set("list4",list4);
}
return "a";
}
/*public void findAllA( String aid1) {
String aid=aid1;
Account list = dao.update1(Long.parseLong(aid));
ActionContext.getContext().getValueStack().set("list",list);
System.out.println(a1);
}
*/
/**
* 页面跳转带aid
* @return
*/
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Java银行管理系统+MySQL.zip,含有代码注释,新手也可看懂,个人手打98分项目,导师非常认可的高分项目,毕业设计、期末大作业和课程设计高分必看,下载下来,简单部署,就可以使用。该项目可以直接作为毕设、期末大作业使用,代码都在里面,系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值,项目都经过严格调试,确保可以运行! Java银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJava银行管理系统+MySQL(高分期末大作业).zipJav
资源推荐
资源详情
资源评论






























收起资源包目录






























































共 45 条
- 1
资源评论


王二空间
- 粉丝: 9369
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 毕设&课设:智慧笔匠在线文档 第十三届“中国软件杯”大学生软件设计大赛 A10 在线编辑器赛道一等奖作品.zip
- 毕设&课设:智慧工地设计方案.zip
- 毕设&课设:智慧记单词,本科Android课程设计.zip
- 毕设&课设:智慧党建项目-中铁一局集团第五工程有限公司-中国兵器工业集团特种能源集团-中铁第一勘察设计院城建院-.zip
- Delphi 12 控件之Delphi-获得打印机列表&打印机状态&打印机详细信息源代码
- 毕设&课设:智慧社区党建积分——毕业设计Android端.zip
- 毕设&课设:智慧零工平台前端系统是一个基于uni-app框架开发的跨平台移动端应用,支持微信小程序和H5双端运行.zip
- 毕设&课设:智慧社区居家养老健康管理系统,计算机毕业设计,毕设,Java毕业设计,SpringBoot,SSM,.zip
- 毕设&课设:智慧社团(毕业设计).zip
- 毕设&课设:智慧外贸平台,计算机毕业设计,毕设,Java毕业设计,SpringBoot,SSM,小程序,Java.zip
- 毕设&课设:智慧图书管理系统设计与实现,计算机毕业设计,毕设,Java毕业设计,SpringBoot,SSM,小.zip
- 毕设&课设:智慧物业平台修改5.5小程序,计算机毕业设计,毕设,Java毕业设计,SpringBoot,SSM,.zip
- 毕设&课设:智慧物业平台小程序,计算机毕业设计,毕设,Java毕业设计,SpringBoot,SSM,小程序,J.zip
- 毕设&课设:智慧物流小程序,计算机毕业设计,毕设,Java毕业设计,SpringBoot,SSM,小程序,Jav.zip
- 毕设&课设:智慧校园云端管理系统的设计和实现.zip
- 毕设&课设:智慧校园管理系统小程序,计算机毕业设计,毕设,Java毕业设计,SpringBoot,SSM,小程序.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
