diff --git a/tall/src/main/java/com/ccsens/tall/service/ExcelService.java b/tall/src/main/java/com/ccsens/tall/service/ExcelService.java index aba56123..6d6b4b29 100644 --- a/tall/src/main/java/com/ccsens/tall/service/ExcelService.java +++ b/tall/src/main/java/com/ccsens/tall/service/ExcelService.java @@ -179,7 +179,7 @@ public class ExcelService implements IExcelService { private void readProject(XSSFSheet wbsSheet, int projectInfoStart, int projectInfoEnd, Long currentUserId, SysProject sysProject) throws Exception { XSSFRow row = wbsSheet.getRow(projectInfoStart + 1); if(ObjectUtil.isNull(row)){ - throw new BaseException(CodeEnum.notProject(wbsSheet.getSheetName() + (projectInfoStart + 1))); +// throw new BaseException(CodeEnum.notProject(wbsSheet.getSheetName() + (projectInfoStart + 1))); } String projectName = ExcelUtil.getCellValue(row.getCell(0)); if (StrUtil.isNotEmpty(projectName)) { @@ -292,6 +292,8 @@ public class ExcelService implements IExcelService { Long firstRoleId = null; Long secondRoleId = null; + //循环结束判断字符串allOneRole是否包含PM和Member + String allOneRole = ""; for (int i = memberStart + 1; i <= memberEnd; i++) { XSSFRow row = wbsSheet.getRow(i); if(ObjectUtil.isNull(row)){ @@ -314,24 +316,31 @@ public class ExcelService implements IExcelService { if (proRoleCell.equalsIgnoreCase(WebConstant.ROLE_NAME.God.phase)) { role.setName(WebConstant.ROLE_NAME.God.value); role.setDescription(WebConstant.ROLE_NAME.God.phase); + allOneRole += WebConstant.ROLE_NAME.God.value; } else if (proRoleCell.equalsIgnoreCase(WebConstant.ROLE_NAME.ManageRepresent.phase)) { role.setName(WebConstant.ROLE_NAME.ManageRepresent.value); role.setDescription(WebConstant.ROLE_NAME.ManageRepresent.phase); + allOneRole += WebConstant.ROLE_NAME.ManageRepresent.value; } else if (proRoleCell.equalsIgnoreCase(WebConstant.ROLE_NAME.Stakeholder.phase)) { role.setName(WebConstant.ROLE_NAME.Stakeholder.value); role.setDescription(WebConstant.ROLE_NAME.Stakeholder.phase); + allOneRole += WebConstant.ROLE_NAME.Stakeholder.value; } else if (proRoleCell.equalsIgnoreCase(WebConstant.ROLE_NAME.PM.phase)) { role.setName(WebConstant.ROLE_NAME.PM.value); role.setDescription(WebConstant.ROLE_NAME.PM.phase); + allOneRole += WebConstant.ROLE_NAME.PM.value; } else if (proRoleCell.equalsIgnoreCase(WebConstant.ROLE_NAME.Member.phase)) { role.setName(WebConstant.ROLE_NAME.Member.value); role.setDescription(WebConstant.ROLE_NAME.Member.phase); + allOneRole += WebConstant.ROLE_NAME.Member.value; } else if (proRoleCell.equalsIgnoreCase(WebConstant.ROLE_NAME.Attention.phase)) { role.setName(WebConstant.ROLE_NAME.Attention.value); role.setDescription(WebConstant.ROLE_NAME.Attention.phase); + allOneRole += WebConstant.ROLE_NAME.Attention.value; }else if (proRoleCell.equalsIgnoreCase(WebConstant.ROLE_NAME.ProjectVirtualRole.phase)) { role.setName(WebConstant.ROLE_NAME.ProjectVirtualRole.value); role.setDescription(WebConstant.ROLE_NAME.ProjectVirtualRole.phase); + allOneRole += WebConstant.ROLE_NAME.ProjectVirtualRole.value; } else { throw new BaseException(CodeEnum.WBS_NOT_FIRST_ROLE.addMsg(wbsSheet.getSheetName() + (i+1))); @@ -351,7 +360,8 @@ public class ExcelService implements IExcelService { // } } if (ObjectUtil.isNull(firstRoleId)) { - throw new BaseException("找不到系统角色[" + (i + 1) + "]"); + continue; +// throw new BaseException("找不到系统角色[" + (i + 1) + "]"); } //二级角色 if (StrUtil.isNotEmpty(secondRoleCell)) { @@ -383,7 +393,8 @@ public class ExcelService implements IExcelService { } } if (ObjectUtil.isNull(secondRoleId)) { - throw new BaseException("找不到二级角色[" + (i+1) + "]"); + continue; +// throw new BaseException("找不到二级角色[" + (i+1) + "]"); } //添加角色成员关联信息 if (StrUtil.isNotEmpty(memberCell)) { @@ -425,6 +436,12 @@ public class ExcelService implements IExcelService { // } } + if (!allOneRole.contains(WebConstant.ROLE_NAME.PM.value)){ + throw new BaseException(CodeEnum.NOT_FOUND_PM); + } + if (!allOneRole.contains(WebConstant.ROLE_NAME.Member.value)){ + throw new BaseException(CodeEnum.NOT_FOUND_Member); + } //角色对谁不可见 String[] excludeRoleCells; for (int i = memberStart + 1; i <= memberEnd; i++) { diff --git a/util/src/main/java/com/ccsens/util/CodeEnum.java b/util/src/main/java/com/ccsens/util/CodeEnum.java index 2a03ab40..49681ea5 100644 --- a/util/src/main/java/com/ccsens/util/CodeEnum.java +++ b/util/src/main/java/com/ccsens/util/CodeEnum.java @@ -199,6 +199,8 @@ public enum CodeEnum { CHONGFUTIJIAO(163,"不要重复提交",true), ZUISHAOCHUANLIANGE(164,"排序最少需要传入两个",true), HOSPITAL_NOT_FOUND(165,"没有找到医院",true), + NOT_FOUND_PM(166,"系统角色缺少项目经理",true), + NOT_FOUND_Member(166,"系统角色缺少项目成员",true), ;