Ejemplo n.º 1
0
 /**
  * @describe 加入收藏夹
  * @param map 类型 ActionMapping
  * @param form 类型 ActionForm
  * @param request 类型 HttpServletRequest
  * @param response 类型 HttpServletResponse
  * @return 类型 ActionForward
  */
 public ActionForward addCollection(
     ActionMapping map, ActionForm form, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   DynaActionFormDTO dto = (DynaActionFormDTO) form;
   UserInfo ui = (UserInfo) request.getSession().getAttribute(SysStaticParameter.USER_IN_SESSION);
   String userkey = ui.getUserName();
   String postsid = request.getParameter("postid");
   dto.set("username", userkey);
   dto.set("postsid", postsid);
   postOper.addCollection(dto);
   return new ActionForward("/forum/postQuery.do?method=toMySavePostList");
 }
Ejemplo n.º 2
0
 /**
  * @describe 发表帖子
  * @param map 类型 ActionMapping
  * @param form 类型 ActionForm
  * @param request 类型 HttpServletRequest
  * @param response 类型 HttpServletResponse
  * @return 类型 ActionForward
  */
 public ActionForward sendPosts(
     ActionMapping map, ActionForm form, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   DynaActionFormDTO dto = (DynaActionFormDTO) form;
   String itemid = request.getParameter("itemid");
   if (request.getSession().getAttribute(SysStaticParameter.USER_IN_SESSION) == null) {
     return new ActionForward("/forum/userOper/register.do?method=toLogin");
   }
   UserInfo ui = (UserInfo) request.getSession().getAttribute(SysStaticParameter.USER_IN_SESSION);
   String userkey = ui.getUserName();
   String ipfrom = request.getRemoteAddr();
   dto.set("itemid", itemid);
   dto.set("userkey", userkey);
   dto.set("ipfrom", ipfrom);
   postOper.sendPosts(dto);
   return new ActionForward("/forum/forumList.do?method=toPostList&itemid=" + itemid);
 }
 /**
  * 接受统计条件,执行相应的的统计方法,将统计结果回显到display页面.
  *
  * @param mapping the mapping
  * @param form the form
  * @param request the request
  * @param response the response
  * @return the action forward
  */
 public ActionForward toDisplay(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   DynaActionFormDTO dto = (DynaActionFormDTO) form;
   String chartType = (String) dto.get("chartType");
   if (chartType.equals("")) {
     List<DynaBeanDTO> list = service.query(dto);
     request.setAttribute("list", list);
     return mapping.findForward("report");
   } else {
     JFreeChart chart = service.statistic(dto);
     request.setAttribute("chart", chart);
     return mapping.findForward("chartDisplay");
   }
 }
Ejemplo n.º 4
0
  /**
   * 根据URL参数执行 toCustinfoList 方法,返回要forward页面。
   *
   * @param ActionMapping
   * @param ActionForm
   * @param HttpServletRequest
   * @param HttpServletResponse
   * @return ActionForward 返回列表页面
   */
  public ActionForward toCustinfoList(
      ActionMapping map,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    Object o = request.getSession().getAttribute("telnum");

    DynaActionFormDTO dto = (DynaActionFormDTO) form;

    String tel = "";
    if (o != null) {
      tel = o.toString();
      dto.set("cust_tel_home", tel);
      request.getSession().removeAttribute("telnum");
    }

    String pageState = null;
    PageInfo pageInfo = null;
    pageState = (String) request.getParameter("pagestate");
    if (pageState == null) {
      pageInfo = new PageInfo();
    } else {
      PageTurning pageTurning = (PageTurning) request.getSession().getAttribute("userpageTurning");
      pageInfo = pageTurning.getPage();
      pageInfo.setState(pageState);
      dto = (DynaActionFormDTO) pageInfo.getQl();
    }
    pageInfo.setPageSize(14);
    // 取得list及条数
    List list = custinfoService.custinfoQuery(dto, pageInfo);
    int size = custinfoService.getCustinfoSize();

    pageInfo.setRowCount(size);
    pageInfo.setQl(dto);
    request.setAttribute("list", list);
    PageTurning pt = new PageTurning(pageInfo, "", map, request);
    request.getSession().setAttribute("userpageTurning", pt);

    return map.findForward("list");
  }
Ejemplo n.º 5
0
  /**
   * 根据URL参数执行 toCustinfoOper 方法,返回要forward页面。 并且根据URL参数中type的值来判断所执行的操作:CRUD
   *
   * @param ActionMapping
   * @param ActionForm
   * @param HttpServletRequest
   * @param HttpServletResponse
   * @return ActionForward 返回列表页面
   */
  public ActionForward toPhoneOper(
      ActionMapping map,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    DynaActionFormDTO dto = (DynaActionFormDTO) form;

    String type = request.getParameter("type");
    request.setAttribute("opertype", type);

    List sexList = cts.getLabelVaList("custSex");
    request.setAttribute("sexList", sexList);

    List typeList = cts.getLabelVaList("phonebook");
    request.setAttribute("typeList", typeList);

    if (type.equals("insert")) {
      try {
        custinfoService.addCustinfo(dto);
        request.setAttribute("operSign", "sys.common.operSuccess");
        return map.findForward("phoneload");
      } catch (RuntimeException e) {
        return map.findForward("error");
      }
    }

    if (type.equals("update")) {
      try {
        boolean b = custinfoService.updateCustinfo(dto);
        if (b == true) {
          request.setAttribute("operSign", "修改成功");
          return map.findForward("phoneload");
        } else {
          request.setAttribute("operSign", "修改失败");
          return map.findForward("phoneload");
        }
      } catch (RuntimeException e) {
        log.error("PortCompareAction : update ERROR");
        e.printStackTrace();
        return map.findForward("error");
      }
    }

    if (type.equals("delete")) {
      try {
        // custinfoService.delCustinfo((String)dto.get("cust_id"));//这句可是真的删除了啊!

        // 下面这块是标记删除
        // boolean b = custinfoService.isDelete((String)
        // dto.get("cust_id"));
        custinfoService.delCustinfo((String) dto.get("cust_id"));

        request.setAttribute("operSign", "删除成功");
        return map.findForward("phoneload");

      } catch (RuntimeException e) {
        e.printStackTrace();
        return map.findForward("error");
      }
    }

    return map.findForward("phoneload");
  }