技术微信:375279829 欢迎来到【毕业设计资料-计算机毕业设计源码网】官网!
您的位置:您的位置:主页 > 作品中心 > Java毕业设计

我爱读书”图书阅读分享平台的设计与实现

技术微信:375279829

本课题包括源程序、数据库、论文、运行软件、运行教程

毕业设计资料-计算机毕业设计源码网:我们提供的源码通过邮箱或者QQ微信传送,如果有啥问题直接联系客服

包在您电脑上运行成功

语言:Java

数据库:MySQL

框架:ssm、springboot、mvc

课题相关技术、功能详情请联系技术

作品描述
“我爱读书”图书阅读分享平台的设计与实现

本课题是一个基于基于web ,采用B/S结构、数据库或其它设计工具,开发的一个能够独立运行的图书阅读分享平台。
该平台系统需要具备用户管理、个人图书库、好书推荐、阅读能手、系统管理等功能。要求界面简洁,功能实用,操作方便。
本系统实现的主要功能模块包括:

1、用户管理模块:简单有效安全的实现用户注册登录功能。
2、个人图书库模块:分类管理用户个人已有图书和已读图书信息。
3、好书推荐模块:平台根据用户的年龄和爱好推荐好书和相关评价。
4、阅读能手模块:统计范围内用户阅读量排名等信息。
5、系统管理模块:对后台数据信息等维护管理。

需要代码段如下:
用户登入注册及我的信息里修改信息代码

登录:
public String userLogin()
{
String sql="from TUser where userName=? and userPw=?";
Object[] con={userName,userPw};
List userList=userDAO.getHibernateTemplate().find(sql,con);
if(userList.size()==0)
{
this.setMessage("用户名或密码错误");
this.setPath("qiantai/default.jsp");
}
else
{
Map session= ServletActionContext.getContext().getSession();
TUser user=(TUser)userList.get(0);
session.put("user", user);
session.put("userid", user.getUserId());
session.put("userjifen", user.getUserJifen());
session.put("username", user.getUserName());
session.put("userage", user.getUserAge());
session.put("userman", user.getUserMan());
 
 
this.setMessage("成功登录");
this.setPath("qiantai/default.jsp");
}
return "succeed";
}


注册
public String userReg()
{
TUser user=new TUser();
user.setUserName(userName);
user.setUserPw(userPw);
user.setUserAddress(userAddress);
user.setUserTel(userTel);
user.setUserRealname(userRealname);
user.setUserEmail(userEmail);
user.setUserSex(userSex);
user.setUserAge(userAge);
        user.setUserMan(userMan);
        user.setUserPic(userPic);
user.setUserDel("no");
userDAO.save(user);
Map session= ServletActionContext.getContext().getSession();
session.put("user", user);
return "successAdd";
}

我的信息里修改信息
public String userEdit()
{
TUser user=userDAO.findById(userId);
user.setUserName(userName);
user.setUserPw(userPw);
user.setUserAddress(userAddress);
user.setUserTel(userTel);
user.setUserRealname(userRealname);
user.setUserEmail(userEmail);
user.setUserSex(userSex);
user.setUserAge(userAge);
        user.setUserMan(userMan);
        user.setUserPic(userPic);
user.setUserDel("no");
userDAO.attachDirty(user);
Map session= ServletActionContext.getContext().getSession();
session.put("user", user);
session.put("userid", user.getUserId());
session.put("userjifen", user.getUserJifen());
session.put("username", user.getUserName());
session.put("userage", user.getUserAge());
session.put("userman", user.getUserMan());

return "successAdd";
}



添加图书
public String bookinfoNAdd()
{
TBookinfo bookinfo=new TBookinfo();
bookinfo.setBookinfoCatelogId(bookinfoCatelogId);
bookinfo.setBookinfoName(bookinfoName);
bookinfo.setBookinfoMiaoshu(bookinfoMiaoshu);
bookinfo.setBookinfoPic(fujian);
bookinfo.setBookinfoFavs(bookinfoFavs);
bookinfo.setBookinfoLeibie(bookinfoLeibie);

    bookinfo.setBookinfoMaterial(bookinfoMaterial);
bookinfo.setBookinfoStatus("no");
        
Map session= ServletActionContext.getContext().getSession();
TUser user=(TUser)session.get("user");
        
bookinfo.setBookinfoUser(user.getUserId());
bookinfo.setBookinfoDel("no");

bookinfoDAO.save(bookinfo);
this.setMessage("操作成功");
this.setPath("bookinfoMyList.action");
return "succeed";

}



个人书库
public String bookinfoMyList()
{
            Map session= ServletActionContext.getContext().getSession();
TUser user=(TUser)session.get("user");
                
String sql="from TBookinfo where bookinfoDel='no' and bookinfoUser="+user.getUserId()+" order by bookinfoId";
List bookinfoList=bookinfoDAO.getHibernateTemplate().find(sql);
         int listSize=bookinfoList.size();
int fromIndex = (pageNow - 1) * pageSize;
int toIndex = Math.min(fromIndex + pageSize, listSize);
pageTotle = listSize%pageSize==0?listSize/pageSize:listSize/pageSize+1 ;

bookinfoList = bookinfoList.subList(fromIndex, toIndex);
for(int i=0;i<bookinfoList.size();i++)
{
TBookinfo bookinfo=(TBookinfo)bookinfoList.get(i);
System.out.println(bookinfo.getBookinfoCatelogId());
bookinfo.setBookinfoCatelogName(catelogDAO.findById(bookinfo.getBookinfoCatelogId()).getCatelogName());
}
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("bookinfoList", bookinfoList);
return ActionSupport.SUCCESS;
}


已读图书
public String bookinfoMyItem()
{
Map request=(Map)ServletActionContext.getContext().get("request");
                
                Map session= ServletActionContext.getContext().getSession();
TUser user=(TUser)session.get("user");
                
                String sql="from TOrderItem where userId="+user.getUserId()+" order by orderItemId";
List orderItemList=orderItemDAO.getHibernateTemplate().find(sql);
        int listSize=orderItemList.size();
int fromIndex = (pageNow - 1) * pageSize;
int toIndex = Math.min(fromIndex + pageSize, listSize);
pageTotle = listSize%pageSize==0?listSize/pageSize:listSize/pageSize+1 ;

orderItemList = orderItemList.subList(fromIndex, toIndex);
                for(int i=0;i<orderItemList.size();i++)
{
TOrderItem orderItem=(TOrderItem)orderItemList.get(i);
//System.out.println(orderItem.getBookinfoId());
orderItem.setBookinfo(bookinfoDAO.findById(orderItem.getBookinfoId()));
}
                
request.put("orderItemList", orderItemList);
                
                
return ActionSupport.SUCCESS;
}


图书评价
    public String discussAdd()
{
TDiscuss discuss=new TDiscuss();
discuss.setDiscussContent(discussContent);
//discuss.setDiscussTitle(discussTitle);
discuss.setDiscussDate(new Date().toLocaleString());
        discuss.setBookinfoId(bookinfoId);
        
Map session=ServletActionContext.getContext().getSession();

if(session.get("user")!=null)
{
TUser user=(TUser)session.get("user");
discuss.setDiscussUser(user.getUserId());
}


discussDAO.save(discuss);
this.setMessage("操作成功");
this.setPath("bookinfoDetail.action?bookinfoId="+bookinfoId);
return "succeed";
}



图书推荐
<%
        String userage= session.getAttribute("userage").toString();
        String userman= session.getAttribute("userman").toString();
        
  
String sql="select t_bookinfo.* from t_bookinfo left join t_catelog on t_catelog.catelog_id=t_bookinfo.bookinfo_catelog_id where t_catelog.catelog_name='"+ userman +"' and t_bookinfo.bookinfo_leibie='"+ userage +"'  ";
ResultSet rs = db1.executeQuery(sql);
System.out.println(sql);

while(rs.next())
                  {
  %>
  
  <tr align='center' bgcolor="#FFFFFF" height="22">
  <td><%= rs.getString("bookinfo_name") %></td>
  <td><%= userman %><br/></td>
  
  <td><a href="<%=path %>/bookinfoDetail.action?bookinfoId=<%= rs.getString("bookinfo_id") %>"> <img src="<%=path %><%= rs.getString("bookinfo_pic") %>" width="60" height="60" border="0"/> </a></td>
  <td><a href="<%=path %>/bookinfoDetail.action?bookinfoId=<%= rs.getString("bookinfo_id") %>">查看详细</a></td>
  </tr>
<%
}
rs.close();
%>


阅读排名
public String bookinfoAllYesT()
{
        Map request=(Map)ServletActionContext.getContext().get("request");


String sql="from TBookinfo where bookinfoDel='no' and bookinfoStatus='yes' order by bookinfoFavs desc";
List bookinfoYesTejiaList=bookinfoDAO.getHibernateTemplate().find(sql);
        int listSize=bookinfoYesTejiaList.size();
int fromIndex = (pageNow - 1) * pageSize;
int toIndex = Math.min(fromIndex + pageSize, listSize);
pageTotle = listSize%pageSize==0?listSize/pageSize:listSize/pageSize+1 ;

bookinfoYesTejiaList = bookinfoYesTejiaList.subList(fromIndex, toIndex);
request.put("bookinfoYesTejiaList", bookinfoYesTejiaList);
return ActionSupport.SUCCESS;
}


我爱阅读数量增加
 public String userAddBookinfo(int userId, int bookinfoId) {
        String result = "no";
//        Map session= ServletActionContext.getContext().getSession();
// TUser user=(TUser)session.get("user");
//         int userId= user.getUserId();
        String sql = "from TOrderItem where userId=? and bookinfoId=?";

        Object con[] = {userId, bookinfoId};

        List list = orderItemDAO.getHibernateTemplate().find(sql, con);
        if (list.size() == 0) {
            TOrderItem orderItem = new TOrderItem();
            orderItem.setUserId(userId);
            orderItem.setBookinfoId(bookinfoId);
            orderItem.setOrderItemStatus("已读");
            orderItemDAO.save(orderItem);
            
            TBookinfo bookinfo = bookinfoDAO.findById(bookinfoId);
            bookinfo.setBookinfoFavs(bookinfo.getBookinfoFavs()+1);
            bookinfoDAO.attachDirty(bookinfo);
            DB sqlherper=new DB();
            
            WebContext ctx = WebContextFactory.get(); 
HttpSession session=ctx.getSession(); 
            String sql2="update t_user set user_jifen=user_jifen+1 where user_id="+session.getAttribute("userid");
            sqlherper.executeMysql(sql2);
            System.out.println(sql2);
            
            result = "yes";
        }
        if (list.size() > 0) {
            //result = "no";
            TOrderItem orderItem = new TOrderItem();
            orderItem.setUserId(userId);
            orderItem.setBookinfoId(bookinfoId);
            orderItem.setOrderItemStatus("已读");
            orderItemDAO.save(orderItem);
            
            TBookinfo bookinfo = bookinfoDAO.findById(bookinfoId);
            bookinfo.setBookinfoFavs(bookinfo.getBookinfoFavs()+1);
            bookinfoDAO.attachDirty(bookinfo);
            DB sqlherper=new DB();
            
            WebContext ctx = WebContextFactory.get(); 
HttpSession session=ctx.getSession(); 
            String sql2="update t_user set user_jifen=user_jifen+1 where user_id="+session.getAttribute("userid");
            sqlherper.executeMysql(sql2);
            System.out.println(sql2);
            
            result = "yes";
        }

        return result;
    }



管理员登入

if(userType==0)//系统管理员登陆
{
String sql="from TAdmin where userName=? and userPw=?";
Object[] con={userName,userPw};
List adminList=adminDAO.getHibernateTemplate().find(sql,con);
if(adminList.size()==0)
{
result="no";
}
else
{
WebContext ctx = WebContextFactory.get(); 
HttpSession session=ctx.getSession(); 
TAdmin admin=(TAdmin)adminList.get(0);
session.setAttribute("userType", 0);
             session.setAttribute("admin", admin);
             result="yes";
}
}
修改个人密码

    public String adminPwEdit(String userPwNew)
    {
System.out.println("DDDD");
    try 
{
Thread.sleep(700);

catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
WebContext ctx = WebContextFactory.get(); 
HttpSession session=ctx.getSession(); 
 
TAdmin admin=(TAdmin)session.getAttribute("admin");
admin.setUserPw(userPwNew);

adminDAO.getHibernateTemplate().update(admin);
session.setAttribute("admin", admin);

return "yes";
    }


会员信息管理删除
管理
public String userMana()
{
List userList=userDAO.findAll();
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("userList", userList);
return ActionSupport.SUCCESS;
}
删除

public String userDel()
{
TUser user=userDAO.findById(userId);
user.setUserDel("yes");
userDAO.attachDirty(user);
this.setMessage("删除成功");
this.setPath("userMana.action");
return "succeed";
}

后台图书分类,
public String catelogMana()
{
String sql="from TCatelog where catelogDel='no'";
List cateLogList=catelogDAO.getHibernateTemplate().find(sql);


Map request=(Map)ServletActionContext.getContext().get("request");
request.put("cateLogList", cateLogList);
return ActionSupport.SUCCESS;
}

public String catelogAdd()
{
TCatelog catelog=new TCatelog();
catelog.setCatelogName(catelogName);
catelog.setCatelogMiaoshu(catelogMiaoshu);
catelog.setCatelogDel("no");
catelogDAO.save(catelog);
this.setMessage("操作成功");
this.setPath("catelogMana.action");
return "succeed";
}


图书管理

public String bookinfoMana()
{
String sql="from TBookinfo where bookinfoDel='no' order by bookinfoStatus";
List bookinfoList=bookinfoDAO.getHibernateTemplate().find(sql);
        int listSize=bookinfoList.size();
int fromIndex = (pageNow - 1) * pageSize;
int toIndex = Math.min(fromIndex + pageSize, listSize);
pageTotle = listSize%pageSize==0?listSize/pageSize:listSize/pageSize+1 ;

bookinfoList = bookinfoList.subList(fromIndex, toIndex);
        
for(int i=0;i<bookinfoList.size();i++)
{
TBookinfo bookinfo=(TBookinfo)bookinfoList.get(i);
System.out.println(bookinfo.getBookinfoCatelogId());
bookinfo.setBookinfoCatelogName(catelogDAO.findById(bookinfo.getBookinfoCatelogId()).getCatelogName());
}
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("bookinfoList", bookinfoList);
return ActionSupport.SUCCESS;
}


public String bookinfoDel()
{
TBookinfo bookinfo=bookinfoDAO.findById(bookinfoId);
bookinfo.setBookinfoDel("yes");
bookinfoDAO.attachDirty(bookinfo);
this.setMessage("操作成功");
this.setPath("bookinfoMana.action");
return "succeed";
}






如需定做或者获取更多资料,请联系QQ:375279829
在线客服
联系方式

技术微信

375279829

在线时间

周一到周日

客服QQ

375279829

二维码
线