Java 实战项目之在线点餐系统的实现流程

网友投稿 374 2022-09-15


Java 实战项目之在线点餐系统的实现流程

一、项目简述

功能包括: 在线点餐,评论,购物车,下单,支付,管理员,店家多 商家管理,后台评论管理,订单管理,商品管理等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: jsP +Spring + SpringMVC + MyBatis + html+ css + javascript + jquery + Ajax + layui+ maven等等。

用户模块:

/**

* 用户模块controller

*/

@Controller

@RequestMapping("/customer")

public class CustomerController {

@Autowired

private CustomerService customerService;

@RequestMapping("/list")

public String list(Model model, Page page)

{

PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询

List list= customerService.list();

int total = (int) new PageInfo<>(list).getTotal();//总条数

page.setTotal(total);

model.addAttribute("list",list);

model.addAttribute("totals",total);

return "cstpage/cst-list";

}

/**

* 设置会员

* @param id

* @return

*/

@RequestMapping("/shezhihuiyuan")

@ResponseBody

public String shezhihuiyuan(int id){

customerService.shezhihuiyuan(id);

return "success";

}

@RequestMapping("/del")

public String del(int id)

{

customerService.del(id);

return "redirect:list";

}

}

后台登陆模块:

/**

* 后台登陆

*/

@Controller

@RequestMapping("")

public class LoginController {

@Autowired

UserService userService;

@RequestMapping(value="/login",method=RequestMethod.POST)

public String login(Model model, String name, String password){//throws ParseEXtBSobxception

Subject subject = SecurityUtils.getSubject();

UsernamePasswordToken token = new UsernamePasswordToken(name,password);

try {

subject.login(token);

User us = userService.getByName(name);

String lastLoginTime = "";

if(us!=null){

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

//上次时间

Date time = us.getLasttime();

lastLoginTime = sdf.format(time);

//新时间

String format = sdf.format(new Date());

//string转date 不处理时间格式会不理想

ParsePosition pos = new ParsePosition(0);

Date strtodate = sdf.parse(format, pos);

us.setLasttime(strtodate);

userService.update(us);

}

if (us.getStatus()==1){

Session session=subject.getSession();

session.setAttribute("subject", subject);

session.setAttribute("lastLoginTime",lastLoginTime);

return "redirect:index";

}else {

model.addAttribute("error", "账号已被停用!");

return "/login";

}

} catch (AuthenticationException e) {

model.addAttribute("error", "验证失败!");

return "/login";

}

}

}

评论模块:

/**

* 评论模块controller

*/

@Controller

@RequestMapping("/review")

public class ReviewController {

@Autowired

private ReviewService reviewService;

@Autowired

private ProductService productService;

@RequestMapping("/list")

public String list(Model model, Page page){

PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询

List list= reviewService.list();

int total = (int) new PageInfo<>(list).getTotal();//总条数

page.setTotal(total);

model.addAttribute("totals",list.size());

model.addAttribute("list",list);

return "pinglunpage/pinglun";

}

@RequestMapping("/del")

public String del(int id){

reviewService.del(id);

return "redirect:list";

}

}

权限模块 :

/**

* 权限模块controller

*/

@Controller

@RequestMapping("/config")

public class PermissionController {

@Autowired

PermissionService permissionService;

/**

* 添加权限页面

* @return

*/

@RequestMapping("/adminPerAddUI")

public String addUI(){

return "syspage/admin-permission-add";

}

/**

* 权限列表

* @param model

* @param page

* @return

*/

@RequestMapping("/listPermission")

public String list(Model model, Page page){

PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询

List ps= permissionService.list();

int total = (int) new PageInfo<>(ps).getTotal();//总条数

page.setTotal(total);

model.addAttribute("ps", ps);

model.addAttribute("perCount",ps.size());

return "syspage/admin-permission";

}

@RequestMapping("/editPermission")

public String list(Model model,long id){

Permission permission =permissionService.get(id);

model.addAttribute("permission", permission);

return "syspage/admin-permission-edit";

}

@RequestMapping("/updatePermission")

public String update(Permission permission){

permissionService.update(permission);

return "redirect:listPermission";

}

@RequestMapping("/addPermission")

public String list(Model model,Permission permission){

permissionService.add(permission);

return "redirect:listPermission";

}

@RequestMapping("/deletePermission")

public String delete(Model model,long id){

permissionService.delete(id);

return "redirect:listPermission";

}

}

以上就是java 实战项目之在线点餐系统的实现流程的详细内容,更多关于Java 在线点餐系统的资料请关注我们其它相关文章!


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:我们网管不能自己贬低自己(网管态度不好)
下一篇:你要金婚?还是金色软件?(我要看金婚的)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~