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


前言

基于SSM的果蔬经营平台系统有两大用户角色:

用户:首页、商品信息、广告信息、个人中心、购物车。

管理员:用户管理、商品信息管理、类型管理、系统管理、订单管理。

前台功能模块

在系统前台可以看到有首页、商品信息、广告信息、个人中心、购物车。

在首页,我们可以看到有商品信息推荐、广告信息推荐等显示。

在个人中心,用户登录后可以在这里进行修改自己的信息和上传自己的头像信息,或者查看自己的订单、地址、收藏等信息。

如需要购买商品而金额不够可以点击充值进行充值。

添加地址页面,用户购买商品需要填写地址并且选择地址。

商品信息详情页面,用户可以在该页面查看商品的详情信息并且可以选择加入购物车或者选择直接购买等操作。

下单商品页面。

管理员功能模块

管理员登录页面。

管理员登录后可以看到系统管理员功能有用户管理、商品信息管理、类型管理、系统管理、订单管理。 

用户管理,管理员在这个页面可以修改或者删除用户的操作。

类型管理,管理员在这个页面可以修改或者删除操作。

在商品信息中,管理员可以发布新的商品信息或者删除旧的商品信息。

在广告信息中,管理员可以发布新的广告或者删除旧的广告信息。


登录模块核心代码


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{@Autowiredprivate UserService userService;@Autowiredprivate 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{@Autowiredprivate 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;}
}

基于SSM的果蔬经营平台系统相关推荐

  1. 基于SSM实现考研信息管理平台系统

    项目编号:BS-PT-047 运行环境: 开发工具:IDEA / ECLIPSE 数据库:MYSQL5.7 应用服务器:TOMCAT8.5.31 JDK: 1.8 开发技术:Spring+Spring ...

  2. ssm Vue的家教平台系统java项目源码

    本系统为家教服务提供一个交流的平台,使学员能够在本系统中找到适合自己的家教,也使有做家教意愿的人群能够发布自己的简历.. 基于ssm Vue的家教平台系统java项目 开发网上基于web的家教服务系统 ...

  3. java计算机毕业设计HTML5果蔬经营平台MyBatis+系统+LW文档+源码+调试部署

    java计算机毕业设计HTML5果蔬经营平台MyBatis+系统+LW文档+源码+调试部署 java计算机毕业设计HTML5果蔬经营平台MyBatis+系统+LW文档+源码+调试部署 本源码技术栈: ...

  4. JAVA毕业设计HTML5果蔬经营平台计算机源码+lw文档+系统+调试部署+数据库

    JAVA毕业设计HTML5果蔬经营平台计算机源码+lw文档+系统+调试部署+数据库 JAVA毕业设计HTML5果蔬经营平台计算机源码+lw文档+系统+调试部署+数据库 本源码技术栈: 项目架构:B/S ...

  5. java计算机毕业设计基于ssm的果蔬销售购物平台

    项目介绍 网上水果超市选择性多,满足人们追求生活质量.喜欢新鲜事物的需求,未来将会受到更多人的青睐.而互联网的加持,更让用户享受到购买水果的简单便捷,提高了用户的生活水平.水果网上超市的意义不仅可以让 ...

  6. 基于javaweb+springboot的兼职平台系统(java+Springboot+ssm+HTML+maven+Ajax+mysql)

    基于javaweb+springboot的兼职平台系统(java+Springboot+ssm+HTML+maven+Ajax+mysql) 一.项目运行 环境配置: Jdk1.8 + Tomcat8 ...

  7. 基于SSM的企业财务分析报告系统

    摘  要: 任何一家企业中最为关键的肯定就是企业的财务管理.财务管理是企业管理的基础.伴随着信息化的浪潮,企业的财务管理需要优先考虑进行信息化改革.这样才能保证企业在行业竞争中不被落下.基于SSM的企 ...

  8. 基于SSM框架的OA办公系统

    在线OA办公系统,毕设项目 基于SSM框架的OA办公系统,毕设项目 软件功能说明 环境搭建 开发环境 组件描述 源代码.资源及数据清单 源代码与数据导入 安装包及数据清单 用户操作说明 项目演示视频 ...

  9. 基于ssm jsp超市在线销售平台的设计与实现

    近年来,网络信息技术的迅猛发展,互联网逐渐渗透到人们日常生活中的方 方面面,而给我们的生活带来巨大变化的电子商务正在以前所未有的速度蓬勃发 展,电子商务也成为网络研究与应用的热点之一.网上商店是电子商 ...

最新文章

  1. Xcode SVN配置
  2. 三星关闭shell提示_凌晨系统崩溃,低级千年虫问题,三星就是这样将中国市场拱手相让...
  3. java 回调(callback)函数简介.
  4. 信息安全系统设计基础第八周学习总结
  5. 【SPOJ】2319 BIGSEQ - Sequence
  6. 古代的政令 —— 两汉均输
  7. 配置apache密码认证
  8. 解决Windows下Redis出现“MISCONF Redis is configured to save RDB snapshots”的错误
  9. 装x玩法:插上你的专有U盘才能开机
  10. Java:QQ登录页面的制作(实现成功登录的代码)——含源码
  11. php免杀教程【绝对原创】
  12. 量子计算机是一种采用基于原理,量子计算的发展
  13. Android WIFI 分析
  14. Oracle学习(七)——————————————查询进阶
  15. 阿里贾扬清:新一轮AI爆发的推动机制是工程化和开源 | MEET2023
  16. Windows7正式版默认壁纸暗藏玄机!
  17. 最左前缀原则最左匹配原则
  18. 直播带货“老三”,抖音背上「KPI」了
  19. Redis之多实例的操作
  20. java.lang.IllegalStateException: No value for key [DynamicDataSource@e5f43124] bound to thread

热门文章

  1. c 在线语言编译器,在线编译器(支持C,C++等较多语言)
  2. ROS2机器人笔记20-12-11
  3. web端读取本地excel表数据
  4. 华硕java安装教程win10_华硕笔记本装win10系统及bios设置教程(附带分区步骤)
  5. ChromeRecorderpuppeteer
  6. 2022-2028全球风电涂料行业调研及趋势分析报告
  7. 水性防腐涂料行业调研报告 - 市场现状分析与发展前景预测
  8. pypy加速python
  9. mysql 不支持表情符号_mysql中插入emoji表情失败的原因与解决
  10. 设置font-family时需要注意的问题