|
|
|
@ -401,16 +401,9 @@ public class Project_ManagementService { |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Transactional |
|
|
|
|
public HashMap<String, Object> insertProjectManagement(Project_Management pro, List<Judgment_Points> points, |
|
|
|
|
List<Integer> roles) { |
|
|
|
|
public HashMap<String, Object> insertProjectManagement(Project_Management pro, List<Judgment_Points> points, List<Integer> roles) { |
|
|
|
|
HashMap<String, Object> resp = new HashMap<String, Object>(); |
|
|
|
|
try { |
|
|
|
|
String projectName = pro.getProjectName(); |
|
|
|
|
Integer count = mapper.getByprojectName(projectName); |
|
|
|
|
if (count != null) { |
|
|
|
|
projectName += (count + 1); |
|
|
|
|
pro.setProjectName(projectName); |
|
|
|
|
} |
|
|
|
|
// 添加项目信息
|
|
|
|
|
mapper.insertProjectManagement(pro); |
|
|
|
|
// 取出添加的项目信息的id
|
|
|
|
@ -472,6 +465,25 @@ public class Project_ManagementService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HashMap<String, Object> getByName(String projectName){ |
|
|
|
|
HashMap<String, Object> resp = new HashMap<String, Object>(); |
|
|
|
|
try{ |
|
|
|
|
Integer count = mapper.getByprojectName(projectName); |
|
|
|
|
if(count>1){ |
|
|
|
|
resp.put("retcode", 300); |
|
|
|
|
resp.put("retvalue", "该项目名称已存在"); |
|
|
|
|
}else{ |
|
|
|
|
resp.put("retcode", 200); |
|
|
|
|
} |
|
|
|
|
}catch (RuntimeException e){ |
|
|
|
|
logger.error(e.getMessage()); |
|
|
|
|
resp.put("retcode", 500); |
|
|
|
|
resp.put("retvalue", "QUERY Failed"); |
|
|
|
|
throw new RuntimeException(); |
|
|
|
|
} |
|
|
|
|
return resp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 修改项目管理信息 |
|
|
|
|
* |
|
|
|
@ -590,17 +602,6 @@ public class Project_ManagementService { |
|
|
|
|
// 修改对应角色的项目id
|
|
|
|
|
mapper.updateRoleProjectId(roleid, project); |
|
|
|
|
} |
|
|
|
|
//项目名称去重
|
|
|
|
|
String projectName = pro.getProjectName(); |
|
|
|
|
|
|
|
|
|
String name = mapper.getNameByProjectId(pro.getProjectId()); |
|
|
|
|
if (projectName != null && !projectName.equals(name)) { |
|
|
|
|
Integer count = mapper.getByprojectName(projectName); |
|
|
|
|
if (count != null && count > 1) { |
|
|
|
|
projectName += (count + 1); |
|
|
|
|
pro.setProjectName(projectName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//修改项目信息
|
|
|
|
|
mapper.updateProjectManagement(pro); |
|
|
|
|