Search in sources :

Example 11 with EnterpriseQq

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

the class RegisterController 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();
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", product.getProject());
    uiModel.addAttribute("projectId", product.getProject());
    uiModel.addAttribute("productId", product.getId());
    uiModel.addAttribute("productName", product.getName());
    uiModel.addAttribute("projectName", project.getName());
    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) {
            e.printStackTrace();
        } catch (JsonMappingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "ixinweb/denglu2";
    }
    if (null != product.getIsBan() && product.getIsBan() == true) {
        EnterpriseQqExample enterprise1 = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterprise1.createCriteria();
        qqEx.andProjectIdEqualTo(product.getProject());
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterprise1);
        if (enterpriseqq != null && enterpriseqq.getEnterpriseQq() != null) {
            uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
        }
        // 产品已经下架
        return "ixinweb/chanpinxiajia";
    }
    return "ixinweb/zhuce";
}
Also used : ProductExample(com.itrus.portal.db.ProductExample) Product(com.itrus.portal.db.Product) IOException(java.io.IOException) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with EnterpriseQq

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

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

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

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

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