Java毕业设计项目实战篇|Java项目:网上花店商城系统(java+jsp+servlert+mysql+ajax)

源码获取:博客首页 "资源" 里下载!
一、项目简述
功能: 一套完整的网上花店商场系统,系统支持前台会员的注册 登陆系统留言,花朵的品种选择,详情浏览,加入购物 车,购买花朵等;后台支持管理员的花朵种类添加,花朵 详情的添加修改,用户管理,留言管理,商场新闻管理等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP + Servlert + html+ css + JavaScript + JQuery + Ajax + Fileupload等等。
Java毕业设计项目实战篇|Java项目:网上花店商城系统(java+jsp+servlert+mysql+ajax)
文章图片



Java毕业设计项目实战篇|Java项目:网上花店商城系统(java+jsp+servlert+mysql+ajax)
文章图片

Java毕业设计项目实战篇|Java项目:网上花店商城系统(java+jsp+servlert+mysql+ajax)
文章图片

Java毕业设计项目实战篇|Java项目:网上花店商城系统(java+jsp+servlert+mysql+ajax)
文章图片


Java毕业设计项目实战篇|Java项目:网上花店商城系统(java+jsp+servlert+mysql+ajax)
文章图片

Java毕业设计项目实战篇|Java项目:网上花店商城系统(java+jsp+servlert+mysql+ajax)
文章图片


用户信息控制层:
/** * 用户 **/ @RestController @RequestMapping("user") public class UserController { @Autowired UserService userService; @Autowired UserDao dao; @RequestMapping("/test") R test() { R r = new R(); return r.setCode(4000).setMsg(Constant.IMG_PATH).setData(dao.findAll()); }@RequestMapping("/queryInfoByAccount") R queryInfoByAccount(@RequestParam("account") String account) { R r = new R(); if (StringUtil.isEmpty(account)){ return r.setCode(4000).setMsg(HttpMsg.INVALID_PARAM); } User loginUser = userService.queryInfo(account); if (loginUser == null){ return r.setCode(4000).setMsg(HttpMsg.INVALID_USER); } return r.setCode(2000).setData(loginUser); }@RequestMapping("/find") R find(@RequestParam("page") int page, @RequestParam("searchKey") String searchKey) { R r = new R(); Map map = new HashMap<>(); List users = userService.find(searchKey); if (users == null) { return r.setCode(2000); } List items = users.size() >= page * Constant.PAGE_SIZE ? users.subList((page - 1) * Constant.PAGE_SIZE, page * Constant.PAGE_SIZE) : users.subList((page - 1) * Constant.PAGE_SIZE, users.size()); int len = users.size() % Constant.PAGE_SIZE == 0 ? users.size() / Constant.PAGE_SIZE : (users.size() / Constant.PAGE_SIZE + 1); map.put("items", items); map.put("len", len); return r.setCode(2000).setData(map); }@RequestMapping("/create") R create(@RequestBody User user) { R r = new R(); int ans = userService.add(user); if (ans == 1) { return r.setCode(2000).setMsg(HttpMsg.ADD_USER_OK); } return r.setCode(4000).setMsg(HttpMsg.ADD_USER_FAILED); }@RequestMapping("/update") R update(@RequestBody User user) { R r = new R(); int ans = userService.update(user); if (ans >= 0) { return r.setCode(2000).setMsg(HttpMsg.UPDATE_USER_OK); } return r.setCode(4000).setMsg(HttpMsg.UPDATE_USER_FAILED); }@DeleteMapping("/delete") R delete(@RequestParam("id") int id) { R r = new R(); int ans = userService.delete(id); if (ans == 1) { return r.setCode(2000).setMsg(HttpMsg.DELETE_USER_OK); } return r.setCode(4000).setMsg(HttpMsg.DELETE_USER_FAILED); } }


订单控制层:
/** * 订单控制层 **/ @RestController @RequestMapping("order") public class OrderController { @Autowired OrderService orderService; @Autowired UserDao userDao; @Autowired OrderDao orderDao; @Autowired FlowersDao flowersDao; @RequestMapping("/test") R test() { R r = new R(); return r.setCode(4000).setMsg(Constant.IMG_PATH).setData(orderDao.findAll(null)); }@RequestMapping("/queryByAccount") R queryByAccount(@RequestParam("account") String account) { R r = new R(); if (StringUtil.isEmpty(account)) { return r.setCode(4000).setMsg(HttpMsg.INVALID_PARAM); } List orders = orderService.queryByAccount(account); return r.setCode(2000).setData(orders); }@RequestMapping("/find") R find(@RequestParam("page") int page, @RequestParam("searchKey") String searchKey, @RequestParam("account") String account) { R r = new R(); Map map = new HashMap<>(); List orders = orderService.find(searchKey, account); if (orders == null) { return r.setCode(2000); } map.put("items", orders); map.put("len", orders.size()); return r.setCode(2000).setData(map); }@RequestMapping("/findAll") R findAll(@RequestParam("page") int page, @RequestParam("searchKey") String searchKey) { R r = new R(); Map map = new HashMap<>(); List orders = orderService.findAll(searchKey); if (orders == null) { return r.setCode(2000); } List items = orders.size() >= page * Constant.PAGE_SIZE ? orders.subList((page - 1) * Constant.PAGE_SIZE, page * Constant.PAGE_SIZE) : orders.subList((page - 1) * Constant.PAGE_SIZE, orders.size()); int len = orders.size() % Constant.PAGE_SIZE == 0 ? orders.size() / Constant.PAGE_SIZE : (orders.size() / Constant.PAGE_SIZE + 1); List vos = new ArrayList<>(); for (Order item : items) { User user = userDao.queryById(item.getUid()); OrderVo vo = new OrderVo(); vo.setAddress(user.getAddress()).setPhone(user.getPhone()).setUsername(user.getName()) .setAmount(item.getAmount()).setFlower(item.getFlower()).setId(item.getId()) .setUid(item.getUid()).setOrder_guid(item.getOrder_guid()).setPrice(item.getPrice()) .setState(item.getState()); vos.add(vo); } map.put("items", vos); map.put("len", len); return r.setCode(2000).setData(map); }@RequestMapping("/update") R update(@RequestBody Order order) { R r = new R(); int ans = orderService.update(order); if (ans >= 0) { return r.setCode(2000).setMsg(HttpMsg.UPDATE_USER_OK); } return r.setCode(4000).setMsg(HttpMsg.UPDATE_USER_FAILED); }@RequestMapping("/changeState") R changeState(@RequestBody Order order) { orderDao.changeState(order); return new R().setCode(2000).setMsg(HttpMsg.UPDATE_ORDER_OK); }@DeleteMapping("/delete") R delete(@RequestParam("id") int id) { R r = new R(); int ans = orderService.delete(id); if (ans == 1) { return r.setCode(2000).setMsg(HttpMsg.DELETE_USER_OK); } return r.setCode(4000).setMsg(HttpMsg.DELETE_USER_FAILED); } }

【Java毕业设计项目实战篇|Java项目:网上花店商城系统(java+jsp+servlert+mysql+ajax)】
用户登录控制层:
/** * 登录 **/ @RestController @RequestMapping("login") public class LoginController { @Autowired LoginDao loginDao; @RequestMapping("/doLogin") R doLogin(@RequestBody LoginForm form) { R r = new R(); if (!VerifyUtil.verifyLoginForm(form)) { return r.setCode(4000).setMsg(HttpMsg.ERROR_INPUT); } User loginUser = loginDao.login(form); if (loginUser != null) { return r.setCode(2000).setMsg("欢迎您:" + loginUser.getName()).setData(loginUser); } return r.setCode(4000).setMsg(HttpMsg.ERROR_VERIFY); }@RequestMapping("/test") R test() { R r = new R(); return r.setCode(4000).setMsg(Constant.IMG_PATH); }}

源码获取:博客首页 "资源" 里下载!

    推荐阅读