Search in sources :

Example 1 with Service

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

the class CustomerServiceCallWebContoller method theDownloadSection.

/**
 * 获取发布信息,进入下载专区
 * @param eid 客服id
 * @param uiModel
 * @param request
 * @return
 */
@RequestMapping(value = "/thedownloaddection/index/{eid}", produces = "text/html")
public String theDownloadSection(@PathVariable("eid") Long eid, // @RequestParam(value = "status", required = false) Integer status,
@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel, HttpServletRequest request) {
    Service service = questionService.getService(eid);
    List<FileIssue> FileIssues = new ArrayList<FileIssue>();
    List<FileIssue> Filecount = new ArrayList<FileIssue>();
    Map<Long, FileConfig> mconfig = new HashMap<Long, FileConfig>();
    if (service != null && service.getProject() != null) {
        if (page == null || page < 1) {
            page = 1;
        }
        if (size == null || size < 1) {
            size = 5;
        }
        // 结束
        // 查询发布文件
        FileIssueExample fileIssueExample = new FileIssueExample();
        FileIssueExample.Criteria cec = fileIssueExample.createCriteria();
        cec.andProjectEqualTo(service.getProject());
        Filecount = configServiceImpl.getList(fileIssueExample);
        // ////分页开始
        Integer count = Filecount.size();
        if (page > 1 && size * (page - 1) >= count) {
            page = (count + size - 1) / size;
        }
        uiModel.addAttribute("count", count);
        uiModel.addAttribute("pages", (count + size - 1) / size);
        uiModel.addAttribute("page", page);
        Integer offset = size * (page - 1);
        fileIssueExample.setOffset(offset);
        fileIssueExample.setLimit(size);
        fileIssueExample.setOrderByClause("priority ASC");
        // ////结束
        FileIssues = configServiceImpl.getList(fileIssueExample);
        for (FileIssue issue : FileIssues) {
            FileConfig fileconfig = configServiceImpl.getFileConfigById(issue.getFileConfig());
            mconfig.put(issue.getId(), fileconfig);
        }
    }
    uiModel.addAttribute("FileIssues", FileIssues);
    // 分页开始
    uiModel.addAttribute("eid", eid);
    // 分页结束
    uiModel.addAttribute("mconfig", mconfig);
    return "ixinweb/kehufuwu_xiazaizhuanqv";
}
Also used : FileConfig(com.itrus.portal.db.FileConfig) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SystemConfigService(com.itrus.portal.service.SystemConfigService) CustomerService(com.itrus.portal.db.CustomerService) Service(com.itrus.portal.db.Service) FileIssue(com.itrus.portal.db.FileIssue) FileIssueExample(com.itrus.portal.db.FileIssueExample)

Example 2 with Service

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

FileIssue (com.itrus.portal.db.FileIssue)2 FileIssueExample (com.itrus.portal.db.FileIssueExample)2 Service (com.itrus.portal.db.Service)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 CustomerService (com.itrus.portal.db.CustomerService)1 EnterpriseQq (com.itrus.portal.db.EnterpriseQq)1 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)1 FileConfig (com.itrus.portal.db.FileConfig)1 Product (com.itrus.portal.db.Product)1 ServiceExample (com.itrus.portal.db.ServiceExample)1 SystemConfigService (com.itrus.portal.service.SystemConfigService)1 List (java.util.List)1 HttpSession (javax.servlet.http.HttpSession)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1