Exemple #1
0
 /**
  * 确认收货
  *
  * @param req
  * @param resp
  * @return
  * @throws ServletException
  * @throws IOException
  */
 public String confirm(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   String oid = req.getParameter("oid");
   /*
    * 校验订单状态
    */
   int status = orderService.findStatus(oid);
   if (status != 3) {
     req.setAttribute("code", "error");
     req.setAttribute("msg", "状态不对,不能确认收货!");
     return "f:/jsps/msg.jsp";
   }
   orderService.updateStatus(oid, 4); // 设置状态为交易成功!
   req.setAttribute("code", "success");
   req.setAttribute("msg", "恭喜,交易成功!");
   return "f:/jsps/msg.jsp";
 }
Exemple #2
0
 /**
  * 取消订单
  *
  * @param req
  * @param resp
  * @return
  * @throws ServletException
  * @throws IOException
  */
 public String cancel(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   String oid = req.getParameter("oid");
   /*
    * 校验订单状态
    */
   int status = orderService.findStatus(oid);
   if (status != 1) {
     req.setAttribute("code", "error");
     req.setAttribute("msg", "状态不对,不能取消!");
     return "f:/jsps/msg.jsp";
   }
   orderService.updateStatus(oid, 5); // 设置状态为取消!
   req.setAttribute("code", "success");
   req.setAttribute("msg", "您的订单已取消,您不后悔吗!");
   return "f:/jsps/msg.jsp";
 }