Beispiel #1
0
  // 分页查询
  public ActionForward list(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws AppException {
    AgentListForm agentListForm = (AgentListForm) form;
    request.setAttribute("companyList", PlatComAccountStore.companyList);
    if (agentListForm == null) {
      agentListForm = new AgentListForm();
    }
    try {
      agentListForm.setList(agentBiz.list(agentListForm));
    } catch (Exception e) {
      e.printStackTrace();
    }
    request.setAttribute("agentListForm", agentListForm);
    List<Agent> agList = agentListForm.getList();
    List<Agent> agentList = agentBiz.getAgentList();
    List<Long> agentIdList = new ArrayList<Long>();

    for (Agent ag : agentList) {
      agentIdList.add(ag.getId());
    }
    for (Agent ag : agList) {
      agentIdList.remove(agentIdList.indexOf(ag.getId()));
    }

    request.setAttribute("agentIdList", agentIdList);
    return mapping.findForward("listAgent");
  }
Beispiel #2
0
 // 跳转添加页面
 public ActionForward savePage(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws AppException {
   Agent agent = new Agent();
   request.setAttribute("companyList", PlatComAccountStore.companyList);
   agent.setThisAction("saveAgent");
   request.setAttribute("agent", agent);
   String forwardPage = "editAgent";
   return mapping.findForward(forwardPage);
 }
Beispiel #3
0
 // 跳转发送短信页面
 public ActionForward sendMessagePage(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws AppException {
   AgentListForm agentListForm = (AgentListForm) form;
   int[] idArray = agentListForm.getSelectedItems();
   Agent agent = new Agent();
   StringBuffer mobelArray = new StringBuffer();
   for (int i = 0; i < idArray.length; i++) {
     agent = agentBiz.getAgentByid(idArray[i]);
     String name = agent.getName();
     String mobel = agent.getMobilePhone();
     if (mobel == null || mobel.trim().length() < 11) { // 号码小于11位
       if (i == idArray.length - 1 && mobelArray.toString().endsWith(",")) {
         mobelArray.deleteCharAt(mobelArray.lastIndexOf(","));
       }
       continue;
     }
     if (i != idArray.length - 1) {
       if (name != null && !"".equals(name.trim())) {
         if (name.indexOf("-") != 0) {
           mobelArray.append(
               mobel + "(" + name.substring(name.lastIndexOf("-") + 1).trim() + ")" + ",");
         } else {
           mobelArray.append(mobel + "(" + name.trim() + ")" + ",");
         }
       } else {
         mobelArray.append(mobel + ",");
       }
     } else {
       if (name != null && !"".equals(name.trim())) {
         if (name.indexOf("-") != 0) {
           mobelArray.append(mobel + "(" + name.substring(name.lastIndexOf("-") + 1).trim() + ")");
         } else {
           mobelArray.append(mobel + "(" + name.trim() + ")");
         }
       } else {
         mobelArray.append(mobel);
       }
     }
   }
   System.out.println(mobelArray.toString());
   agentListForm.setReceiver(mobelArray.toString());
   agentListForm.setThisAction("sendMobelMessage");
   request.setAttribute("agentListForm", agentListForm);
   String forwardPage = "sendMessage";
   return mapping.findForward(forwardPage);
 }
Beispiel #4
0
 // 跳转修改页面
 public ActionForward updatePage(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws AppException {
   AgentListForm agentListForm = (AgentListForm) form;
   request.setAttribute("companyList", PlatComAccountStore.companyList);
   long agentId = agentListForm.getSelectedItems()[0];
   if (agentId > 0) {
     Agent agent = agentBiz.getAgentByid(agentId);
     agent.setThisAction("updateAgent");
     agent.setCompanyId(agent.getCompany().getId());
     request.setAttribute("agent", agent);
   } else {
     request.setAttribute("agent", new Agent());
   }
   return mapping.findForward("editAgent");
 }