Search in sources :

Example 1 with CustomerServiceExample

use of com.itrus.portal.db.CustomerServiceExample in project portal by ixinportal.

the class CustomerServiceCallWebContoller method telephoneQuery.

/**
 * 获取客服电话,跳转电话页面
 * @param eid 客服id
 * @param uiModel
 * @param request
 * @return
 */
@RequestMapping(value = "/telephoneQuery/index/{eid}", produces = "text/html")
public String telephoneQuery(@PathVariable("eid") Long eid, Model uiModel, HttpServletRequest request) {
    HttpSession session = request.getSession();
    EnterpriseQq enterpriseqq = enterpriseqqService.selectOne(eid);
    uiModel.addAttribute("enterpriseqq", enterpriseqq);
    session.removeAttribute("enterpriseqqE");
    if (enterpriseqq != null && enterpriseqq.getEnterpriseQqLinks() != null) {
        session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
    }
    List<CustomerService> customerlist = new ArrayList<CustomerService>();
    Project project = new Project();
    if (enterpriseqq != null) {
        String sid = enterpriseqq.getId().toString();
        int id = Integer.parseInt(sid);
        CustomerServiceExample customer = new CustomerServiceExample();
        CustomerServiceExample.Criteria serviceEx = customer.createCriteria();
        serviceEx.andEnterpriseIdEqualTo(id);
        customerlist = sqlSession.selectList("com.itrus.portal.db.CustomerServiceMapper.selectByExample", customer);
        // 获取项目
        project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", enterpriseqq.getProjectId());
    }
    uiModel.addAttribute("customerlist", customerlist);
    uiModel.addAttribute("project", project);
    return "ixinweb/kehufuwu_kefudianhua";
}
Also used : Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) HttpSession(javax.servlet.http.HttpSession) ArrayList(java.util.ArrayList)

Example 2 with CustomerServiceExample

use of com.itrus.portal.db.CustomerServiceExample in project portal by ixinportal.

the class OnlineServiceController method establishCustomerService.

/*
	 * 创建客服
	 * 
	 */
@RequestMapping(produces = "text/html", params = "form")
public String establishCustomerService(Model model) {
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    List<Map<String, Object>> projectIds = onlineService.getProjects();
    List<Long> pids = new ArrayList<>();
    for (Map<String, Object> p : projectIds) {
        if (p != null) {
            Long project_id = (Long) p.get("project_id");
            pids.add(project_id);
        }
    }
    model.addAttribute("pids", pids);
    // 查询默认客服的数据
    EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
    EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
    qqEx.andEnterpriseQqStateEqualTo(0L);
    EnterpriseQq enterpriseqq = onlineService.selectQq(enterpriseE);
    // 查询默认客服的数据
    CustomerServiceExample customerE = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
    serviceE.andServiceStateEqualTo(0);
    CustomerService customerService = onlineService.selectService(customerE);
    if (customerService == null) {
        model.addAttribute("customerstatus", 1);
    }
    if (enterpriseqq == null) {
        model.addAttribute("qqstatus", 1);
    }
    ProjectExample projectE = new ProjectExample();
    ProjectExample.Criteria pec = projectE.createCriteria();
    pec.andIdIn(Arrays.asList(projectsOfAdmin));
    List<Project> projectlist = projectService.getProjectByExample(projectE);
    // Map<Long,Project> projectlist= onlineService.selectProject();
    model.addAttribute("projectlist", projectlist);
    return "onlineservices/create";
}
Also used : CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) ProjectExample(com.itrus.portal.db.ProjectExample) ArrayList(java.util.ArrayList) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JSONObject(com.alibaba.fastjson.JSONObject) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with CustomerServiceExample

use of com.itrus.portal.db.CustomerServiceExample in project portal by ixinportal.

the class OnlineServiceController method selectProject.

@RequestMapping(produces = "text/html")
public String selectProject(@RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "projectId", required = false) Long projectId, @RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "enterpriseQq", required = false) String enterpriseQq, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "status", required = false) String status, Model uiModel) {
    if (queryDate1 == null && queryDate2 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate2 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate1 = calendar.getTime();
    }
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    Map param = new HashMap();
    param.put("hasProjects", Arrays.asList(projectsOfAdmin));
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    Integer offset = size * (page - 1);
    param.put("offset", offset);
    param.put("limit", size);
    param.put("queryDate1", queryDate1);
    param.put("queryDate2", queryDate2);
    if (projectId != null) {
        param.put("projectId", projectId);
    }
    if (StringUtils.isNotEmpty(phone)) {
        param.put("phone", "%" + phone + "%");
    }
    if (StringUtils.isNotEmpty(enterpriseQq)) {
        param.put("enterpriseQq", "%" + enterpriseQq + "%");
    }
    // 查詢qq客服
    List<Map<String, Object>> enterpriseqQq = onlineService.selectQqList(param);
    // 得到數量
    int count = onlineService.selectcount(param);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    Map<Long, List<CustomerService>> listmain = new HashMap<Long, List<CustomerService>>();
    for (int i = 0; i < enterpriseqQq.size(); i++) {
        long id = Long.parseLong(enterpriseqQq.get(i).get("id").toString());
        CustomerServiceExample customerE = new CustomerServiceExample();
        CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
        int cid = Integer.parseInt(enterpriseqQq.get(i).get("id").toString());
        serviceE.andEnterpriseIdEqualTo(cid);
        List<CustomerService> listcustomer = onlineService.selectServiceList(customerE);
        listmain.put(id, listcustomer);
    }
    ProjectExample projectE = new ProjectExample();
    ProjectExample.Criteria pec = projectE.createCriteria();
    pec.andIdIn(Arrays.asList(projectsOfAdmin));
    List<Project> project = projectService.getProjectByExample(projectE);
    uiModel.addAttribute("listQq", enterpriseqQq);
    uiModel.addAttribute("listmain", listmain);
    uiModel.addAttribute("list", project);
    // 查询默认客服的数据
    EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
    EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
    qqEx.andEnterpriseQqStateEqualTo(0L);
    EnterpriseQq enterpriseqq = onlineService.selectQq(enterpriseE);
    // 查询默认客服的数据
    CustomerServiceExample customerE = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
    serviceE.andServiceStateEqualTo(0);
    CustomerService customerService = onlineService.selectService(customerE);
    uiModel.addAttribute("enterpriseqq", enterpriseqq);
    uiModel.addAttribute("customerService", customerService);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    uiModel.addAttribute("projectId", projectId);
    uiModel.addAttribute("phone", phone);
    uiModel.addAttribute("enterpriseQq", enterpriseQq);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("page", page);
    return "onlineservices/list";
}
Also used : CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample) Calendar(java.util.Calendar) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) ArrayList(java.util.ArrayList) List(java.util.List) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with CustomerServiceExample

use of com.itrus.portal.db.CustomerServiceExample in project portal by ixinportal.

the class OnlineServiceController method delete.

// 删除
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
@ResponseBody
public String delete(@PathVariable("id") Long id, HttpServletRequest request, Model uiModel) {
    // System.out.println("删除");
    EnterpriseQq enterprise = onlineService.selectEnterprise(id);
    if (enterprise != null) {
        CustomerServiceExample customerE = new CustomerServiceExample();
        CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
        int cid = Integer.parseInt(enterprise.getId().toString());
        serviceE.andEnterpriseIdEqualTo(cid);
        List<CustomerService> listcustomer = onlineService.selectServiceList(customerE);
        if (listcustomer.size() > 0) {
            for (CustomerService cus : listcustomer) {
                onlineService.deleteId(cus.getId());
            }
        }
        onlineService.deleteById(id);
        LogUtil.adminlog(sqlSession, "删除天威客服", enterprise.getProjectId() + "删除的文件是:" + enterprise.getEnterpriseQq());
    } else {
        return "为找到相应的qq";
    }
    return null;
}
Also used : EnterpriseQq(com.itrus.portal.db.EnterpriseQq) CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with CustomerServiceExample

use of com.itrus.portal.db.CustomerServiceExample in project portal by ixinportal.

the class OnlineServiceController method updateshow.

/**
 * 跳转修改页面
 *
 * @param id
 * @return
 */
@RequestMapping(value = "/updateshow/{id}", produces = "text/html")
public String updateshow(@PathVariable("id") Long id, Model uiModel) {
    EnterpriseQq enterprise = onlineService.selectEnterprise(id);
    // Long qq_state=enterprise.getQqState();
    // Long custerm_service_state=enterprise.getCustermServiceState();
    // Map<Long, List<CustomerService>> listmain = new HashMap<Long,
    // List<CustomerService>>();
    CustomerServiceExample customerE = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
    int cid = Integer.parseInt(enterprise.getId().toString());
    serviceE.andEnterpriseIdEqualTo(cid);
    List<CustomerService> listcustomer = onlineService.selectServiceList(customerE);
    // CustomerServiceExample customerE = new CustomerServiceExample();
    // List<CustomerService> customerService =
    // onlineService.selectServiceList(customerE);
    Map<Long, Object> map = new HashMap<>();
    String json = "";
    for (CustomerService c : listcustomer) {
        String str = null;
        try {
            str = jsonTool.writeValueAsString(c);
            ObjectMapper mapper = new ObjectMapper();
            json = mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
        }
        map.put(c.getId(), str);
    }
    try {
        uiModel.addAttribute("json", jsonTool.writeValueAsString(json));
        uiModel.addAttribute("json1", jsonTool.writeValueAsString(listcustomer));
    } catch (Exception e) {
        e.printStackTrace();
    }
    ProjectExample projectE = new ProjectExample();
    List<Project> project = projectService.getProjectByExample(projectE);
    // 查询默认客服的数据
    EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
    EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
    qqEx.andEnterpriseQqStateEqualTo(0L);
    EnterpriseQq enterpriseqq = onlineService.selectQq(enterpriseE);
    // 查询默认客服的数据
    CustomerServiceExample customerEX = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceEX = customerEX.createCriteria();
    serviceEX.andServiceStateEqualTo(0);
    CustomerService customerService = onlineService.selectService(customerEX);
    if (customerService == null) {
        uiModel.addAttribute("customerstatus", 1);
    }
    if (enterpriseqq == null) {
        uiModel.addAttribute("qqstatus", 1);
    }
    uiModel.addAttribute("enterprise", enterprise);
    uiModel.addAttribute("listcustomer", listcustomer);
    uiModel.addAttribute("projectList", project);
    return "onlineservices/update";
}
Also used : CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JSONObject(com.alibaba.fastjson.JSONObject) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

CustomerService (com.itrus.portal.db.CustomerService)8 CustomerServiceExample (com.itrus.portal.db.CustomerServiceExample)8 EnterpriseQq (com.itrus.portal.db.EnterpriseQq)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)4 Project (com.itrus.portal.db.Project)4 JSONObject (com.alibaba.fastjson.JSONObject)3 ProjectExample (com.itrus.portal.db.ProjectExample)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Date (java.util.Date)2 Map (java.util.Map)2 Calendar (java.util.Calendar)1 List (java.util.List)1 HttpSession (javax.servlet.http.HttpSession)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1