Search in sources :

Example 1 with ProjectPO

use of com.ibeiliao.deployment.admin.po.project.ProjectPO in project Corgi by kevinYin.

the class StatProjectDaoTest method createProject.

private int createProject() {
    ProjectPO po = new ProjectPO();
    po.setProjectNo("#" + System.currentTimeMillis());
    po.setCreateTime(new Date());
    po.setProgramLanguage("java");
    po.setManagerEmail("a@b.com");
    po.setManagerName("Sam");
    po.setManagerPhone("13000001111");
    po.setProjectName("some project");
    projectDao.insert(po);
    return po.getProjectId();
}
Also used : StatProjectPO(com.ibeiliao.deployment.admin.po.stat.StatProjectPO) ProjectPO(com.ibeiliao.deployment.admin.po.project.ProjectPO) Date(java.util.Date)

Example 2 with ProjectPO

use of com.ibeiliao.deployment.admin.po.project.ProjectPO in project Corgi by kevinYin.

the class ProjectServiceImpl method saveProject.

@Override
@Transactional
public Project saveProject(long accountId, Project project) {
    Assert.notNull(project, "项目为空!");
    Assert.isTrue(StringUtils.isNotBlank(project.getProjectName()), "项目名称为空!");
    Assert.isTrue(StringUtils.isNotBlank(project.getProjectNo()), "项目编号为空!");
    checkProjectAccountRelations(project.getProjectAccountRelations());
    ProjectPO projectPO = VOUtil.from(project, ProjectPO.class);
    if (project.getProjectId() > 0) {
        ProjectPO current = projectDao.get(project.getProjectId());
        Assert.notNull(current, "项目不存在");
        // 禁止修改
        projectPO.setProjectNo(current.getProjectNo());
        projectDao.update(projectPO);
    } else {
        ProjectPO current = projectDao.getByProjectNo(project.getProjectNo());
        if (current != null) {
            throw new IllegalArgumentException("项目[" + project.getProjectNo() + "]已经存在");
        }
        projectPO.setCreateTime(new Date());
        projectDao.insert(projectPO);
        project.setProjectId(projectPO.getProjectId());
    }
    saveProjectRelations(project);
    return VOUtil.from(projectPO, Project.class);
}
Also used : ProjectPO(com.ibeiliao.deployment.admin.po.project.ProjectPO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with ProjectPO

use of com.ibeiliao.deployment.admin.po.project.ProjectPO in project Corgi by kevinYin.

the class ProjectModuleServiceImpl method rebuildModuleName.

private List<ProjectModule> rebuildModuleName(ArrayList<Integer> projectIds, List<ProjectModulePO> modulePOS) {
    List<ProjectModule> modules = VOUtil.fromList(modulePOS, ProjectModule.class);
    List<ProjectPO> projectPOS = projectDao.getByProjectIds(projectIds);
    HashMap<Integer, ProjectPO> projectId2ProjectMap = Maps.newHashMap();
    for (ProjectPO projectPO : projectPOS) {
        projectId2ProjectMap.put(projectPO.getProjectId(), projectPO);
    }
    for (ProjectModule module : modules) {
        if (projectId2ProjectMap.get(module.getProjectId()) != null) {
            String projectName = projectId2ProjectMap.get(module.getProjectId()).getProjectName();
            module.setModuleName(module.getModuleName() + "(" + projectName + ")");
        }
    }
    return modules;
}
Also used : ProjectModule(com.ibeiliao.deployment.admin.vo.project.ProjectModule) ProjectPO(com.ibeiliao.deployment.admin.po.project.ProjectPO)

Example 4 with ProjectPO

use of com.ibeiliao.deployment.admin.po.project.ProjectPO in project Corgi by kevinYin.

the class ProjectServiceImpl method getProject.

@Override
public Project getProject(int projectId) {
    Assert.isTrue(projectId > 0, "项目id小于或等于0!");
    ProjectPO projectPO = projectDao.get(projectId);
    return VOUtil.from(projectPO, Project.class);
}
Also used : ProjectPO(com.ibeiliao.deployment.admin.po.project.ProjectPO)

Aggregations

ProjectPO (com.ibeiliao.deployment.admin.po.project.ProjectPO)4 StatProjectPO (com.ibeiliao.deployment.admin.po.stat.StatProjectPO)1 ProjectModule (com.ibeiliao.deployment.admin.vo.project.ProjectModule)1 Date (java.util.Date)1 Transactional (org.springframework.transaction.annotation.Transactional)1