how2j.cn

-->
下载区
文件名 文件大小
请先登录 1m
增值内容 1m
1m

解压rar如果失败,请用5.21版本或者更高版本的winrar

点击下载 winrar5.21
步骤 1 : 先运行,看到效果,再学习   
步骤 2 : 模仿和排错   
步骤 3 : 我的订单页面操作   
步骤 4 : 付款   
步骤 5 : 确认收货   
步骤 6 : 确认收货成功   
步骤 7 : 评价   
步骤 8 : 删除   

步骤 1 :

先运行,看到效果,再学习

edit
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
步骤 3 :

我的订单页面操作

edit
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
我的订单页面操作
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
付款
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
确认收货
@RequestMapping("foreconfirmPay") public String confirmPay( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); model.addAttribute("o", o); return "fore/confirmPay"; }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@include file="../include/fore/header.jsp"%> <%@include file="../include/fore/top.jsp"%> <%@include file="../include/fore/simpleSearch.jsp"%> <%@include file="../include/fore/cart/confirmPayPage.jsp"%> <%@include file="../include/fore/footer.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <div class="confirmPayPageDiv"> <div class="confirmPayImageDiv"> <img src="img/site/comformPayFlow.png"> <div class="confirmPayTime1"> <fmt:formatDate value="${o.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/> </div> <div class="confirmPayTime2"> <fmt:formatDate value="${o.payDate}" pattern="yyyy-MM-dd HH:mm:ss"/> </div> <div class="confirmPayTime3"> yyyy-MM-dd HH:mm:ss </div> </div> <div class="confirmPayOrderInfoDiv"> <div class="confirmPayOrderInfoText">我已收到货,同意支付宝付款</div> </div> <div class="confirmPayOrderItemDiv"> <div class="confirmPayOrderItemText">订单信息</div> <table class="confirmPayOrderItemTable"> <thead> <th colspan="2">宝贝</th> <th width="120px">单价</th> <th width="120px">数量</th> <th width="120px">商品总价 </th> <th width="120px">运费</th> </thead> <c:forEach items="${o.orderItems}" var="oi"> <tr> <td><img width="50px" src="img/productSingle_middle/${oi.product.firstProductImage.id}.jpg"></td> <td class="confirmPayOrderItemProductLink"> <a href="#nowhere">${oi.product.name}</a> </td> <td>¥<fmt:formatNumber type="number" value="${oi.product.originalPrice}" minFractionDigits="2"/></td> <td>1</td> <td><span class="conformPayProductPrice">¥<fmt:formatNumber type="number" value="${oi.product.promotePrice}" minFractionDigits="2"/></span></td> <td><span>快递 : 0.00 </span></td> </tr> </c:forEach> </table> <div class="confirmPayOrderItemText pull-right"> 实付款: <span class="confirmPayOrderItemSumPrice">¥<fmt:formatNumber type="number" value="${o.total}" minFractionDigits="2"/></span> </div> </div> <div class="confirmPayOrderDetailDiv"> <table class="confirmPayOrderDetailTable"> <tr> <td>订单编号:</td> <td>${o.orderCode} <img width="23px" src="img/site/confirmOrderTmall.png"></td> </tr> <tr> <td>卖家昵称:</td> <td>天猫商铺 <span class="confirmPayOrderDetailWangWangGif"></span></td> </tr> <tr> <td>收货信息: </td> <td>${o.address},${o.receiver}, ${o.mobile},${o.post} </td> </tr> <tr> <td>成交时间:</td> <td><fmt:formatDate value="${o.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td> </tr> </table> </div> <div class="confirmPayButtonDiv"> <div class="confirmPayWarning">请收到货后,再确认收货!否则您可能钱货两空!</div> <a href="foreorderConfirmed?oid=${o.id}"><button class="confirmPayButton">确认支付</button></a> </div> </div>
package com.how2java.tmall.controller; import com.github.pagehelper.PageHelper; import com.how2java.tmall.pojo.*; import com.how2java.tmall.service.*; import comparator.*; import org.apache.commons.lang.math.RandomUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.util.HtmlUtils; import javax.servlet.http.HttpSession; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; @Controller @RequestMapping("") public class ForeController { @Autowired CategoryService categoryService; @Autowired ProductService productService; @Autowired UserService userService; @Autowired ProductImageService productImageService; @Autowired PropertyValueService propertyValueService; @Autowired OrderService orderService; @Autowired OrderItemService orderItemService; @Autowired ReviewService reviewService; @RequestMapping("forehome") public String home(Model model) { List<Category> cs= categoryService.list(); productService.fill(cs); productService.fillByRow(cs); model.addAttribute("cs", cs); return "fore/home"; } @RequestMapping("foreregister") public String register(Model model,User user) { String name = user.getName(); name = HtmlUtils.htmlEscape(name); user.setName(name); boolean exist = userService.isExist(name); if(exist){ String m ="用户名已经被使用,不能使用"; model.addAttribute("msg", m); return "fore/register"; } userService.add(user); return "redirect:registerSuccessPage"; } @RequestMapping("forelogin") public String login(@RequestParam("name") String name, @RequestParam("password") String password, Model model, HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ model.addAttribute("msg", "账号密码错误"); return "fore/login"; } session.setAttribute("user", user); return "redirect:forehome"; } @RequestMapping("forelogout") public String logout( HttpSession session) { session.removeAttribute("user"); return "redirect:forehome"; } @RequestMapping("foreproduct") public String product( int pid, Model model) { Product p = productService.get(pid); List<ProductImage> productSingleImages = productImageService.list(p.getId(), ProductImageService.type_single); List<ProductImage> productDetailImages = productImageService.list(p.getId(), ProductImageService.type_detail); p.setProductSingleImages(productSingleImages); p.setProductDetailImages(productDetailImages); List<PropertyValue> pvs = propertyValueService.list(p.getId()); List<Review> reviews = reviewService.list(p.getId()); productService.setSaleAndReviewNumber(p); model.addAttribute("reviews", reviews); model.addAttribute("p", p); model.addAttribute("pvs", pvs); return "fore/product"; } @RequestMapping("forecheckLogin") @ResponseBody public String checkLogin( HttpSession session) { User user =(User) session.getAttribute("user"); if(null!=user) return "success"; return "fail"; } @RequestMapping("foreloginAjax") @ResponseBody public String loginAjax(@RequestParam("name") String name, @RequestParam("password") String password,HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ return "fail"; } session.setAttribute("user", user); return "success"; } @RequestMapping("forecategory") public String category(int cid,String sort, Model model) { Category c = categoryService.get(cid); productService.fill(c); productService.setSaleAndReviewNumber(c.getProducts()); if(null!=sort){ switch(sort){ case "review": Collections.sort(c.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(c.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(c.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(c.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(c.getProducts(),new ProductAllComparator()); break; } } model.addAttribute("c", c); return "fore/category"; } @RequestMapping("foresearch") public String search( String keyword,Model model){ PageHelper.offsetPage(0,20); List<Product> ps= productService.search(keyword); productService.setSaleAndReviewNumber(ps); model.addAttribute("ps",ps); return "fore/searchResult"; } @RequestMapping("forebuyone") public String buyone(int pid, int num, HttpSession session) { Product p = productService.get(pid); int oiid = 0; User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); oiid = oi.getId(); } return "redirect:forebuy?oiid="+oiid; } @RequestMapping("forebuy") public String buy( Model model,String[] oiid,HttpSession session){ List<OrderItem> ois = new ArrayList<>(); float total = 0; for (String strid : oiid) { int id = Integer.parseInt(strid); OrderItem oi= orderItemService.get(id); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); ois.add(oi); } session.setAttribute("ois", ois); model.addAttribute("total", total); return "fore/buy"; } @RequestMapping("foreaddCart") @ResponseBody public String addCart(int pid, int num, Model model,HttpSession session) { Product p = productService.get(pid); User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); } return "success"; } @RequestMapping("forecart") public String cart( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<OrderItem> ois = orderItemService.listByUser(user.getId()); model.addAttribute("ois", ois); return "fore/cart"; } @RequestMapping("forechangeOrderItem") @ResponseBody public String changeOrderItem( Model model,HttpSession session, int pid, int number) { User user =(User) session.getAttribute("user"); if(null==user) return "fail"; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==pid){ oi.setNumber(number); orderItemService.update(oi); break; } } return "success"; } @RequestMapping("foredeleteOrderItem") @ResponseBody public String deleteOrderItem( Model model,HttpSession session,int oiid){ User user =(User) session.getAttribute("user"); if(null==user) return "fail"; orderItemService.delete(oiid); return "success"; } @RequestMapping("forecreateOrder") public String createOrder( Model model,Order order,HttpSession session){ User user =(User) session.getAttribute("user"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUid(user.getId()); order.setStatus(OrderService.waitPay); List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois"); float total =orderService.add(order,ois); return "redirect:forealipay?oid="+order.getId() +"&total="+total; } @RequestMapping("forepayed") public String payed(int oid, float total, Model model) { Order order = orderService.get(oid); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); model.addAttribute("o", order); return "fore/payed"; } @RequestMapping("forebought") public String bought( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<Order> os= orderService.list(user.getId(),OrderService.delete); orderItemService.fill(os); model.addAttribute("os", os); return "fore/bought"; } @RequestMapping("foreconfirmPay") public String confirmPay( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); model.addAttribute("o", o); return "fore/confirmPay"; } }
步骤 6 :

确认收货成功

edit
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
@RequestMapping("foreorderConfirmed") public String orderConfirmed( Model model,int oid) { Order o = orderService.get(oid); o.setStatus(OrderService.waitReview); o.setConfirmDate(new Date()); orderService.update(o); return "fore/orderConfirmed"; }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@include file="../include/fore/header.jsp"%> <%@include file="../include/fore/top.jsp"%> <%@include file="../include/fore/simpleSearch.jsp"%> <%@include file="../include/fore/cart/orderConfirmedPage.jsp"%> <%@include file="../include/fore/footer.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <div class="orderFinishDiv"> <div class="orderFinishTextDiv"> <img src="img/site/orderFinish.png"> <span>交易已经成功,卖家将收到您的货款。</span> </div> </div>
package com.how2java.tmall.controller; import com.github.pagehelper.PageHelper; import com.how2java.tmall.pojo.*; import com.how2java.tmall.service.*; import comparator.*; import org.apache.commons.lang.math.RandomUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.util.HtmlUtils; import javax.servlet.http.HttpSession; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; @Controller @RequestMapping("") public class ForeController { @Autowired CategoryService categoryService; @Autowired ProductService productService; @Autowired UserService userService; @Autowired ProductImageService productImageService; @Autowired PropertyValueService propertyValueService; @Autowired OrderService orderService; @Autowired OrderItemService orderItemService; @Autowired ReviewService reviewService; @RequestMapping("forehome") public String home(Model model) { List<Category> cs= categoryService.list(); productService.fill(cs); productService.fillByRow(cs); model.addAttribute("cs", cs); return "fore/home"; } @RequestMapping("foreregister") public String register(Model model,User user) { String name = user.getName(); name = HtmlUtils.htmlEscape(name); user.setName(name); boolean exist = userService.isExist(name); if(exist){ String m ="用户名已经被使用,不能使用"; model.addAttribute("msg", m); return "fore/register"; } userService.add(user); return "redirect:registerSuccessPage"; } @RequestMapping("forelogin") public String login(@RequestParam("name") String name, @RequestParam("password") String password, Model model, HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ model.addAttribute("msg", "账号密码错误"); return "fore/login"; } session.setAttribute("user", user); return "redirect:forehome"; } @RequestMapping("forelogout") public String logout( HttpSession session) { session.removeAttribute("user"); return "redirect:forehome"; } @RequestMapping("foreproduct") public String product( int pid, Model model) { Product p = productService.get(pid); List<ProductImage> productSingleImages = productImageService.list(p.getId(), ProductImageService.type_single); List<ProductImage> productDetailImages = productImageService.list(p.getId(), ProductImageService.type_detail); p.setProductSingleImages(productSingleImages); p.setProductDetailImages(productDetailImages); List<PropertyValue> pvs = propertyValueService.list(p.getId()); List<Review> reviews = reviewService.list(p.getId()); productService.setSaleAndReviewNumber(p); model.addAttribute("reviews", reviews); model.addAttribute("p", p); model.addAttribute("pvs", pvs); return "fore/product"; } @RequestMapping("forecheckLogin") @ResponseBody public String checkLogin( HttpSession session) { User user =(User) session.getAttribute("user"); if(null!=user) return "success"; return "fail"; } @RequestMapping("foreloginAjax") @ResponseBody public String loginAjax(@RequestParam("name") String name, @RequestParam("password") String password,HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ return "fail"; } session.setAttribute("user", user); return "success"; } @RequestMapping("forecategory") public String category(int cid,String sort, Model model) { Category c = categoryService.get(cid); productService.fill(c); productService.setSaleAndReviewNumber(c.getProducts()); if(null!=sort){ switch(sort){ case "review": Collections.sort(c.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(c.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(c.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(c.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(c.getProducts(),new ProductAllComparator()); break; } } model.addAttribute("c", c); return "fore/category"; } @RequestMapping("foresearch") public String search( String keyword,Model model){ PageHelper.offsetPage(0,20); List<Product> ps= productService.search(keyword); productService.setSaleAndReviewNumber(ps); model.addAttribute("ps",ps); return "fore/searchResult"; } @RequestMapping("forebuyone") public String buyone(int pid, int num, HttpSession session) { Product p = productService.get(pid); int oiid = 0; User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); oiid = oi.getId(); } return "redirect:forebuy?oiid="+oiid; } @RequestMapping("forebuy") public String buy( Model model,String[] oiid,HttpSession session){ List<OrderItem> ois = new ArrayList<>(); float total = 0; for (String strid : oiid) { int id = Integer.parseInt(strid); OrderItem oi= orderItemService.get(id); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); ois.add(oi); } session.setAttribute("ois", ois); model.addAttribute("total", total); return "fore/buy"; } @RequestMapping("foreaddCart") @ResponseBody public String addCart(int pid, int num, Model model,HttpSession session) { Product p = productService.get(pid); User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); } return "success"; } @RequestMapping("forecart") public String cart( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<OrderItem> ois = orderItemService.listByUser(user.getId()); model.addAttribute("ois", ois); return "fore/cart"; } @RequestMapping("forechangeOrderItem") @ResponseBody public String changeOrderItem( Model model,HttpSession session, int pid, int number) { User user =(User) session.getAttribute("user"); if(null==user) return "fail"; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==pid){ oi.setNumber(number); orderItemService.update(oi); break; } } return "success"; } @RequestMapping("foredeleteOrderItem") @ResponseBody public String deleteOrderItem( Model model,HttpSession session,int oiid){ User user =(User) session.getAttribute("user"); if(null==user) return "fail"; orderItemService.delete(oiid); return "success"; } @RequestMapping("forecreateOrder") public String createOrder( Model model,Order order,HttpSession session){ User user =(User) session.getAttribute("user"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUid(user.getId()); order.setStatus(OrderService.waitPay); List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois"); float total =orderService.add(order,ois); return "redirect:forealipay?oid="+order.getId() +"&total="+total; } @RequestMapping("forepayed") public String payed(int oid, float total, Model model) { Order order = orderService.get(oid); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); model.addAttribute("o", order); return "fore/payed"; } @RequestMapping("forebought") public String bought( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<Order> os= orderService.list(user.getId(),OrderService.delete); orderItemService.fill(os); model.addAttribute("os", os); return "fore/bought"; } @RequestMapping("foreconfirmPay") public String confirmPay( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); model.addAttribute("o", o); return "fore/confirmPay"; } @RequestMapping("foreorderConfirmed") public String orderConfirmed( Model model,int oid) { Order o = orderService.get(oid); o.setStatus(OrderService.waitReview); o.setConfirmDate(new Date()); orderService.update(o); return "fore/orderConfirmed"; } }
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
删除
var page="foredeleteOrder"; $.post( page, {"oid":deleteOrderid}, function(result){ if("success"==result){ $("table.orderListItemTable[oid="+deleteOrderid+"]").hide(); } else{ location.href="login.jsp"; } } );
@RequestMapping("foredeleteOrder") @ResponseBody public String deleteOrder( Model model,int oid){ Order o = orderService.get(oid); o.setStatus(OrderService.delete); orderService.update(o); return "success"; } }
package com.how2java.tmall.controller; import com.github.pagehelper.PageHelper; import com.how2java.tmall.pojo.*; import com.how2java.tmall.service.*; import comparator.*; import org.apache.commons.lang.math.RandomUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.util.HtmlUtils; import javax.servlet.http.HttpSession; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; @Controller @RequestMapping("") public class ForeController { @Autowired CategoryService categoryService; @Autowired ProductService productService; @Autowired UserService userService; @Autowired ProductImageService productImageService; @Autowired PropertyValueService propertyValueService; @Autowired OrderService orderService; @Autowired OrderItemService orderItemService; @Autowired ReviewService reviewService; @RequestMapping("forehome") public String home(Model model) { List<Category> cs= categoryService.list(); productService.fill(cs); productService.fillByRow(cs); model.addAttribute("cs", cs); return "fore/home"; } @RequestMapping("foreregister") public String register(Model model,User user) { String name = user.getName(); name = HtmlUtils.htmlEscape(name); user.setName(name); boolean exist = userService.isExist(name); if(exist){ String m ="用户名已经被使用,不能使用"; model.addAttribute("msg", m); return "fore/register"; } userService.add(user); return "redirect:registerSuccessPage"; } @RequestMapping("forelogin") public String login(@RequestParam("name") String name, @RequestParam("password") String password, Model model, HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ model.addAttribute("msg", "账号密码错误"); return "fore/login"; } session.setAttribute("user", user); return "redirect:forehome"; } @RequestMapping("forelogout") public String logout( HttpSession session) { session.removeAttribute("user"); return "redirect:forehome"; } @RequestMapping("foreproduct") public String product( int pid, Model model) { Product p = productService.get(pid); List<ProductImage> productSingleImages = productImageService.list(p.getId(), ProductImageService.type_single); List<ProductImage> productDetailImages = productImageService.list(p.getId(), ProductImageService.type_detail); p.setProductSingleImages(productSingleImages); p.setProductDetailImages(productDetailImages); List<PropertyValue> pvs = propertyValueService.list(p.getId()); List<Review> reviews = reviewService.list(p.getId()); productService.setSaleAndReviewNumber(p); model.addAttribute("reviews", reviews); model.addAttribute("p", p); model.addAttribute("pvs", pvs); return "fore/product"; } @RequestMapping("forecheckLogin") @ResponseBody public String checkLogin( HttpSession session) { User user =(User) session.getAttribute("user"); if(null!=user) return "success"; return "fail"; } @RequestMapping("foreloginAjax") @ResponseBody public String loginAjax(@RequestParam("name") String name, @RequestParam("password") String password,HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ return "fail"; } session.setAttribute("user", user); return "success"; } @RequestMapping("forecategory") public String category(int cid,String sort, Model model) { Category c = categoryService.get(cid); productService.fill(c); productService.setSaleAndReviewNumber(c.getProducts()); if(null!=sort){ switch(sort){ case "review": Collections.sort(c.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(c.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(c.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(c.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(c.getProducts(),new ProductAllComparator()); break; } } model.addAttribute("c", c); return "fore/category"; } @RequestMapping("foresearch") public String search( String keyword,Model model){ PageHelper.offsetPage(0,20); List<Product> ps= productService.search(keyword); productService.setSaleAndReviewNumber(ps); model.addAttribute("ps",ps); return "fore/searchResult"; } @RequestMapping("forebuyone") public String buyone(int pid, int num, HttpSession session) { Product p = productService.get(pid); int oiid = 0; User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); oiid = oi.getId(); } return "redirect:forebuy?oiid="+oiid; } @RequestMapping("forebuy") public String buy( Model model,String[] oiid,HttpSession session){ List<OrderItem> ois = new ArrayList<>(); float total = 0; for (String strid : oiid) { int id = Integer.parseInt(strid); OrderItem oi= orderItemService.get(id); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); ois.add(oi); } session.setAttribute("ois", ois); model.addAttribute("total", total); return "fore/buy"; } @RequestMapping("foreaddCart") @ResponseBody public String addCart(int pid, int num, Model model,HttpSession session) { Product p = productService.get(pid); User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); } return "success"; } @RequestMapping("forecart") public String cart( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<OrderItem> ois = orderItemService.listByUser(user.getId()); model.addAttribute("ois", ois); return "fore/cart"; } @RequestMapping("forechangeOrderItem") @ResponseBody public String changeOrderItem( Model model,HttpSession session, int pid, int number) { User user =(User) session.getAttribute("user"); if(null==user) return "fail"; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==pid){ oi.setNumber(number); orderItemService.update(oi); break; } } return "success"; } @RequestMapping("foredeleteOrderItem") @ResponseBody public String deleteOrderItem( Model model,HttpSession session,int oiid){ User user =(User) session.getAttribute("user"); if(null==user) return "fail"; orderItemService.delete(oiid); return "success"; } @RequestMapping("forecreateOrder") public String createOrder( Model model,Order order,HttpSession session){ User user =(User) session.getAttribute("user"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUid(user.getId()); order.setStatus(OrderService.waitPay); List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois"); float total =orderService.add(order,ois); return "redirect:forealipay?oid="+order.getId() +"&total="+total; } @RequestMapping("forepayed") public String payed(int oid, float total, Model model) { Order order = orderService.get(oid); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); model.addAttribute("o", order); return "fore/payed"; } @RequestMapping("forebought") public String bought( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<Order> os= orderService.list(user.getId(),OrderService.delete); orderItemService.fill(os); model.addAttribute("os", os); return "fore/bought"; } @RequestMapping("foreconfirmPay") public String confirmPay( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); model.addAttribute("o", o); return "fore/confirmPay"; } @RequestMapping("foreorderConfirmed") public String orderConfirmed( Model model,int oid) { Order o = orderService.get(oid); o.setStatus(OrderService.waitReview); o.setConfirmDate(new Date()); orderService.update(o); return "fore/orderConfirmed"; } @RequestMapping("foredeleteOrder") @ResponseBody public String deleteOrder( Model model,int oid){ Order o = orderService.get(oid); o.setStatus(OrderService.delete); orderService.update(o); return "success"; } }


HOW2J公众号,关注后实时获知最新的教程和优惠活动,谢谢。


问答区域    
2021-09-07 确认收货的前端页面数据修改
NBYXS




在comfirmpayPage.jsp 单个orderItem中 单价改为promotePrice,站长写的是原价。。 数量改为number(站长直接写了数量为1,嘿嘿偷懒了哇) 总价由计算得出,站长写的现价
加载中

							

							


1 个答案

how2j
答案时间:2021-09-15
细心的同学,点赞,哈哈~



回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到





2019-08-12 站长,我发现有bug
WANGMING123

就是删除后,把指定的oid隐藏,再选择”待付款“,然后选择”所有订单“,原本的隐藏就全部显示出来了。。。。。




3 个答案

Ivan2019
答案时间:2020-01-03
其它页面也要考虑, 比如它在待收货,状态, 你去访问时候待收货是不是也会显示? ajax,$("table.orderListItemTable[oid="+deleteOrderid+"]").hide(); 时候不知道是否可以刷新当前页。 location.reload(); 会不会导致访问服务器过度频繁

how2j
答案时间:2019-08-13
good, 非常好, 赞!

WANGMING123
答案时间:2019-08-12
解决好了,我直接加上 $("table.orderListItemTable[oid="+deleteOrderid+"]").attr("yin",true); 然后显示所有订单的话,则排除显示属性为yin的值true就ok



回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到




2019-08-09 站长大大,实付款金额位数不对,有什么好的处理办法吗
2019-05-11 controller接收参数
2019-05-11 为什么在controller中,有些要加@Responsebody,而有一些却不用呢?


提问太多,页面渲染太慢,为了加快渲染速度,本页最多只显示几条提问。还有 5 条以前的提问,请 点击查看

提问之前请登陆
提问已经提交成功,正在审核。 请于 我的提问 处查看提问记录,谢谢
关于 实践项目-天猫整站SSM-我的订单页操作 的提问

尽量提供截图代码异常信息,有助于分析和解决问题。 也可进本站QQ群交流: 578362961
提问尽量提供完整的代码,环境描述,越是有利于问题的重现,您的问题越能更快得到解答。
对教程中代码有疑问,请提供是哪个步骤,哪一行有疑问,这样便于快速定位问题,提高问题得到解答的速度
在已经存在的几千个提问里,有相当大的比例,是因为使用了和站长不同版本的开发环境导致的,比如 jdk, eclpise, idea, mysql,tomcat 等等软件的版本不一致。
请使用和站长一样的版本,可以节约自己大量的学习时间。 站长把教学中用的软件版本整理了,都统一放在了这里, 方便大家下载: https://how2j.cn/k/helloworld/helloworld-version/1718.html

上传截图