Search in sources :

Example 16 with EnterpriseQq

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

the class OnlineServiceController method update.

/**
 * 修改处理
 *
 * @param id
 * @param customerJson
 * @param keys
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/update/{id}", produces = "text/html")
public String update(@PathVariable("id") Long id, @RequestParam(value = "jsonObj", required = false) String customerJson, @RequestParam(value = "keys", required = false) String keys, @RequestParam(value = "delKeys", required = false) String delKeys, @RequestParam(value = "projectId", required = false) Long projectId, @RequestParam(value = "entQq", required = false) String entQq, @RequestParam(value = "entQqLinks", required = false) String entQqLinks, @RequestParam(value = "isDefaultQq", required = false) String isDefaultQq, @RequestParam(value = "isDefaultPhone", required = false) String isDefaultPhone, Model uiModel) {
    // List<CustomerService> customer = (List<CustomerService>)
    // JSON.parseObject(customerJson, CustomerService.class);//Weibo类在下边定义
    String[] keyArr = keys.split(",");
    if (StringUtils.isNotEmpty(delKeys)) {
        String[] delKeyArr = delKeys.split(",");
        for (String d : delKeyArr) {
            if (!d.contains("new")) {
                List<CustomerService> customerServices = onlineService.selectlistcustomer(Long.parseLong(d));
                if (customerServices != null) {
                    customerServices.get(0);
                    onlineService.delete(Long.parseLong(d));
                }
            }
        }
    }
    EnterpriseQq enterprise = onlineService.selectEnterprise(id);
    if (StringUtils.isNotEmpty(isDefaultQq) && isDefaultQq.equals("1")) {
        EnterpriseQq enterpriseQqDefault = onlineService.selectByDefaultEnterpriseQq();
        enterprise.setEnterpriseQq(enterpriseQqDefault.getEnterpriseQq());
        enterprise.setEnterpriseQqLinks(enterpriseQqDefault.getEnterpriseQqLinks());
        enterprise.setQqState(0L);
    } else {
        enterprise.setEnterpriseQq(entQq);
        enterprise.setEnterpriseQqLinks(entQqLinks);
        enterprise.setQqState(1L);
    }
    enterprise.setEnterpriseQqState(1L);
    enterprise.setProjectId(projectId);
    enterprise.setModifier(getAdmin().getId());
    enterprise.setModifyTime(new Date());
    onlineService.updateenterprise(enterprise);
    // 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);
    if (StringUtils.isNotEmpty(isDefaultPhone) && isDefaultPhone.equals("1")) {
        for (CustomerService c : listcustomer) {
            onlineService.delete(c.getId());
        }
        CustomerService customerService = new CustomerService();
        CustomerService customerServiceDefault = onlineService.selectByDefaultCustomerService();
        customerService.setServicePhone(customerServiceDefault.getServicePhone());
        customerService.setPhoneName(customerServiceDefault.getPhoneName());
        customerService.setExplanatoryTime(customerServiceDefault.getExplanatoryTime());
        customerService.setServiceState(1);
        customerService.setCreator(getAdmin().getId());
        customerService.setCreateTime(new Date());
        customerService.setEnterpriseId(enterprise.getId());
        enterprise.setCustermServiceState(0L);
        onlineService.updateenterprise(enterprise);
        onlineService.insert(customerService);
    } else {
        enterprise.setCustermServiceState(1L);
        onlineService.updateenterprise(enterprise);
        JSONObject jsonObj = JSONObject.parseObject(customerJson);
        for (String s : keyArr) {
            JSONObject jsonc = jsonObj.getJSONObject(s);
            int i = 0;
            for (CustomerService c : listcustomer) {
                if (c.getId().toString().equals(s)) {
                    i++;
                    // 修改 c
                    c.setPhoneName(jsonc.getString("phoneName"));
                    c.setServicePhone(jsonc.getString("servicePhone"));
                    c.setExplanatoryTime(jsonc.getString("explanatoryTime"));
                    c.setModifyTime(new Date());
                    c.setModifier(getAdmin().getId());
                    c.setServiceState(1);
                    onlineService.updatecustomer(c);
                }
            }
            if (i == 0 && s.contains("new")) {
                // 增加
                CustomerService custom = new CustomerService();
                custom.setPhoneName(jsonc.getString("phoneName"));
                custom.setServicePhone(jsonc.getString("servicePhone"));
                custom.setExplanatoryTime(jsonc.getString("explanatoryTime"));
                custom.setCreateTime(new Date());
                custom.setServiceState(1);
                custom.setEnterpriseId(enterprise.getId());
                onlineService.insertcustomer(custom);
            }
            if (i == 0 && !s.contains("new")) {
                // 删除 c
                Long sid = Long.parseLong(s.toString());
                onlineService.delete(sid);
            }
        }
    }
    return "redirect:/onlineserviceconfig";
}
Also used : CustomerService(com.itrus.portal.db.CustomerService) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) JSONObject(com.alibaba.fastjson.JSONObject) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with EnterpriseQq

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

the class OnlineServiceController method create.

/**
 * 创建客服配置
 *
 * @param phoneconfig
 * @param projectId
 * @param enterpriseQq
 * @param enterpriseQqLinks
 * @param isDefaultQq
 * @param isDefaultPhone
 * @param uiModel
 * @return
 * @throws Exception
 */
@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String create(@RequestParam(value = "phoneconfig", required = false) String phoneconfig, @RequestParam(value = "projectId", required = false) Long projectId, @RequestParam(value = "entQq", required = false) String entQq, @RequestParam(value = "entQqLinks", required = false) String entQqLinks, @RequestParam(value = "isDefaultQq", required = false) String isDefaultQq, @RequestParam(value = "isDefaultPhone", required = false) String isDefaultPhone, Model uiModel) throws Exception {
    EnterpriseQq enterpriseQq = new EnterpriseQq();
    CustomerService customerService = new CustomerService();
    // 判断是否默认客服qq
    if (StringUtils.isNotEmpty(isDefaultQq) && isDefaultQq.equals("1")) {
        EnterpriseQq enterpriseQqDefault = onlineService.selectByDefaultEnterpriseQq();
        enterpriseQq.setEnterpriseQq(enterpriseQqDefault.getEnterpriseQq());
        enterpriseQq.setEnterpriseQqLinks(enterpriseQqDefault.getEnterpriseQqLinks());
        enterpriseQq.setQqState(0L);
    } else {
        enterpriseQq.setEnterpriseQq(entQq);
        enterpriseQq.setEnterpriseQqLinks(entQqLinks);
        enterpriseQq.setQqState(1L);
    }
    enterpriseQq.setEnterpriseQqState(1L);
    enterpriseQq.setProjectId(projectId);
    enterpriseQq.setCreator(getAdmin().getId());
    enterpriseQq.setCreateTime(new Date());
    onlineService.insert(enterpriseQq);
    // 判断是否默认客服电话
    if (StringUtils.isNotEmpty(isDefaultPhone) && isDefaultPhone.equals("1")) {
        CustomerService customerServiceDefault = onlineService.selectByDefaultCustomerService();
        customerService.setServicePhone(customerServiceDefault.getServicePhone());
        customerService.setPhoneName(customerServiceDefault.getPhoneName());
        customerService.setExplanatoryTime(customerServiceDefault.getExplanatoryTime());
        customerService.setServiceState(1);
        customerService.setCreator(getAdmin().getId());
        customerService.setCreateTime(new Date());
        customerService.setEnterpriseId(enterpriseQq.getId());
        enterpriseQq.setCustermServiceState(0L);
        onlineService.updateenterprise(enterpriseQq);
        onlineService.insert(customerService);
    } else {
        enterpriseQq.setCustermServiceState(1L);
        onlineService.updateenterprise(enterpriseQq);
        JSONArray jsonArr = JSONArray.parseArray(phoneconfig);
        for (int i = 0; i < jsonArr.size(); i++) {
            customerService = new CustomerService();
            JSONObject jsonObject = (JSONObject) jsonArr.get(i);
            customerService.setServicePhone(jsonObject.getString("phone"));
            customerService.setPhoneName(jsonObject.getString("phoneName"));
            customerService.setExplanatoryTime(jsonObject.getString("explain"));
            customerService.setServiceState(1);
            customerService.setCreator(getAdmin().getId());
            customerService.setCreateTime(new Date());
            customerService.setEnterpriseId(enterpriseQq.getId());
            onlineService.insert(customerService);
        }
    }
    return "redirect:/onlineserviceconfig";
}
Also used : EnterpriseQq(com.itrus.portal.db.EnterpriseQq) CustomerService(com.itrus.portal.db.CustomerService) JSONObject(com.alibaba.fastjson.JSONObject) JSONArray(com.alibaba.fastjson.JSONArray) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 18 with EnterpriseQq

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

use of com.itrus.portal.db.EnterpriseQq 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)19 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)15 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)15 CustomerService (com.itrus.portal.db.CustomerService)8 HttpSession (javax.servlet.http.HttpSession)8 CustomerServiceExample (com.itrus.portal.db.CustomerServiceExample)7 HashMap (java.util.HashMap)7 UserInfo (com.itrus.portal.db.UserInfo)6 ArrayList (java.util.ArrayList)6 Product (com.itrus.portal.db.Product)5 Project (com.itrus.portal.db.Project)5 JSONObject (com.alibaba.fastjson.JSONObject)4 Map (java.util.Map)4 ProjectExample (com.itrus.portal.db.ProjectExample)3 IOException (java.io.IOException)3 Date (java.util.Date)3 List (java.util.List)3 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)3 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)3 Bill (com.itrus.portal.db.Bill)2