Java毕业设计实战之线上水果超市商城的实现
作者:OldWinePot 发布时间:2021-09-15 19:23:01
主要技术实现:spring、 springmvc、 redis、 springboot、 mybatis 、session、 jquery 、 md5 、bootstarp.js tomcat、、 * 等。
主要功能实现: 前端:登录、注册、商品分类查看、浏览水果商品、订单管理、发表评论、收藏商品、购物车管理、个人订单管理查看、个人信息查看修改、地址管理等
后台管理员:后台登录、数据统计、系统版本信息等、管理员管理、角色管理、订单管理、通知公告管理、商品种类、和商品详情管理
主要功能截图如下:
用户填写相关信息进行注册:
水果商品数据列表查看:也可以根据关键字搜索水果商品信息
水果商品详情管理:点击可以查看水果商品购买详情数据、可以进行数量操作、加入订单和购物车以及收藏商品和查看排行等功能
我的购物车详情:可以结算以及继续购物和删除购物车信息等操作
订单详情管理:
我的个人信息管理:可以进行密码修改、订单查看管理、收藏查看管理、收获地址管理
我的评论查看:
我的收藏;可以移除收藏
后台管理员端主要实现: 超级管理员admin登录
系统首页:主要功能用户、角色、通知公告信息、商品种类以及商品详情管理和用户管理以及订单信息管理等数据操作。
后台菜单管理:
用户管理:
通知公告列表展示以及内容添加:
后台管理员对水果商品的管理:
上传商品详情信息:
商品评论数据维护:
订单管理和维护:
项目使用eclipse和idea运行、推荐idea、源码架构:
数据库设计ER图:
订单信息控制层:
@Controller
@RequestMapping("/orderInfo")
public class OrderInfoController {
@Autowired
private IOrderInfoBiz orderInfoBiz;
@RequestMapping("/addOrderInfo")
@ResponseBody
public Integer addOrderInfo(String ono, String odate, String ano, String price) {
Integer in = 0;
try {
in = orderInfoBiz.addOrderInfo(ono, odate,ano,price);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return in;
}
@RequestMapping("/getOrder")
@ResponseBody
public List<OrderInfo> getOrder(String mno) {
return orderInfoBiz.getOrder(mno);
}
@RequestMapping("/getallOrder")
@ResponseBody
public List<OrderInfo> getallOrder(String mno) {
return orderInfoBiz.getallOrder(mno);
}
@RequestMapping("/setStatus")
@ResponseBody
public Integer setStatus(String ono) {
System.out.println("修改1");
return orderInfoBiz.setStatus(ono);
}
@RequestMapping("/getOrderByPage")
@ResponseBody
public List<OrderInfo> getOrderByPage(String mno, Integer page) {
return orderInfoBiz.getOrderByPage(mno,page);
}
@RequestMapping("/getPage")
@ResponseBody
public Integer getPage(String mno) {
int total=orderInfoBiz.getTotal(mno);
int page=total%2==0?total/2:total/2+1;
return page;
}
}
商品管理控制层:
@Controller
@RequestMapping("/goodsInfo")
public class GoodsInfoController {
@Autowired
private IGoodsInfoBiz goodsInfoBiz;
@RequestMapping("/findAll")
@ResponseBody
public List<GoodsInfo> findAll() {
return goodsInfoBiz.findAll();
}
@RequestMapping("/find")
@ResponseBody
public GoodsInfo find(String str) {
System.out.println(goodsInfoBiz.find(str));
return goodsInfoBiz.find(str);
}
@RequestMapping("/findByTno")
@ResponseBody
public List<GoodsInfo> findByTno(String tno,String start) {
return goodsInfoBiz.findByTno(tno,start);
}
@RequestMapping("/updateBal")
@ResponseBody
public Integer updateBal(String[] gnos,String[] nums) {
return goodsInfoBiz.updateBal(gnos,nums);
}
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds() {
return goodsInfoBiz.finds();
}
@RequestMapping("/upload")
@ResponseBody
public Map<String, Object> add(@RequestParam("upload")MultipartFile pic,HttpServletRequest request) {
Map<String, Object> map = new HashMap<String, Object>();
if(pic.isEmpty()){
return map;
}
try{
String savePath = "images/goods";
String path = request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadPath");
if(temp != null){
savePath = temp;
}
//在用户上传的文件名的前面加上时间戳
savePath += "/" + new Date().getTime() + "_" +pic.getOriginalFilename();
File dest = new File(new File(path).getParentFile(),savePath);
//将本地图片保存到服务器
pic.transferTo(dest);
map.put("fileName", pic.getOriginalFilename());
map.put("uploaded", 1);
map.put("url","../../../"+savePath);
}catch(IllegalStateException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
return map;
}
//管理员端的商品信息
@RequestMapping("/addGood")
@ResponseBody
public int addGood(@RequestParam Map<String,Object> map,@RequestParam MultipartFile pic, HttpServletRequest request){
int result =-1;
if(pic.isEmpty()){
result=-2;//说明没有图片需要上传
}
String savePath="";
try {
String path= request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadpath");
if(!StringUtil.checkNull(temp)){
savePath = temp;
}
savePath="images/goods/"+pic.getOriginalFilename();
File dest = new File(path, savePath);
//将图片存到服务器的指定文件夹
pic.transferTo(dest);
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
map.put("pics", savePath);
result=goodsInfoBiz.addGood(map);
return result;
}
@RequestMapping("/findgoods")
@ResponseBody
public List<GoodsInfo> findgoods() {
return goodsInfoBiz.findgoods();
}
@RequestMapping("/del")
@ResponseBody
public int del(String gno) {
return goodsInfoBiz.del(gno);
}
@RequestMapping("/getPage")
@ResponseBody
public Integer getPage(String tno) {
int total=goodsInfoBiz.getTotal(tno);
int page=total%10==0?total/10:total/10+1;
return page;
}
}
购物车信息控制层:
@Controller
@RequestMapping("/cartInfo")
public class CartInfoController {
@Autowired
private ICartInfoBiz cartInfoBiz;
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds(String mno) {
return cartInfoBiz.finds(mno);
}
@RequestMapping("/update")
@ResponseBody
public Integer update(String cno, Integer num) {
return cartInfoBiz.update(cno, num);
}
@RequestMapping("/del")
@ResponseBody
public Integer del(String cno) {
return cartInfoBiz.del(cno);
}
@RequestMapping("/add")
@ResponseBody
public Integer add(String mno, String gno, Integer num) {
return cartInfoBiz.add(mno,gno,num);
}
@RequestMapping("/checkCar")
@ResponseBody
public Integer checkCar(String mno, String gno) {
return cartInfoBiz.checkCar(mno,gno);
}
@RequestMapping("/dels")
@ResponseBody
public Integer dels(String[] gnos)throws IOException {
return cartInfoBiz.dels(gnos);
}
}
管理信息控制层:
@Controller
@RequestMapping("/admin")
public class AdminInfoController {
@Autowired
private IAdminInfoBiz adminInfoBiz;
@RequestMapping("/checkLogin")
@ResponseBody
public Object checkLogin(HttpSession session) {
Object obj = session.getAttribute("currentLoginUser");
if(obj == null){
return "{\"code\":\"101\"}";
} else {
return obj;
}
}
@RequestMapping("/login")
@ResponseBody
public int login(String aname, String pwd, HttpSession session) {
AdminInfo af = adminInfoBiz.login(aname, pwd);
int result = 0;
if(af != null){
session.setAttribute("currentLoginUser", af);
result = 1;
}
return result;
}
@RequestMapping("/success")
public String loginSuccess(HttpSession session) {
if(session.getAttribute("currentLoginUser") != null){
return "/WEB-INF/back/page/index.html";
} else {
return "/bk/index.html";//以/开头从项目目录开始算
}
}
@RequestMapping("/findAll")
@ResponseBody
public List<AdminInfo> findAll() {
return adminInfoBiz.findAll();
}
@RequestMapping("/add")
@ResponseBody
public int add(String aname, String pwd, String tel) {
return adminInfoBiz.add(aname,pwd,tel);
}
@RequestMapping("/update")
@ResponseBody
public int update(String aid,String tel) {
return adminInfoBiz.update(aid,tel);
}
@RequestMapping("/del")
@ResponseBody
public int del(String aid) {
return adminInfoBiz.del(aid);
}
/*@RequestMapping("/upload")
@ResponseBody
public Map<String, String> upload(MultipartFile pics, HttpServletRequest request, @RequestParam Map<String, Object> params) {
if (pics.isEmpty()){
return Collections.emptyMap();
}
String savePath = "../pics";
try{
String path = request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadpath");
if(!StringUtil.checkNull(temp)){
savePath = temp;
}
savePath += "/" + new Date().getTime() + "_" + new Random().nextInt(10000) + "-" + pics.getOriginalFilename();
File dest = new File(path, savePath);
//将图片存到服务器的指定文件
pics.transferTo(dest);
} catch (IllegalStateException e){
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
params.put("photo", savePath);
if(adminInfoBiz.updatephoto(params) > 0){
Map<String, String> map = new HashMap<String, String>();
map.put("savepath", savePath);
return map;
} else {
return Collections.emptyMap();
}
}*/
}
菜单信息控制层:
@Controller
@RequestMapping("/menberInfo")
public class MenberInfoController {
@Autowired
private IMenberInfoBiz menberInfoBiz;
@RequestMapping("/logout")
private Object logout(HttpSession session) {
session.removeAttribute("LoginUser");
return "logoutsuccess";
}
@RequestMapping("/checkLogin")
@ResponseBody
public Object checkLogin(HttpSession session) {
Object obj = session.getAttribute("LoginUser");
if(obj == null){
return "{\"code\":\"101\"}";
} else {
return obj;
}
}
@RequestMapping("/login")
@ResponseBody
public Integer login(String nickname, String pwd, HttpSession session) {
MenberInfo mf = menberInfoBiz.login(nickname, pwd);
int result = 0;
if(mf != null){
session.setAttribute("LoginUser", mf);
result = 1;
}
return result;
}
@RequestMapping("/getTotal")
public Integer getTotal(String no) {
return menberInfoBiz.getTotal(no);
}
@RequestMapping("/reg")
@ResponseBody
public int reg(@RequestParam Map<String, Object> map) {
return menberInfoBiz.reg(map);
}
@RequestMapping("/checkName")
@ResponseBody
public int checkName(String nickname) {
return menberInfoBiz.checkName(nickname);
}
@RequestMapping("/checkTel")
@ResponseBody
public int checkTel(String tel) {
return menberInfoBiz.checkTel(tel);
}
@RequestMapping("/checkEmail")
@ResponseBody
public int checkEmail(String email) {
return menberInfoBiz.checkEmail(email);
}
@RequestMapping("/findAll")
@ResponseBody
public List<MenberInfo> findAll() {
return menberInfoBiz.findAll();
}
@RequestMapping("/del")
@ResponseBody
public int del(String mno) {
return menberInfoBiz.del(mno);
}
/*@RequestMapping("/upload")
@ResponseBody
public Map<String, String> upload(MultipartFile pics, HttpServletRequest request, @RequestParam Map<String, Object> params) {
if (pics.isEmpty()){
return Collections.emptyMap();
}
String savePath = "../pics";
try{
String path = request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadpath");
if(!StringUtil.checkNull(temp)){
savePath = temp;
}
savePath += "/" + new Date().getTime() + "_" + new Random().nextInt(10000) + "-" + pics.getOriginalFilename();
File dest = new File(path, savePath);
//将图片存到服务器的指定文件
pics.transferTo(dest);
} catch (IllegalStateException e){
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
params.put("photo", savePath);
if(adminInfoBiz.updatephoto(params) > 0){
Map<String, String> map = new HashMap<String, String>();
map.put("savepath", savePath);
return map;
} else {
return Collections.emptyMap();
}
}*/
}
来源:https://blog.csdn.net/pastclouds/article/details/122323021


猜你喜欢
- 使用百度地图出现闪退一般情况下出现闪退是在AndroidManifest.xml文件中未在application标签中配置<meta-
- 前言在Java8中接口中不再只有抽象方法,还可以有静态方法以及默认方法,此时的接口更像是一个类。我们一起来看看如何使用吧~Java8中,可以
- 1、找准入口,使用ClassPathXmlApplicationContext的构造方法加载配置文件,用于加载classPath下的配置文件
- 类的定义面向对象的程序设计中,类可以看作是我们自定义的数据类型,那么,如何能更加优美,更加高效地定义它就显得尤为重要。类中的成员有很多,每一
- 本示例演示如何通过设置Intent对象的标记,来改变当前任务堆栈中既存的Activity的顺序。1. Intent对象的Activity启动
- 在Thread中注入Bean无效在Spring项目中,有时需要新开线程完成一些复杂任务,而线程中可能需要注入一些服务。而通过Spring注入
- 一、MyBatis简介MyBatis是支持普通SQL查询,存储过程和高级映射的优秀持久层框架。MyBatis消除了几乎所有的JDBC代码和参
- 代码测试可用,运行结果非常辣眼睛,有种二十一世纪初流行于广大中小学生之间的失落非主流的感觉!还是比较有参考价值的,获取当前日期时间,日期类格
- 有很多同学肯定想学习opencv相关的知识,但是有些情况下每建一次项目都要重新引入下各种文件是不是很苦恼,所以我也面临了这个问题,在网上看到
- 在项目中选择器的使用是非常多的,以下是本人在项目中的一些常用的背景选择器的写法带边框下划线背景选择器效果图:上面布局中放了10个CheckB
- 使用ModelAndView向request域对象共享数据index.html<a th:href="@{/testMode
- 操作字符串的类都有哪些?区别是什么?操作字符串的类主要用三个,分别是String类,StringBuffer类和StringBuilder类
- 前言最近接手了一个老项目,“愉悦的心情”自然无以言表,做开发的朋友都懂,这里就不多说了,都是泪...
- 前言在写项目的时候经常需要特定的时间做一些特定的操作,尤其是游戏服务器,维护线程之类的,这时候就需要用到定时器。如果此时你刚好用的是spri
- 一、创建资源文件可以将字符串、图像或对象数据等资源包含在资源文件中,方便应用程序使用。创建资源文件的方法:1、手动或使用IDE工具自动生成X
- //======================================//输出格式: hex2bin 5e.//得到: 0101
- 下面是我自己收集整理的2017年Java岗位的面试题,可以用它来好好准备面试。一、Java基础1. String类为什么是final的。2.
- 本文实例为大家分享了android实现底部导航栏的具体代码,供大家参考,具体内容如下常见的底部导航栏动态效果实现步骤1.底部导航栏样式我们应
- 多线程安全嘛在 Spring 框架中,Bean 是应用程序的核心构建块,代表了在 Spring 容器中管理的对象或组件。Spring 容器负
- 我们很多时候会碰到这样的问题,使用多线程刷一个表的数据时需要多个线程不能重复提取数据,那么这个时候就需要使用到线程的排他锁了。在c#里面其实