├── .gitignore ├── README.md ├── WebContent ├── META-INF │ └── MANIFEST.MF ├── WEB-INF │ ├── lib │ │ └── javasqlxt.jar │ └── web.xml ├── about.jsp ├── error_404.jsp ├── goods │ └── info.jsp ├── index.jsp ├── search.jsp ├── site │ ├── footer.jsp │ ├── head.jsp │ ├── header.jsp │ └── personal │ │ ├── auditing.jsp │ │ ├── history.jsp │ │ ├── info.jsp │ │ ├── like.jsp │ │ ├── mess.jsp │ │ ├── push.jsp │ │ ├── pushed.jsp │ │ └── shopcart.jsp ├── src │ ├── bootstrap3 │ │ ├── css │ │ │ ├── bootstrap-theme.css │ │ │ ├── bootstrap-theme.css.map │ │ │ ├── bootstrap-theme.min.css │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ └── bootstrap.min.css │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.min.js │ │ │ └── npm.js │ ├── css │ │ ├── main.css │ │ └── sign.css │ └── jquery2 │ │ ├── jquery.js │ │ └── jquery.min.js ├── static │ ├── goods_img │ │ ├── 1.jpg │ │ ├── 10.jpg │ │ ├── 11.jpg │ │ ├── 12.jpg │ │ ├── 13.jpg │ │ ├── 14.jpg │ │ ├── 15.jpg │ │ ├── 16.jpg │ │ ├── 17.jpg │ │ ├── 18.jpg │ │ ├── 19.jpg │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── 4.jpg │ │ ├── 5.jpg │ │ ├── 6.jpg │ │ ├── 7.jpg │ │ ├── 8.jpg │ │ └── 9.jpg │ ├── image │ │ ├── ac_24.png │ │ └── ac_31.png │ └── user_img │ │ ├── 0 │ │ ├── 1 │ │ ├── 9 │ │ ├── 10 │ │ ├── 123 │ │ └── 1019 ├── test │ └── tips.txt └── user │ ├── agreement.jsp │ ├── login.jsp │ ├── personal.jsp │ ├── register.jsp │ └── sendmess.jsp ├── doc ├── 合肥学院二手物品交易网站.ppt └── 需求分析 - 合肥学院物品交易网站的实现.doc ├── sql └── hfuu_shop.sql └── src └── src ├── dbHandle ├── CollectHandle.java ├── GoodsHandle.java ├── MessHandle.java ├── OrderHandle.java ├── ShopCartHandle.java └── UserHandle.java ├── dbc └── DatabaseConnection.java ├── servlet ├── AuditingServlet.java ├── AutoLogin.java ├── BuyAllShopcartServlet.java ├── CharSet.java ├── CollectServlet.java ├── ExitLoginServlet.java ├── GoodsCheckServlet.java ├── LoginServlet.java ├── MessCheckServlet.java ├── OrderCheckServlet.java ├── RegisterServlet.java ├── RemoveCollectServlet.java ├── RemoveMessServlet.java ├── RemoveShopCartServlet.java ├── ShoppingCartServlet.java ├── UpdateUserImgServlet.java └── UpdateUserInfoServlet.java ├── tools ├── GetCookie.java ├── IntHolder.java ├── LoginVerify.java ├── MD5.java └── StaticVar.java └── vo ├── Goods.java ├── Mess.java ├── Order.java └── User.java /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | .settings/* 3 | .project 4 | .classpath 5 | bin/* 6 | /build/ 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 使用原生Jsp和Servlet实现的简单二手物品交易网站 2 | 3 | 引用了`jquery`和`bootstrap`,已经包含在`WebContent/src/`中了 4 | 5 | 使用了eclipse默认的的文件结构, 测试和部署的简单方法是使用eclipse导出war文件, 其他ide自行更改文件结构。sql/hfuu_shop.sql包含了完整的数据库结构和测试数据。 6 | 7 | 功能实现: 8 | 9 | - 商品发布 10 | - 商品浏览、购买 11 | - 购物车(批量购买) 12 | - 消息系统 13 | - 自动消息通知(审核结果、商品变动) 14 | - 站内私信 15 | - 个人中心 16 | - 管理员商品审核 17 | - 消息发送/接收 18 | - 购买历史 19 | - 发布历史 20 | - 收藏夹 21 | - 个人信息 22 | - 物品搜索 23 | - 物品、消息、收藏夹的分页 24 | -------------------------------------------------------------------------------- /WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/javasqlxt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/WEB-INF/lib/javasqlxt.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | HfuuShop 4 | 5 | login 6 | src.servlet.AutoLogin 7 | 8 | 9 | login 10 | /* 11 | 12 | 13 | charset 14 | src.servlet.CharSet 15 | 16 | 17 | charset 18 | /* 19 | 20 | 21 | register 22 | src.servlet.RegisterServlet 23 | 24 | 25 | register 26 | /user/register 27 | 28 | 29 | index.jsp 30 | 31 | 32 | 404 33 | /error_404.jsp 34 | 35 | -------------------------------------------------------------------------------- /WebContent/about.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 关于页面
11 | 并没有什么可写的 12 | 13 | -------------------------------------------------------------------------------- /WebContent/error_404.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <% 4 | String path = request.getContextPath(); 5 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 6 | %> 7 | 8 | 9 | 10 | 11 | 404 12 | 13 | 14 |

合肥学院物品交易网站

15 | 页面未找到,检查你的URL 16 | 17 | -------------------------------------------------------------------------------- /WebContent/goods/info.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="src.dbHandle.UserHandle"%> 2 | <%@page 3 | import="src.dbHandle.GoodsHandle,src.vo.*,src.tools.*,java.util.*,java.text.*,src.servlet.*"%> 4 | <%/* 5 | 物品详情页,包含详情和操作按钮 6 | */%> 7 | <%@ page language="java" contentType="text/html; charset=UTF-8" 8 | pageEncoding="UTF-8"%> 9 | <% 10 | String path = request.getContextPath(); 11 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 12 | %> 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 物品详情 22 | 69 | 70 | 71 | 72 | <% 73 | int goodsId=Integer.parseInt(request.getParameter("goodsid")); 74 | 75 | Integer goodsNum=0; 76 | GoodsHandle goodsHandle=new GoodsHandle(); 77 | UserHandle userHandle=new UserHandle(); 78 | Goods good=goodsHandle.findById(goodsId); 79 | if(good==null){ 80 | out.print("
"+"没有这个物品!,请返回并检查来源页"+"
"); 81 | return; 82 | } 83 | boolean isLogin =LoginVerify.isLogin(request); 84 | pageContext.setAttribute("good",good); 85 | User Procuteuser=userHandle.findById(good.getProducter_id()); 86 | pageContext.setAttribute("Procuteuser",Procuteuser); 87 | int typeId= good.getType_id(); 88 | String typeName=""; 89 | switch(typeId){ 90 | case 6:typeName="其他"; 91 | break; 92 | case 1:typeName="书籍"; 93 | break; 94 | case 2:typeName="生活用品"; 95 | break; 96 | case 5:typeName="体育"; 97 | break; 98 | case 3:typeName="衣装"; 99 | break; 100 | case 4:typeName="电子"; 101 | break; 102 | } 103 | Date date=good.getCreatDate(); 104 | SimpleDateFormat myFmt=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分"); 105 | String dateStr =myFmt.format(date); 106 | %> 107 | 108 |
109 |
110 |
111 |
112 |
113 | <% 114 | out.println("物品详情"); 115 | 116 | %> 117 | 118 |
119 | 120 |
121 |
122 |
123 | 124 |
125 |
126 |

127 |

128 |

129 | ${good.getName()} 130 |

131 |

132 |
类型:<%=typeName %>
134 |
135 |

136 |

137 | 价格:${good.price}
138 |
139 |

140 | 141 | 142 |

143 | 发布者: 144 | ${Procuteuser.getName()} 146 | (联系:${Procuteuser.getEmail()} 147 | 148 | 或 149 | 站内信) 150 |

151 |

152 |

153 | 发布时间:<%=dateStr %> 154 |

155 |

156 |

157 | 物品说明:<%=good.getContent().replaceAll("<", "<").replaceAll(">", ">").replaceAll("\n", "
") %> 158 |

159 |
160 |
161 | 162 | 169 | 199 | 200 | 201 | 202 | <% 203 | if(request.getParameter("info")!=null){ 204 | %> 205 |
<%=request.getParameter("info") %>
206 | <%}%> 207 | 208 |
209 |
210 |
211 | 212 |
213 |
214 | 217 |
218 |
219 | 228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 | 236 | 237 | 238 | <% 239 | userHandle.close(); 240 | goodsHandle.close(); 241 | %> -------------------------------------------------------------------------------- /WebContent/index.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="src.tools.*"%> 2 | <%@page import="src.dbHandle.UserHandle"%> 3 | <%@page import="org.w3c.dom.UserDataHandler"%> 4 | <%@page import="src.dbHandle.GoodsHandle"%> 5 | <%@ page language="java" contentType="text/html; charset=UTF-8" 6 | pageEncoding="UTF-8"%> 7 | <%@ page language="java"%> 8 | <%@ page 9 | import="java.text.SimpleDateFormat,java.sql.*,java.lang.Math,src.tools.*,javax.servlet.http.HttpSession,java.util.*,src.vo.*"%> 10 | <% 11 | String path = request.getContextPath(); 12 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() 13 | + path + "/"; 14 | %> 15 | <% 16 | //判断pn参数 17 | int pn = 1; 18 | int perPage = StaticVar.PERPAGE_GOODS;//每页显示几条? 19 | int ceta = 0; 20 | String tmpString = request.getParameter("pn"); 21 | //获取pn参数 22 | if (tmpString != null && tmpString.length() != 0) { 23 | if (Integer.parseInt(tmpString) > 0) { 24 | pn = Integer.parseInt(tmpString); 25 | } 26 | } 27 | //获取ceta参数 28 | tmpString = request.getParameter("ceta"); 29 | if (tmpString != null && tmpString.length() != 0) { 30 | if (Integer.parseInt(tmpString) > 0) { 31 | ceta = Integer.parseInt(tmpString); 32 | } 33 | } 34 | int limitMin = (pn - 1) * perPage; 35 | GoodsHandle goodHandle = new GoodsHandle(); 36 | UserHandle userHandle = new UserHandle(); 37 | List list = null; 38 | IntHolder num = new IntHolder(0); 39 | %> 40 | 41 | 42 | 43 | 44 | 45 | 物品交易-合肥学院-首页 46 | 47 | 48 | 49 |
50 |
51 | 76 |
77 |
78 | <% 79 | switch (ceta) { 80 | case 0: 81 | out.println("分类-全部"); 82 | list = goodHandle.findAll(num, limitMin, perPage); 83 | break; 84 | case 1: 85 | out.println("分类-书籍"); 86 | list = goodHandle.findByCeta(1, num, limitMin, perPage); 87 | break; 88 | case 2: 89 | out.println("分类-生活出行"); 90 | list = goodHandle.findByCeta(2, num, limitMin, perPage); 91 | break; 92 | case 3: 93 | out.println("分类-衣物鞋包"); 94 | list = goodHandle.findByCeta(3, num, limitMin, perPage); 95 | break; 96 | case 4: 97 | out.println("分类-电子产品"); 98 | list = goodHandle.findByCeta(4, num, limitMin, perPage); 99 | break; 100 | case 5: 101 | out.println("分类-体育运动"); 102 | list = goodHandle.findByCeta(5, num, limitMin, perPage); 103 | break; 104 | case 6: 105 | out.println("分类-其他"); 106 | list = goodHandle.findByCeta(6, num, limitMin, perPage); 107 | break; 108 | default: 109 | out.println("分类-全部"); 110 | list = goodHandle.findAll(num, limitMin, perPage); 111 | break; 112 | } 113 | if (list.size() != 0) { 114 | for (Goods good : list) { 115 | if (good.getProducter_id() == null) 116 | continue; 117 | User user = userHandle.findById(good.getProducter_id()); 118 | %>
119 |
120 |
121 | 123 |
124 |
125 |
126 | <%=good.getName()%> 127 |
128 |
129 | ¥<%=Math.round(good.getPrice())%> 130 | 发布者:<% 131 | if (user.getName() != null) { 132 | %><%=user.getName()%> <% 133 | } else { 134 | %><%=user.getEmail()%> <% 135 | } 136 | %> 137 | 时间: <% 138 | java.util.Date date = good.getCreatDate(); 139 | SimpleDateFormat myFmt = new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); 140 | String dateStr = myFmt.format(date); 141 | out.print(dateStr); 142 | %> 143 | 144 |
145 |
146 |
147 |
148 | <% 149 | } 150 | } else { 151 | %> 152 |
此分类下暂无物品或页数已经到达最大!
153 | <% 154 | } 155 | %> 156 |
157 | <% 158 | int maxPage = num.value % perPage == 0 ? num.value / perPage : num.value / perPage + 1; 159 | %> 160 | 173 |
174 |
175 |
176 | 177 | 178 | 179 | <% 180 | goodHandle.close(); 181 | userHandle.close(); 182 | %> -------------------------------------------------------------------------------- /WebContent/search.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="src.dbHandle.UserHandle"%> 2 | <%@page import="org.w3c.dom.UserDataHandler"%> 3 | <%@page import="src.dbHandle.GoodsHandle"%> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8"%> 6 | <%@ page language="java"%> 7 | <%@ page import="java.text.SimpleDateFormat,java.sql.*,java.lang.Math,src.tools.*,javax.servlet.http.HttpSession,java.util.*,src.vo.*"%> 8 | <% 9 | String path = request.getContextPath(); 10 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 11 | %> 12 | <% 13 | List list= new ArrayList(); 14 | String key=""; 15 | GoodsHandle goodsHandle=new GoodsHandle(); 16 | UserHandle userHandle=new UserHandle(); 17 | if(request.getParameter("key")==null || request.getParameter("key").length()==0){ 18 | response.sendRedirect("index.jsp?ceta=0"); 19 | goodsHandle.close(); 20 | userHandle.close(); 21 | return; 22 | }else{ 23 | key=request.getParameter("key"); 24 | try { 25 | list = goodsHandle.findByKey(key); 26 | } catch (Exception e) { 27 | e.printStackTrace(); 28 | } 29 | } 30 | %> 31 | 32 | 33 | 34 | 35 | 36 | 物品交易-合肥学院-首页 37 | 38 | 39 | 40 |
41 |
42 |
43 |
44 |
45 |
46 | 分类 47 | 全部 48 | 生活出行 49 | 书籍 50 | 体育运动 51 | 电子产品 52 | 衣物鞋包 53 | 其他 54 |
55 |
56 |
57 |
58 |
59 |
60 | "<%=request.getParameter("key")%>" 的搜索结果 61 | <% if(list.size()!=0){ 62 | for(Goods good:list){ 63 | if(good.getProducter_id()==null)continue; 64 | User user = userHandle.findById(good.getProducter_id()); 65 | %>
66 |
67 |
68 | 70 |
71 |
72 | 91 |
<%=Math.round(good.getPrice()) %> 92 |  发布者:<%if(user.getName()!=null){%><%=user.getName() %><%}else{%><%=user.getEmail()%><%}%> 93 |  时间: 94 | <% 95 | java.util.Date date=good.getCreatDate(); 96 | SimpleDateFormat myFmt=new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); 97 | String dateStr =myFmt.format(date); 98 | out.print(dateStr); 99 | %> 100 | 101 |
102 |
103 |
104 |
105 | <% 106 | } 107 | }else{%> 108 |
109 | 未搜索到任何物品 110 |
111 | <%}%> 112 |
113 |
114 |
115 |
116 | 117 | 118 | 119 | <% 120 | goodsHandle.close(); 121 | userHandle.close(); 122 | %> -------------------------------------------------------------------------------- /WebContent/site/footer.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 页脚 3 | */%> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8"%> 6 | <% 7 | String path = request.getContextPath(); 8 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 9 | %> 10 | 27 |
28 |

29 | Hfuu物品交易-发布平台,Powered By HfuuShop | © 2015 - 2015 32 |

33 |
-------------------------------------------------------------------------------- /WebContent/site/head.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 公共 3 | */%> 4 | <% 5 | String path = request.getContextPath(); 6 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 7 | %> 8 | 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /WebContent/site/header.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%/* 3 | 导航栏 4 | */%> 5 | <%@ page language="java" contentType="text/html; charset=UTF-8" 6 | pageEncoding="UTF-8" 7 | import="javax.servlet.http.HttpSession,src.dbHandle.*,src.vo.*,src.tools.*"%> 8 | <% 9 | String path = request.getContextPath(); 10 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 11 | %> 12 | 95 | -------------------------------------------------------------------------------- /WebContent/site/personal/auditing.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 审核页面,被/personal.jsp包含,查找所有未审核商品(status=1) 3 | status说明: 4 | 1-未审核 5 | 2-审核通过 6 | 3-审核未通过 7 | 4-已被购买(交易中) 8 | 5-交易完成 9 | */%> 10 | <%@ page language="java" contentType="text/html; charset=UTF-8" 11 | pageEncoding="UTF-8"%> 12 | <%@ page import="src.dbHandle.*,src.vo.*,java.sql.*,java.util.*,java.text.SimpleDateFormat"%> 13 | <% 14 | String path = request.getContextPath(); 15 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 16 | %> 17 | 38 |
39 |
40 | <% 41 | out.println("审核商品"); 42 | %> 43 |
44 |
45 | <% 46 | GoodsHandle goodsHandle=new GoodsHandle(); 47 | UserHandle userHandle=new UserHandle(); 48 | List all=null; 49 | try{ 50 | all = goodsHandle.findAllNotAuditing(); 51 | }catch(Exception e){ 52 | System.out.print("数据库异常"); 53 | } 54 | if(all.size()==0){ 55 | %> 56 | 59 | <% 60 | }else{ 61 | %> 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | <% 71 | for(Goods goods:all) 72 | { 73 | %> 74 | 75 | 85 | 86 | 88 | 91 | 100 | 101 | 102 | <%}%> 103 | <%}%> 104 |
用户发布于物品名详情操作
76 | <% 77 | if(userHandle.findById(goods.getProducter_id()).getName()==null){ 78 | out.print(userHandle.findById(goods.getProducter_id()).getEmail()); 79 | } 80 | else{ 81 | out.print(userHandle.findById(goods.getProducter_id()).getName()); 82 | } 83 | %> 84 | <%=new SimpleDateFormat("yyyy/MM/dd HH:mm").format(goods.getCreatDate())%><%=""+goods.getName()+""%> 87 | [详情] 90 | 92 |
94 | 96 | 98 |
99 |
105 | 106 |
107 |
108 | <% 109 | userHandle.close(); 110 | goodsHandle.close(); 111 | %> -------------------------------------------------------------------------------- /WebContent/site/personal/history.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 购买历史页,被/personal.jsp包含,查找所有自己已购买商品 3 | */%> 4 | <%@ page import="java.text.SimpleDateFormat,java.sql.*,src.tools.*,javax.servlet.http.HttpSession,java.util.*,src.vo.*"%> 5 | <%@ page language="java" contentType="text/html; charset=UTF-8" 6 | pageEncoding="UTF-8"%> 7 | <%@ page import="src.dbHandle.*,src.vo.*,java.sql.*,java.util.*,java.text.SimpleDateFormat"%> 8 | <% 9 | String path = request.getContextPath(); 10 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 11 | %> 12 | <% 13 | //findGoodsByUser 14 | OrderHandle orderHandle=new OrderHandle(); 15 | User me =(User)session.getAttribute("loginUser"); 16 | UserHandle userHandle=new UserHandle(); 17 | List list=null; 18 | list=orderHandle.findGoodsByUser(me); 19 | %> 20 |
21 |
22 | 我的购买记录 23 |
24 |
25 | 26 | <% 27 | if(list.size()!=0){ 28 | for(Goods good:list){ 29 | if(good.getProducter_id()==null)continue; 30 | User user = userHandle.findById(good.getProducter_id()); 31 | %> 32 | 33 |
34 |
35 |
36 | 38 |
39 |
40 | 43 |
<%=Math.round(good.getPrice()) %> 44 |  发布者:<%if(user.getName()!=null){%><%=user.getName() %><%}else{%><%=user.getEmail()%><%}%> 45 |  时间: 46 | <% 47 | java.util.Date date=good.getCreatDate(); 48 | SimpleDateFormat myFmt=new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); 49 | String dateStr =myFmt.format(date); 50 | out.print(dateStr); 51 | %> 52 | 53 | 54 |
55 | 56 |
57 |
58 |
59 | <%}}else{%> 60 | 还没有购买过商品 61 | <%}%> 62 |
63 |
64 | <% 65 | userHandle.close(); 66 | orderHandle.close(); 67 | %> -------------------------------------------------------------------------------- /WebContent/site/personal/info.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 个人信息页,被/personal包含,非自己只显示公开信息 3 | */%> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8"%> 6 | <% 7 | String path = request.getContextPath(); 8 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 9 | %> 10 | <%@ page import="java.text.SimpleDateFormat,java.sql.*,src.dbHandle.*,src.tools.*,javax.servlet.http.HttpSession,java.util.*,src.vo.*"%> 11 | <% 12 | //根据cache参数来决定是否使用缓存 13 | //解决上传新头像不刷新的问题 14 | String isCache=request.getParameter("cache"); 15 | if(isCache!=null && isCache.equals("0")){ 16 | response.setHeader("Pragma","No-cache"); 17 | response.setHeader("Cache-Control","no-cache"); 18 | response.setDateHeader("Expires", 0); 19 | } 20 | %> 21 | <% 22 | UserHandle userHandle=new UserHandle(); 23 | Boolean isLogined=LoginVerify.isLogin(request); 24 | User me=(User)session.getAttribute("loginUser"); 25 | User user=null; 26 | if(request.getAttribute("isMe")!=null){ 27 | user=me; 28 | }else{ 29 | user=userHandle.findById(Integer.parseInt(request.getParameter("userid"))); 30 | } 31 | %> 32 | 33 | <% 34 | String cantAlter=""; 35 | if(!isLogined || (isLogined && user.getId()!=me.getId())){ 36 | cantAlter="readonly"; 37 | } 38 | %> 39 |
40 |
41 | <% 42 | out.println("个人资料"); 43 | %> 44 |
45 |
46 | <%if(request.getParameter("info")!=null && request.getParameter("info").length()>0){ 47 | String info=new String(request.getParameter("info").getBytes("UTF-8"),"UTF-8"); 48 | out.print("
"+info+"
"); 49 | } 50 | %> 51 | <%if(isLogined && user.getId()==me.getId()){ %> 52 |
53 | 54 |
55 | 56 | 72 |
73 | <%}%> 74 |
75 |
76 |
77 | 姓名 78 | > 79 |
80 |
81 | 82 |
83 |
84 | 邮箱 85 | > 86 |
87 |
88 | 89 |
90 |
91 | 电话 92 | " <%=cantAlter %>> 93 |
94 |
95 | 96 | 110 | <%if(isLogined && user.getId()==me.getId()){ %> 111 | 112 | 113 | <%}else{%> 114 | 115 | <%}%> 116 |
117 |
118 |
119 | 120 | 132 | <% 133 | userHandle.close(); 134 | %> -------------------------------------------------------------------------------- /WebContent/site/personal/like.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 购物车页面,被/personal.jsp包含,查找所有购物车内物品 3 | */%> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8"%> 6 | <%@ page import="src.tools.IntHolder,src.tools.*,src.dbHandle.*,src.vo.*,java.sql.*,java.util.*,java.text.SimpleDateFormat"%> 7 | <% 8 | String path = request.getContextPath(); 9 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 10 | %> 11 |
12 |
13 | <% 14 | //判断pn参数 15 | User user=(User)session.getAttribute("loginUser"); 16 | int pn=1; 17 | int perPage=StaticVar.PERPAGE_COLLECT;//每页显示几条? 18 | int ceta=0; 19 | String tmpString=request.getParameter("pn"); 20 | //获取pn参数 21 | if(tmpString!=null && tmpString.length()!=0){ 22 | if(Integer.parseInt(tmpString)>0){ 23 | pn=Integer.parseInt(tmpString); 24 | } 25 | } 26 | //获取ceta参数 27 | tmpString=request.getParameter("ceta"); 28 | if(tmpString!=null && tmpString.length()!=0){ 29 | if(Integer.parseInt(tmpString)>0){ 30 | ceta=Integer.parseInt(tmpString); 31 | } 32 | } 33 | int limitMin=(pn-1)*perPage; 34 | GoodsHandle goodHandle=new GoodsHandle(); 35 | UserHandle userHandle =new UserHandle(); 36 | CollectHandle collectHandle=new CollectHandle(); 37 | List list=null; 38 | IntHolder num = new IntHolder(0); 39 | %> 40 | <% 41 | out.println("我的收藏"); 42 | list = collectHandle.findGoodsByUser(user, num, limitMin, perPage); 43 | if(list.size()!=0){ 44 | for(Goods good:list){ 45 | if(good.getProducter_id()==null)continue; 46 | User pUser = userHandle.findById(good.getProducter_id()); 47 | %>
48 |
49 |
50 | 52 |
53 |
54 |
55 | "> 56 | <%=good.getStates()==2?"出售中":"已被购买" %> 57 | 58 | <%=good.getName()%> 59 |
60 |
<%=Math.round(good.getPrice()) %> 61 |  发布者:<%if(pUser.getName()!=null){%><%=pUser.getName() %><%}else{%><%=pUser.getEmail()%><%}%> 62 |  时间: 63 | <% 64 | java.util.Date date=good.getCreatDate(); 65 | SimpleDateFormat myFmt=new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); 66 | String dateStr =myFmt.format(date); 67 | out.print(dateStr); 68 | %> 69 | 71 | 72 |
73 |
74 |
75 |
76 | <% 77 | } 78 | }else{%> 79 |
80 | 尚未收藏任何物品 81 |
82 | <%}%> 83 |
84 | <% 85 | int maxPage=num.value%perPage==0?num.value/perPage:num.value/perPage+1; 86 | %> 87 | 94 |
95 | 96 | 125 | <% 126 | userHandle.close(); 127 | goodHandle.close(); 128 | collectHandle.close(); 129 | %> -------------------------------------------------------------------------------- /WebContent/site/personal/mess.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="src.tools.IntHolder"%> 2 | <%/* 3 | 个人信息页,被/personal包含,非自己只显示公开信息 4 | */%> 5 | <% 6 | UserHandle userHandle=new UserHandle(); 7 | MessHandle messHandle= new MessHandle(); 8 | User user=null; 9 | if(!LoginVerify.isLogin(request)){ 10 | request.getRequestDispatcher("../../user/login.jsp?login-info="+java.net.URLEncoder.encode("你应该先登录,之后从个人中心进入消息页","UTF-8")).forward(request,response); 11 | return; 12 | } 13 | User me=(User)session.getAttribute("loginUser"); 14 | 15 | int pn=1; 16 | String tmpString=request.getParameter("pn"); 17 | //获取pn参数 18 | if(tmpString!=null && tmpString.length()!=0){ 19 | if(Integer.parseInt(tmpString)>0){ 20 | pn=Integer.parseInt(tmpString); 21 | } 22 | } 23 | int perPage=StaticVar.PERPAGE_MESS;//每页显示几条? 24 | IntHolder num=new IntHolder(0); 25 | int limitMin=(pn-1)*perPage; 26 | 27 | List allMess = messHandle.findAllMessByUser(num,me, limitMin, perPage); 28 | int maxPage=num.value%perPage==0?num.value/perPage:num.value/perPage+1; 29 | %> 30 | <%@ page language="java" contentType="text/html; charset=UTF-8" 31 | pageEncoding="UTF-8"%> 32 | <% 33 | String path = request.getContextPath(); 34 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 35 | %> 36 | <%@ page import="java.text.SimpleDateFormat,java.sql.*,src.dbHandle.*,src.tools.*,javax.servlet.http.HttpSession,java.util.*,src.vo.*"%> 37 | 38 |
39 |
40 | <% 41 | String handle=request.getParameter("handle"); 42 | Boolean isWrite=(handle!=null && handle.equals("write"))?true:false; 43 | %> 44 | 我的消息 45 | / 46 | 发送站内信 47 |
48 |
49 | <%if(!isWrite){%> 50 | 53 | 54 | <% 55 | //访问了消息页,则将消息数量清零 56 | userHandle.emptyMessnum(me); 57 | %> 58 | 62 | <% 63 | if(allMess.size()!=0){ 64 | for(int i=0;i 67 | 68 | 69 | <%user=userHandle.findById(mess.getMessFromId()); %> 70 |
71 | 78 |
79 | 80 | 81 | <% 82 | if(user.getId()==1){ 83 | out.print("SYS"); 84 | }else{ 85 | out.print("user"); 86 | } 87 | %> 88 | 来自 89 | 90 | <% 91 | if(user.getName()==null || user.getName().length()==0){ 92 | out.print(user.getEmail()); 93 | }else{ 94 | out.print(user.getName()); 95 | } 96 | %> 97 | , 98 | <% 99 | java.util.Date date=mess.getSendDate(); 100 | SimpleDateFormat myFmt=new SimpleDateFormat("yyyy-MM-dd HH:mm"); 101 | String dateStr =myFmt.format(date); 102 | out.print(dateStr); 103 | %> 104 | 105 | 111 | 112 | 116 | 117 |
<%
118 |     if(user.getId()==1){
119 |     	out.print(mess.getMessText());
120 |     }else{
121 |     	out.print(mess.getMessText().replaceAll("<", "<").replaceAll(">", ">"));
122 |     }
123 |     %>
124 |
125 |
126 | 127 | 128 | <%}%> 129 | 136 | <%}else{%> 137 | 140 | <%}%> 141 | 142 | <%} else{ %> 143 | 144 | 147 | 148 | <% 149 | //提示 150 | if(request.getParameter("info")!=null && !request.getParameter("info").equals("")){ 151 | %> 152 | 155 | <%}%> 156 | <% 157 | //邮箱自动填写 158 | String toEmail=""; 159 | if(request.getParameter("toemail")!=null && !request.getParameter("toemail").equals("")){ 160 | toEmail=request.getParameter("toemail"); 161 | } 162 | %> 163 | 164 |
165 |
166 | 167 | 168 |
169 |
170 | 171 | 172 |
173 | 174 |
175 | 176 | <%} %> 177 |
178 |
179 | 180 | 216 | <% 217 | userHandle.close(); 218 | messHandle.close(); 219 | %> -------------------------------------------------------------------------------- /WebContent/site/personal/push.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 商品发布页,被/personal.jsp包含 3 | */%> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8" isThreadSafe="false"%> 6 | <% 7 | String path = request.getContextPath(); 8 | String servletPath=path+"/GoodsCheckServlet"; 9 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 10 | %> 11 |
12 |
13 | <% 14 | out.println("发布新物品"); 15 | %> 16 |
17 |
18 | 19 |
21 | 22 | <% 23 | if(request.getParameter("info")!=null && !request.getParameter("info").equals("")){%> 24 | 27 | <%}%> 28 | <% 29 | if(request.getParameter("seccess")!=null && request.getParameter("seccess").equals("0") && request.getAttribute("isCheck")!=null){%> 30 | 49 | <% }%> 50 |
51 |

物品名称:

52 | 53 |
54 |
55 |

价格(元):

56 | 57 |
58 |
59 |

物品简介:

60 | 61 |
62 |
63 |

选择一个分类:

64 | 72 |
73 |
74 |

物品图片:

75 | 76 |

提醒:请上传真实物品照片

77 |
78 | 79 |
80 |
81 |
-------------------------------------------------------------------------------- /WebContent/site/personal/pushed.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 已发布的商品页,被/personal.jsp包含 3 | */%> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8" isThreadSafe="false"%> 6 | <%@ page import="java.text.SimpleDateFormat,java.sql.*,src.dbHandle.*,src.tools.*,javax.servlet.http.HttpSession,java.util.*,src.vo.*"%> 7 | 8 | <% 9 | String path = request.getContextPath(); 10 | String servletPath=path+"/GoodsCheckServlet"; 11 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 12 | %> 13 | <% 14 | UserHandle userHandle=new UserHandle(); 15 | GoodsHandle goodsHandle=new GoodsHandle(); 16 | Boolean isLogined=LoginVerify.isLogin(request); 17 | User me=(User)session.getAttribute("loginUser"); 18 | User user=null; 19 | if(request.getAttribute("isMe")!=null){ 20 | user=me; 21 | }else{ 22 | user=userHandle.findById(Integer.parseInt(request.getParameter("userid"))); 23 | } 24 | List list=null; 25 | list=goodsHandle.findByUserId(user.getId()); 26 | SimpleDateFormat myFmt=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分"); 27 | %> 28 |
29 |
30 | <% 31 | out.println("发布的物品"); 32 | %> 33 |
34 |
35 | <% 36 | if(list.size()>0){ 37 | %> 38 |
39 | <% for(Goods good:list){ %> 40 | 41 |
42 |
43 |
44 | 46 |
47 |
48 |
49 | "> 50 | <%=good.getStates()==2?"出售中":"已被购买" %> 51 | 52 | <%=good.getName()%> 53 |
54 |
<%=Math.round(good.getPrice()) %> 55 |  发布者:<%if(user.getName()!=null){%><%=user.getName() %><%}else{%><%=user.getEmail()%><%}%> 56 |  时间: 57 | <% 58 | java.util.Date date=good.getCreatDate(); 59 | out.print(myFmt.format(date)); 60 | %> 61 | 62 | 63 |
64 | 65 |
66 |
67 |
68 | <%}%> 69 | <%}else{%> 70 | 还没有发布的物品 71 | <%}%> 72 |
73 |
74 |
75 | <% 76 | userHandle.close(); 77 | goodsHandle.close(); 78 | %> -------------------------------------------------------------------------------- /WebContent/site/personal/shopcart.jsp: -------------------------------------------------------------------------------- 1 | <%/* 2 | 购物车页面,被/personal.jsp包含,查找所有购物车内物品 3 | */%> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8"%> 6 | <%@ page import="src.dbHandle.*,src.vo.*,java.sql.*,java.util.*,java.text.SimpleDateFormat"%> 7 | <% 8 | String path = request.getContextPath(); 9 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 10 | %> 11 | <% 12 | ShopCartHandle shopCartHandle=new ShopCartHandle(); 13 | User me =(User)session.getAttribute("loginUser"); 14 | UserHandle userHandle=new UserHandle(); 15 | List list=null; 16 | list=shopCartHandle.findGoodsByUser(me); 17 | 18 | %> 19 | 20 |
21 |
22 | 我的购物车 23 |
24 |
25 |
26 | <% 27 | if(list.size()!=0){ 28 | String goodsIdList="";%> 29 |
<% 30 | for(Goods good:list){ 31 | goodsIdList=goodsIdList+good.getId()+","; 32 | if(good.getProducter_id()==null)continue; 33 | User user = userHandle.findById(good.getProducter_id()); 34 | %>
35 |
36 |
37 | 39 |
40 |
41 |
42 |
43 | <%=good.getName()%> 44 | 47 |
48 |
49 |
价格:<%=good.getPrice()%>
50 | 51 |
发布者:<%if(user.getName()!=null){ %><%=user.getName() %><%}else{%><%=user.getEmail()%><%}%>
52 |
53 | 时间: 54 | <% 55 | java.util.Date date=good.getCreatDate(); 56 | SimpleDateFormat myFmt=new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); 57 | String dateStr =myFmt.format(date); 58 | out.print(dateStr); 59 | %> 60 |
61 |
62 |
63 |
<%}%>
64 |
65 | 68 |
69 | <%}else { 70 | if(request.getParameter("info")==null){ 71 | %> 72 | 购物车是空的! 73 | <%}else{%> 74 | 75 | <% 76 | }} 77 | %> 78 |
79 |
80 |
81 | 119 | <% 120 | userHandle.close(); 121 | shopCartHandle.close(); 122 | %> -------------------------------------------------------------------------------- /WebContent/src/bootstrap3/css/bootstrap-theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.5 (http://getbootstrap.com) 3 | * Copyright 2011-2015 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger.disabled,.btn-danger[disabled],.btn-default.disabled,.btn-default[disabled],.btn-info.disabled,.btn-info[disabled],.btn-primary.disabled,.btn-primary[disabled],.btn-success.disabled,.btn-success[disabled],.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-danger,fieldset[disabled] .btn-default,fieldset[disabled] .btn-info,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-success,fieldset[disabled] .btn-warning{-webkit-box-shadow:none;box-shadow:none}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)} -------------------------------------------------------------------------------- /WebContent/src/bootstrap3/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/src/bootstrap3/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /WebContent/src/bootstrap3/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/src/bootstrap3/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /WebContent/src/bootstrap3/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/src/bootstrap3/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /WebContent/src/bootstrap3/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/src/bootstrap3/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /WebContent/src/bootstrap3/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /WebContent/src/css/main.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | 3 | .img-item-goods { 4 | width: 110px; 5 | height: 110px; 6 | } 7 | 8 | .detail-goods { 9 | margin: 10px 0px; 10 | } 11 | 12 | .img-personal-main-info { 13 | width: 80px; 14 | } 15 | 16 | .personal-main-info { 17 | text-align: center; 18 | } 19 | .img-personal-info-info{ 20 | width: 150px; 21 | /*height: 150px;*/ 22 | } 23 | .info-img { 24 | width:350px; 25 | } 26 | .info-goods{ 27 | font-size:17px; 28 | } 29 | .info-goods-name{ 30 | color:#D35473; 31 | } 32 | .info-goods-content{ 33 | font-size:15px; 34 | } 35 | .bg-beselect{ 36 | background-color:#FF8C8C; 37 | } 38 | 39 | .page-cut-btn{ 40 | background-color:#D9EDF7 !important; 41 | } 42 | /*首页分类列表,已弃用*/ 43 | .index-ceta-list{ 44 | background-color:#D9EDF7 !important; 45 | } 46 | .active{ 47 | background-color:#5892EE !important; 48 | } 49 | pre{ 50 | white-space: pre-wrap; 51 | word-wrap: break-word; 52 | } -------------------------------------------------------------------------------- /WebContent/src/css/sign.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #eff; 3 | } 4 | 5 | .form-signin { 6 | max-width: 330px; 7 | padding: 15px; 8 | margin: 0 auto; 9 | } 10 | 11 | .form-signin .form-signin-heading,.form-signin .checkbox { 12 | margin-bottom: 10px; 13 | } 14 | 15 | .form-signin .checkbox { 16 | font-weight: normal; 17 | } 18 | 19 | .form-signin .form-control { 20 | position: relative; 21 | height: auto; 22 | -webkit-box-sizing: border-box; 23 | -moz-box-sizing: border-box; 24 | box-sizing: border-box; 25 | padding: 10px; 26 | font-size: 16px; 27 | } 28 | 29 | .form-signin .form-control:focus { 30 | z-index: 2; 31 | } 32 | 33 | .form-signin input[type="email"] { 34 | margin-bottom: -1px; 35 | border-bottom-right-radius: 0; 36 | border-bottom-left-radius: 0; 37 | } 38 | 39 | .form-signin input[type="password"] { 40 | margin-bottom: 10px; 41 | border-top-left-radius: 0; 42 | border-top-right-radius: 0; 43 | } 44 | 45 | .xt_mid:focus { 46 | z-index: 2; 47 | } 48 | 49 | .xt_mid { 50 | text-align: center; 51 | max-width: 630px; 52 | padding: 15px; 53 | margin: 0 auto; 54 | position: relative; 55 | height: auto; 56 | -webkit-box-sizing: border-box; 57 | -moz-box-sizing: border-box; 58 | box-sizing: border-box; 59 | padding: 10px; 60 | font-size: 16px; 61 | } -------------------------------------------------------------------------------- /WebContent/static/goods_img/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/1.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/10.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/11.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/12.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/13.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/14.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/15.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/16.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/17.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/18.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/19.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/19.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/2.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/3.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/4.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/5.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/6.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/7.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/8.jpg -------------------------------------------------------------------------------- /WebContent/static/goods_img/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/goods_img/9.jpg -------------------------------------------------------------------------------- /WebContent/static/image/ac_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/image/ac_24.png -------------------------------------------------------------------------------- /WebContent/static/image/ac_31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/image/ac_31.png -------------------------------------------------------------------------------- /WebContent/static/user_img/0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/user_img/0 -------------------------------------------------------------------------------- /WebContent/static/user_img/1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/user_img/1 -------------------------------------------------------------------------------- /WebContent/static/user_img/10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/user_img/10 -------------------------------------------------------------------------------- /WebContent/static/user_img/1019: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/user_img/1019 -------------------------------------------------------------------------------- /WebContent/static/user_img/123: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/user_img/123 -------------------------------------------------------------------------------- /WebContent/static/user_img/9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/WebContent/static/user_img/9 -------------------------------------------------------------------------------- /WebContent/test/tips.txt: -------------------------------------------------------------------------------- 1 | server.xml 2 | --- 3 | useBodyEncodingForURI="true" URIEncoding="UTF-8" -------------------------------------------------------------------------------- /WebContent/user/agreement.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=utf-8" 2 | pageEncoding="utf-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 用户协议页面
11 | 并没有什么可写的 12 | 13 | -------------------------------------------------------------------------------- /WebContent/user/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ page language="java"%> 4 | <%@ page import="java.sql.*"%> 5 | <% 6 | String path = request.getContextPath(); 7 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 8 | %> 9 | 10 | 11 | 12 | 13 | 14 | 登录-合肥学院物品交易 15 | 16 | 17 | 18 | 19 | 20 | <%if(request.getAttribute("isRegister")!=null){ 21 | out.print("
注册成功,现在你可以登录
"); 22 | } 23 | %> 24 | 25 | <%if(request.getAttribute("isLoginOk")!=null && request.getAttribute("isLoginOk").equals("false")){ 26 | out.print("
登录失败,请检查邮箱和密码
"); 27 | } 28 | %> 29 | 30 | <%if(request.getParameter("login-info")!=null){ 31 | String loginInfo=new String(request.getParameter("login-info").getBytes("UTF-8"),"UTF-8"); 32 | out.print("
"+loginInfo+"
"); 33 | } 34 | %> 35 | 36 |
37 | 51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /WebContent/user/personal.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="org.apache.el.lang.ELSupport"%> 2 | <%@ page language="java" contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | <%@ page 5 | import="java.sql.*,src.vo.*,src.tools.*,javax.servlet.http.HttpSession,src.dbHandle.*"%> 6 | <% 7 | String path = request.getContextPath(); 8 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 9 | %> 10 | <% 11 | Boolean isMe=false; 12 | Boolean isLogin=LoginVerify.isLogin(request); 13 | User me=null; 14 | User user=null; 15 | Integer userid=0; 16 | if(request.getParameter("userid")!=null && request.getParameter("userid").length()!=0){ 17 | UserHandle userHandle=new UserHandle(); 18 | userid=Integer.parseInt(request.getParameter("userid")); 19 | user=userHandle.findById(userid); 20 | userHandle.close(); 21 | } 22 | 23 | if(isLogin){ 24 | me=(User)session.getAttribute("loginUser"); 25 | if((userid!=0 && me.getId()==user.getId()) || userid==0){ 26 | isMe=true; 27 | user=me; 28 | request.setAttribute("isMe",true); 29 | } 30 | }else{ 31 | request.getRequestDispatcher("../user/login.jsp?login-info="+java.net.URLEncoder.encode("你应该先登录,之后才可查看自己或其他人的个人信息页","UTF-8")).forward(request,response); 32 | return; 33 | } 34 | 35 | String tab = request.getParameter("tab"); 36 | %> 37 | 38 | 39 | 40 | 41 | 42 | 43 | 用户中心 - HfuuShop 44 | 45 | 46 | 47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | 55 | 57 |
姓名:<%=user.getName() %>
58 |
邮箱:<%=user.getEmail() %>
59 | 60 |
61 | "> 63 | 个人信息 64 | 65 | <%if(isMe){ 66 | %> 67 | <%if(LoginVerify.isAdmin(request)){ 68 | %> 69 | 70 | "> 72 | 物品审核 73 | <%}%> 74 | "> 76 | 站内消息 77 | "> 79 | 购物车 80 | "> 82 | 购买历史 83 | "> 85 | 我发布的 86 | "> 88 | 发布商品 89 | "> 91 | 收藏夹 92 | 97 | <%}else{%> 98 | "> 100 | 他发布的商品 101 | <%}%> 102 |
103 |
104 |
105 |
106 |
107 | <%if(tab.equals("push")){%> 108 | 109 | <%}else if(tab.equals("info")){%> 110 | 111 | <%}else if(tab.equals("auditing")){%> 112 | 113 | <%}else if(tab.equals("shopcart")){%> 114 | 115 | <%}else if(tab.equals("like")){%> 116 | 117 | <%}else if(tab.equals("mess")){%> 118 | 119 | <%}else if(tab.equals("pushed")){%> 120 | 121 | <%}else if(tab.equals("history")){%> 122 | 123 | <%}%> 124 |
125 |
126 |
127 | 128 | 129 | -------------------------------------------------------------------------------- /WebContent/user/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ page language="java"%> 4 | <% 5 | String path = request.getContextPath(); 6 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 7 | %> 8 | 9 | 10 | 11 | 12 | 13 | 注册-合肥学院物品交易 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | <% 22 | if(request.getAttribute("isRegister")!=null){ 23 | %> 24 | 34 | <% 35 | } 36 | %> 37 |
38 |
39 | 40 | 41 |
42 | 43 |
44 | 45 |
46 | 48 |
49 |
50 |
51 | 52 |
53 | 55 |
56 |
57 | 58 |
59 | 60 |
61 | 63 |
64 |
65 |
66 | 67 |
68 | 70 |
71 |
72 | 73 |
74 | 75 |
76 | 同意注册说明您已阅读《用户协议》 77 |
78 |
79 | 80 |
81 | 82 |
83 | 84 |
85 |
86 |
87 |
88 |
89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /WebContent/user/sendmess.jsp: -------------------------------------------------------------------------------- 1 | <% 2 | //消息发送页面 3 | %> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8"%> 6 | 7 | 8 | 9 | 10 | Insert title here 11 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/合肥学院二手物品交易网站.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/doc/合肥学院二手物品交易网站.ppt -------------------------------------------------------------------------------- /doc/需求分析 - 合肥学院物品交易网站的实现.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veekxt/hfuu_shop/e7466f87487b4e6a5817e8cd42bbbaa2401d51eb/doc/需求分析 - 合肥学院物品交易网站的实现.doc -------------------------------------------------------------------------------- /sql/hfuu_shop.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : xtvps 5 | Source Server Version : 50546 6 | Source Host : 45.78.60.77:3306 7 | Source Database : hfuu_shop 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50546 11 | File Encoding : 65001 12 | 13 | Date: 2015-12-25 16:05:04 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for `collect` 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `collect`; 22 | CREATE TABLE `collect` ( 23 | `user_id` int(11) DEFAULT NULL, 24 | `goods_id` int(11) DEFAULT NULL 25 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 26 | 27 | -- ---------------------------- 28 | -- Records of collect 29 | -- ---------------------------- 30 | 31 | -- ---------------------------- 32 | -- Table structure for `goods` 33 | -- ---------------------------- 34 | DROP TABLE IF EXISTS `goods`; 35 | CREATE TABLE `goods` ( 36 | `id` int(11) NOT NULL, 37 | `image` char(255) COLLATE utf8_bin NOT NULL, 38 | `type_id` int(11) NOT NULL COMMENT '类型id', 39 | `name` char(255) COLLATE utf8_bin NOT NULL COMMENT '商品名', 40 | `num` int(11) DEFAULT NULL COMMENT '数量', 41 | `price` float NOT NULL, 42 | `status` int(11) NOT NULL, 43 | `content` varchar(255) COLLATE utf8_bin NOT NULL, 44 | `producter_id` int(11) NOT NULL, 45 | `create_date` datetime NOT NULL, 46 | PRIMARY KEY (`id`) 47 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 48 | 49 | -- ---------------------------- 50 | -- Records of goods 51 | -- ---------------------------- 52 | INSERT INTO `goods` VALUES ('1', 'static/goods_img/1.jpg', '4', '笔记本', '1', '4000', '2', '二手笔记本,8成新,I7处理器', '10', '2015-12-12 12:10:10'); 53 | INSERT INTO `goods` VALUES ('2', 'static/goods_img/2.jpg', '2', '被套', '1', '30', '2', '二手被套', '1017', '2015-12-16 02:34:01'); 54 | INSERT INTO `goods` VALUES ('3', 'static/goods_img/3.jpg', '2', '自行车', '1', '50', '2', '二手自行车', '1017', '2015-12-11 11:22:33'); 55 | INSERT INTO `goods` VALUES ('4', 'static/goods_img/4.jpg', '5', '网球拍', '1', '50', '2', '二手网球拍,用过几天,九成新', '123', '2015-12-17 11:00:16'); 56 | INSERT INTO `goods` VALUES ('5', 'static/goods_img/5.jpg', '5', '篮球', '1', '80', '2', '全牛皮篮球,', '9', '2015-12-17 11:02:57'); 57 | INSERT INTO `goods` VALUES ('6', 'static/goods_img/6.jpg', '2', '懒人桌', '1', '15', '2', '加固型懒人桌,九成新', '123', '2015-12-17 11:05:00'); 58 | INSERT INTO `goods` VALUES ('7', 'static/goods_img/7.jpg', '1', '考研书', '1', '30', '2', '聚星文登考研', '123', '2015-12-21 11:07:22'); 59 | INSERT INTO `goods` VALUES ('8', 'static/goods_img/8.jpg', '1', '公务员书', '1', '30', '2', '公务员考试书籍,9成新', '123', '2015-12-23 16:02:21'); 60 | INSERT INTO `goods` VALUES ('9', 'static/goods_img/9.jpg', '2', '凉席', '1', '60', '2', '寝室牛皮凉席', '123', '2015-12-23 16:20:46'); 61 | INSERT INTO `goods` VALUES ('10', 'static/goods_img/10.jpg', '2', '纯棉枕头', '1', '50', '2', '纯棉枕头', '123', '2015-12-23 16:21:37'); 62 | INSERT INTO `goods` VALUES ('11', 'static/goods_img/11.jpg', '2', 'LED台灯,学习卧室床头书桌大学生寝室插电节能USB调光夹子台灯', '1', '100', '2', '灯光颜色默认自然光,轻微偏黄的灯光颜色,台灯默认USB接口,台灯供电方式:1,可用一切手机充电器直接插220V家用插座。 2,可接电脑USB。 3,可接手机充电宝供电。(注:这款不是充电台灯,不带蓄电池,必须连着电源使用)', '123', '2015-12-23 16:29:32'); 63 | INSERT INTO `goods` VALUES ('12', 'static/goods_img/12.jpg', '1', '《c primer plus(第五版)中文版》C语言经典入门书籍', '1', '23', '2', '只翻过几次,几乎全新。', '10', '2015-12-24 01:02:27'); 64 | INSERT INTO `goods` VALUES ('13', 'static/goods_img/13.jpg', '4', '诺基亚830手机', '1', '1200', '2', '购买时间在一年内,无保修,屏幕无划痕或坏点,机身有破裂损伤,完全正常,曾无拆无修,待机时长超过2天。相关配件有原装电池。', '10', '2015-12-24 01:08:58'); 65 | INSERT INTO `goods` VALUES ('14', 'static/goods_img/14.jpg', '2', '室内物品收纳架,多功能免钉可伸缩衣柜分层隔板', '1', '11', '2', '多功能免钉无痕衣柜分层架,', '123', '2015-12-24 09:26:42'); 66 | INSERT INTO `goods` VALUES ('15', 'static/goods_img/15.jpg', '3', '沃曼威斯韩版夜光双肩包大容量个性背包', '1', '50', '2', '书包,8成新\r\n', '123', '2015-12-24 09:36:38'); 67 | INSERT INTO `goods` VALUES ('16', 'static/goods_img/16.jpg', '4', '华为荣耀4x手机', '1', '450', '2', '移动4g标配版在保九新,京东抢购的,配件发票箱盒齐全,已经贴好钢化膜,送一软壳,便框有些许磕碰,不明显,屏幕右上方有出厂黄斑,4x通病,买回来就这样,无拆无修,特价处理。不议价,顺丰到付。', '10', '2015-12-24 15:30:13'); 68 | INSERT INTO `goods` VALUES ('17', 'static/goods_img/17.jpg', '4', '畅学STM32开发学习板,配套stm32f103c8t6最小系统核心板', '1', '67', '1', '畅学STM32开发学习板,所有模块均可用', '10', '2015-12-24 15:34:45'); 69 | INSERT INTO `goods` VALUES ('18', 'static/goods_img/18.jpg', '1', '地球往事系列小说 ,三体1+三体2黑暗森林+三体3死神永生', '1', '72', '1', '重庆出版集团出版\r\n全部是正版\r\nISBN编号: 9787536693968', '10', '2015-12-24 15:43:54'); 70 | INSERT INTO `goods` VALUES ('19', 'static/goods_img/19.jpg', '1', '《1984》(精装珍藏本) 奥威尔著 世界名著小说', '1', '23', '1', '全新\r\n中国画报出版社出版\r\n译者: 林东泰\r\nISBN编号: 9787514601312\r\n2011年08月', '10', '2015-12-25 15:57:39'); 71 | 72 | -- ---------------------------- 73 | -- Table structure for `message` 74 | -- ---------------------------- 75 | DROP TABLE IF EXISTS `message`; 76 | CREATE TABLE `message` ( 77 | `mess_from_id` int(11) NOT NULL, 78 | `mess_to_id` int(11) NOT NULL, 79 | `mess_text` varchar(255) COLLATE utf8_bin NOT NULL, 80 | `send_time` datetime NOT NULL, 81 | `mess_id` int(11) unsigned NOT NULL AUTO_INCREMENT, 82 | `mess_type` int(11) DEFAULT NULL, 83 | PRIMARY KEY (`mess_id`) 84 | ) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 85 | 86 | -- ---------------------------- 87 | -- Records of message 88 | -- ---------------------------- 89 | 90 | -- ---------------------------- 91 | -- Table structure for `order` 92 | -- ---------------------------- 93 | DROP TABLE IF EXISTS `order`; 94 | CREATE TABLE `order` ( 95 | `id` int(11) NOT NULL, 96 | `goods_id` int(11) NOT NULL, 97 | `user_id` int(11) NOT NULL, 98 | `date` datetime NOT NULL, 99 | `message` varchar(255) COLLATE utf8_bin DEFAULT NULL, 100 | PRIMARY KEY (`id`) 101 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 102 | 103 | -- ---------------------------- 104 | -- Records of order 105 | -- ---------------------------- 106 | 107 | -- ---------------------------- 108 | -- Table structure for `shoppingcart` 109 | -- ---------------------------- 110 | DROP TABLE IF EXISTS `shoppingcart`; 111 | CREATE TABLE `shoppingcart` ( 112 | `id` int(11) NOT NULL, 113 | `goodsId` int(11) NOT NULL, 114 | `userId` int(11) NOT NULL 115 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 116 | 117 | -- ---------------------------- 118 | -- Records of shoppingcart 119 | -- ---------------------------- 120 | 121 | -- ---------------------------- 122 | -- Table structure for `user` 123 | -- ---------------------------- 124 | DROP TABLE IF EXISTS `user`; 125 | CREATE TABLE `user` ( 126 | `img` char(255) COLLATE utf8_bin DEFAULT NULL, 127 | `id` int(11) NOT NULL, 128 | `email` char(255) COLLATE utf8_bin NOT NULL, 129 | `pwd` char(255) COLLATE utf8_bin NOT NULL, 130 | `name` char(255) COLLATE utf8_bin DEFAULT NULL, 131 | `stu_num` char(255) COLLATE utf8_bin DEFAULT NULL, 132 | `qq` char(255) COLLATE utf8_bin DEFAULT NULL, 133 | `phone` char(255) COLLATE utf8_bin DEFAULT NULL, 134 | `mess_num` int(11) NOT NULL DEFAULT '0', 135 | PRIMARY KEY (`id`) 136 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 137 | 138 | -- ---------------------------- 139 | -- Records of user 140 | -- ---------------------------- 141 | INSERT INTO `user` VALUES (null, '1', 'hfuu_shop@163.com', '8560ef54213c8b32e89a24ccc323a79e', '交易系统', null, null, null, '1'); 142 | INSERT INTO `user` VALUES ('static/user_img/9', '9', 'dandan@qq.com', '14e1b600b1fd579f47433b88e8d85291', '朱雷雷', null, null, '', '0'); 143 | INSERT INTO `user` VALUES ('static/user_img/10', '10', 'veekxt@gmail.com', '14e1b600b1fd579f47433b88e8d85291', '解涛', null, null, '15256925578', '0'); 144 | INSERT INTO `user` VALUES ('static/user_img/123', '123', '1300573251@qq.com', '191016dc3346309bee3403f55f77e871', '张剑', null, null, null, '0'); 145 | INSERT INTO `user` VALUES ('static/user_img/0', '1017', '1050026@qq.com', 'acd09f1f204179b957001f53f411899b', '陈生辉', null, null, '13245634567', '0'); 146 | INSERT INTO `user` VALUES ('static/user_img/1019', '1019', '18256989168@163.com', '191016dc3346309bee3403f55f77e871', '张剑', null, null, null, '0'); 147 | INSERT INTO `user` VALUES (null, '1020', '121@qq.com', '14e1b600b1fd579f47433b88e8d85291', null, null, null, null, '0'); 148 | INSERT INTO `user` VALUES (null, '1021', 'leilei@qq.com', '14e1b600b1fd579f47433b88e8d85291', null, null, null, null, '0'); 149 | DROP TRIGGER IF EXISTS `notify_auditing`; 150 | DELIMITER ;; 151 | CREATE TRIGGER `notify_auditing` AFTER UPDATE ON `goods` FOR EACH ROW begin 152 | set @goodsid=new.id; 153 | set @goodsname=new.name; 154 | set @newst=new.status; 155 | set @oldst=old.status; 156 | if ((@newst=2) and (@oldst=1)) then 157 | INSERT INTO `message`(mess_from_id,mess_to_id,mess_text,send_time) VALUES(1,new.producter_id,CONCAT("你的商品 ","",@goodsname,"","已经审核通过"),now()); 158 | end if; 159 | if ((@newst=3) and (@oldst=1)) then 160 | INSERT INTO `message`(mess_from_id,mess_to_id,mess_text,send_time) VALUES(1,new.producter_id,CONCAT("你的商品 ","",@goodsname,"","审核未通过"),now()); 161 | end if; 162 | end 163 | ;; 164 | DELIMITER ; 165 | DROP TRIGGER IF EXISTS `change_user_mess_num`; 166 | DELIMITER ;; 167 | CREATE TRIGGER `change_user_mess_num` AFTER INSERT ON `message` FOR EACH ROW update user set mess_num=mess_num+1 where id=new.mess_to_id 168 | ;; 169 | DELIMITER ; 170 | DROP TRIGGER IF EXISTS `update_goods_status`; 171 | DELIMITER ;; 172 | CREATE TRIGGER `update_goods_status` AFTER INSERT ON `order` FOR EACH ROW begin 173 | set @buyerid=new.user_id; 174 | set @buyername=(select name from user where id=@buyerid); 175 | set @sellerid = (select producter_id from goods where id=new.goods_id); 176 | set @goodsid = (select id from goods where id=new.goods_id); 177 | set @goodsname = (select name from goods where id=new.goods_id); 178 | set @sellername = (select name from `user` where id=@sellerid); 179 | INSERT INTO `message`(mess_from_id,mess_to_id,mess_text,send_time) VALUES (1,@sellerid,CONCAT("你的商品","",@goodsname,"","被购买,请尽快联系买家","",@buyername,"",",以下为买家的附加信息(可能为空) 180 | ============== 181 | ",new.message),new.date); 182 | update goods set status=4 where id=new.goods_id; 183 | end 184 | ;; 185 | DELIMITER ; 186 | -------------------------------------------------------------------------------- /src/src/dbHandle/CollectHandle.java: -------------------------------------------------------------------------------- 1 | package src.dbHandle; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | import src.tools.IntHolder; 10 | 11 | import src.dbc.DatabaseConnection; 12 | import src.vo.Goods; 13 | import src.vo.User; 14 | public class CollectHandle { 15 | private Connection conn = null; 16 | private PreparedStatement pstmt = null; 17 | public CollectHandle() { 18 | try { 19 | this.conn = new DatabaseConnection().getConnection(); 20 | } catch (Exception e) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | 25 | public boolean doCreate(int user_id,int goods_id) throws Exception{ 26 | boolean flag = false; 27 | String sql="select user_id from `collect` where user_id="+user_id+" and goods_id="+goods_id; 28 | this.pstmt = this.conn.prepareStatement(sql); 29 | ResultSet rs = this.pstmt.executeQuery(); 30 | if(rs.next()){ 31 | //已经收藏过了,直接 32 | return true; 33 | } 34 | 35 | sql="insert into `collect`(user_id,goods_id) values (?,?)"; 36 | this.pstmt = this.conn.prepareStatement(sql); 37 | this.pstmt.setInt(1, user_id); 38 | this.pstmt.setInt(2, goods_id); 39 | if (this.pstmt.executeUpdate() > 0) { 40 | flag = true; 41 | } 42 | rs.close();this.pstmt.close(); 43 | return flag; 44 | } 45 | 46 | //查找user所有收藏夹内物品 47 | public List findGoodsByUser(User user,IntHolder num,int limitMin,int perPage) throws Exception{ 48 | int userId=user.getId(); 49 | List all = new ArrayList(); 50 | String sql = "select SQL_CALC_FOUND_ROWS id,num,content,type_id,image,producter_id,price,create_date,name,status from `goods` where id=any(SELECT goods_id from `collect` where user_id=?) order by create_date desc limit ?,?"; 51 | this.pstmt = this.conn.prepareStatement(sql); 52 | this.pstmt.setInt(1,userId); 53 | this.pstmt.setInt(2,limitMin); 54 | this.pstmt.setInt(3,perPage); 55 | 56 | ResultSet rs = this.pstmt.executeQuery(); 57 | while (rs.next()) { 58 | Goods good = new Goods(); 59 | good.setId(rs.getInt(1)); 60 | good.setNum(rs.getInt(2)); 61 | good.setContent(rs.getString(3)); 62 | good.setType_id(rs.getInt(4)); 63 | good.setImage(rs.getString(5)); 64 | good.setProducter_id(rs.getInt(6)); 65 | good.setPrice(rs.getFloat(7)); 66 | good.setName(rs.getString(9)); 67 | java.sql.Timestamp timeStamp=rs.getTimestamp(8); 68 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 69 | good.setCreatDate(date); 70 | good.setStates(rs.getInt(10)); 71 | all.add(good); 72 | } 73 | rs = this.pstmt.executeQuery("SELECT FOUND_ROWS()"); 74 | if(rs.next()){ 75 | num.value=rs.getInt(1); 76 | } 77 | rs.close();this.pstmt.close(); 78 | return all; 79 | } 80 | //移除一个收藏夹物品 81 | public boolean removeOneFromCollect(int goodsId,int userId) throws Exception{ 82 | Boolean flag=false; 83 | String sql="Delete from `collect` where goods_id=? and user_id=?"; 84 | pstmt=conn.prepareStatement(sql); 85 | pstmt.setInt(1, goodsId); 86 | pstmt.setInt(2, userId); 87 | if (this.pstmt.executeUpdate() > 0) { 88 | flag = true; 89 | } 90 | this.pstmt.close(); 91 | return flag; 92 | } 93 | 94 | public void close(){ 95 | if(this.conn != null){ 96 | try{ 97 | this.conn.close(); 98 | }catch(Exception e){ 99 | e.printStackTrace(); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/src/dbHandle/GoodsHandle.java: -------------------------------------------------------------------------------- 1 | package src.dbHandle; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | import src.tools.IntHolder; 10 | import src.dbc.DatabaseConnection; 11 | import src.vo.Goods; 12 | 13 | public class GoodsHandle { 14 | private Connection conn = null; 15 | private PreparedStatement pstmt = null; 16 | public GoodsHandle() { 17 | try { 18 | this.conn = new DatabaseConnection().getConnection(); 19 | } catch (Exception e) { 20 | e.printStackTrace(); 21 | } 22 | } 23 | 24 | public Goods findById(int id) throws Exception { 25 | Goods goods = null; 26 | String sql = "SELECT id,image,type_id,name,num,price,status,content,producter_id,create_date FROM goods WHERE id=?"; 27 | this.pstmt = this.conn.prepareStatement(sql); 28 | this.pstmt.setInt(1, id); 29 | ResultSet rs = this.pstmt.executeQuery(); 30 | if (rs.next()) { 31 | goods = new Goods(); 32 | goods.setId(rs.getInt(1)); 33 | goods.setImage(rs.getString(2)); 34 | goods.setType_id(rs.getInt(3)); 35 | goods.setName(rs.getString(4)); 36 | goods.setNum(rs.getInt(5)); 37 | goods.setPrice(rs.getFloat(6)); 38 | goods.setStates(rs.getInt(7)); 39 | goods.setContent(rs.getString(8)); 40 | goods.setProducter_id(rs.getInt(9)); 41 | java.sql.Timestamp timeStamp=rs.getTimestamp(10); 42 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 43 | goods.setCreatDate(date); 44 | } 45 | rs.close();this.pstmt.close(); 46 | return goods; 47 | } 48 | 49 | public boolean doCreate(Goods good) throws Exception { 50 | boolean flag = false; 51 | String sql = "INSERT INTO `goods`(name,price,image,content,status,id,type_id,producter_id,create_date,num) VALUES (?,?,?,?,?,?,?,?,?,?)"; 52 | this.pstmt = this.conn.prepareStatement(sql); 53 | pstmt.setString(1, good.getName()); 54 | pstmt.setFloat(2, good.getPrice()); 55 | pstmt.setString(3, good.getImage()); 56 | pstmt.setString(4, good.getContent()); 57 | pstmt.setInt(5, 1); 58 | pstmt.setInt(6, good.getId()); 59 | pstmt.setInt(7, good.getType_id()); 60 | pstmt.setInt(8, good.getProducter_id()); 61 | java.sql.Timestamp dateTime = new java.sql.Timestamp(good.getCreatDate().getTime()); 62 | pstmt.setTimestamp(9, dateTime); 63 | pstmt.setInt(10, good.getNum()); 64 | if (this.pstmt.executeUpdate() > 0) { 65 | flag = true; 66 | } 67 | this.pstmt.close(); 68 | return flag; 69 | } 70 | 71 | public int getMaxId() throws Exception { 72 | ResultSet rs = this.conn.prepareStatement("select max(id) from goods").executeQuery(); 73 | rs.next(); 74 | int maxId = rs.getInt(1); 75 | return maxId; 76 | } 77 | 78 | public List findAll(IntHolder num,int limitMin,int perPage) throws Exception { 79 | List all = new ArrayList(); 80 | String sql = "SELECT SQL_CALC_FOUND_ROWS id,num,content,type_id,image,producter_id,price,create_date,name from goods where status=? order by create_date desc limit ?,?"; 81 | this.pstmt = this.conn.prepareStatement(sql); 82 | this.pstmt.setInt(1, 2); 83 | this.pstmt.setInt(2, limitMin); 84 | this.pstmt.setInt(3, perPage); 85 | ResultSet rs = this.pstmt.executeQuery(); 86 | while (rs.next()) { 87 | Goods good = new Goods(); 88 | good.setId(rs.getInt(1)); 89 | good.setNum(rs.getInt(2)); 90 | good.setContent(rs.getString(3)); 91 | good.setType_id(rs.getInt(4)); 92 | good.setImage(rs.getString(5)); 93 | good.setProducter_id(rs.getInt(6)); 94 | good.setPrice(rs.getFloat(7)); 95 | good.setName(rs.getString(9)); 96 | java.sql.Timestamp timeStamp=rs.getTimestamp(8); 97 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 98 | good.setCreatDate(date); 99 | all.add(good); 100 | } 101 | rs = this.pstmt.executeQuery("SELECT FOUND_ROWS()"); 102 | if(rs.next()){ 103 | num.value=rs.getInt(1); 104 | } 105 | rs.close();this.pstmt.close(); 106 | return all; 107 | } 108 | 109 | public List findAllNotAuditing() throws Exception { 110 | List all = new ArrayList(); 111 | String sql = "SELECT id,num,content,type_id,image,producter_id,price,name,create_date from goods where status=1"; 112 | this.pstmt = this.conn.prepareStatement(sql); 113 | ResultSet rs = this.pstmt.executeQuery(); 114 | Goods good = null; 115 | while (rs.next()) { 116 | good = new Goods(); 117 | good.setId(rs.getInt(1)); 118 | good.setNum(rs.getInt(2)); 119 | good.setContent(rs.getString(3)); 120 | good.setType_id(rs.getInt(4)); 121 | good.setImage(rs.getString(5)); 122 | good.setProducter_id(rs.getInt(6)); 123 | good.setPrice(rs.getFloat(7)); 124 | good.setName(rs.getString(8)); 125 | java.sql.Timestamp timeStamp=rs.getTimestamp(9); 126 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 127 | good.setCreatDate(date); 128 | all.add(good); 129 | } 130 | rs.close();this.pstmt.close(); 131 | return all; 132 | } 133 | 134 | public boolean doUpdate(Goods good) throws Exception { 135 | boolean flag = false; 136 | String sql = "update goods set id=?,image=?,type_id=?,name=?,num=?,price=?,status=?,content=?,producter_id=?,create_date=? where id=?"; 137 | this.pstmt = this.conn.prepareStatement(sql); 138 | 139 | pstmt.setInt(1, good.getId()); 140 | pstmt.setString(2, good.getImage()); 141 | pstmt.setInt(3, good.getType_id()); 142 | pstmt.setString(4, good.getName()); 143 | pstmt.setInt(5, good.getNum()); 144 | pstmt.setFloat(6, good.getPrice()); 145 | pstmt.setInt(7, good.getStates()); 146 | pstmt.setString(8, good.getContent()); 147 | pstmt.setInt(9, good.getProducter_id()); 148 | java.sql.Timestamp dateTime = new java.sql.Timestamp(good.getCreatDate().getTime()); 149 | pstmt.setTimestamp(10, dateTime); 150 | pstmt.setInt(11, good.getId()); 151 | if (this.pstmt.executeUpdate() > 0) { 152 | flag = true; 153 | } 154 | this.pstmt.close(); 155 | return flag; 156 | } 157 | 158 | public List findByCeta(int cetaId,IntHolder num,int limitMin,int perPage) throws Exception { 159 | List all = new ArrayList(); 160 | String sql = "SELECT SQL_CALC_FOUND_ROWS id,num,content,type_id,image,producter_id,price,name,create_date from goods where status=2 and type_id="+cetaId+" order by create_date desc limit ?,?"; 161 | this.pstmt = this.conn.prepareStatement(sql); 162 | this.pstmt.setInt(1, limitMin); 163 | this.pstmt.setInt(2, perPage); 164 | ResultSet rs = this.pstmt.executeQuery(); 165 | Goods good = null; 166 | while (rs.next()){ 167 | good = new Goods(); 168 | good.setId(rs.getInt(1)); 169 | good.setNum(rs.getInt(2)); 170 | good.setContent(rs.getString(3)); 171 | good.setType_id(rs.getInt(4)); 172 | good.setImage(rs.getString(5)); 173 | good.setProducter_id(rs.getInt(6)); 174 | good.setPrice(rs.getFloat(7)); 175 | good.setName(rs.getString(8)); 176 | java.sql.Timestamp timeStamp=rs.getTimestamp(9); 177 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 178 | good.setCreatDate(date); 179 | all.add(good); 180 | } 181 | rs = this.pstmt.executeQuery("SELECT FOUND_ROWS()"); 182 | if(rs.next()){ 183 | num.value=rs.getInt(1); 184 | } 185 | rs.close();this.pstmt.close(); 186 | return all; 187 | } 188 | 189 | public List findByKey(String key) throws Exception { 190 | List all = new ArrayList(); 191 | String sql = "SELECT id,num,content,type_id,image,producter_id,price,name,create_date from goods where status=2 and name like ? order by create_date desc"; 192 | this.pstmt = this.conn.prepareStatement(sql); 193 | this.pstmt.setString(1, "%"+key+"%"); 194 | ResultSet rs = this.pstmt.executeQuery(); 195 | Goods good = null; 196 | while (rs.next()){ 197 | good = new Goods(); 198 | good.setId(rs.getInt(1)); 199 | good.setNum(rs.getInt(2)); 200 | good.setContent(rs.getString(3)); 201 | good.setType_id(rs.getInt(4)); 202 | good.setImage(rs.getString(5)); 203 | good.setProducter_id(rs.getInt(6)); 204 | good.setPrice(rs.getFloat(7)); 205 | good.setName(rs.getString(8)); 206 | java.sql.Timestamp timeStamp=rs.getTimestamp(9); 207 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 208 | good.setCreatDate(date); 209 | all.add(good); 210 | } 211 | rs.close();this.pstmt.close(); 212 | return all; 213 | } 214 | 215 | public List findByUserId(int userId) throws Exception { 216 | List all = new ArrayList(); 217 | String sql = "SELECT id,num,content,type_id,image,producter_id,price,name,create_date,status from goods where (status=2 or status=4) and producter_id="+userId+" order by create_date desc"; 218 | this.pstmt = this.conn.prepareStatement(sql); 219 | ResultSet rs = this.pstmt.executeQuery(); 220 | Goods good = null; 221 | while (rs.next()){ 222 | good = new Goods(); 223 | good.setId(rs.getInt(1)); 224 | good.setNum(rs.getInt(2)); 225 | good.setContent(rs.getString(3)); 226 | good.setType_id(rs.getInt(4)); 227 | good.setImage(rs.getString(5)); 228 | good.setProducter_id(rs.getInt(6)); 229 | good.setPrice(rs.getFloat(7)); 230 | good.setName(rs.getString(8)); 231 | java.sql.Timestamp timeStamp=rs.getTimestamp(9); 232 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 233 | good.setCreatDate(date); 234 | good.setStates(rs.getInt(10)); 235 | all.add(good); 236 | } 237 | rs.close();this.pstmt.close(); 238 | return all; 239 | } 240 | 241 | public void close(){ 242 | if(this.conn != null){ 243 | try{ 244 | this.conn.close(); 245 | }catch(Exception e){ 246 | e.printStackTrace(); 247 | } 248 | } 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /src/src/dbHandle/MessHandle.java: -------------------------------------------------------------------------------- 1 | package src.dbHandle; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | import src.tools.IntHolder; 10 | 11 | import src.dbc.DatabaseConnection; 12 | import src.vo.*; 13 | 14 | public class MessHandle { 15 | private Connection conn = null; 16 | private PreparedStatement pstmt = null; 17 | public MessHandle() { 18 | try { 19 | this.conn = new DatabaseConnection().getConnection(); 20 | } catch (Exception e) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | 25 | public boolean doCreate(Mess mess) throws Exception { 26 | boolean flag = false; 27 | String sql = "INSERT INTO `message`(mess_from_id,mess_to_id,mess_text,send_time) VALUES (?,?,?,?)"; 28 | this.pstmt = this.conn.prepareStatement(sql); 29 | //pstmt.setInt(1, mess.getMessId()); 30 | pstmt.setInt(1, mess.getMessFromId()); 31 | pstmt.setInt(2, mess.getMessToId()); 32 | pstmt.setString(3, mess.getMessText()); 33 | pstmt.setTimestamp(4,new java.sql.Timestamp(mess.getSendDate().getTime())); 34 | if (this.pstmt.executeUpdate() > 0) { 35 | flag = true; 36 | } 37 | this.pstmt.close(); 38 | return flag; 39 | } 40 | 41 | public List findAllMessByUser(IntHolder num,User user,int limitMin,int perPage) throws Exception { 42 | List all = new ArrayList(); 43 | String sql = "SELECT SQL_CALC_FOUND_ROWS mess_id,mess_from_id,mess_to_id,send_time,mess_text from `message` where mess_to_id=? order by send_time desc limit ?,?"; 44 | this.pstmt = this.conn.prepareStatement(sql); 45 | this.pstmt.setInt(1,user.getId()); 46 | this.pstmt.setInt(2,limitMin); 47 | this.pstmt.setInt(3,perPage); 48 | 49 | ResultSet rs = this.pstmt.executeQuery(); 50 | while (rs.next()) { 51 | Mess mess = new Mess(); 52 | mess.setMessId(rs.getInt(1)); 53 | mess.setMessFromId(rs.getInt(2)); 54 | mess.setMessToId(rs.getInt(3)); 55 | java.sql.Timestamp timeStamp=rs.getTimestamp(4); 56 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 57 | mess.setSendDate(date); 58 | mess.setMessText(rs.getString(5)); 59 | all.add(mess); 60 | } 61 | rs = this.pstmt.executeQuery("SELECT FOUND_ROWS()"); 62 | if(rs.next()){ 63 | num.value=rs.getInt(1); 64 | } 65 | rs.close();this.pstmt.close(); 66 | return all; 67 | } 68 | 69 | public boolean removeOneMess(int messId,int userId) throws Exception{ 70 | Boolean flag=false; 71 | String sql="Delete from `message` where mess_id=? and mess_to_id=?"; 72 | pstmt=conn.prepareStatement(sql); 73 | pstmt.setInt(1, messId); 74 | pstmt.setInt(2,userId); 75 | if (this.pstmt.executeUpdate() > 0) { 76 | flag = true; 77 | } 78 | this.pstmt.close(); 79 | return flag; 80 | } 81 | 82 | public void close(){ 83 | if(this.conn != null){ 84 | try{ 85 | this.conn.close(); 86 | }catch(Exception e){ 87 | e.printStackTrace(); 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/src/dbHandle/OrderHandle.java: -------------------------------------------------------------------------------- 1 | package src.dbHandle; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | import src.dbc.DatabaseConnection; 10 | import src.vo.*; 11 | 12 | public class OrderHandle { 13 | private Connection conn = null; 14 | private PreparedStatement pstmt = null; 15 | 16 | public OrderHandle() { 17 | try { 18 | this.conn = new DatabaseConnection().getConnection(); 19 | } catch (Exception e) { 20 | e.printStackTrace(); 21 | } 22 | } 23 | 24 | public boolean doCreate(Order order) throws Exception { 25 | boolean flag = false; 26 | String sql = "INSERT INTO `order`(id,goods_id,user_id,date,message) VALUES (?,?,?,?,?)"; 27 | Integer maxId=0; 28 | try { 29 | ResultSet max_id=this.conn.prepareStatement("select max(id) from `order`").executeQuery(); 30 | if(max_id.next()) 31 | { 32 | maxId=max_id.getInt("max(id)"); 33 | } 34 | } catch (Exception e) { 35 | e.printStackTrace(); 36 | } 37 | this.pstmt = this.conn.prepareStatement(sql); 38 | this.pstmt.setInt(1,1+maxId); 39 | this.pstmt.setInt(2,order.getGoodsId()); 40 | this.pstmt.setInt(3,order.getUserId()); 41 | java.sql.Timestamp dateTime = new java.sql.Timestamp(order.getDate().getTime()); 42 | pstmt.setTimestamp(4, dateTime); 43 | pstmt.setString(5, order.getMessage()); 44 | if (this.pstmt.executeUpdate() > 0) { 45 | flag = true; 46 | } 47 | 48 | this.pstmt.close(); 49 | return flag; 50 | } 51 | 52 | public List findGoodsByUser(User user) throws Exception{ 53 | int userId=user.getId(); 54 | List all = new ArrayList(); 55 | String sql = "select id,num,content,type_id,image,producter_id,price,create_date,name from `goods` where id=any(SELECT goods_id from `order` where user_id=?)"; 56 | this.pstmt = this.conn.prepareStatement(sql); 57 | this.pstmt.setInt(1,userId); 58 | ResultSet rs = this.pstmt.executeQuery(); 59 | while (rs.next()) { 60 | Goods good = new Goods(); 61 | good.setId(rs.getInt(1)); 62 | good.setNum(rs.getInt(2)); 63 | good.setContent(rs.getString(3)); 64 | good.setType_id(rs.getInt(4)); 65 | good.setImage(rs.getString(5)); 66 | good.setProducter_id(rs.getInt(6)); 67 | good.setPrice(rs.getFloat(7)); 68 | good.setName(rs.getString(9)); 69 | java.sql.Timestamp timeStamp=rs.getTimestamp(8); 70 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 71 | good.setCreatDate(date); 72 | all.add(good); 73 | } 74 | rs.close();this.pstmt.close(); 75 | return all; 76 | } 77 | 78 | public void close(){ 79 | if(this.conn != null){ 80 | try{ 81 | this.conn.close(); 82 | }catch(Exception e){ 83 | e.printStackTrace(); 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/src/dbHandle/ShopCartHandle.java: -------------------------------------------------------------------------------- 1 | package src.dbHandle; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | import src.dbc.DatabaseConnection; 10 | import src.vo.Goods; 11 | import src.vo.User; 12 | public class ShopCartHandle { 13 | private Connection conn = null; 14 | private PreparedStatement pstmt = null; 15 | 16 | public ShopCartHandle() { 17 | try { 18 | this.conn = new DatabaseConnection().getConnection(); 19 | } catch (Exception e) { 20 | e.printStackTrace(); 21 | } 22 | } 23 | //获取user购物车物品数量 24 | //不一致性标记:为什么用id作参数? 25 | public Integer getShopCartNum(int id) throws Exception { 26 | String sql = "SELECT count(goodsId) FROM ShoppingCart WHERE userId=?"; 27 | this.pstmt = this.conn.prepareStatement(sql); 28 | this.pstmt.setInt(1, id); 29 | ResultSet rs = this.pstmt.executeQuery(); 30 | if(rs.next()){ 31 | return rs.getInt(1); 32 | }else{ 33 | return 0; 34 | } 35 | } 36 | //增加一条购物车记录,goodsNum已废弃 37 | public boolean doSaveShoppingCart( int goodsNum,int goodsId,int userId) throws Exception { 38 | boolean flag = false; 39 | String sql="select id from shoppingcart where userId="+userId+" and goodsId="+goodsId; 40 | this.pstmt = this.conn.prepareStatement(sql); 41 | ResultSet rs = this.pstmt.executeQuery(); 42 | if(rs.next()){ 43 | return false; 44 | } 45 | sql = "INSERT INTO shoppingcart(id,goodsId,userId) VALUES (?,?,?)"; 46 | this.pstmt = this.conn.prepareStatement(sql); 47 | pstmt.setInt(1, goodsNum); 48 | pstmt.setInt(2, goodsId); 49 | pstmt.setInt(3, userId); 50 | if (this.pstmt.executeUpdate() > 0) { 51 | flag = true; 52 | } 53 | rs.close();this.pstmt.close(); 54 | return flag; 55 | } 56 | //查找user所有购物车内物品 57 | public List findGoodsByUser(User user) throws Exception{ 58 | int userId=user.getId(); 59 | List all = new ArrayList(); 60 | String sql = "select id,num,content,type_id,image,producter_id,price,create_date,name from `goods` where id=any(SELECT goodsId from `shoppingcart` where userId=?) order by create_date desc"; 61 | this.pstmt = this.conn.prepareStatement(sql); 62 | this.pstmt.setInt(1,userId); 63 | ResultSet rs = this.pstmt.executeQuery(); 64 | while (rs.next()) { 65 | Goods good = new Goods(); 66 | good.setId(rs.getInt(1)); 67 | good.setNum(rs.getInt(2)); 68 | good.setContent(rs.getString(3)); 69 | good.setType_id(rs.getInt(4)); 70 | good.setImage(rs.getString(5)); 71 | good.setProducter_id(rs.getInt(6)); 72 | good.setPrice(rs.getFloat(7)); 73 | good.setName(rs.getString(9)); 74 | java.sql.Timestamp timeStamp=rs.getTimestamp(8); 75 | java.util.Date date=new java.util.Date(timeStamp.getTime()); 76 | good.setCreatDate(date); 77 | all.add(good); 78 | } 79 | rs.close();this.pstmt.close(); 80 | return all; 81 | } 82 | //移除购物车的一个物品 83 | public boolean removeList(int goodId,int userId) throws Exception{ 84 | Boolean flag=false; 85 | String sql="Delete from shoppingcart where goodsId=? and userId=?"; 86 | pstmt=conn.prepareStatement(sql); 87 | pstmt.setInt(1, goodId); 88 | pstmt.setInt(2,userId); 89 | if (this.pstmt.executeUpdate() > 0) { 90 | flag = true; 91 | } 92 | this.pstmt.close(); 93 | return flag; 94 | } 95 | //清空user的购物车 96 | public boolean removeAllByUser(User user) throws Exception{ 97 | Boolean flag=false; 98 | String sql="Delete from shoppingcart where and userId=?"; 99 | pstmt=conn.prepareStatement(sql); 100 | pstmt.setInt(1,user.getId()); 101 | if (this.pstmt.executeUpdate() > 0) { 102 | flag = true; 103 | } 104 | this.pstmt.close(); 105 | return flag; 106 | } 107 | 108 | public void close(){ 109 | if(this.conn != null){ 110 | try{ 111 | this.conn.close(); 112 | }catch(Exception e){ 113 | e.printStackTrace(); 114 | } 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/src/dbHandle/UserHandle.java: -------------------------------------------------------------------------------- 1 | package src.dbHandle; 2 | import java.util.* ; 3 | import java.sql.* ; 4 | 5 | import src.dbc.DatabaseConnection; 6 | import src.vo.* ; 7 | public class UserHandle{ 8 | private Connection conn = null; 9 | private PreparedStatement pstmt = null ; 10 | public UserHandle(){ 11 | try { 12 | this.conn=new DatabaseConnection().getConnection(); 13 | } catch (Exception e) { 14 | e.printStackTrace(); 15 | } 16 | } 17 | public boolean doCreate(User user) throws Exception{ 18 | boolean flag = false ; 19 | ResultSet max_id=this.conn.prepareStatement("select max(id) from user").executeQuery(); 20 | max_id.next(); 21 | String maxId=max_id.getString("max(id)"); 22 | String sql = "INSERT INTO user(id,email,pwd,name,stu_num,phone) VALUES (?,?,?,?,?,?)" ; 23 | this.pstmt = this.conn.prepareStatement(sql) ; 24 | this.pstmt.setInt(1,1+Integer.parseInt(maxId)); 25 | this.pstmt.setString(2,user.getEmail()) ; 26 | this.pstmt.setString(3,user.getPwd()) ; 27 | this.pstmt.setString(4,user.getName()) ; 28 | this.pstmt.setString(5,user.getStu_num()) ; 29 | this.pstmt.setString(6,user.getPhone()) ; 30 | if(this.pstmt.executeUpdate() > 0){ 31 | flag = true ; 32 | } 33 | this.pstmt.close() ; 34 | return flag ; 35 | } 36 | 37 | public boolean doUpdate(User user) throws Exception{ 38 | boolean flag = false ; 39 | String sql = "update user set pwd=?,name=?,phone=?,img=? where id=?" ; 40 | this.pstmt = this.conn.prepareStatement(sql) ; 41 | this.pstmt.setString(1,user.getPwd()); 42 | this.pstmt.setString(2,user.getName()) ; 43 | this.pstmt.setString(3,user.getPhone()) ; 44 | this.pstmt.setString(4,user.getImg()) ; 45 | this.pstmt.setInt(5,user.getId()) ; 46 | if(this.pstmt.executeUpdate() > 0){ 47 | flag = true ; 48 | } 49 | this.pstmt.close() ; 50 | return flag ; 51 | } 52 | 53 | public List findAll(String keyWord) throws Exception{ 54 | List all = new ArrayList() ; 55 | String sql = "SELECT id,email,pwd,name,stu_num FROM user WHERE name LIKE ? OR email LIKE ?" ; 56 | this.pstmt = this.conn.prepareStatement(sql) ; 57 | this.pstmt.setString(1,"%"+keyWord+"%") ; 58 | this.pstmt.setString(2,"%"+keyWord+"%") ; 59 | ResultSet rs = this.pstmt.executeQuery() ; 60 | User user = null ; 61 | while(rs.next()){ 62 | user = new User() ; 63 | user.setId(rs.getInt(1)) ; 64 | user.setEmail(rs.getString(2)) ; 65 | user.setPwd(rs.getString(3)) ; 66 | user.setName(rs.getString(4)) ; 67 | user.setStu_num(rs.getString(5)) ; 68 | all.add(user) ; 69 | } 70 | this.pstmt.close() ; 71 | return all ; 72 | } 73 | 74 | public boolean emptyMessnum(User user) throws Exception{ 75 | String sql = "update user set mess_num=0 WHERE id="+user.getId(); 76 | this.pstmt = this.conn.prepareStatement(sql) ; 77 | if(this.pstmt.executeUpdate(sql)>0){ 78 | user.setMessnum(0); 79 | return true; 80 | } 81 | return false; 82 | } 83 | 84 | public User findById(int id) throws Exception{ 85 | User user = null ; 86 | String sql = "SELECT id,email,pwd,name,stu_num ,phone,mess_num,img FROM user WHERE id=?" ; 87 | this.pstmt = this.conn.prepareStatement(sql) ; 88 | this.pstmt.setInt(1,id) ; 89 | ResultSet rs = this.pstmt.executeQuery(); 90 | if(rs.next()){ 91 | user = new User() ; 92 | user.setId(rs.getInt(1)) ; 93 | user.setEmail(rs.getString(2)) ; 94 | user.setPwd(rs.getString(3)) ; 95 | user.setName(rs.getString(4)) ; 96 | user.setStu_num(rs.getString(5)) ; 97 | user.setPhone(rs.getString(6)) ; 98 | user.setImg(rs.getString(8)) ; 99 | user.setMessnum(rs.getInt(7)) ; 100 | } 101 | rs.close();this.pstmt.close(); 102 | return user ; 103 | } 104 | public User findByEmail(String str) throws Exception{ 105 | User user = null ; 106 | String sql = "SELECT id,email,pwd,name,stu_num,phone,mess_num,img FROM user WHERE email=?" ; 107 | this.pstmt = this.conn.prepareStatement(sql) ; 108 | this.pstmt.setString(1,str) ; 109 | ResultSet rs = this.pstmt.executeQuery() ; 110 | if(rs.next()){ 111 | user = new User() ; 112 | user.setId(rs.getInt(1)) ; 113 | user.setEmail(rs.getString(2)) ; 114 | user.setPwd(rs.getString(3)) ; 115 | user.setName(rs.getString(4)) ; 116 | user.setStu_num(rs.getString(5)) ; 117 | user.setPhone(rs.getString(6)) ; 118 | user.setImg(rs.getString(8)) ; 119 | user.setMessnum(rs.getInt(7)) ; 120 | } 121 | rs.close();this.pstmt.close(); 122 | return user ; 123 | } 124 | 125 | public void close(){ 126 | if(this.conn != null){ 127 | try{ 128 | this.conn.close(); 129 | }catch(Exception e){ 130 | e.printStackTrace(); 131 | } 132 | } 133 | } 134 | } -------------------------------------------------------------------------------- /src/src/dbc/DatabaseConnection.java: -------------------------------------------------------------------------------- 1 | package src.dbc; 2 | import java.sql.*; 3 | public class DatabaseConnection { 4 | private static final String DBDRIVER = "com.mysql.jdbc.Driver" ; 5 | private static final String DBURL = "jdbc:mysql://127.0.0.1:3306/hfuu_shop" ; 6 | private static final String DBUSER = "root" ; 7 | private static final String DBPASSWORD = "loroot" ; 8 | private Connection conn ; 9 | public DatabaseConnection() throws Exception { 10 | Class.forName(DBDRIVER) ; 11 | this.conn = DriverManager.getConnection(DBURL,DBUSER,DBPASSWORD) ; 12 | //this.conn.createStatement().execute("SET NAMES utf8"); 13 | } 14 | public Connection getConnection(){ 15 | return this.conn ; 16 | } 17 | public void close() throws Exception { 18 | if(this.conn != null){ 19 | try{ 20 | this.conn.close() ; 21 | }catch(Exception e){ 22 | throw e ; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/src/servlet/AuditingServlet.java: -------------------------------------------------------------------------------- 1 | package src.servlet; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import src.dbHandle.GoodsHandle; 11 | import src.tools.LoginVerify; 12 | import src.vo.*; 13 | /** 14 | * Servlet implementation class AuditingServlet 15 | */ 16 | @WebServlet("/AuditingServlet") 17 | public class AuditingServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | public AuditingServlet() { 21 | super(); 22 | } 23 | /** 24 | * Servlet:验证待审核物品 25 | */ 26 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 27 | if(LoginVerify.isAdmin(request)){ 28 | int isPass=Integer.parseInt(request.getParameter("hd")); 29 | int goodsId=Integer.parseInt(request.getParameter("goodsid")); 30 | boolean isSuc=false; 31 | GoodsHandle goodsHandle=new GoodsHandle(); 32 | try { 33 | Goods goods=goodsHandle.findById(goodsId); 34 | if(isPass==1){ 35 | goods.setStates(2); 36 | isSuc=true; 37 | }else if(isPass==0){ 38 | goods.setStates(3); 39 | isSuc=true; 40 | }else{ 41 | response.getWriter().print("error"); 42 | } 43 | if(isSuc){ 44 | goodsHandle.doUpdate(goods); 45 | response.getWriter().print("success"); 46 | } 47 | } catch (Exception e) { 48 | e.printStackTrace(); 49 | response.getWriter().print("error"); 50 | }finally { 51 | goodsHandle.close(); 52 | } 53 | }else{ 54 | response.getWriter().print("error"); 55 | } 56 | } 57 | 58 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 59 | doGet(request,response); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/src/servlet/AutoLogin.java: -------------------------------------------------------------------------------- 1 | package src.servlet; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.Filter; 5 | import javax.servlet.FilterChain; 6 | import javax.servlet.FilterConfig; 7 | import javax.servlet.ServletException; 8 | import javax.servlet.ServletRequest; 9 | import javax.servlet.ServletResponse; 10 | import javax.servlet.annotation.WebFilter; 11 | import javax.servlet.http.Cookie; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpSession; 14 | import src.dbHandle.UserHandle; 15 | import src.tools.LoginVerify; 16 | import src.vo.User; 17 | 18 | /** 19 | * Servlet Filter implementation class AutoLogin 20 | */ 21 | @WebFilter("/AutoLogin") 22 | public class AutoLogin implements Filter { 23 | public AutoLogin() { 24 | } 25 | 26 | public void destroy() { 27 | } 28 | 29 | public void doFilter(ServletRequest request, ServletResponse response,FilterChain chain) throws IOException, ServletException { 30 | HttpServletRequest req = (HttpServletRequest) request; 31 | HttpSession ses = req.getSession(); 32 | 33 | if(LoginVerify.isLogin(req)){ 34 | chain.doFilter(request, response); 35 | return; 36 | } 37 | 38 | Cookie[] cookies = req.getCookies(); 39 | UserHandle userHandle = new UserHandle(); 40 | String emailCookie = null; 41 | /* 42 | * **重要**://日后修复标记:这里仅用了email作为cookie并用于验证,极不安全 43 | */ 44 | if (cookies != null) { 45 | for (Cookie cookie : cookies) { 46 | if ("LOGIN_EMAIL".equals(cookie.getName())) { 47 | emailCookie = cookie.getValue(); 48 | try { 49 | if (userHandle.findByEmail(emailCookie) != null) { 50 | User user = userHandle.findByEmail(emailCookie); 51 | if(user!=null) 52 | { 53 | ses.setAttribute("loginUser",user); 54 | ses.setAttribute("isLogined", true); 55 | }else{ 56 | //未检测到cookie,不做任何事 57 | } 58 | } 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | } 62 | } 63 | } 64 | } 65 | userHandle.close(); 66 | chain.doFilter(request, response); 67 | } 68 | 69 | public void init(FilterConfig fConfig) throws ServletException { 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/src/servlet/BuyAllShopcartServlet.java: -------------------------------------------------------------------------------- 1 | package src.servlet; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.ArrayList; 6 | import java.util.Date; 7 | import java.util.List; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | import src.dbHandle.*; 16 | import src.tools.LoginVerify; 17 | import src.vo.*; 18 | 19 | @WebServlet("/BuyAllShopcartServlet") 20 | public class BuyAllShopcartServlet extends HttpServlet { 21 | private static final long serialVersionUID = 1L; 22 | 23 | public BuyAllShopcartServlet() { 24 | super(); 25 | } 26 | 27 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 28 | PrintWriter resOut = response.getWriter(); 29 | Boolean isLogined = LoginVerify.isLogin(request); 30 | User user = null; 31 | if(isLogined){ 32 | user = (User)request.getSession().getAttribute("loginUser"); 33 | }else{ 34 | request.getRequestDispatcher("user/login.jsp?login-info="+java.net.URLEncoder.encode("你应该先登录","UTF-8")).forward(request,response); 35 | } 36 | ShopCartHandle shopCartHandle=new ShopCartHandle(); 37 | List list = null; 38 | try { 39 | list = shopCartHandle.findGoodsByUser(user); 40 | } catch (Exception e) { 41 | e.printStackTrace(); 42 | }finally { 43 | ; 44 | } 45 | if(list!=null && list.size()!=0){ 46 | OrderHandle orderHandle=new OrderHandle(); 47 | Order order=new Order(); 48 | Date date=new Date(); 49 | //使用两个list来收集失败和成功的物品 50 | List listSuc = new ArrayList(); 51 | List listErr = new ArrayList(); 52 | 53 | for(Goods goods:list){ 54 | order.setGoodsId(goods.getId()); 55 | order.setUserId(user.getId()); 56 | order.setMessage("此物品通过购物车批量购买"); 57 | order.setDate(date); 58 | try { 59 | if(orderHandle.doCreate(order)){ 60 | listSuc.add(goods); 61 | //购买成功则移除 62 | shopCartHandle.removeList(goods.getId(), user.getId()); 63 | }else{ 64 | listErr.add(goods); 65 | } 66 | } catch (Exception e) { 67 | e.printStackTrace(); 68 | listErr.add(goods); 69 | }finally{ 70 | ; 71 | } 72 | } 73 | orderHandle.close(); 74 | if(listSuc.size()>0){ 75 | resOut.println("

物品:

"); 76 | for(int i=0;i"+listSuc.get(i).getName()+" "); 78 | } 79 | resOut.println("

购买成功!

"); 80 | } 81 | if(listErr.size()>0){ 82 | resOut.println("

物品:

"); 83 | for(int i=0;i"+listErr.get(i).getName()+" "); 85 | } 86 | resOut.println("

购买失败

"); 87 | } 88 | } 89 | 90 | shopCartHandle.close(); 91 | } 92 | 93 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 94 | doGet(request, response); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/src/servlet/CharSet.java: -------------------------------------------------------------------------------- 1 | package src.servlet; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.Filter; 5 | import javax.servlet.FilterChain; 6 | import javax.servlet.FilterConfig; 7 | import javax.servlet.ServletException; 8 | import javax.servlet.ServletRequest; 9 | import javax.servlet.ServletResponse; 10 | import javax.servlet.annotation.WebFilter; 11 | 12 | @WebFilter("/CharSet") 13 | public class CharSet implements Filter { 14 | public CharSet() { 15 | } 16 | 17 | public void destroy() { 18 | } 19 | //过滤器:设置编码,统一使用UTF-8 20 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 21 | request.setCharacterEncoding("UTF-8"); 22 | response.setCharacterEncoding("UTF-8"); 23 | chain.doFilter(request, response); 24 | } 25 | 26 | public void init(FilterConfig fConfig) throws ServletException { 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/src/servlet/CollectServlet.java: -------------------------------------------------------------------------------- 1 | package src.servlet; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import src.dbHandle.*; 11 | import src.tools.LoginVerify; 12 | import src.vo.Goods; 13 | import src.vo.User; 14 | 15 | /** 16 | * Servlet implementation class collectServlet 17 | */ 18 | @WebServlet("/CollectServlet") 19 | public class CollectServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public CollectServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 32 | */ 33 | //添加一个物品到收藏夹 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 35 | if (LoginVerify.isLogin(request)) { 36 | User user = (User) request.getSession().getAttribute("loginUser"); 37 | int userId = user.getId(); 38 | int goodsId = Integer.parseInt(request.getParameter("goodsId")); 39 | CollectHandle collectHandle = new CollectHandle(); 40 | GoodsHandle goodsHandle = new GoodsHandle(); 41 | Goods goods=null; 42 | try { 43 | goods=goodsHandle.findById(goodsId); 44 | } catch (Exception e1) { 45 | e1.printStackTrace(); 46 | }finally { 47 | goodsHandle.close(); 48 | } 49 | try { 50 | if(goods!=null && goods.getStates()==2 && collectHandle.doCreate(userId, goodsId)){ 51 | response.getWriter().print("success"); 52 | } 53 | else{ 54 | response.getWriter().print("error"); 55 | } 56 | } catch (Exception e) { 57 | e.printStackTrace(); 58 | response.getWriter().print("error"); 59 | }finally { 60 | collectHandle.close(); 61 | } 62 | } else { 63 | response.getWriter().print("unLogin"); 64 | } 65 | } 66 | 67 | /** 68 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 69 | */ 70 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 71 | // TODO Auto-generated method stub 72 | doGet(request, response); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/src/servlet/ExitLoginServlet.java: -------------------------------------------------------------------------------- 1 | package src.servlet; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.Cookie; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | @WebServlet("/ExitLoginServlet") 12 | public class ExitLoginServlet extends HttpServlet { 13 | private static final long serialVersionUID = 1L; 14 | 15 | public ExitLoginServlet() { 16 | super(); 17 | } 18 | //退出登录,移除cookies和session属性 19 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | request.getSession().setAttribute("isLogined", false); 21 | Cookie[] cookies=request.getCookies(); 22 | for(int i=0;i0){ 41 | if(pwd1.equals(pwd2) && pwd1.matches("[A-Za-z0-9]{6,}")){ 42 | user.setPwd(MD5.getMD5(pwd1)); 43 | }else{ 44 | info="更新失败,两次密码不一致"; 45 | response.sendRedirect("user/personal.jsp?tab=info&info="+java.net.URLEncoder.encode(info,"UTF-8")); 46 | return; 47 | } 48 | } 49 | if(name.length()>0 && (phone.matches("^[0-9]*$") || phone.length()==0)){ 50 | user.setName(name); 51 | user.setPhone(phone); 52 | UserHandle userHandle=new UserHandle(); 53 | try { 54 | if(userHandle.doUpdate(user)){ 55 | info="更新信息成功"; 56 | }else{ 57 | info="更新失败"; 58 | } 59 | } catch (Exception e) { 60 | info="更新失败,数据库错误"; 61 | e.printStackTrace(); 62 | }finally { 63 | userHandle.close(); 64 | } 65 | }else{ 66 | info="更新失败,检查你的输入"; 67 | } 68 | response.sendRedirect("user/personal.jsp?tab=info&info="+java.net.URLEncoder.encode(info,"UTF-8")); 69 | }else{ 70 | response.sendRedirect("user/login.jsp?login-info="+java.net.URLEncoder.encode("你应该先登录","UTF-8")); 71 | } 72 | 73 | } 74 | 75 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 76 | doGet(request, response); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/src/tools/GetCookie.java: -------------------------------------------------------------------------------- 1 | package src.tools; 2 | 3 | import javax.servlet.http.Cookie; 4 | 5 | public class GetCookie { 6 | public static String getCookie(Cookie[] cookies, String cookiename) { 7 | for (Cookie cookie : cookies) { 8 | if (cookie.getName().equals(cookiename)) { 9 | String cookieValue = cookie.getValue(); 10 | return cookieValue; 11 | } 12 | } 13 | return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/src/tools/IntHolder.java: -------------------------------------------------------------------------------- 1 | package src.tools; 2 | 3 | public class IntHolder { 4 | public int value; 5 | 6 | public IntHolder(int i) { 7 | this.value = i; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/src/tools/LoginVerify.java: -------------------------------------------------------------------------------- 1 | package src.tools; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpSession; 5 | import src.vo.*; 6 | 7 | public class LoginVerify { 8 | //登录验证 9 | //判断是否为管理员登录 10 | public static boolean isAdmin(HttpServletRequest request){ 11 | HttpSession ses=request.getSession(); 12 | if(isLogin(request) && ((User)ses.getAttribute("loginUser")).getId()<1000){ 13 | return true; 14 | } 15 | return false; 16 | } 17 | //是否已经登录 18 | public static boolean isLogin(HttpServletRequest request){ 19 | HttpSession ses=request.getSession(); 20 | if(ses.getAttribute("isLogined")!=null 21 | && ses.getAttribute("isLogined").equals(true) && ses.getAttribute("loginUser")!=null){ 22 | return true; 23 | } 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/src/tools/MD5.java: -------------------------------------------------------------------------------- 1 | package src.tools; 2 | 3 | public class MD5 { 4 | public static String getMD5(String password) { 5 | byte[] source=password.getBytes(); 6 | String s = null; 7 | char hexDigits[] = { // 用来将字节转换成 16 进制表示的字符 8 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; 9 | try { 10 | java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); 11 | md.update(source); 12 | byte tmp[] = md.digest(); // MD5 的计算结果是一个 128 位的长整数, 13 | // 用字节表示就是 16 个字节 14 | char str[] = new char[16 * 2]; // 每个字节用 16 进制表示的话,使用两个字符, 15 | // 所以表示成 16 进制需要 32 个字符 16 | int k = 0; // 表示转换结果中对应的字符位置 17 | for (int i = 0; i < 16; i++) { // 从第一个字节开始,对 MD5 的每一个字节 18 | // 转换成 16 进制字符的转换 19 | byte byte0 = tmp[i]; // 取第 i 个字节 20 | str[k++] = hexDigits[byte0 >>> 4 & 0xf]; // 取字节中高 4 位的数字转换, 21 | // >>> 为逻辑右移,将符号位一起右移 22 | str[k++] = hexDigits[byte0 & 0xf]; // 取字节中低 4 位的数字转换 23 | } 24 | s = new String(str); // 换后的结果转换为字符串 25 | 26 | } catch (Exception e) { 27 | e.printStackTrace(); 28 | } 29 | return s; 30 | } 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/src/tools/StaticVar.java: -------------------------------------------------------------------------------- 1 | package src.tools; 2 | 3 | public class StaticVar { 4 | //这里放一些网站配置数据 5 | public static int PERPAGE_MESS=10;//消息页每页显示个数 6 | public static int PERPAGE_GOODS=11;//物品浏览页每页显示个数 7 | public static int PERPAGE_COLLECT=7;//收藏页每页显示个数 8 | public static boolean USESQLPOOL=false;//是否使用连接池 9 | } 10 | -------------------------------------------------------------------------------- /src/src/vo/Goods.java: -------------------------------------------------------------------------------- 1 | package src.vo; 2 | 3 | import java.util.Date; 4 | 5 | public class Goods { 6 | private Integer id; 7 | private String image; 8 | private Integer type_id;//商品类型id 9 | private String name; 10 | private Integer num;//数量 11 | private Float price; 12 | private String content;// 13 | private Integer producter_id; 14 | private Integer states; 15 | private Date creatDate; 16 | public Date getCreatDate() { 17 | return creatDate; 18 | } 19 | public void setCreatDate(Date creatDate) { 20 | this.creatDate = creatDate; 21 | } 22 | public Integer getId() { 23 | return id; 24 | } 25 | public Integer getStates() { 26 | return states; 27 | } 28 | public void setStates(Integer states) { 29 | this.states = states; 30 | } 31 | public void setId(Integer id) { 32 | this.id = id; 33 | } 34 | public String getImage() { 35 | return image; 36 | } 37 | public void setImage(String image) { 38 | this.image = image; 39 | } 40 | public Integer getType_id() { 41 | return type_id; 42 | } 43 | public void setType_id(Integer type_id) { 44 | this.type_id = type_id; 45 | } 46 | public String getName() { 47 | return name; 48 | } 49 | public void setName(String name) { 50 | this.name = name; 51 | } 52 | public Integer getNum() { 53 | return num; 54 | } 55 | public void setNum(Integer num) { 56 | this.num = num; 57 | } 58 | public Float getPrice() { 59 | return price; 60 | } 61 | public void setPrice(Float price) { 62 | this.price = price; 63 | } 64 | public String getContent() { 65 | return content; 66 | } 67 | public void setContent(String content) { 68 | this.content = content; 69 | } 70 | public Integer getProducter_id() { 71 | return producter_id; 72 | } 73 | public void setProducter_id(Integer producter_id) { 74 | this.producter_id = producter_id; 75 | } 76 | 77 | } 78 | 79 | -------------------------------------------------------------------------------- /src/src/vo/Mess.java: -------------------------------------------------------------------------------- 1 | package src.vo; 2 | 3 | import java.util.Date; 4 | 5 | public class Mess { 6 | private int messFromId; 7 | private int messToId; 8 | private String messText; 9 | private Date sendDate; 10 | private int messId; 11 | private int messType; 12 | 13 | public int getMessFromId() { 14 | return messFromId; 15 | } 16 | public void setMessFromId(int messFromId) { 17 | this.messFromId = messFromId; 18 | } 19 | public int getMessToId() { 20 | return messToId; 21 | } 22 | public void setMessToId(int messToId) { 23 | this.messToId = messToId; 24 | } 25 | public String getMessText() { 26 | return messText; 27 | } 28 | public void setMessText(String messText) { 29 | this.messText = messText; 30 | } 31 | public Date getSendDate() { 32 | return sendDate; 33 | } 34 | public void setSendDate(Date sendDate) { 35 | this.sendDate = sendDate; 36 | } 37 | public int getMessId() { 38 | return messId; 39 | } 40 | public void setMessId(int messId) { 41 | this.messId = messId; 42 | } 43 | public int getMessType() { 44 | return messType; 45 | } 46 | public void setMessType(int messType) { 47 | this.messType = messType; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/src/vo/Order.java: -------------------------------------------------------------------------------- 1 | package src.vo; 2 | 3 | import java.util.Date; 4 | 5 | public class Order { 6 | private int id; 7 | private int goodsId; 8 | private int userId; 9 | private Date date; 10 | private String message; 11 | 12 | public int getId() { 13 | return id; 14 | } 15 | public void setId(int id) { 16 | this.id = id; 17 | } 18 | public int getGoodsId() { 19 | return goodsId; 20 | } 21 | public void setGoodsId(int goodsId) { 22 | this.goodsId = goodsId; 23 | } 24 | public int getUserId() { 25 | return userId; 26 | } 27 | public void setUserId(int userId) { 28 | this.userId = userId; 29 | } 30 | public Date getDate() { 31 | return date; 32 | } 33 | public void setDate(Date date) { 34 | this.date = date; 35 | } 36 | public String getMessage() { 37 | return message; 38 | } 39 | public void setMessage(String message) { 40 | this.message = message; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/src/vo/User.java: -------------------------------------------------------------------------------- 1 | package src.vo; 2 | 3 | public class User { 4 | private int id; 5 | private String email; 6 | private String pwd; 7 | private String name; 8 | private String stu_num; 9 | private String qq; 10 | private String phone; 11 | private String img; 12 | public String getImg() { 13 | String userImg=img; 14 | if(userImg==null || userImg.length()==0){ 15 | return "static/user_img/0"; 16 | }else{ 17 | return userImg; 18 | } 19 | } 20 | 21 | public void setImg(String img) { 22 | this.img = img; 23 | } 24 | 25 | private int messnum; 26 | 27 | 28 | public int getMessnum() { 29 | return messnum; 30 | } 31 | 32 | public void setMessnum(int messnum) { 33 | this.messnum = messnum; 34 | } 35 | 36 | public String getQq() { 37 | return qq; 38 | } 39 | 40 | public void setQq(String qq) { 41 | this.qq = qq; 42 | } 43 | 44 | public String getPhone() { 45 | return phone; 46 | } 47 | 48 | public void setPhone(String phone) { 49 | this.phone = phone; 50 | } 51 | 52 | public void setName(String tmp) { 53 | name = tmp; 54 | } 55 | 56 | public void setEmail(String tmp) { 57 | email = tmp; 58 | } 59 | 60 | public void setId(int tmp) { 61 | id = tmp; 62 | } 63 | 64 | public void setPwd(String tmp) { 65 | pwd = tmp; 66 | } 67 | 68 | public void setStu_num(String tmp) { 69 | stu_num = tmp; 70 | } 71 | 72 | public String getName() { 73 | return name; 74 | } 75 | 76 | public String getEmail() { 77 | return email; 78 | } 79 | 80 | public String getPwd() { 81 | return pwd; 82 | } 83 | 84 | public int getId() { 85 | return id; 86 | } 87 | 88 | public String getStu_num() { 89 | return stu_num; 90 | } 91 | 92 | } 93 | --------------------------------------------------------------------------------