Search in sources :

Example 11 with EnterpriseQqExample

use of com.itrus.portal.db.EnterpriseQqExample 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 12 with EnterpriseQqExample

use of com.itrus.portal.db.EnterpriseQqExample 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)

Example 13 with EnterpriseQqExample

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

the class OnlineServiceController method createService.

/**
 * 创建(修改)天威默认客服
 *
 * @param phoneName1
 * @param phone1
 * @param downloadUrl1
 * @param messageContent1
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/createService", produces = "text/html")
public // 客服电话名称
String createService(// 客服电话名称
@RequestParam(value = "phoneName1", required = false) String phoneName1, // 客服电话号码
@RequestParam(value = "phone1", required = false) String phone1, // 企业QQ账号
@RequestParam(value = "downloadUrl1", required = false) String downloadUrl1, // 企业QQ链接
@RequestParam(value = "messageContent1", required = false) String messageContent1, Model uiModel) {
    // 查询默认客服的数据
    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 (enterpriseqq != null) {
        enterpriseqq.setEnterpriseQq(downloadUrl1);
        enterpriseqq.setEnterpriseQqLinks(messageContent1);
        enterpriseqq.setEnterpriseQqState(0L);
        enterpriseqq.setModifyTime(new Date());
        onlineService.updateenterprise(enterpriseqq);
        /*Project project = projectService.selectByPrimaryKey(enterpriseqq.getProjectId());
			LogUtil.adminlog(sqlSession, "修改天威默认客服", project.getName() + "修改的文件是:" + enterpriseqq.getEnterpriseQq());*/
        // 修改默认qq
        EnterpriseQqExample enterpriseEX = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqE = enterpriseEX.createCriteria();
        qqE.andQqStateEqualTo(0L);
        List<EnterpriseQq> enterpriseq = onlineService.selectQqList(enterpriseEX);
        if (enterpriseq.size() != 0) {
            for (EnterpriseQq e : enterpriseq) {
                e.setEnterpriseQq(downloadUrl1);
                e.setEnterpriseQqLinks(messageContent1);
                e.setModifyTime(new Date());
                onlineService.updateenterprise(e);
            }
        }
    } else {
        EnterpriseQq enterprise = new EnterpriseQq();
        enterprise.setEnterpriseQq(downloadUrl1);
        enterprise.setEnterpriseQqLinks(messageContent1);
        enterprise.setEnterpriseQqState(0L);
        enterprise.setCreateTime(new Date());
        onlineService.insertenterprise(enterprise);
        LogUtil.adminlog(sqlSession, "修改天威默认客服", "修改的文件是:" + messageContent1);
    }
    if (customerService != null) {
        customerService.setServicePhone(phone1);
        customerService.setPhoneName(phoneName1);
        customerService.setServiceState(0);
        customerService.setModifyTime(new Date());
        onlineService.updatecustomer(customerService);
        // 修改默认客服电话
        EnterpriseQqExample enterpriseEX = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqE = enterpriseEX.createCriteria();
        qqE.andCustermServiceStateEqualTo(0L);
        List<EnterpriseQq> enterpriseq = onlineService.selectQqList(enterpriseEX);
        if (enterpriseq.size() != 0) {
            for (EnterpriseQq e : enterpriseq) {
                CustomerServiceExample customerEX = new CustomerServiceExample();
                CustomerServiceExample.Criteria serviceEX = customerEX.createCriteria();
                int cid = Integer.parseInt(e.getId().toString());
                serviceEX.andEnterpriseIdEqualTo(cid);
                CustomerService customers = onlineService.selectService(customerEX);
                if (customers != null) {
                    customers.setServicePhone(phone1);
                    customers.setPhoneName(phoneName1);
                    customers.setCreateTime(new Date());
                    onlineService.updatecustomer(customers);
                }
            }
        }
    } else {
        CustomerService customer = new CustomerService();
        customer.setServicePhone(phone1);
        customer.setPhoneName(phoneName1);
        customer.setServiceState(0);
        customer.setCreateTime(new Date());
        onlineService.insertcustomer(customer);
        LogUtil.adminlog(sqlSession, "修改天威默认客服", "修改的文件是:" + phoneName1);
    }
    return "redirect:/onlineserviceconfig";
}
Also used : EnterpriseQq(com.itrus.portal.db.EnterpriseQq) CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with EnterpriseQqExample

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

the class HomeController method register.

// @RequestMapping(value = "/s/{name}")
public String register(@PathVariable("name") String name, @RequestParam(value = "login", required = false) String login, HttpSession session, Model uiModel) {
    ProductExample productExample = new ProductExample();
    ProductExample.Criteria pe = productExample.createCriteria();
    pe.andProNameEqualTo(name);
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByExample", productExample);
    // return
    // "forward:/userInfoWeb/zhuce.html?projectId="+product.getProject()+"&productId="+product.getId();
    uiModel.addAttribute("projectId", product.getProject());
    uiModel.addAttribute("productId", product.getId());
    if (StringUtils.isNotBlank(login) && login.equals("1")) {
        List<String> allIssUerDn = new ArrayList<String>();
        allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
        try {
            uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
            // 返回随机数
            String random = UniqueIDUtils.genUUID();
            uiModel.addAttribute("random", random);
            session.setAttribute("webrandom", random);
        } catch (JsonGenerationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (JsonMappingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return "ixinweb/denglu2";
    }
    if (null != product.getIsBan() && product.getIsBan() == true) {
        EnterpriseQqExample enterprise = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterprise.createCriteria();
        qqEx.andProjectIdEqualTo(product.getProject());
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterprise);
        uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
        // 产品已经下架
        return "ixinweb/chanpinxiajia";
    }
    return "ixinweb/zhuce";
}
Also used : EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) ProductExample(com.itrus.portal.db.ProductExample) Product(com.itrus.portal.db.Product) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException)

Example 15 with EnterpriseQqExample

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

the class ThirdPartyController method customerService.

/**
 * 进入常见问题页面
 * @param product
 * @param uiModel
 * @param request
 * @return
 */
@RequestMapping("/s/{product}/help")
public String customerService(@PathVariable("product") String product, Model uiModel, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Product pro = productService.getProductByproName(product);
    if (pro != null) {
        // 查询企业客服
        EnterpriseQqExample enterprise = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterprise.createCriteria();
        qqEx.andProjectIdEqualTo(pro.getProject());
        EnterpriseQq enterpriseqq = enterpriseqqService.selectByEnterpriseQq(enterprise);
        // 查询发布文件
        FileIssueExample fileIssueExample = new FileIssueExample();
        FileIssueExample.Criteria cec = fileIssueExample.createCriteria();
        cec.andProjectEqualTo(pro.getProject());
        List<FileIssue> FileIssues = configServiceImpl.getList(fileIssueExample);
        Long questionId = 0L;
        ServiceExample serviceExample = new ServiceExample();
        ServiceExample.Criteria srCriteria = serviceExample.createCriteria();
        serviceExample.clear();
        serviceExample.setLimit(null);
        srCriteria = serviceExample.createCriteria();
        srCriteria.andProjectEqualTo(pro.getProject());
        srCriteria.andTypeEqualTo(1);
        Service service = questionService.getService(serviceExample);
        if (null == service && (enterpriseqq == null || FileIssues.size() == 0)) {
            serviceExample.clear();
            srCriteria = serviceExample.createCriteria();
            srCriteria.andNameEqualTo("缺省项目");
            srCriteria.andTypeEqualTo(1);
            Service service2 = questionService.getService(serviceExample);
            questionId = service2.getId();
        } else {
            questionId = service.getId();
        }
        // 查询是否存在
        Service service1 = questionService.getService(questionId);
        // Service pService = sqlSession.selectOne("com.itrus.portal.db.ServiceMapper.selectByPrimaryKey", service.getParentId());
        uiModel.addAttribute("service", service1);
        // uiModel.addAttribute("pService", pService);
        // 查询子节点
        ServiceExample serviceExample2 = new ServiceExample();
        ServiceExample.Criteria srCriteria2 = serviceExample2.createCriteria();
        serviceExample2.clear();
        serviceExample2.setLimit(null);
        srCriteria2 = serviceExample2.createCriteria();
        srCriteria2.andParentIdEqualTo(questionId);
        Map<Long, Service> childSR = questionService.getChildSR(serviceExample2);
        uiModel.addAttribute("childSR", childSR);
        // 若没有子节点,直接返回
        if (childSR == null || childSR.isEmpty()) {
            return null;
        }
        Map<Integer, Long> idMap = new HashMap<>();
        // 查询子节点是否包含下级节点
        serviceExample2.clear();
        srCriteria2 = serviceExample2.createCriteria();
        srCriteria2.andParentIdIn(new ArrayList<Long>(childSR.keySet()));
        Map<Long, Object> childNumMap = questionService.getChildNumMap(serviceExample2);
        // 组装子节点信息
        // List<Map<String,Object>> childList = new ArrayList<Map<String, Object>>();
        // 对节点按照id顺序排序
        List<List<Service>> childrenList = new ArrayList<List<Service>>();
        List<Service> typeList = questionService.sortTypesMap(childSR);
        List<Service> childList = new ArrayList<Service>();
        int i = 1;
        for (Service sr : typeList) {
            if (childNumMap != null && childNumMap.containsKey(sr.getId())) {
                serviceExample2.clear();
                serviceExample2.setLimit(null);
                srCriteria2 = serviceExample2.createCriteria();
                srCriteria2.andParentIdEqualTo(sr.getId());
                Map<Long, Service> childMap = questionService.getChildSR(serviceExample2);
                childList = questionService.sortTypesMap(childMap);
                childrenList.add(childList);
            } else {
                childrenList.add(childList);
            }
            idMap.put(i, sr.getId());
            i++;
        }
        uiModel.addAttribute("childNumMap", childNumMap);
        uiModel.addAttribute("childrenList", childrenList);
        uiModel.addAttribute("idMap", idMap);
        uiModel.addAttribute("pid", questionId);
        serviceExample2.clear();
        srCriteria = serviceExample2.createCriteria();
        srCriteria.andTypeEqualTo(2);
        srCriteria.andParentIdEqualTo(service1.getId());
        List<Service> serviceList1 = questionService.getServiceList(serviceExample2);
        Long sId = serviceList1.get(0).getId();
        serviceExample2.clear();
        srCriteria = serviceExample2.createCriteria();
        srCriteria.andTypeEqualTo(3);
        srCriteria.andParentIdEqualTo(sId);
        List<Service> serviceList2 = questionService.getServiceList(serviceExample2);
        Long gsId = serviceList2.get(0).getId();
        uiModel.addAttribute("gsid", gsId);
        uiModel.addAttribute("tab", "kehufuwu");
        if (enterpriseqq != null && enterpriseqq.getId() != null) {
            uiModel.addAttribute("eid", enterpriseqq.getId());
            session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
        }
        return "ixinweb/kehufuwu_changjianwenti";
    }
    uiModel.addAttribute("tab", "kehufuwu");
    return "ixinweb/kehufuwu_xuanzexiangmu";
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Product(com.itrus.portal.db.Product) FileIssueExample(com.itrus.portal.db.FileIssueExample) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) ArrayList(java.util.ArrayList) List(java.util.List) FileIssue(com.itrus.portal.db.FileIssue) HttpSession(javax.servlet.http.HttpSession) Service(com.itrus.portal.db.Service) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) ServiceExample(com.itrus.portal.db.ServiceExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

EnterpriseQq (com.itrus.portal.db.EnterpriseQq)15 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)15 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 HashMap (java.util.HashMap)7 HttpSession (javax.servlet.http.HttpSession)7 UserInfo (com.itrus.portal.db.UserInfo)6 Product (com.itrus.portal.db.Product)5 ArrayList (java.util.ArrayList)5 CustomerService (com.itrus.portal.db.CustomerService)4 CustomerServiceExample (com.itrus.portal.db.CustomerServiceExample)4 Project (com.itrus.portal.db.Project)4 Map (java.util.Map)4 ProjectExample (com.itrus.portal.db.ProjectExample)3 IOException (java.io.IOException)3 List (java.util.List)3 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)3 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)3 JSONObject (com.alibaba.fastjson.JSONObject)2 Bill (com.itrus.portal.db.Bill)2 DigitalCert (com.itrus.portal.db.DigitalCert)2