Beispiel #1
0
 @RequestMapping(value = "/orders", method = RequestMethod.GET)
 public String orderList(HttpSession session, Model model) {
   Account account = (Account) session.getAttribute(Const.ACCOUNT_IN_SESSION);
   List<Order> orderList = orderService.findOrderByAccountId(account.getId());
   model.addAttribute("orderList", orderList);
   return "orders";
 }
Beispiel #2
0
  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    Logger log = LoggerFactory.getLogger(AddEventServlet.class);
    String sid = request.getParameter("id");
    String scontent = request.getParameter("content");
    if (sid == null || !StringUtils.isNumeric(sid)) {
      response.sendError(401, "非法操作,权限终结");
      return;
    }
    Long id = Long.valueOf(sid);
    ContentService cts = new ContentService();
    Content content = new Content();
    HttpSession session = request.getSession();
    Account account = (Account) session.getAttribute("account");
    if (account != null) {
      content.setAccountid(account.getId());
    }
    content.setContent(scontent);
    content.setCustid(id);
    content.setCreatetime(getNowtime());
    if (cts.addContent(content) > 0) {
      log.debug("添加{}备注内容为:{} 存储成功", id, content);
      response.sendRedirect("/cust/event.do?id=" + id);
      return;
    } else {

      response.sendError(500, "请稍后再试");
    }
  }
Beispiel #3
0
  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    Account account = (Account) request.getSession().getAttribute("account");

    String states = request.getParameter("q_eq_state");
    ScheduleService chs = new ScheduleService();
    if (states != null && ("1".equals(states) || "0".equals(states))) {

      Boolean schstates = "1".equals(states) ? true : false;
      List<Schedule> schList = chs.findByStates(schstates, account.getId());
      request.setAttribute("schList", schList);
      forward("schedule/show.jsp", request, response);
      return;
    }

    /*String overNo = request.getParameter("over_p");
    String unoverNo = request.getParameter("unover_p");
    */
    /*
    int overpage = 1;
    if(overNo != null && StringUtils.isNumeric(overNo)){
    	overpage = Integer.valueOf(overNo);
    }

    int unoverpage = 1;
    if(unoverNo != null && StringUtils.isNumeric(unoverNo)){
    	unoverpage = Integer.valueOf(unoverNo);
    }*/

    List<Schedule> overList = chs.findOver(account.getId(), getNowtime());
    Map<String, List<Schedule>> unoverMap = chs.findUnOverNodone(account.getId(), getNowtime());
    request.setAttribute("overList", overList);

    request.setAttribute("unoverMap", unoverMap);

    forward("schedule/show.jsp", request, response);
  }
Beispiel #4
0
 @RequestMapping(value = "/orders/{orderid:\\d+}/cancel", method = RequestMethod.GET)
 public String changeOrderState(
     @PathVariable Long orderid, HttpSession session, RedirectAttributes redirectAttributes) {
   Account account = (Account) session.getAttribute(Const.ACCOUNT_IN_SESSION);
   Order order = orderService.findOrderByOrderId(orderid);
   if (order == null || account == null) {
     throw new NotFoundException();
   }
   if (!order.getAcid().equals(account.getId())) {
     throw new ForbiddenException();
   }
   orderService.changeOrderState(order, "cancel", false);
   redirectAttributes.addFlashAttribute("message", "¶©µ¥×´Ì¬¸Ä±ä³É¹¦");
   return "redirect:/u/orders/" + order.getOrdercode();
 }