package com.jkj.books.struts.action;
import java.sql.Timestamp;
import java.util.List;
import com.jkj.books.biz.BookBiz;
import com.jkj.books.entity.ReaderFee;
import com.jkj.books.entity.Record;
import com.jkj.books.entity.SystemBooks;
import com.jkj.books.entity.SystemReaders;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
public class BookAction extends ActionSupport implements
ModelDriven<SystemBooks> {
/**
*
*/
private static final long serialVersionUID = 8160933970416306626L;
private int bookid;
BookBiz bookbiz;
private SystemBooks book = new SystemBooks();
private Record record = new Record();
private ReaderFee fee=new ReaderFee();
public Record getRecord() {
return record;
}
public void setRecord(Record record) {
this.record = record;
}
public ReaderFee getFee() {
return fee;
}
public void setFee(ReaderFee fee) {
this.fee = fee;
}
public void setBookbiz(BookBiz bookbiz) {
this.bookbiz = bookbiz;
}
public SystemBooks getModel() {
// TODO Auto-generated method stub
return book;
}
public int getBookid() {
return bookid;
}
public void setBookid(int bookid) {
this.bookid = bookid;
}
// 选书操作
public String doSelect() {
ActionContext context = ActionContext.getContext();
context.getSession().get("loginUser");
Timestamp now = new Timestamp(System.currentTimeMillis());//获取当前时间
SystemReaders reader = (SystemReaders) context.getSession().get(
"loginUser");// SystemReaders
//
book = (SystemBooks) bookbiz.searchBookById(book.getBookid());//通过Id获取book
Timestamp borrowdate = now;// 借阅时间
Timestamp returndate = null;// 归还时间:未归还
int isback = 0;// 状态0:未归还
Record record = new Record(reader, book, borrowdate, returndate, isback);
book.setIsborrowed(1);
bookbiz.doUpdate(book, record);
return "Message";
}
public String doReturn() {
ActionContext context = ActionContext.getContext();
context.getSession().get("loginUser");// SystemReaders
Timestamp now = new Timestamp(System.currentTimeMillis());
book = (SystemBooks) bookbiz.searchBookById(book.getBookid());// SystemBooks
record = bookbiz.searchRecordByBookid(book.getBookid());
int id = record.getId();
Timestamp borrowdate = record.getBorrowdate();// 借阅时间
Timestamp returndate = now;// 归还时间
int isback = 1;// 状态1:归还
record = bookbiz.searchRecordById(id);
if (bookbiz.getOverDate(borrowdate, returndate) < 30) {
record.setBorrowdate(borrowdate);
record.setReturndate(returndate);
book.setIsborrowed(0);
record.setIsback(isback);
bookbiz.doReturn(book, record);
return "Message";
}else {
record.setBorrowdate(borrowdate);
record.setReturndate(returndate);
book.setIsborrowed(1);
record.setIsback(0);
bookbiz.doReturn(book, record);
return "tofee";
}
}
//
public String toFee(){
ActionContext context = ActionContext.getContext();
context.getSession().get("loginUser");// SystemReaders
book = (SystemBooks) bookbiz.searchBookById(book.getBookid());// SystemBooks
record = bookbiz.searchRecordByBookid(book.getBookid());
int id = record.getId();
record=bookbiz.searchRecordById(id);//得到该条记录
//得到超期时长
int overday=bookbiz.getOverDate(record.getBorrowdate(), record.getReturndate())-30;
Double overfee=0.5*overday;//超期费用,每日0.5元
fee.setBookfee(overfee);
fee.setOvertime(overday);
fee.setBookname(record.getSystemBooks().getBookname());
fee.setSystemBooks(record.getSystemBooks());
fee.setReadername(record.getSystemReaders().getReadername());
fee.setSystemReaders(record.getSystemReaders());
bookbiz.doFee(fee);//插入罚款表
book.setIsborrowed(0);
bookbiz.doReturn(book, record);
return showFee();
}
public String showFee(){
ActionContext context = ActionContext.getContext();
context.getSession().get("loginUser");// SystemReaders
book = (SystemBooks) bookbiz.searchBookById(book.getBookid());// SystemBooks
fee=bookbiz.searchFeeByBookid(book.getBookid());
int feeid=fee.getFeeId();
List<ReaderFee> fee=bookbiz.showFee(feeid);
context.put("fee",fee);
return "showfee";
}
public String doFee(){
ActionContext context = ActionContext.getContext();
context.getSession().get("loginUser");// SystemReaders
book = (SystemBooks) bookbiz.searchBookById(book.getBookid());// SystemBooks
record = bookbiz.searchRecordByBookid(book.getBookid());
int id = record.getId();
record=bookbiz.searchRecordById(id);//得到该条记录
record.setIsback(1);
bookbiz.doReturn(book, record);
return "Message";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
管理员的用户名110110,密码123 具体实现的有: (1)管理读者的基本信息:读者姓名、性别、学号等。 (2)管理书籍的基本信息:图书名称、图书编号、作者、出版社、单价、存在状态(借出/库存)、存放地点,若已借出,则为归还时间等。 (3)对新进图书进行录入,包括图书的基本信息。 (4)支持读者查询图书的基本信息。 (5)对撤销的图书信息进行删除。 (6)为读者办理注册,包括读者的基本信息。 (7)为读者办理借出手续(非注册者不能借书)。 (8)若读者借书到期未还,要对读者进行罚款,并记录读者的不良记录。
资源推荐
资源详情
资源评论
收起资源包目录
基于MyEclipse 的图书管理系统 (182个子文件)
BookAction.class 6KB
ReaderAction.class 5KB
ReaderBizImpl.class 5KB
AdminAction.class 4KB
BookBizImpl.class 3KB
SystemBooks.class 3KB
BaseHibDao.class 3KB
AdminBookAction.class 3KB
SystemReaders.class 3KB
BookDaoImpl.class 3KB
ReaderFee.class 3KB
AdminBizImpl.class 2KB
Record.class 2KB
ReaderDaoImpl.class 2KB
BookStyle.class 1KB
AdminDaoImpl.class 1KB
SystemAdmin.class 1KB
BookDao.class 1KB
ReaderBiz.class 1KB
ReaderDao.class 780B
BookBiz.class 708B
AdminDao.class 413B
AdminBiz.class 362B
.classpath 623B
org.eclipse.wst.common.component 453B
org.eclipse.wst.jsdt.ui.superType.container 49B
project.css 100KB
login.css 3KB
login.gif 370B
reset.gif 359B
hibernate3.jar 2.31MB
aspectjweaver-1.6.9.jar 1.59MB
jsf-impl.jar 1.15MB
dwr.jar 1.13MB
xwork-core-2.2.1.jar 997KB
freemarker-2.3.16.jar 860KB
mysql-connector-java-5.1.22-bin.jar 813KB
org.springframework.context-3.1.1.RELEASE.jar 812KB
struts2-core-2.2.1.jar 755KB
mysql-connector-java-5.1.10-bin.jar 707KB
struts2-embeddedjsp-plugin-2.2.1.jar 662KB
c3p0-0.9.1.2.jar 596KB
javassist-3.9.0.GA.jar 583KB
org.springframework.beans-3.1.1.RELEASE.jar 576KB
org.springframework.web.servlet-3.1.1.RELEASE.jar 560KB
commons-collections-3.2.jar 558KB
commons-collections-3.1.jar 546KB
org.springframework.web-3.1.1.RELEASE.jar 532KB
javassist-3.7.ga.jar 531KB
spring-beans-2.5.6.jar 477KB
log4j-1.2.16.jar 470KB
spring-context-2.5.6.jar 466KB
org.springframework.core-3.1.1.RELEASE.jar 439KB
antlr-2.7.6.jar 433KB
jstl-1.2.jar 405KB
org.springframework.jdbc-3.1.1.RELEASE.jar 395KB
org.springframework.orm-3.1.1.RELEASE.jar 370KB
log4j-1.2.14.jar 359KB
org.springframework.aop-3.1.1.RELEASE.jar 324KB
cglib-nodep-2.2.jar 315KB
jsf-api.jar 314KB
dom4j-1.6.1.jar 307KB
commons-httpclient-3.1.jar 298KB
spring-core-2.5.6.jar 279KB
commons-lang-2.5.jar 273KB
cglib-2.2.jar 272KB
org.springframework.transaction-3.1.1.RELEASE.jar 241KB
commons-lang-2.3.jar 240KB
ognl-3.0.jar 224KB
ehcache-1.2.3.jar 203KB
org.springframework.jms-3.1.1.RELEASE.jar 195KB
spring-web-2.5.6.jar 190KB
org.springframework.web.portlet-3.1.1.RELEASE.jar 186KB
commons-beanutils-1.7.0.jar 184KB
org.springframework.expression-3.1.1.RELEASE.jar 172KB
commons-dbcp-1.4.jar 157KB
commons-digester-2.0.jar 145KB
commons-validator-1.3.1.jar 136KB
json-lib-2.1-jdk15.jar 122KB
org.springframework.context.support-3.1.1.RELEASE.jar 105KB
commons-pool-1.5.3.jar 94KB
commons-chain-1.2.jar 90KB
commons-io-1.3.2.jar 86KB
org.springframework.oxm-3.1.1.RELEASE.jar 71KB
struts2-convention-plugin-2.2.1.jar 64KB
oro-2.0.8.jar 64KB
commons-logging-1.1.1.jar 59KB
commons-fileupload-1.2.1.jar 56KB
struts2-json-plugin-2.2.1.jar 55KB
commons-fileupload-1.2.jar 52KB
org.springframework.asm-3.1.1.RELEASE.jar 52KB
org.springframework.aspects-3.1.1.RELEASE.jar 49KB
commons-logging-api-1.1.jar 44KB
commons-logging-1.0.4.jar 37KB
classworlds-1.1.jar 37KB
jaxr-api.jar 31KB
org.springframework.web.struts-3.1.1.RELEASE.jar 31KB
sslext-1.2-0.jar 26KB
slf4j-api-1.5.8.jar 23KB
struts2-spring-plugin-2.2.1.jar 21KB
共 182 条
- 1
- 2
资源评论
- elvisyyh2018-06-10可以 可以 可以
wilber_meng
- 粉丝: 2
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功