|
@@ -145,20 +145,26 @@ public class ProjectController extends BaseController {
|
|
|
j.setMsg(errMsg);
|
|
|
return j;
|
|
|
}
|
|
|
+ List<Project> projects = new ArrayList<Project>();
|
|
|
+ projects.add(project);
|
|
|
+ String loginName = UserUtils.getUser().getLoginName();
|
|
|
+ Boolean judgeValue = ProExcelInfo.getJudgeValue(projects);
|
|
|
if (project.getIsNewRecord()){
|
|
|
- project.preInsert();
|
|
|
- List<Project> projects = new ArrayList<Project>();
|
|
|
- projects.add(project);
|
|
|
- Boolean judgeValue = ProExcelInfo.getJudgeValue(projects);
|
|
|
- if (judgeValue){
|
|
|
+ if (judgeValue||!project.getProjectManageRole().equals(loginName)){
|
|
|
j.setSuccess(false);
|
|
|
j.setMsg("新建失败:数据不符合规范");
|
|
|
return j;
|
|
|
}
|
|
|
+ project.preInsert();
|
|
|
projectService.saveList(projects);
|
|
|
j.setSuccess(true);
|
|
|
j.setMsg("保存需求基本信息成功");
|
|
|
}else{
|
|
|
+ if (judgeValue||!project.getProjectManageRole().equals(loginName)){
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg("修改失败:数据不符合规范");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
project.preUpdate();
|
|
|
projectService.save(project);
|
|
|
j.setSuccess(true);
|
|
@@ -257,9 +263,9 @@ public class ProjectController extends BaseController {
|
|
|
@ResponseBody
|
|
|
@RequiresPermissions("sg:managementcenter:project:import")
|
|
|
@RequestMapping(value = "import")
|
|
|
- public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request){
|
|
|
+ public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) throws Exception{
|
|
|
AjaxJson j = new AjaxJson();
|
|
|
- try {
|
|
|
+// try {
|
|
|
ImportUtil importUtil = new ImportUtil(file, 0, 0);
|
|
|
Boolean projectUtilFlag = ProExcelInfo.getProjectUtilFlag(importUtil);
|
|
|
if (projectUtilFlag){
|
|
@@ -267,7 +273,7 @@ public class ProjectController extends BaseController {
|
|
|
j.setMsg("表不符合规范");
|
|
|
return j;
|
|
|
}
|
|
|
- List<Project> projects = ProExcelInfo.getProjectUtil(importUtil);
|
|
|
+ List<Project> projects =ProExcelInfo.getSureProjects(ProExcelInfo.getProjectUtil(importUtil));
|
|
|
Boolean judgeValue = ProExcelInfo.getJudgeValue(projects);
|
|
|
if (judgeValue){
|
|
|
j.setSuccess(false);
|
|
@@ -276,10 +282,10 @@ public class ProjectController extends BaseController {
|
|
|
}
|
|
|
projectService.saveList(projects);
|
|
|
j.setMsg( "已成功导入 "+projects.size()+" 条项目表单记录");
|
|
|
- } catch (Exception e) {
|
|
|
- j.setSuccess(false);
|
|
|
- j.setMsg("导入需求基本信息表单失败!失败信息:"+e.getMessage());
|
|
|
- }
|
|
|
+// } catch (Exception e) {
|
|
|
+// j.setSuccess(false);
|
|
|
+// j.setMsg("导入需求基本信息表单失败!失败信息:"+e.getMessage());
|
|
|
+// }
|
|
|
return j;
|
|
|
}
|
|
|
}
|