Java 实战项目之家居购物商城系统详解流程

网友投稿 293 2022-09-16


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> listData(HttpServletRequest request) {

List orders = orderService.findUserOrder(request);

return new ResultBean<>(orders);

}

/**

* 查询订单详情

*

* @param orderId

* @return

*/

@RequestMapping("/getDetail.do")

@ResponseBody

phttp://ublic ResultBean> getDetail(int orderId) {

List 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 pay(int orderId, HttpServletResponse response) throws IOException {

orderService.pay(orderId);

return new ResultBean<>(true);

}

/**

* 确认收货

* @param orderId

* @param response

* @return

zJEgmqdaqq * @throws IOException

*/

@RequestMapping("receive.do")

@ResponseBody

public ResultBean 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 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 map) {

Product product = productService.findById(id);

map.put("product", product);

return "mall/product/info";

}

/**

* 查找热门商品

*

* @return

*/

@ResponseBody

@RequestMapping("/hot.do")

public ResultBean> getHotProduct() {

List products = productService.findHotProduct();

return new ResultBean<>(products);

}

/**

* 查找最新商品

*

* @param pageNo

* @param pageSize

* @return

*/

@ResponseBody

@RequestMapping("/new.do")

public ResultBean> getNewProduct(int pageNo, int pageSize) {

Pageable pageable = new PageRequest(pageNo, pageSize);

List products = productService.findNewProduct(pageable);

return new ResultBean<>(products);

}

/**

* 打开分类查看商品页面

*

* @return

*/

@RequestMapping("/category.html")

public String toCatePage(int cid, Map 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> getCategoryProduct(int cid, int pageNo, int pageSize) {

Pageable pageable = new PageRequest(pageNo, pageSize);

List products = productService.findByCid(cid, pageable);

return new ResultBean<>(products);

}

/**

* 按二级分类查找商品

*

* @param csId

* @param pageNo

* @param pageSize

* @return

*/

@ResponseBody

@RequestMapping("/categorySec.do")

public ResultBean> getCategorySecProduct(int csId, int pageNo, int pageSize) {

Pageable pageable = new PageRequest(pageNo, pageSize);

List products = productService.findByCsid(csId, pageable);

return new ResultBean<>(products);

}

/**

* 根据一级分类查询它所有的二级分类

* @param cid

* @return

*/

@ResponseBody

@RequestMapping("/getCategorySec.do")

public ResultBean> getCategorySec(int cid){

List list = classificationService.findByParentId(cid);

return new ResultBean<>(list);

}

/**

* 加购物车

*

* @param productId

* @param request

* @return

*/

@ResponseBody

@RequestMapping("/addCart.do")

public ResultBean 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 delToCart(int productId, HttpServletRequest request) throws Exception {

shopCartService.remove(productId, request);

return new ResultBean<>(true);

}

/**

* 查看购物车商品

* @param request

* @return

*/

@ResponseBody

@RequestMapping("/listCart.do")

public ResultBean> listCart(HttpServletRequest request) throws Exception {

List orderItems = shopCartService.listCart(request);

return new ResultBean<>(orderItems);

}

}

以上就是Java 实战项目之家居购物商城系统详解流程的详细内容,更多关于Java 家居购物商城系统的资料请关注我们其它相关文章!


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

上一篇:2021年10月份大厂网络工程师面试笔试题题【推荐收藏】(互联网大厂笔试题)
下一篇:计算机网络之第三次实验(计算机网络第三章)
相关文章

 发表评论

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