——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明





基于javaweb的SSM水果商城管理系统(java+ssm+jsp+jquery+mysql)(平台、卖家、买家)
1 2 3 4 5 6 7 8 9
| 管理员(后台管理): admin 123456
农户(即卖家,可以发布商品): user1 123456
经销商(即买家,可以购买商品): user2 123456
|
项目介绍
该系统主要分为前台和后台两大功能模块,共包含三个角色:农户、经销商和管理员。 具体的系统功能如下: 1.前台功能 前台首页、用户注册、用户登录、新闻公告、水果行情、查看水果、水果详情、加入购物车、加入收藏、购买水果、付款结算、添加评论、留言交流、个人中心、我的订单、我的收藏、意见反馈、发布水果、我的销售等功能。 2.后台功能 后台系统登陆、用户管理、管理员管理、网站内容管理、水果类型管理、水果信息管理、采购订单管理、用户评价管理、意见反馈管理、留言交流管理等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目; 6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后台框架:Spring、SpringMVC、MyBatis UI界面:JSP、jQuery 数据库:MySQL
使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| }
@RequestMapping("query.action") public String query(String name) { this.front(); Goods goods = new Goods(); goods.setGoodsname(name); List<Goods> goodsList = this.goodsService.getGoodsByLike(goods); this.getRequest().setAttribute("goodsList", goodsList); return "users/list"; }
@RequestMapping("detail.action") public String detail(String id) { this.front(); Goods goods = this.goodsService.getGoodsById(id); goods.setHits("" + (Integer.parseInt(goods.getHits()) + 1)); this.goodsService.updateGoods(goods); this.getRequest().setAttribute("goods", goods); Topic topic = new Topic(); topic.setGoodsid(id); List<Topic> topicList = this.topicService.getTopicByCond(topic); this.getRequest().setAttribute("topicList", topicList); this.getRequest().setAttribute("tnum", topicList.size()); return "users/detail"; }
@RequestMapping("addfav.action") public String addfav(Fav fav) { this.front(); if (this.getSession().getAttribute("userid") == null) { return "redirect:/index/preLogin.action"; } String userid = (String) getRequest().getSession().getAttribute("userid"); fav.setAddtime(VeDate.getStringDateShort()); fav.setGoodsid(getRequest().getParameter("id")); fav.setUsersid(userid); this.favService.insertFav(fav); return "redirect:/index/myfav.action"; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| @RequestMapping("queryUsersByCond.action") public String queryUsersByCond(String cond, String name, String number) { Users users = new Users(); if (cond != null) { if ("username".equals(cond)) { users.setUsername(name); } if ("password".equals(cond)) { users.setPassword(name); } if ("realname".equals(cond)) { users.setRealname(name); } if ("sex".equals(cond)) { users.setSex(name); } if ("birthday".equals(cond)) { users.setBirthday(name); } if ("contact".equals(cond)) { users.setContact(name); } if ("address".equals(cond)) { users.setAddress(name); } if ("image".equals(cond)) { users.setImage(name); } if ("role".equals(cond)) { users.setRole(name); } if ("status".equals(cond)) { users.setStatus(name); } if ("regdate".equals(cond)) { users.setRegdate(name); } }
List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); nameList.add(cond);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 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
| fav.setGoodsid(getRequest().getParameter("id")); fav.setUsersid(userid); this.favService.insertFav(fav); return "redirect:/index/myfav.action"; }
@RequestMapping("myfav.action") public String myfav(String number) { this.front(); if (getRequest().getSession().getAttribute("userid") == null) { return "redirect:/index/preLogin.action"; } String userid = (String) this.getSession().getAttribute("userid"); Fav fav = new Fav(); fav.setUsersid(userid); List<Fav> favList = this.favService.getFavByCond(fav); PageHelper.getIndexPage(favList, "fav", "myfav", null, 10, number, this.getRequest()); return "users/myfav"; }
@RequestMapping("deletefav.action") public String deletefav() { this.front(); if (this.getSession().getAttribute("userid") == null) { return "redirect:/index/preLogin.action"; } this.favService.deleteFav(this.getRequest().getParameter("id")); return "redirect:/index/myfav.action"; }
@RequestMapping("preComplains.action") public String preComplains() { this.front(); if (this.getSession().getAttribute("userid") == null) { return "redirect:/index/preLogin.action"; } return "users/addComplains"; }
@RequestMapping("addComplains.action") public String addComplains(Complains complains) { this.front(); if (this.getSession().getAttribute("userid") == null) { return "redirect:/index/preLogin.action"; } String userid = (String) this.getSession().getAttribute("userid"); complains.setAddtime(VeDate.getStringDateShort()); complains.setStatus("未回复"); complains.setUsersid(userid); this.complainsService.insertComplains(complains); return "redirect:/index/preComplains.action";
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| this.topicService.insertTopic(topic); return "redirect:/index/showOrders.action"; } }
public class PageHelper {
public static void getPage(List<?> list, String name, List<String> nameList, List<String> valueList, int pageSize, String number, HttpServletRequest request, String method) { StringBuffer buffer = new StringBuffer(); String name2 = name.substring(0, 1).toUpperCase() + name.substring(1); String path = ""; String action = "getAll" + name2 + ".action"; if (method != null) { action = "query" + name2 + "ByCond.action"; }
List<Object> objList = new ArrayList<Object>(); if (nameList != null && valueList != null) { for (int i = 0; i < nameList.size(); i++) { path += "&" + nameList.get(i) + "=" + valueList.get(i); } } int pageNumber = list.size(); int maxPage = pageNumber; if (maxPage % pageSize == 0) { maxPage = maxPage / pageSize; } else { maxPage = maxPage / pageSize + 1; } if (number == null) { number = "0"; } int start = Integer.parseInt(number) * pageSize; int over = (Integer.parseInt(number) + 1) * pageSize; int count = pageNumber - over; if (count <= 0) { over = pageNumber; } for (int i = start; i < over; i++) { Object obj = list.get(i);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| PageHelper.getPage(cateList, "cate", null, null, 10, number, this.getRequest(), null); return "admin/listcate"; }
@RequestMapping("queryCateByCond.action") public String queryCateByCond(String cond, String name, String number) { Cate cate = new Cate(); if(cond != null){ if ("catename".equals(cond)) { cate.setCatename(name); } if ("memo".equals(cond)) { cate.setMemo(name); } }
List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); nameList.add(cond); valueList.add(name); PageHelper.getPage(this.cateService.getCateByLike(cate), "cate", nameList, valueList, 10, number, this.getRequest(), "query"); name = null; cond = null; return "admin/querycate"; }
@RequestMapping("getCateById.action") public String getCateById(String id) { Cate cate = this.cateService.getCateById(id); this.getRequest().setAttribute("cate", cate); return "admin/editcate"; }
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| @ResponseBody public String chartline() throws JSONException { String start = this.getRequest().getParameter("start"); String end = this.getRequest().getParameter("end"); long days = VeDate.getDays(end, start) + 1; JSONArray total = new JSONArray(); JSONArray count = new JSONArray(); JSONArray day = new JSONArray(); for (int i = 0; i < days; i++) { String nxtDay = VeDate.getNextDay(start, "" + i); System.out.println(nxtDay); Orders orders = new Orders(); orders.setAddtime(nxtDay); List<Orders> list = this.ordersService.getOrdersByCond(orders); double sellTotal = 0; double sellCount = 0; for (Orders x : list) { sellTotal += Double.parseDouble(x.getTotal()); } sellCount = list.size(); total.put(VeDate.getDouble(sellTotal)); count.put(sellCount); day.put(nxtDay); } JSONArray cate = new JSONArray(); cate.put("订单收入"); JSONObject json = new JSONObject(); json.put("sellTotal", total.toString()); json.put("days", day.toString().replaceAll("\"", "")); json.put("cate", cate.toString().replaceAll("\"", "")); System.out.println(json.toString()); return json.toString(); }
@RequestMapping("chartPie.action") @ResponseBody public String chartPie() throws JSONException { JSONArray names = new JSONArray(); JSONArray count = new JSONArray(); int stars1 = 0; int stars2 = 0; int stars3 = 0; int stars4 = 0; int stars5 = 0; names.put("非常满意"); names.put("满意"); names.put("一般"); names.put("不满意");
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=220023061907201bf
https://javayms.pages.dev?id=220023061907201bf