功能包括: 前台实现:用户浏览菜单、菜品分类筛选、查看菜单详 情、添加购物车、购物车结算、会员券、个人订单查询等 等。 后台实现:餐系管理、菜品管理、订单管理、系统管理、 酉己备员管理等。 系统分为:高或管理员、顾客、厨师、配送员等等。
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
@RestController
@RequestMapping("/backstage/user")
public class UserManageController {
@Autowired
private UserService userService;
/**
* 根据页面的条件查找用户列表
* @param vo
* @return
*/
@RequestMapping("/list")
public String findUserListByPage(UserVo vo){
LayuiTableDataResult userListByPage = userService.findUserListByPage(vo);
return JSON.toJSONString(userListByPage);
}
/**
* 后台添加用户
* @param vo
* @return
*/
@RequestMapping("/add")
public String addUser(UserVo vo){
Map map = userService.addUser(vo);
return JSON.toJSONString(map);
}
/**
* 后台修改用户信息
* @param vo
* @return
*/
@RequestMapping("/modify")
public String modifyUserBackstage(UserVo vo){
Map map = userService.modifyUserBackstage(vo);
return JSON.toJSONString(map);
}
/**
* 重置用户密码
* @param userId
* @return
*/
@RequestMapping("/resetPassword")
public String resetPassword(Long userId){
Map map = userService.resetPassword(userId);
return JSON.toJSONString(map);
}
/**
* 查找该用户所拥有的角色
* @param userId
* @return
*/
@RequestMapping("/findRole")
public String findRoleListByUserId(Long userId){
LayuiTableDataResult roleListByUserId = userService.findRoleListByUserId(userId);
return JSON.toJSONString(roleListByUserId);
}
/**
* 为用户授权角色
* @param roleIds
* @param userId
* @return
*/
@RequestMapping("/grantRole")
public String grantRole(String roleIds, Long userId){
Map map = userService.grantRole(roleIds, userId);
return JSON.toJSONString(map);
}
/**
* 删除用户信息
* @param userId
* @return
*/
@RequestMapping("/delete")
public String deleteUser(Long userId){
Map map = userService.deleteUser(userId);
return JSON.toJSONString(map);
}
}
/**
* 用户地址管理控制器
*/
@RestController
@RequestMapping("/address")
public class AddressController {
@Autowired
private AddressService addressService;
/**
* 查找该角色的所有地址信息,返回LayUI数据表格格式
*/
@RequestMapping("/list")
public String findAddressListByUserId(AddressVo vo, HttpSession session){
vo.setUserId(((UserEntity) session.getAttribute("userLogin")).getUserId());
LayuiTableDataResult addressListByUserId = addressService.findAddressListByUserId(vo);
return JSON.toJSONString(addressListByUserId);
}
/**
* 查找该角色的所有地址信息,返回Map格式
* @param session
* @return
*/
@RequestMapping("/listByUser")
public String findAddressListByUser(HttpSession session){
Map map = addressService.findAddressListByUser(session);
return JSON.toJSONString(map);
}
/**
* 添加地址
* @param vo
* @return
*/
@RequestMapping("/add")
public String addAddress(AddressVo vo, HttpSession session){
Map map = addressService.addAddress(vo, session);
return JSON.toJSONString(map);
}
/**
* 修改地址
* @param vo
* @return
*/
@RequestMapping("/modify")
public String modifyAddress(AddressVo vo, HttpSession session){
Map map = addressService.modifyAddress(vo, session);
return JSON.toJSONString(map);
}
/**
* 删除地址
* @param addressId
* @return
*/
@RequestMapping("/delete")
public String deleteAddress(Long addressId){
Map map = addressService.deleteAddress(addressId);
return JSON.toJSONString(map);
}
}
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
/**
* 用户登录
* @param username
* @param password
* @param session
* @return
*/
@ResponseBody
@RequestMapping("/login")
public String login(String username, String password, HttpSession session){
Map map = userService.login(username, password, session);
return JSON.toJSONString(map);
}
/**
* 退出登录
* @param session
* @return
*/
@RequestMapping("/exit")
public String exit(HttpSession session){
userService.exit(session);
return "redirect:/login.html";
}
/**
* 校验用户注册输入的用户名是否存在
* @param username
* @return
*/
@ResponseBody
@RequestMapping("/checkUsername")
public String checkUsername(String username){
Map map = userService.checkUsername(username);
return JSON.toJSONString(map);
}
/**
* 用户注册
* @param vo
* @param session
* @return
*/
@ResponseBody
@RequestMapping("/register")
public String register(UserVo vo, HttpSession session){
Map register = userService.register(vo, session);
return JSON.toJSONString(register);
}
/**
* 查询登录用户的个人资料
* @param session
* @return
*/
@ResponseBody
@RequestMapping("/findUserByUserId")
public String findUserByUserId(HttpSession session){
Long userId = ((UserEntity) session.getAttribute(SystemConstant.USERLOGIN)).getUserId();
Map userByUserId = userService.findUserByUserId(userId);
return JSON.toJSONString(userByUserId);
}
/**
* 查询某个用户的个人资料
* @param vo
* @return
*/
@ResponseBody
@RequestMapping("/modifyUserInfo")
public String modifyUserInfo(UserVo vo, HttpSession session){
Map map = userService.modifyUserReception(vo, session);
return JSON.toJSONString(map);
}
/**
* 用户修改密码
* @param oldPassword
* @param newPassword
* @param session
* @return
*/
@ResponseBody
@RequestMapping("/modifyPassword")
public String modifyPassword(String oldPassword, String newPassword, HttpSession session){
Map map = userService.modifyPassword(oldPassword, newPassword, session);
return JSON.toJSONString(map);
}
}
/**
* 优惠券商城控制器
*/
@RestController
@RequestMapping("/reception/ticket")
public class TicketController {
@Autowired
private TicketService ticketService;
/**
* 查询所有上架的优惠券类别
* @return
*/
@RequestMapping("/findAll")
public String findAllTicketOnShelf(){
Map map = ticketService.findAllTicketOnShelf();
return JSON.toJSONString(map);
}
/**
* 领取优惠券
* @param ticketTypeId
* @param session
* @return
*/
@RequestMapping("/receiveTicket")
public String receiveTicket(Long ticketTypeId, HttpSession session){
Map map = ticketService.receiveTicket(ticketTypeId, session);
return JSON.toJSONString(map);
}
/**
* 查询某个用户的优惠券记录
* @param session
* @return
*/
@RequestMapping("/findByUser")
public String findByUser(HttpSession session){
Map map = ticketService.findByUser(session);
return JSON.toJSONString(map);
}
/**
* 查询该用户未使用的优惠券
* @param session
* @return
*/
@RequestMapping("/findByUserUnuse")
public String findByUserUnuse(HttpSession session){
Map map = ticketService.findByUserUnuse(session);
return JSON.toJSONString(map);
}
/**
* 根据优惠券编号查询优惠券
* @param ticketId
* @return
*/
@RequestMapping("/findTicketById")
public String findTicketById(Long ticketId){
Map map = ticketService.findTicketById(ticketId);
return JSON.toJSONString(map);
}
}
/**
* 购物车控制器
*/
@RestController
@RequestMapping("/reception/shopcart")
public class ShopcartController {
@Autowired
private ShopcartService shopcartService;
/**
* 添加菜品SKU到购物车
* @param session
* @param numCount
* @param skuId
* @return
*/
@RequestMapping("/add")
public String addShopcart(Long skuId, Integer numCount, HttpSession session){
Map map = shopcartService.addShopcart(skuId, numCount, session);
return JSON.toJSONString(map);
}
/**
* 查找该用户下的所有购物车信息
* @param session
* @return
*/
@RequestMapping("/findByUserId")
public String findAllShopcartByUserId(HttpSession session){
Map map = shopcartService.findAllShopcartByUserId(session);
return JSON.toJSONString(map);
}
/**
* 新增该用户某个SKU菜品的数量
* @param shopcartId
* @return
*/
@RequestMapping("/addNumCountOne")
public String addNumCountOne(Long shopcartId){
Map map = shopcartService.addNumCountOne(shopcartId);
return JSON.toJSONString(map);
}
/**
* 减少该用户某个SKU菜品的数量
* @param shopcartId
* @return
*/
@RequestMapping("/reduceNumCountOne")
public String reduceNumCountOne(Long shopcartId){
Map map = shopcartService.reduceNumCountOne(shopcartId);
return JSON.toJSONString(map);
}
/**
* 删除购物车的某一个条目
* @param shopcartId
* @return
*/
@RequestMapping("/delete")
public String deleteShopcart(Long shopcartId){
Map map = shopcartService.deleteShopcart(shopcartId);
return JSON.toJSONString(map);
}
}