基于SSM+Vue的咖啡销售系统

news2025/7/12 11:16:01

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:Vue
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

登录模块详细设计

用户注册模块

在线客服模块的实现

个人中心管理模块

咖啡信息管理模块的实现

系统管理模块的实现

下单流程模块的实现

订单管理模块设计

用户前台界面模块

四、核心代码

登录相关

文件上传

封装


一、项目简介

现代社会是计算机技术普遍发展与应用的社会,甚至无网不成行,由此可见信息网络已经在商家活动或者人们生活中占据非常重要的地位,成为各行业不可割舍的重要组成。而随着网络地位的越来越突出,网络平台已经超越电视、报纸等传统媒体,成为商家宣传与发展的重要平台。网络费用低廉,只要商家建立网站、或者利用其它大众平台,就能够实现网上购物、信息更新与查询等等功能,所有这些都是在与时俱进的过程中,为商家争取更多的效益,所以对于商家来说,拥有一个属于自己的网站平台是非常重要的。

近年来,由于电子商务和网上商城的快速发展,越来越多的人在网上商城进行商品的交易,取代了传统的当面交易,这无非使交易更安全更快捷。本文以咖啡销售系统为题,进行系统开发,主要解决人们在线购物的流畅,实现计算机化管理。

本文是针对web技术进行相应研究,并在其基础之上制定了一套基于SSM三层体系结构,采用JAVA技术结合Mysql数据库来实现咖啡商品管理系统。


二、系统功能

前台功能有查看咖啡资讯、咖啡商品等信息,进行用户注册,登录后进行在线咨询,商品购买等。用户后台功能有个人资料管理、购物车结算管理、我的订单管理;管理员功能有系统管理员(管理员添加、管理员查询、注册用户管理、修改密码)、咖啡资讯管理(咖啡资讯添加、咖啡资讯查询)、咖啡商品信息管理(商品类别添加、商品类别查询)、所有订单管理、系统管理(在线客服、轮播图)。



三、系统项目截图

登录模块详细设计

本系统角色有两类,管理员、注册用户,他们都属于系统的用户,用户登录实现的过程主要有几个步骤,首先对用户输入的信息进行保存然后利用JAVA程序从数据库中进行检索看是不是有用户输入的信息在数据库中是否存在如果存在就返回正确的结果,如果不正确就返回错误的结果。如果结果数据库中存在就显示登录成功,如果数据库不存在就显示失败请重新登录。

用户注册模块

用户需要注册登录才能进行购买商品。所以网站提供了一个用户注册和登陆的模块,用户需要正确输入账号和密码才能登录系统。

 

在线客服模块的实现

在线客服需要用户登录后才可以实现。 

个人中心管理模块

管理员登入系统,可以添加新的管理员用户,删除现有的管理员,也可以对自己的密码进行修改。修改密码,添加删除管理员实现的过程主要是将填写的数据写入数据库中即可。

 

咖啡信息管理模块的实现

管理员登录系统后,可以添加上传咖啡信息,管理员可以对咖啡信息进行增删改查,用户在前台登录后可以查询咖啡信息。

系统管理模块的实现

管理员登录系统后,可以管理咖啡资讯和在线客服以及轮播图。 

 

下单流程模块的实现

首先,用户经过注册登录系统前台,进行商品购买,用户选择商品和购买数量,进行添加购物车,用户进入个人后台,进行购物车结算,生成订单,商家登录后台进行用户订单审核,审核通过,进行商品发货,用户购买成功。

 

订单管理模块设计

订单管理模块分为两部分:用户的订单管理和管理员的订单管理,用户在前台进行商品的在线下单,登录个人后台之后,选择购物车的订单,生成有最终订单,付款成功后,这样在管理员后台就可以看到该单子。

 

用户前台界面模块

用户前台功能有查看咖啡资讯、商品、个人中心、购物车、在线客服等信息,进行用户注册,登录后进行在线咨询,商品购买等。用户后台功能有个人资料管理、我的收藏管理、我的订单管理等,主要是将在前台添加进行购物车的商品进行生成订单。


四、核心代码

登录相关


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

文件上传

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

封装

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1103309.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

全面中文大语言模型评测来啦!香港中文大学最新研究

ChatGPT 的一声号角吹响了2023年全球大语言模型的竞赛。 2023年初以来&#xff0c;来自工业界和研究机构的各种大语言模型层出不穷&#xff0c;特别值得一提的是&#xff0c;中文大语言模型也如雨后春笋般&#xff0c;在过去的半年里不断涌现。 与此同时&#xff0c;和如何训…

Android 10 中的隐私权变更

Android 10 中的隐私权变更 重大变更外部存储访问权限范围限定为应用文件和媒体在后台运行时访问设备位置信息需要权限以 Android 9 或更低版本为目标平台时自动授予访问权限在设备升级到 Android 10 后访问针对从后台启动 Activity 的限制标识符和数据移除了联系人亲密程度信息…

Go语言入门心法(六): HTTP面向客户端|服务端编程

Go语言入门心法(一): 基础语法 Go语言入门心法(二): 结构体 Go语言入门心法(三): 接口 Go语言入门心法(四): 异常体系 Go语言入门心法(五): 函数 一:go语言面向web编程认知 Go语言的最大优势在于并发与性能,其性能可以媲美C和C,并发在网络编程中更是至关重要 使用http发送请…

hal开发之hidl/aidl支持的绑定式直通式详细讲解

为啥有hidl呢&#xff1f; 这个问题其实网络上答案比较多&#xff0c;属于android想要让厂商快速升级解耦制定的&#xff0c;即把原来系统framework和厂商耦合的hal在同一个个system.img进行剥离开&#xff0c;把厂商相关的放到vendor.img&#xff0c;aosp系统公共部分framewo…

ros_rtsp订阅Image类型topic转换为rtsp视频流

文章目录 一、安装环境二、在catkin工作空间中构建三、设置流四、推出视频流五、验证视频流1、安装vlc拉流2、安装gstreamer拉流3、安装FFmpeg拉流 一、安装环境 ROS gstreamer development libs&#xff0c;包括base、good、bad和rtspserver: sudo apt-get install libgstre…

成功实施自动化测试的优点

目录 什么是自动化测试&#xff1f; 自动化测试的好处 测试执行7*24 回归测试 可重用性 节省您很多时间 降低成本更好地利用人力 左移测试做得更好&#xff01; 解放手动测试 最大化测试覆盖率 监控服务 复杂而冗长的测试方案 结论 随着技术的发展&#xff0c;保证…

国产FiRa认证低功耗UWB系统级SoC精准定位方案芯片

目录 什么是"UWB技术"国产UWB方案芯片特性国产低功耗UWB SoC芯片特性 随着物联网、无线通信等技术的不断发展&#xff0c;UWB作为一种超宽带通信技术&#xff0c;逐渐在精准定位、智能家居、汽车电子、智能制造等领域崭露头角。 什么是"UWB技术" UWB&…

Python接口自动化测试之Requests库Pytest框架

发送get请求 #导包 import requests #定义一个url url "http://xxxxxxx" #传递参数 payload"{\"head\":{\"accessToken\":\"\",\"lastnotice\":0,\"msgid\":\"\"},\"body\":{\"…

C#简单晶圆wafermapping显示示范demo

点击&#xff0c;双击可改变颜色 预设5行8列数据&#xff1a; using (fratte.at.WafermapDisplay.Form1 form_show new fratte.at.WafermapDisplay.Form1()){int[,] data_demo new int[,]{{ 0,0,0,1,0 },{ 0,5,1,0,0 },{ 1,7,6,2,3 },{ 1,0,1,2,3 },{ 0,2,0,2,3 }, { 1,5,6,…

SpringCloud: feign整合sentinel实现降级

一、加依赖&#xff1a; <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0"xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation"http://maven.apache…

软件测试用例设计方法-因果图法

边界值法是等价类划分法的补充&#xff0c;所以&#xff0c;它们是一对搭档。 那么&#xff0c;判定表法有没有它的搭档呢&#xff1f; 答案是&#xff0c;有的。那就是本篇文章分享的用例设计方法—— 因果图法 。 定义 因果图法&#xff1a; 用来处理等价类划分和边界值考…

基于YOLOv8模型的老虎目标检测系统(PyTorch+Pyside6+YOLOv8模型)

摘要&#xff1a;基于YOLOv8模型的老虎目标检测系统可用于日常生活中检测与定位老虎目标&#xff0c;利用深度学习算法可实现图片、视频、摄像头等方式的目标检测&#xff0c;另外本系统还支持图片、视频等格式的结果可视化与结果导出。本系统采用YOLOv8目标检测算法训练数据集…

postgresql中uuid的使用

1.安装扩展插件 create extension "pgcrypto"; 2.查询uuid #36位uuid select gen_random_uuid();#去除斜杠 select REPLACE(gen_random_uuid()::text, -, ) 3.uuid在字段默认值上的使用 注:在函数前,需要加上模式名称

6.SNMP报错-Error opening specified endpoint “udp6:[::1]:161“处理

启动SNMP服务 /etc/init.d/snmpd start 出现以下报错信息 [....] Starting snmpd (via systemctl): snmpd.serviceJob for snmpd.service failed because the control process exited with error code. See "systemctl status snmpd.service" and "journalctl…

树控件的使用

目录 1、修改树控件的基础属性&#xff1a; 2、准备图标 &#xff1a; &#xff08;1&#xff09;、ico后缀的图片放入当前文件路径的rc中 &#xff08;2&#xff09;、在Icon中添加资源&#xff0c;导入图片 &#xff08;3&#xff09;、准备HICON图标 &#xff08;4&am…

牛客:FZ113 牛群的配对

FZ113 牛群的配对 文章目录 FZ113 牛群的配对题目描述题解思路题解代码 题目描述 题解思路 倒序遍历字符串&#xff0c;若当前字符是d且前一个字符是c&#xff0c;或者当前字符是b且前一个字符是a则在字符串中消除这两个字符&#xff0c;直到字符串便遍历完毕&#xff0c;若字…

prometheus获取kubelet接口监控数据

一、前言 k8s集群的kubelet服务内部有自带的cadvisor服务用于收集k8s集群的监控数据&#xff0c;所以可以通过调用kubelet的接口就能获取pod的资源监控数据&#xff0c;在新版本的k8s中&#xff0c;kubelet的监控数据获取端口为10250端口&#xff0c;老版本的是10255端口 二、…

web前端基础训练-----创建用户反馈表单

1&#xff0c;实验代码 <!DOCTYPE html> <html><head><meta charset"utf-8"><title>用户反馈表单</title></head><body><form><fieldset><h1>用户反馈</h1><hr/><h4>亲爱的用…

tortoise 快捷操作分支合并

请大佬来看看有没有问题&#xff1f;&#xff0c;补充一下 1.创建新分支&#xff1a;bbb 2.在分支中修改我需要的功能 3.提交&#xff0c;本地代码&#xff0c;分支可推送&#xff0c;也可不推送到远端 4. 切换到需要合并的目标分支master&#xff0c;然后点击分支合并&#x…

Java并发面试题:(四)synchronized和lock区别

synchronized 关键字 synchronized关键字解决的是多个线程之间访问资源的同步性&#xff0c;synchronized关键字可以保证被它 修饰的方法或者代码块在任意时刻只能有一个线程执行。 另外&#xff0c;在 Java 早期版本中&#xff0c; synchronized属于重量级锁&#xff0c;效率…