package com.mealorder.action;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.mealorder.model.AdminUser;
import com.mealorder.model.Buy;
import com.mealorder.model.Cart;
import com.mealorder.model.Goods;
import com.mealorder.model.Goodsevaluate;
import com.mealorder.model.Goodstype;
import com.mealorder.model.PageBean;
import com.mealorder.model.Shop;
import com.mealorder.util.GetOrderIdByTime;
import com.mealorder.util.PageUtil;
import com.mealorder.util.ResponseUtil;
import com.mealorder.util.StringUtil;
import com.mealorder.dao.AdminUserDao;
import com.mealorder.dao.BuyDao;
import com.mealorder.dao.CartDao;
import com.mealorder.dao.GoodsDao;
import com.mealorder.dao.GoodsevaluateDao;
import com.mealorder.dao.GoodstypeDao;
import com.mealorder.dao.ShopDao;
import net.sf.json.JSONObject;
/**
* 前端主控制类
* @author gongwei
*
*/
@Controller
public class FrontMainAction {
@Resource
private AdminUserDao adminuserDao;
@Resource
private ShopDao shopDao;
@Resource
private GoodsDao goodsDao;
@Resource
private GoodstypeDao goodstypeDao;
@Resource
private CartDao cartDao;
@Resource
private BuyDao buyDao;
@Resource
private GoodsevaluateDao goodsevaluateDao;
/**
* 前端用户登录
* @return
*/
@RequestMapping(value = "/front/frontlogin")
public void frontlogin(Model model, HttpServletRequest request, HttpServletResponse response) throws IOException {
JSONObject resultJson = new JSONObject();
String user_iphone = request.getParameter("user_iphone");//获取用户手机号码
String user_password = request.getParameter("user_password");//获取用户密码
HttpSession session = request.getSession();
AdminUser user = adminuserDao.userLogin(user_iphone, user_password);
if (user.getAdminuser_iphone() == null || user.getAdminuser_iphone() == "") {
resultJson.put("result", "failone");//登录失败,用户不存在
} else {
session.setAttribute("currentUser", user);
//setMaxInactiveInterval设置的是当前会话的失效时间,不是整个web的时间,单位为以秒计算。如果设置的值为零或负数,则表示会话将永远不会超时。
session.setMaxInactiveInterval(0);
resultJson.put("result", "success");
}
try {
ResponseUtil.write(resultJson, response);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 前端用户注册
* @return
* @throws Exception
*/
@RequestMapping(value = "/front/frontregister")
public String frontregister(HttpServletRequest request, HttpServletResponse response) {
JSONObject resultJson = new JSONObject();
String user_iphone = request.getParameter("user_iphone");//获取手机号码
String user_password = request.getParameter("user_password");//获取用户密码
String user_name = request.getParameter("user_name");//获取用户名称
//查询手机号码是否存在
List<AdminUser> useriphonelist = adminuserDao.findUserByIphone(user_iphone);
if (useriphonelist.size() > 0) {
resultJson.put("result", "failone");//手机号码已存在
} else {
AdminUser user = new AdminUser();
user.setAdminuser_username(user_name);//设置用户名称
user.setAdminuser_password(user_password);//设置用户密码
user.setAdminuser_iphone(user_iphone);//设置用户手机号码
//获取当前系统时间
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String user_registertime = formatter.format(date);
user.setAdminuser_registertime(user_registertime);//设置用户注册时间
user.setRole_id(2);//设置用户角色 1、管理员 2、用户
user.setAdminuser_sex(1);//设置用户性别 1、男 0、女
user.setAdminuser_age(1);//设置用户年龄
user.setAdminuser_status(1);//设置用户状态 1、正常 2、锁定
int a = adminuserDao.addAdminUser(user);
if (a > 0) {//用户添加成功后获取用户id
resultJson.put("result", "success");//注册成功
} else {
resultJson.put("result", "failtwo");//注册失败
}
}
try {
ResponseUtil.write(resultJson, response);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 用户退出系统
* @return
* @throws IOException
* @throws Exception
*/
@RequestMapping(value = "/front/frontlogout")
public void phonelogout(HttpServletRequest request, HttpServletResponse response) throws IOException {
request.getSession().invalidate();
response.sendRedirect("mainindex");//退出后返回首页
}
/**
* 前台首页
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/front/mainindex")
public String mainindex(Model model, HttpServletRequest request, HttpServletResponse response) {
//查询推荐门店
List<Shop> shoplistfortj = shopDao.findShopFortuijian(null);
model.addAttribute("shoplistfortj", shoplistfortj);
//查询推荐门店
List<Shop> shoplistforntj = shopDao.findShopForNotuijian(null);
model.addAttribute("shoplistforntj", shoplistforntj);
return "index.jsp";
}
// /**
// * 商品分类页
// * @param request
// * @param response
// * @return
// */
// @RequestMapping(value = "/front/goodstype")
// public String goodstype(Model model, HttpServletRequest request, HttpServletResponse response) {
//
// //查询商品分类列表
// List<Goodstype> goodstypelist = goodstypeDao.findGoodstype(null);
// model.addAttribute("goodstypelist", goodstypelist);
//
// //商品列表
// List<Goods> goodslist = null;
// String goodstype_id = request.getParameter("goodstype_id");//获取商品类型id
// if (StringUtil.isNotEmpty(goodstype_id)) {//类型不为空,则按类型查询商品列表
// goodslist = goodsDao.findGoodsByGoodstypeId(Integer.parseInt(goodstype_id));
// } else {
// goodslist = goodsDao.findGoodss(null);
// }
//
// List<Goodstype> goodstypegoodslist = goodstypeDao.getgoodstype();
// model.addAttribute("goodstypegoodslist", goodstypegoodslist);
//
//
//
// return "goodstype.jsp";
// }
/**
* 商品分类页
* @return
*/
@RequestMapping(value = "/front/goodstype")
public void goodstype(Model model, HttpServletRequest request, HttpServletResponse response) throws IOException {
JSONObject resultJson = new JSONObject();
//查询商品分类列表
List<Goodstype> goodstypelist = goodstypeDao.findGoodstype(null);
resultJson.put("goodstypelist", goodstypelist);//商品分类列表
//商品列表
List<Goods> goodslist = null;
int goodstype_id = Integer.parseInt(request.getParameter("goodstype_id"));//获取商品类型id
if (goodstype_id == 0) {//查询第一个分类的商品列表
goodslist = goodsDao.findGoodsByGoodstypeId(1);
} else {//按类型查询商品列表
goodslist = goodsDao.findGoodsByGoodstypeId(goodstype_id);
}
resultJson.put("goodslist", goodslist);//商品列表
try {
ResponseUtil.write(resultJson, response);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 商品详情页
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/front/goodsinfo")
public String goodsinfo(Model model, HttpServletRequest request, HttpServletResponse response) {
String goods_id = request.getParameter("goods_id");//商品id
//根据商品id查询商品信息
List<Goods> goodslist = goodsDao.findGoodsById(Integer.parseI
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
## jsp+ssm框架实现手机WAP版外卖订餐系统 这是一款由jsp+ssm框架(spring、springMVC、mybaits)实现的手机WAP版外卖订餐系统。 本系统前台页面是手机端的,跟目前主流的饿了么、美团外卖等一样的界面风格。 前台实现了用户登录注册、查看菜品信息、添加到购物车、提交订单、查看个人订单、修改个人资料等。 后台管理实现了菜品分类管理、菜品管理、客户管理、订单管理等功能。 #### 环境需要 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.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 5.7、8.0等版本均可; #### 技术栈 1. 后端:Spring SpringMVC MyB
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 1301 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/0dd9dfde5e4f4ea2a69a07b46fbf473d_yuyecsdn.jpg!1)
beyondwild
- 粉丝: 9727
- 资源: 4903
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)