您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
本篇文章给大家分享的是有关如何Java分析家居购物商城系统,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
功能: Java Web精品项目源码,家居商城分类展示,商品展示, 商品下单,购物车,个人中心,后台管理,用户管理,商品管理,分类管理等等。
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: Jdbc+ Servlert + html+ css + JavaScript + JQuery + Ajax + Fileupload
@Controller @RequestMapping("/order") public class OrderController { @Autowired private OrderService orderService; /** * 打开订单列表页面 * * @return */ @RequestMapping("/toList.html") public String toOrderList() { return "mall/order/list"; } /** * 查询用户订单列表 * * @param request * @return */ @RequestMapping("/list.do") @ResponseBody public ResultBean<List<Order>> listData(HttpServletRequest request) { List<Order> orders = orderService.findUserOrder(request); return new ResultBean<>(orders); } /** * 查询订单详情 * * @param orderId * @return */ @RequestMapping("/getDetail.do") @ResponseBody public ResultBean<List<OrderItem>> getDetail(int orderId) { List<OrderItem> orderItems = orderService.findItems(orderId); return new ResultBean<>(orderItems); } /** * 提交订单 * * @param name * @param phone * @param addr * @param request * @param response */ @RequestMapping("/submit.do") public void submit(String name, String phone, String addr, HttpServletRequest request, HttpServletResponse response) throws Exception { orderService.submit(name, phone, addr, request, response); } /** * 支付方法 * * @param orderId */ @RequestMapping("pay.do") @ResponseBody public ResultBean<Boolean> pay(int orderId, HttpServletResponse response) throws IOException { orderService.pay(orderId); return new ResultBean<>(true); } /** * 确认收货 * @param orderId * @param response * @return * @throws IOException */ @RequestMapping("receive.do") @ResponseBody public ResultBean<Boolean> receive(int orderId, HttpServletResponse response) throws IOException { orderService.receive(orderId); return new ResultBean<>(true); } }
@Controller @RequestMapping("/product") public class ProductController { @Autowired private ProductService productService; @Autowired private ClassificationService classificationService; @Autowired private ShopCartService shopCartService; /** * 获取商品信息 * * @param id * @return */ @RequestMapping("/get.do") public ResultBean<Product> getProduct(int id) { Product product = productService.findById(id); return new ResultBean<>(product); } /** * 打开商品详情页面 * * @param id * @param map * @return */ @RequestMapping("/get.html") public String toProductPage(int id, Map<String, Object> map) { Product product = productService.findById(id); map.put("product", product); return "mall/product/info"; } /** * 查找热门商品 * * @return */ @ResponseBody @RequestMapping("/hot.do") public ResultBean<List<Product>> getHotProduct() { List<Product> products = productService.findHotProduct(); return new ResultBean<>(products); } /** * 查找最新商品 * * @param pageNo * @param pageSize * @return */ @ResponseBody @RequestMapping("/new.do") public ResultBean<List<Product>> getNewProduct(int pageNo, int pageSize) { Pageable pageable = new PageRequest(pageNo, pageSize); List<Product> products = productService.findNewProduct(pageable); return new ResultBean<>(products); } /** * 打开分类查看商品页面 * * @return */ @RequestMapping("/category.html") public String toCatePage(int cid, Map<String, Object> map) { Classification classification = classificationService.findById(cid); map.put("category", classification); return "mall/product/category"; } @RequestMapping("/toCart.html") public String toCart(){ return "mall/product/cart"; } /** * 按一级分类查找商品 * * @param cid * @param pageNo * @param pageSize * @return */ @ResponseBody @RequestMapping("/category.do") public ResultBean<List<Product>> getCategoryProduct(int cid, int pageNo, int pageSize) { Pageable pageable = new PageRequest(pageNo, pageSize); List<Product> products = productService.findByCid(cid, pageable); return new ResultBean<>(products); } /** * 按二级分类查找商品 * * @param csId * @param pageNo * @param pageSize * @return */ @ResponseBody @RequestMapping("/categorySec.do") public ResultBean<List<Product>> getCategorySecProduct(int csId, int pageNo, int pageSize) { Pageable pageable = new PageRequest(pageNo, pageSize); List<Product> products = productService.findByCsid(csId, pageable); return new ResultBean<>(products); } /** * 根据一级分类查询它所有的二级分类 * @param cid * @return */ @ResponseBody @RequestMapping("/getCategorySec.do") public ResultBean<List<Classification>> getCategorySec(int cid){ List<Classification> list = classificationService.findByParentId(cid); return new ResultBean<>(list); } /** * 加购物车 * * @param productId * @param request * @return */ @ResponseBody @RequestMapping("/addCart.do") public ResultBean<Boolean> addToCart(int productId, HttpServletRequest request) throws Exception { shopCartService.addCart(productId, request); return new ResultBean<>(true); } /** * 移除购物车 * * @param productId * @param request * @return */ @ResponseBody @RequestMapping("/delCart.do") public ResultBean<Boolean> delToCart(int productId, HttpServletRequest request) throws Exception { shopCartService.remove(productId, request); return new ResultBean<>(true); } /** * 查看购物车商品 * @param request * @return */ @ResponseBody @RequestMapping("/listCart.do") public ResultBean<List<OrderItem>> listCart(HttpServletRequest request) throws Exception { List<OrderItem> orderItems = shopCartService.listCart(request); return new ResultBean<>(orderItems); } }
以上就是如何Java分析家居购物商城系统,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。