Search in sources :

Example 1 with FileIssueExample

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

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

the class DownloadConfigController method update.

// 修改处理
@RequestMapping(params = "update", produces = "text/html")
public String update(@Valid FileConfig fileConfig, @RequestParam(value = "upFile", required = false) MultipartFile upFile, @RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "projectId", required = false) Long projectId, @RequestParam(value = "fileIdArr", required = false) String fileIdArr, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
    if (bindingResult.hasErrors()) {
        return updateForm(fileConfig.getId(), status, uiModel);
    }
    if (status == 1) {
        FileConfig fileConfig0 = configServiceImpl.getFileConfigById(fileConfig.getId());
        if (!(upFile == null || upFile.isEmpty())) {
            try {
                // 保存新文件
                Map<String, Object> retMap = null;
                if (upFile != null) {
                    // 上传文件
                    retMap = saveFile(upFile);
                    if (retMap == null || (int) retMap.get("retCode") != 1) {
                        return updateForm(fileConfig.getId(), 3, uiModel);
                    }
                    fileConfig.setFileSize(retMap.get("fileSize").toString());
                    fileConfig.setFile(retMap.get("name").toString());
                    fileConfig.setHash(retMap.get("hash").toString());
                }
                // 删除旧文件
                if (StringUtils.isNotEmpty(fileConfig0.getFile())) {
                    FileUtils.deleteQuietly(new File(systemConfigService.getSoftDir(), fileConfig0.getFile()));
                }
            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        } else if (StringUtils.isNotEmpty(fileConfig.getDownloadUrl()) && StringUtils.isNotEmpty(fileConfig0.getFile())) {
            // 删除旧文件
            if (StringUtils.isNotEmpty(fileConfig0.getFile())) {
                try {
                    FileUtils.deleteQuietly(new File(systemConfigService.getSoftDir(), fileConfig0.getFile()));
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        } else if (StringUtils.isNotEmpty(fileConfig0.getFile())) {
            fileConfig.setFile(fileConfig0.getFile());
            fileConfig.setFileSize(fileConfig0.getFileSize());
            fileConfig.setHash(fileConfig0.getHash());
        }
        fileConfig.setCreator(fileConfig0.getCreator());
        fileConfig.setCreateTime(fileConfig0.getCreateTime());
        fileConfig.setModifier(getAdmin().getId());
        fileConfig.setModifyTime(new Date());
        configServiceImpl.updateFileConfig(fileConfig);
        String oper = "修改文件管理信息";
        String info = "文件名称: " + fileConfig.getName();
        LogUtil.adminlog(sqlSession, oper, info);
        return "redirect:/downloadconfig/" + fileConfig.getId() + "/" + status;
    } else {
        Long FileIssueId = 0L;
        // 修改删除的发布文件信息
        FileIssueExample issueExample = new FileIssueExample();
        FileIssueExample.Criteria fec = issueExample.createCriteria();
        fec.andProjectEqualTo(projectId);
        List<FileIssue> issues = configServiceImpl.getList(issueExample);
        for (FileIssue fileIssue : issues) {
            if (!fileIdArr.contains(fileIssue.getFileConfig().toString())) {
                configServiceImpl.deleteFileIssueById(fileIssue.getId());
            }
        }
        // 修改发布文件信息 没有的信息则添加
        String[] idArr = fileIdArr.split(",");
        String nameAll = null;
        for (int i = 0; i < idArr.length; i++) {
            FileIssue fileIssue = configServiceImpl.selectFileIssue(Long.parseLong(idArr[i]), projectId);
            if (fileIssue != null) {
                fileIssue.setPriority(i + 1);
                fileIssue.setModifier(getAdmin().getId());
                fileIssue.setModifyTime(new Date());
                configServiceImpl.updateFileIssue(fileIssue);
                if (i == 0) {
                    FileIssueId = fileIssue.getId();
                }
            } else {
                FileIssue fileIssue2 = new FileIssue();
                fileIssue2.setCreator(getAdmin().getId());
                fileIssue2.setCreateTime(new Date());
                fileIssue2.setFileConfig(Long.parseLong(idArr[i]));
                fileIssue2.setProject(projectId);
                fileIssue2.setPriority(i + 1);
                configServiceImpl.insertFileIssue(fileIssue2, null, null);
                if (i == 0) {
                    FileIssueId = fileIssue2.getId();
                }
            }
            FileConfig config = configServiceImpl.getFileConfigById(Long.parseLong(idArr[i]));
            if (nameAll == null) {
                nameAll = config.getName();
            } else {
                nameAll = nameAll + "," + config.getName();
            }
        }
        Project project = projectServiceImpl.selectByPrimaryKey(projectId);
        String oper = "修改文件发布信息";
        String info = project.getName() + "项目下发布文件: " + nameAll;
        LogUtil.adminlog(sqlSession, oper, info);
        return "redirect:/downloadconfig/" + FileIssueId + "/" + status;
    }
}
Also used : FileConfig(com.itrus.portal.db.FileConfig) FileIssueExample(com.itrus.portal.db.FileIssueExample) Date(java.util.Date) Project(com.itrus.portal.db.Project) FileIssue(com.itrus.portal.db.FileIssue) File(java.io.File) MultipartFile(org.springframework.web.multipart.MultipartFile) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with FileIssueExample

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

the class DownloadConfigController method updateForm.

// 返回修改页面
@RequestMapping(value = "/{id}/{status}", params = "form", produces = "text/html")
public String updateForm(@PathVariable("id") Long id, @PathVariable("status") Integer status, Model uiModel) {
    if (status == 1) {
        FileConfig fileConfig = configServiceImpl.getFileConfigById(id);
        uiModel.addAttribute("fileConfig", fileConfig);
        return "downloadconfig/update1";
    } else if (status == 2) {
        FileIssue fileIssue = configServiceImpl.getFileIssueById(id);
        // uiModel.addAttribute("fileIssue", fileIssue);
        // 获取对应项目信息
        Project project = projectServiceImpl.selectByPrimaryKey(fileIssue.getProject());
        uiModel.addAttribute("project", project);
        // Map<String, Object> param = new HashMap<>();
        // param.put("projectId1", fileIssue.getProject());
        // List<Map<String, Object>> fileIssues = configServiceImpl.getList(param);
        // 获取所有文件信息
        List<FileConfig> fileConfigs = configServiceImpl.getList(new FileConfigExample());
        uiModel.addAttribute("fileConfigs", fileConfigs);
        try {
            uiModel.addAttribute("jsonFile", jsonTool.writeValueAsString(fileConfigs));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        // 获取对应项目下的所有发布文件
        FileIssueExample issueExample = new FileIssueExample();
        FileIssueExample.Criteria fec = issueExample.createCriteria();
        fec.andProjectEqualTo(fileIssue.getProject());
        issueExample.setOrderByClause("priority asc");
        List<FileIssue> fileIssues = configServiceImpl.getList(issueExample);
        try {
            uiModel.addAttribute("jsonFileIssues", jsonTool.writeValueAsString(fileIssues));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        uiModel.addAttribute("fileIssues", fileIssues);
        return "downloadconfig/update2";
    } else {
        FileConfig fileConfig = configServiceImpl.getFileConfigById(id);
        uiModel.addAttribute("fileConfig", fileConfig);
        uiModel.addAttribute("message", "修改文件管理信息失败!");
        return "downloadconfig/update1";
    }
}
Also used : FileConfig(com.itrus.portal.db.FileConfig) Project(com.itrus.portal.db.Project) FileConfigExample(com.itrus.portal.db.FileConfigExample) ArrayList(java.util.ArrayList) List(java.util.List) FileIssue(com.itrus.portal.db.FileIssue) FileIssueExample(com.itrus.portal.db.FileIssueExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with FileIssueExample

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

Example 5 with FileIssueExample

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

the class DownloadConfigServiceImpl method selectFileIssue.

/**
 * 根据文件Id 和 项目Id 获取对应的文件发表信息
 * @param fileConfigId
 * @param productId
 * @return
 */
public FileIssue selectFileIssue(Long fileConfigId, Long projectId) {
    FileIssueExample fileIssueExample = new FileIssueExample();
    FileIssueExample.Criteria fec = fileIssueExample.createCriteria();
    fec.andProjectEqualTo(projectId);
    fec.andFileConfigEqualTo(fileConfigId);
    FileIssue fileIssue = sqlSession.selectOne("com.itrus.portal.db.FileIssueMapper.selectByExample", fileIssueExample);
    if (fileIssue == null) {
        return null;
    } else {
        return fileIssue;
    }
}
Also used : FileIssue(com.itrus.portal.db.FileIssue) FileIssueExample(com.itrus.portal.db.FileIssueExample)

Aggregations

FileIssue (com.itrus.portal.db.FileIssue)5 FileIssueExample (com.itrus.portal.db.FileIssueExample)5 FileConfig (com.itrus.portal.db.FileConfig)3 ArrayList (java.util.ArrayList)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 Project (com.itrus.portal.db.Project)2 Service (com.itrus.portal.db.Service)2 HashMap (java.util.HashMap)2 List (java.util.List)2 CustomerService (com.itrus.portal.db.CustomerService)1 EnterpriseQq (com.itrus.portal.db.EnterpriseQq)1 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)1 FileConfigExample (com.itrus.portal.db.FileConfigExample)1 Product (com.itrus.portal.db.Product)1 ServiceExample (com.itrus.portal.db.ServiceExample)1 SystemConfigService (com.itrus.portal.service.SystemConfigService)1 File (java.io.File)1 Date (java.util.Date)1 HttpSession (javax.servlet.http.HttpSession)1 MultipartFile (org.springframework.web.multipart.MultipartFile)1