Search in sources :

Example 61 with Project

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

the class DownloadConfigController method createForm.

// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String createForm(@RequestParam(value = "status", required = false) Integer status, Model uiModel) {
    if (status == 2) {
        // 管理员项目权限
        Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
        // param.put("hasProjects", Arrays.asList(projectsOfAdmin));
        List<Map<String, Object>> projectIds = configServiceImpl.getProjects();
        List<Long> pids = new ArrayList<>();
        for (Map<String, Object> p : projectIds) {
            pids.add((Long) p.get("project"));
        }
        uiModel.addAttribute("pids", pids);
        // 获取所有项目信息
        ProjectExample projectExample = new ProjectExample();
        ProjectExample.Criteria pec = projectExample.createCriteria();
        pec.andIdIn(Arrays.asList(projectsOfAdmin));
        List<Project> projects = projectServiceImpl.getProjectByExample(projectExample);
        uiModel.addAttribute("projects", projects);
        // 获取所有文件信息
        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();
        }
        return "downloadconfig/create2";
    } else {
        if (status == 3) {
            uiModel.addAttribute("message", "创建文件信息失败!");
        }
        return "downloadconfig/create1";
    }
}
Also used : FileConfig(com.itrus.portal.db.FileConfig) ProjectExample(com.itrus.portal.db.ProjectExample) ArrayList(java.util.ArrayList) Project(com.itrus.portal.db.Project) FileConfigExample(com.itrus.portal.db.FileConfigExample) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 62 with Project

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

the class DownloadConfigController method list.

// 列表所有信息
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "page2", required = false) Integer page2, @RequestParam(value = "size2", required = false) Integer size2, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "description", required = false) String description, @RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "projectId1", required = false) Long projectId1, @RequestParam(value = "name1", required = false) String name1, @RequestParam(value = "description1", required = false) String description1, @RequestParam(value = "queryDate3", required = false) Date queryDate3, @RequestParam(value = "queryDate4", required = false) Date queryDate4, 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();
    }
    if (queryDate3 == null && queryDate4 == 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);
        queryDate4 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate3 = calendar.getTime();
    }
    // page,size
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    Integer offset = size * (page - 1);
    // 筛选对应 fileConfig 表的信息
    FileConfigExample fileConfigExample = new FileConfigExample();
    FileConfigExample.Criteria cec = fileConfigExample.createCriteria();
    if (StringUtils.isNotEmpty(name))
        cec.andNameLike("%" + name + "%");
    if (StringUtils.isNotEmpty(description))
        cec.andDescriptionLike("%" + description + "%");
    if (queryDate1 != null && queryDate2 != null)
        cec.andCreateTimeBetween(queryDate1, queryDate2);
    else if (queryDate1 != null && queryDate2 == null)
        cec.andCreateTimeGreaterThanOrEqualTo(queryDate1);
    else if (queryDate1 == null && queryDate2 != null)
        cec.andCreateTimeLessThan(queryDate2);
    fileConfigExample.setOffset(offset);
    fileConfigExample.setLimit(size);
    fileConfigExample.setOrderByClause("create_time desc");
    List<FileConfig> fileConfigs = configServiceImpl.getList(fileConfigExample);
    uiModel.addAttribute("fileConfigs", fileConfigs);
    // count,pages
    Integer count = configServiceImpl.getCount(fileConfigExample);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    // page,size
    if (page2 == null || page2 < 1)
        page2 = 1;
    if (size2 == null || size2 < 1)
        size2 = 10;
    Integer offset2 = size2 * (page2 - 1);
    // 筛选对应 FileIssue 表的信息
    Map<String, Object> param = new HashMap<>();
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    param.put("hasProjects", Arrays.asList(projectsOfAdmin));
    param.put("offset", offset2);
    param.put("limit", size2);
    param.put("queryDate3", queryDate3);
    param.put("queryDate4", queryDate4);
    if (StringUtils.isNotEmpty(name1)) {
        param.put("name1", "%" + name1 + "%");
    }
    if (StringUtils.isNotEmpty(description1)) {
        param.put("description1", "%" + description1 + "%");
    }
    if (projectId1 != null && projectId1 != 0) {
        param.put("projectId1", projectId1);
    }
    List<Map<String, Object>> fileIssues = configServiceImpl.getList(param);
    uiModel.addAttribute("fileIssues", fileIssues);
    Integer count2 = configServiceImpl.getCount(param);
    uiModel.addAttribute("count2", count2);
    // 获取所有项目信息
    ProjectExample projectExample = new ProjectExample();
    ProjectExample.Criteria pec = projectExample.createCriteria();
    pec.andIdIn(Arrays.asList(projectsOfAdmin));
    List<Project> projects = projectServiceImpl.getProjectByExample(projectExample);
    uiModel.addAttribute("pages2", (count2 + size2 - 1) / size2);
    if (page2 > 1 && size2 * (page2 - 1) >= count2) {
        page2 = (count2 + size2 - 1) / size2;
    }
    uiModel.addAttribute("page2", page2);
    uiModel.addAttribute("size2", size2);
    // 返回搜索条件参数
    uiModel.addAttribute("status", status);
    uiModel.addAttribute("projects", projects);
    uiModel.addAttribute("name", name);
    uiModel.addAttribute("name1", name1);
    uiModel.addAttribute("description", description);
    uiModel.addAttribute("description1", description1);
    uiModel.addAttribute("projectId1", projectId1);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    uiModel.addAttribute("queryDate3", queryDate3);
    uiModel.addAttribute("queryDate4", queryDate4);
    return "downloadconfig/list";
}
Also used : FileConfig(com.itrus.portal.db.FileConfig) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample) Calendar(java.util.Calendar) Project(com.itrus.portal.db.Project) FileConfigExample(com.itrus.portal.db.FileConfigExample) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 63 with Project

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

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

the class AbstractController method getProjectMapOfAdmin.

/**
 * 获取管理员管理的项目Map
 *
 * @return
 */
public Map<Long, Project> getProjectMapOfAdmin() {
    Map<Long, Project> projectMap = new HashMap<Long, Project>();
    ProjectExample projectExample = new ProjectExample();
    ProjectExample.Criteria criteria = projectExample.or();
    criteria.andIdIn(Arrays.asList(getProjectLongIdsOfAdmin()));
    projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample, "id");
    return projectMap;
}
Also used : Project(com.itrus.portal.db.Project) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample)

Example 65 with Project

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

the class AdminController method updateForm.

// 返回修改页面
@RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String updateForm(@PathVariable("id") Long id, Model uiModel) {
    Admin admin = sqlSession.selectOne("com.itrus.portal.db.AdminMapper.selectByPrimaryKey", id);
    admin.setPassword("");
    uiModel.addAttribute("admin", admin);
    ProjectExample projectex = new ProjectExample();
    Map<Long, Project> projects = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectex, "id");
    // 所有项目
    uiModel.addAttribute("projects", projects);
    List<Long> projectList = new ArrayList<Long>();
    uiModel.addAttribute("hasAllProject", 0);
    if (admin.getProjects().contains(",")) {
        String[] strs = admin.getProjects().split(",");
        for (String s : strs) {
            if (s.equals("0")) {
                // 包含所有项目
                uiModel.addAttribute("hasAllProject", 1);
                break;
            }
        }
    }
    for (Project project : adminService.getProjectByAdminId(id)) {
        projectList.add(project.getId());
    }
    // 管理员管理的项目id
    uiModel.addAttribute("projectList", projectList);
    List adminroles = sqlSession.selectList("com.itrus.portal.db.AdminRoleMapper.selectByExample");
    uiModel.addAttribute("adminroles", adminroles);
    return "admins/update";
}
Also used : Project(com.itrus.portal.db.Project) ProjectExample(com.itrus.portal.db.ProjectExample) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Admin(com.itrus.portal.db.Admin) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Project (com.itrus.portal.db.Project)77 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)59 HashMap (java.util.HashMap)32 UserInfo (com.itrus.portal.db.UserInfo)24 Enterprise (com.itrus.portal.db.Enterprise)20 ExtraProduct (com.itrus.portal.db.ExtraProduct)17 ProjectExample (com.itrus.portal.db.ProjectExample)16 ArrayList (java.util.ArrayList)15 ProjectKeyInfo (com.itrus.portal.db.ProjectKeyInfo)12 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)12 Product (com.itrus.portal.db.Product)10 Date (java.util.Date)10 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)9 BusinessLicense (com.itrus.portal.db.BusinessLicense)8 IdentityCard (com.itrus.portal.db.IdentityCard)8 OrgCode (com.itrus.portal.db.OrgCode)8 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)8 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)8 List (java.util.List)8 Map (java.util.Map)8