Пример #1
0
 // 已拨电话清单
 @RequestMapping("/agent/listCallHis.do")
 public String listCallHisAction(AgentCallHisDto dto) {
   //		Agent agent = Struts2Helper.getCurrentAgent();
   //		if (agent != null) {
   //			dto.setAgentId(agent.getId());
   //		}
   Company c = SpringHelper.getCurrentCompany();
   if (c != null) {
     dto.setCompanyId(c.getId());
   }
   User user = SpringHelper.getCurrentUser();
   List<User> list = null;
   if (StringUtils.isEmpty(dto.getDeptId())) {
     list = CRMHelper.getAccessAgentUsers(user, CRMHelper.isCurrentUserManager());
     // 有部门
   } else {
     Dept dept = ServiceLocator.getDeptService().getDept(dto.getDeptId());
     list = dept.getAvailableUsers();
   }
   if (StringUtils.isEmpty(dto.getProcessor())) {
     if (list.size() > 1) {
       StringBuilder sb = new StringBuilder();
       for (int i = 0; i < list.size(); i++) {
         sb.append("'").append(list.get(i).getId()).append("',");
       }
       dto.setProcessor(sb.substring(0, sb.length() - 1));
     } else {
       dto.setProcessor(user.getId());
     }
   }
   this.getRequest()
       .setAttribute("isManager", securityService.hasRole(Role.ROLE_CODE_CRM_MANAGER));
   this.getRequest().setAttribute("userlist", list);
   Pagination pagination = service.queryPage(dto);
   this.getRequest().setAttribute("pagination", pagination);
   this.getRequest().setAttribute("dto", dto);
   return CRMConstants.CRM_JSP_ROOT + "call/callList";
 }
Пример #2
0
 @RequestMapping("/agent/updateAgent.do")
 public void updateAgent(HttpServletResponse response) {
   try {
     String agentval = this.getRequest().getParameter("agentState");
     Agent agent = service.getAgent(CRMHelper.getCurrentAgent().getId());
     log.debug("座席:" + agent.getPhone() + " 设置状态为:" + agentval);
     agent.setState(agentval);
     service.updateAgent(agent);
     SpringHelper.getSession().setAttribute(CRMConstants.CRM_SESSION_CURRENT_AGENT, agent);
     CallServiceClient.getInstance().notifyAgentStateChangeAsync(agent);
     if (agentval.equals(Agent.STATE_IDLE)) {
       write(response, "Bizidle");
     } else {
       write(response, "BizBusy");
     }
   } catch (Exception ex) {
     log.error(ex.getMessage(), ex);
   }
 }
Пример #3
0
 @RequestMapping("/agent/makeCallAjax.do")
 public void makeCallAjax(HttpServletResponse response) {
   JsonResult jr = new JsonResult();
   try {
     String callNum = this.getRequest().getParameter("callNum").trim();
     if (callNum.startsWith("1") && callNum.length() >= 11) {
       String localCode = CRMConfiguration.getLocalAreaCode();
       String mobileCode = service.getMobileArea(callNum);
       if (!localCode.equals(mobileCode)) {
         callNum = "0" + callNum;
       }
     }
     Agent agent = CRMHelper.getCurrentAgent();
     log.debug(agent.getPhone() + " called " + callNum);
     CRMServiceLocator.getCallService().doMakeCall(agent, callNum);
   } catch (Exception ex) {
     log.error(ex.getMessage(), ex);
     jr.setResult(JsonResult.RESULT_FALSE);
     jr.setMessage(ex.getMessage());
   }
   writeJson(response, jr);
 }
Пример #4
0
  @RequestMapping("/agent/smsList.do")
  public String smsListAction(SmsDto dto) {
    User user = SpringHelper.getCurrentUser();
    List<User> list = securityService.getAccessUsers(user, CRMHelper.isCurrentUserManager());
    if (StringUtils.isEmpty(dto.getProcessor())) {
      if (list.size() > 1) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
          sb.append("'").append(list.get(i).getId()).append("',");
        }
        dto.setProcessor(sb.substring(0, sb.length() - 1));
      } else {
        dto.setProcessor(user.getId());
      }
    }

    Pagination pagination = service.querySMS(dto);
    this.getRequest().setAttribute("userlist", list);
    this.getRequest().setAttribute("pagination", pagination);
    this.getRequest().setAttribute("dto", dto);
    return CRMConstants.CRM_JSP_ROOT + "/call/smsList";
  }
Пример #5
0
 // 查询今天已经联系的客户
 public String todayRelationCustomer() {
   Agent agent = CRMHelper.getCurrentAgent();
   List<Customer> list = service.todayRelationCustomer(agent);
   this.getRequest().setAttribute("customerList", list);
   return "todayRelation";
 }