Java项目-基于Springboot的在线外卖系统项目(源码+说明).zip

ops/2024/10/19 9:51:15/

作者:计算机学长阿伟
开发技术:SpringBoot、SSM、Vue、MySQL、ElementUI等,“文末源码”。

开发运行环境

  • 开发语言:Java
  • 数据库:MySQL
  • 技术:SpringBoot、Vue、Mybaits Plus、ELementUI
  • 工具:IDEA/Ecilpse、Navicat、Maven

源码下载地址:

https://download.csdn.net/download/weixin_53180424/89897628

一、项目简介

        本项目是一个在线外卖系统,旨在为用户提供便捷的外卖订餐服务。系统界面采用紫色调设计,简洁明了,易于操作。用户可以通过系统浏览各种美食,选择心仪的商家和菜品进行下单。系统还提供了公告资讯功能,方便用户了解最新的优惠活动和商家信息。个人中心则用于管理用户的个人信息和订单记录。后台管理功能为管理员提供了对系统的全面监控和管理能力。购物车功能则方便用户将多个菜品加入购物车,统一进行结算。

三、系统项目部分截图

3.1后台系统部分页面效果

四、部分核心代码

java">package com.controller;import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;import com.entity.AddressEntity;
import com.entity.view.AddressView;import com.service.AddressService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;/*** 地址* 后端接口*/
@RestController
@RequestMapping("/address")
public class AddressController {@Autowiredprivate AddressService addressService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,AddressEntity address,HttpServletRequest request){if(!request.getSession().getAttribute("role").toString().equals("管理员")) {address.setUserid((Long)request.getSession().getAttribute("userId"));}EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));return R.ok().put("data", page);}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,AddressEntity address, HttpServletRequest request){if(!request.getSession().getAttribute("role").toString().equals("管理员")) {address.setUserid((Long)request.getSession().getAttribute("userId"));}EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( AddressEntity address){EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();ew.allEq(MPUtil.allEQMapPre( address, "address")); return R.ok().put("data", addressService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(AddressEntity address){EntityWrapper< AddressEntity> ew = new EntityWrapper< AddressEntity>();ew.allEq(MPUtil.allEQMapPre( address, "address")); AddressView addressView =  addressService.selectView(ew);return R.ok("查询地址成功").put("data", addressView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){AddressEntity address = addressService.selectById(id);return R.ok().put("data", address);}/*** 前端详情*/@IgnoreAuth@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){AddressEntity address = addressService.selectById(id);return R.ok().put("data", address);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody AddressEntity address, HttpServletRequest request){address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(address);address.setUserid((Long)request.getSession().getAttribute("userId"));Long userId = (Long)request.getSession().getAttribute("userId");if(address.getIsdefault().equals("是")) {addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));}address.setUserid(userId);addressService.insert(address);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody AddressEntity address, HttpServletRequest request){address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(address);address.setUserid((Long)request.getSession().getAttribute("userId"));Long userId = (Long)request.getSession().getAttribute("userId");if(address.getIsdefault().equals("是")) {addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));}address.setUserid(userId);addressService.insert(address);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody AddressEntity address, HttpServletRequest request){//ValidatorUtils.validateEntity(address);if(address.getIsdefault().equals("是")) {addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", request.getSession().getAttribute("userId")));}addressService.updateById(address);//全部更新return R.ok();}/*** 获取默认地址*/@RequestMapping("/default")public R defaultAddress(HttpServletRequest request){Wrapper<AddressEntity> wrapper = new EntityWrapper<AddressEntity>().eq("isdefault", "是").eq("userid", request.getSession().getAttribute("userId"));AddressEntity address = addressService.selectOne(wrapper);return R.ok().put("data", address);}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){addressService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 提醒接口*/@RequestMapping("/remind/{columnName}/{type}")public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) {map.put("column", columnName);map.put("type", type);if(type.equals("2")) {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");Calendar c = Calendar.getInstance();Date remindStartDate = null;Date remindEndDate = null;if(map.get("remindstart")!=null) {Integer remindStart = Integer.parseInt(map.get("remindstart").toString());c.setTime(new Date()); c.add(Calendar.DAY_OF_MONTH,remindStart);remindStartDate = c.getTime();map.put("remindstart", sdf.format(remindStartDate));}if(map.get("remindend")!=null) {Integer remindEnd = Integer.parseInt(map.get("remindend").toString());c.setTime(new Date());c.add(Calendar.DAY_OF_MONTH,remindEnd);remindEndDate = c.getTime();map.put("remindend", sdf.format(remindEndDate));}}Wrapper<AddressEntity> wrapper = new EntityWrapper<AddressEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}if(!request.getSession().getAttribute("role").toString().equals("管理员")) {wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));}int count = addressService.selectCount(wrapper);return R.ok().put("count", count);}}

获取源码或文档

如需对应的论文或文档,以及其他定制需求,也可以下方添加联系我。


http://www.ppmy.cn/ops/126683.html

相关文章

子网掩码问题3 已知ip 地址数是5

假设 1.1.1.0 /24 需 划分27 个地址&#xff0c;求这个地址段的网络位&#xff0c;主机位&#xff0c;以及他们的详细信息 解&#xff1a; 假设主机地址位数是x 那么主机的地址个数 2的x次方-2 因为地址不能全部为0 也不能全为1 2 的x 次方 -2 > 27…

原型链+instanceof+Vue底层原理

一些重要的前端知识总结&#xff08;基于笔面试题的扩展&#xff09;&#xff0c;包含原型链、instanceof、深度剖析Vue底层原理 目录 一、原型链 二、instanceof 1. instanceof 2. 用法 三、defineProperty和Proxy 1. vue架构-MVVM 2. render函数 1&#xff09;render…

Leetcode 二叉搜索树的第 K 个元素

复习一下二叉搜索树 二叉搜索树 (Binary Search Tree, 简称 BST) 是一种特殊的二叉树(可以为空)&#xff0c;其中每个节点都有一个值&#xff0c;并且满足以下特点&#xff1a; 定义&#xff1a; 左子树节点的值小于根节点的值&#xff1a;对于每个节点&#xff0c;左子树中所…

利用 Direct3D 绘制几何体—6.常量缓冲区

1. 创建常量缓冲区 常量缓冲区 (constant buffer) 也是一种 GPU 资源 (ID3D12Resource)&#xff0c;其数据内容可供着色器程序所引用。顶点着色器实例中&#xff1a; cbuffer cbPerObject : register(b0) {float4x4 gWorldViewProj; }; 在这段代码中&#xff0c;cbuffer 对…

Java异常体系

1. 概述 以下是详细内容 2. 什么是异常 编程的错误分为语法错误、逻辑错误、异常三种&#xff0c;其中语法错误和逻辑错误不属于异常。因为如果发生语法错误&#xff0c;Java程序根本无法运行&#xff0c;而如果发生逻辑错误&#xff0c;Java程序也不可能得到正确的结果。 我…

repo 命令大全详解(第十一篇 repo init)

repo forall 命令用于在指定的项目上执行给定的命令&#xff0c;非常适合批量操作。 参数分类及解释 基本参数 [<project>...]: 可选&#xff0c;指定要操作的项目。如果不指定&#xff0c;则对所有项目执行命令。 示例: repo forall my_project -c "git status&q…

目标检测最新SOTA模型D-FINE

2024年10月18号&#xff0c;中科大推出了 D-FINE&#xff0c;这是一款功能强大的实时物体检测器&#xff0c;通过重新定义 DETR 模型中的边界框回归任务实现了出色的定位精度。 摘要 D-FINE 包含两个关键组件&#xff1a;细粒度分布细化 (FDR) 和全局最优定位自蒸馏 (GO-LSD)…

eggjs sequelize egg-sequelize-auto自动从零生成一个数据表 自动创建model

sequelize egg-sequelize-auto整个过程还是有一些坑 包括兼容性问题 依赖安装问题 需要注意 缺少一个条件 包跑不起来 或使用体验很差 1. 全局安装插件 pnpm install -g sequelize-cli sequelize mysql2 egg-sequelize-auto 2. 执行命令创建 migrate迁移文件 以及 mod…