博主介绍:✌在职Java研发工程师、专注于程序设计、源码分享、技术交流、专注于Java技术领域和毕业设计

项目名称

SpringBoot+Mysql+小程序实现的美团外卖美食小程序系统附带前台和后台代码整套源码包运行(问题解答)

演示视频

SpringBoot+Mysql+小程序实现的美团外卖美食小程序系统附带前台和后台代码整套源码包运行(问题解答)_哔哩哔哩_bilibili

系统介绍

前端小程序功能有:
美食分类、美食浏览、购物车、订单、个人中心、收货地址、红包管理、评价管理、登录。
订单支付用的是模拟直接支付成功)

后台管理模块功能有(包括基础系统管理功能):
美食分类管理、美食管理、口味管理、公司管理、活动管理、红包管理、订单管理、退款管理、评价管理。

环境需要

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.数据库:MySql 5.7版本;
6.是否Maven项目:否;

技术栈

1. 后端:Spring+SpringMVC+Mybatis
2. 前端:JSP+CSS+JavaScript+jQuery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/ 登录

运行截图

用户管理控制层:

package com.houserss.controller;import javax.servlet.http.HttpSession;import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import com.houserss.common.Const;
import com.houserss.common.Const.Role;
import com.houserss.common.ServerResponse;
import com.houserss.pojo.User;
import com.houserss.service.IUserService;
import com.houserss.service.impl.UserServiceImpl;
import com.houserss.util.MD5Util;
import com.houserss.util.TimeUtils;
import com.houserss.vo.DeleteHouseVo;
import com.houserss.vo.PageInfoVo;/*** Created by admin*/
@Controller
@RequestMapping("/user/")
public class UserController {@Autowiredprivate IUserService iUserService;/*** 用户登录* @param username* @param password* @param session* @return*/@RequestMapping(value = "login.do",method = RequestMethod.POST)@ResponseBodypublic ServerResponse<User> login(User user,String uvcode, HttpSession session){String code = (String)session.getAttribute("validationCode");if(StringUtils.isNotBlank(code)) {if(!code.equalsIgnoreCase(uvcode)) {return ServerResponse.createByErrorMessage("验证码不正确");}}ServerResponse<User> response = iUserService.login(user.getUsername(),user.getPassword());if(response.isSuccess()){session.setAttribute(Const.CURRENT_USER,response.getData());}return response;}}

管理员管理控制层:


package com.sxl.controller.admin;import java.util.List;
import java.util.Map;import javax.servlet.http.HttpServletRequest;import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;import com.sxl.controller.MyController;@Controller("adminController")
@RequestMapping(value = "/admin")
public class AdminController extends MyController {@RequestMapping(value = "/index")public String frame(Model model, HttpServletRequest request)throws Exception {return "/admin/index";}@RequestMapping(value = "/main")public String main(Model model, HttpServletRequest request)throws Exception {return "/admin/main";}@RequestMapping(value = "/tj1")public String tj1(Model model, HttpServletRequest request)throws Exception {String sql="select DATE_FORMAT(insertDate,'%Y-%m-%d') dates,sum(allPrice) price from t_order order by DATE_FORMAT(insertDate,'%Y-%m-%d')  desc";List<Map> list = db.queryForList(sql);model.addAttribute("list", list);System.out.println(list);return "/admin/tj/tj1";}@RequestMapping(value = "/password")public String password(Model model, HttpServletRequest request)throws Exception {return "/admin/password";}@RequestMapping(value = "/changePassword")public ResponseEntity<String> loginSave(Model model,HttpServletRequest request,String oldPassword,String newPassword) throws Exception {Map admin = getAdmin(request);if(oldPassword.equals(admin.get("password").toString())){String sql="update t_admin set password=? where id=?";db.update(sql, new Object[]{newPassword,admin.get("id")});return renderData(true,"1",null);}else{return renderData(false,"1",null);}}
}

修改密码业务逻辑:


package com.sxl.controller.admin;import java.util.Map;import javax.servlet.http.HttpServletRequest;import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;import com.sxl.controller.MyController;@Controller("userController")
@RequestMapping(value = "/user")
public class UserController extends MyController {@RequestMapping(value = "/index")public String frame(Model model, HttpServletRequest request)throws Exception {return "/user/index";}@RequestMapping(value = "/main")public String main(Model model, HttpServletRequest request)throws Exception {return "/user/main";}@RequestMapping(value = "/password")public String password(Model model, HttpServletRequest request)throws Exception {return "/user/password";}@RequestMapping(value = "/changePassword")public ResponseEntity<String> loginSave(Model model,HttpServletRequest request,String oldPassword,String newPassword) throws Exception {Map user = getUser(request);if(oldPassword.equals(user.get("password").toString())){String sql="update t_user set password=? where id=?";db.update(sql, new Object[]{newPassword,user.get("id")});return renderData(true,"1",null);}else{return renderData(false,"1",null);}}@RequestMapping(value = "/mine")public String mine(Model model, HttpServletRequest request)throws Exception {
Map user =getUser(request);Map map = db.queryForMap("select * from t_user where id=?",new Object[]{user.get("id")});model.addAttribute("map", map);        return "/user/mine";}@RequestMapping(value = "/mineSave")public ResponseEntity<String> mineSave(Model model,HttpServletRequest request,Long id,String username,String password,String name,String gh,String mobile) throws Exception{int result = 0;String sql="update t_user set name=?,gh=?,mobile=? where id=?";result = db.update(sql, new Object[]{name,gh,mobile,id});if(result==1){return renderData(true,"操作成功",null);}else{return renderData(false,"操作失败",null);}}}

通用管理模块:

package com.sxl.controller;import java.nio.charset.Charset;
import java.util.Locale;
import java.util.ResourceBundle;import javax.servlet.http.HttpServletRequest;import org.apache.commons.lang.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 com.sxl.util.JacksonJsonUtil;
import com.sxl.util.StringUtil;
import com.sxl.util.SystemProperties;public class BaseController {public static final Long EXPIRES_IN = 1000 * 3600 * 24 * 1L;// 1天@Autowiredprivate SystemProperties systemProperties;/*** 获得配置文件内容*/public String getConfig(String key) {return systemProperties.getProperties(key);}/*** 返回服务器地址 like http://192.168.1.1:8441/UUBean/*/public String getHostUrl(HttpServletRequest request) {String hostName = request.getServerName();Integer hostPort = request.getServerPort();String path = request.getContextPath();if (hostPort == 80) {return "http://" + hostName + path + "/";} else {return "http://" + hostName + ":" + hostPort + path + "/";}}/**** 获取当前的website路径 String*/public static String getWebSite(HttpServletRequest request) {String returnUrl = request.getScheme() + "://"+ request.getServerName();if (request.getServerPort() != 80) {returnUrl += ":" + request.getServerPort();}returnUrl += request.getContextPath();return returnUrl;}/*** 初始化HTTP头.* * @return HttpHeaders*/public HttpHeaders initHttpHeaders() {HttpHeaders headers = new HttpHeaders();MediaType mediaType = new MediaType("text", "html",Charset.forName("utf-8"));headers.setContentType(mediaType);return headers;}/*** 返回 信息数据* * @param status* @param msg* @return*/public ResponseEntity<String> renderMsg(Boolean status, String msg) {if (StringUtils.isEmpty(msg)) {msg = "";}String str = "{\"status\":\"" + status + "\",\"msg\":\"" + msg + "\"}";ResponseEntity<String> responseEntity = new ResponseEntity<String>(str,initHttpHeaders(), HttpStatus.OK);return responseEntity;}/*** 返回obj数据* * @param status* @param msg* @param obj* @return*/public ResponseEntity<String> renderData(Boolean status, String msg,Object obj) {if (StringUtils.isEmpty(msg)) {msg = "";}StringBuffer sb = new StringBuffer();sb.append("{");sb.append("\"status\":\"" + status + "\",\"msg\":\"" + msg + "\",");sb.append("\"data\":" + JacksonJsonUtil.toJson(obj) + "");sb.append("}");ResponseEntity<String> responseEntity = new ResponseEntity<String>(sb.toString(), initHttpHeaders(), HttpStatus.OK);return responseEntity;}/**** 获取IP(如果是多级代理,则得到的是一串IP值)*/public static String getIpAddr(HttpServletRequest request) {String ip = request.getHeader("x-forwarded-for");if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getHeader("Proxy-Client-IP");}if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getHeader("WL-Proxy-Client-IP");}if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getRemoteAddr();}if (ip != null && ip.length() > 0) {String[] ips = ip.split(",");for (int i = 0; i < ips.length; i++) {if (!"unknown".equalsIgnoreCase(ips[i])) {ip = ips[i];break;}}}return ip;}/*** 国际化获得语言内容* * @param key*            语言key* @param args* @param argsSplit* @param defaultMessage* @param locale* @return*/public static String getLanguage(String key, String args, String argsSplit,String defaultMessage, String locale) {String language = "zh";String contry = "cn";String returnValue = defaultMessage;if (!StringUtil.isEmpty(locale)) {try {String[] localeArray = locale.split("_");language = localeArray[0];contry = localeArray[1];} catch (Exception e) {}}try {ResourceBundle resource = ResourceBundle.getBundle("lang.resource",new Locale(language, contry));returnValue = resource.getString(key);if (!StringUtil.isEmpty(args)) {String[] argsArray = args.split(argsSplit);for (int i = 0; i < argsArray.length; i++) {returnValue = returnValue.replace("{" + i + "}",argsArray[i]);}}} catch (Exception e) {}return returnValue;}
}

SpringBoot+Mysql+小程序实现的美团外卖美食小程序系统附带前台和后台代码整套源码包运行(问题解答)相关推荐

  1. 原生小程序之仿美团外卖

    根据美团外卖仿写微信小程序 根据美团外卖仿写小程序,请求运用封装的微信小程序的原生方法wx.request,后台数据自己在本地搭建的mock模拟数据,封装store代替状态管理工具,即app.js中的 ...

  2. ssm基于微信小程序的社区老人健康管理服务系统的设计与实现 毕业设计-附源码011513

    摘要 随着现在网络的快速发展,网络的应用在各行各业当中它很快融入到了许多分类管理之中,他们利用网络来做这个社区老人健康管理服务系统,随之就产生了"社区老人健康管理服务系统 .",这 ...

  3. 微信小程序跳转美团外卖小程序时出现白屏解决demo

    最近在开发小程序时需要做小程序跳转到美团的小程序商家详情页面,前端使用的是wx.navigateToMiniProgram(Object object)方法,前期使用的时候功能是是正常的,突然昨天用户 ...

  4. 基于微信小程序的点餐系统 报告+任务书+开题报告+中期报告+中期PPT+项目源码(Java+MySQL)及数据库文件

    摘 要 随着"互联网+"的大潮兴起,手机微信深受人的欢迎.随即带来的就是微信小程序凭借微信强大的用户基础及其应用的便捷而受人们热捧.此外微信小程序无需安装,扫描二维码或者微信内搜索 ...

  5. 基于java实现农产品_基于微信小程序的个人商铺(农产品)设计与实现毕业论文+开题报告+前后台源码(JavaSSM+Mysql)+文献资料...

    摘  要 伴随着Internet的蓬勃发展,网络购物中心作为电子商务的一种形式正以其高效.低成本的优势,逐步成为新兴的经营模式和理念,人们已经不再满足用途信息的浏览和发布,而是渴望着能够充分享受网络所 ...

  6. 计算机毕业设计(49)java小程序毕设作品之菜谱美食小程序系统

    项目背景和意义 目的:本课题主要目标是设计并能够实现一个基于微信小程序美食菜谱点评系统,前台用户使用小程序,后台管理使用Java+Mysql开发,后台使用了springboot框架:通过后台添加资讯和 ...

  7. 微信小程序医院门诊体检预约信息管理系统SSM-JAVA【数据库设计、论文、源码、开题报告】

    功能介绍 本系统分为用户和管理员两个角色,用户的操作主要为微信端,管理员的操作为服务端.用户在微信端可以根据不同的分类浏览体检套餐,可以预约,管理自己的预约信息.体检报告信息.收藏信息等:管理员可以管 ...

  8. 微信小程序UI自动化实践:python+minium+PO模式(超详细教程附源码供下载)

    文章目录 前言 一.minium介绍 二.安装环境 1. 安装minium doc 2. 安装minium 3. 启动小程序 三.准备知识 1. 启动 2. 配置 3. 命令行运行 4. 元素定位 5 ...

  9. 微信小程序(图像识别)腾讯云、百度智能云API(含源码)

    前言 近期因为自己生活上的需要,开发了一款图像识别小程序.在开发初期,自己浏览参考了大量网上现成存在的小程序,根据体验功能的使用情况,基本都能达到其所述功能.但是有个问题是,很多小程序图像识别功能过于 ...

最新文章

  1. 兼容低版本浏览器的一些方法
  2. 推荐一个优化分页查询的办法(分页数很大的情况)
  3. 【机器视觉】 dev_set_check算子
  4. 创建hugo博客_如何创建您的第一个Hugo博客:实用指南
  5. IO流配置文件,键值对Properties 的读取
  6. 计算机教案的自我分析怎么写,教案的自我分析怎么写.docx
  7. linux添加ssh公钥免密登录
  8. 抖音内测网页版 网友:摸鱼党新的快乐来了
  9. 2019-0403视觉SLAM的学习第二讲
  10. java面向对象面试怎么回答_Java面向对象面试题
  11. freeSWITCH中动态加载模块
  12. 清除 DNS 缓存( 附全平台详细教程 )
  13. 饥荒 Don‘t Starve Together Mac游戏介绍
  14. 《高性能iOS 应用开发》之降低你 APP 的电量消耗
  15. 数据科学的重要支柱——统计学的最佳入门书籍
  16. FACEGOOD-Audio2Face(个人学习)
  17. error: cannot lock ref ‘refs/remotes/origin/douyin/open‘: ‘refs/remotes/origin/douyin‘ exists;
  18. 在微信朋友圈常见的H5要如何制作?
  19. 洛谷P5594-【XR-4】模拟赛(模拟)
  20. 最近失业了,在做副业的路上走了很多坑

热门文章

  1. chrome插件通过下载实现导出文件
  2. mysql 活锁_死锁与活锁的区别
  3. ccf论文分级_CCF、 A、B、C类是什么??CCF难发还是SCI难
  4. systemctl 启动/关闭/启用/禁用服务 总结
  5. proftpd启动失败提示unable to determine IP address of “xxx.com”
  6. JAVA从零开始自学历程(第一周)
  7. C++ 文件输出与输入
  8. IOS - ReplayKit2 获取影像方向+ReplayKit的坑
  9. cocos2d-x中的导演、场景、层和精灵
  10. 远程连接不成功,提示您的凭据不工作的解决办法