From cd56d401c5233f24790a5be8ba4075a97ab80fe3 Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 화, 28 12월 2021 19:20:08 +0900 Subject: [PATCH] 상위 프로젝트는 추가 못하도록 수정 --- src/main/java/kr/wisestone/owl/service/impl/WidgetServiceImpl.java | 84 ++++++++++++++++++++++++++++++++++------- 1 files changed, 69 insertions(+), 15 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/service/impl/WidgetServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/WidgetServiceImpl.java index 250a93e..b2b71cc 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/WidgetServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/WidgetServiceImpl.java @@ -4,6 +4,7 @@ import kr.wisestone.owl.common.ExcelConditionCheck; import kr.wisestone.owl.common.MessageAccessor; import kr.wisestone.owl.constant.Constants; +import kr.wisestone.owl.constant.MngPermission; import kr.wisestone.owl.constant.MsgConstants; import kr.wisestone.owl.domain.*; import kr.wisestone.owl.domain.enumType.ProjectType; @@ -53,6 +54,9 @@ private ProjectService projectService; @Autowired + private ProjectRoleDepartmentService projectRoleDepartmentService; + + @Autowired private ProjectClosureService projectClosureService; @Autowired @@ -60,6 +64,9 @@ @Autowired private UserService userService; + + @Autowired + private UserLevelService userLevelService; @Autowired private UserDepartmentService userDepartmentService; @@ -164,9 +171,11 @@ @Transactional(readOnly = true) public WidgetCondition makeWidgetCondition() { User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); // �빐�떦 �썙�겕�뒪�럹�씠�뒪�뿉�꽌 李몄뿬�븯怨� �엳�뒗 �봽濡쒖젥�듃 以� �긽�깭媛� �삤�뵂�씤 �봽濡쒖젥�듃 List<Map<String, Object>> projects = null; - if (this.userWorkspaceService.checkWorkspaceManager(user)) { + if (this.userWorkspaceService.checkWorkspaceManager(user) + || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT)) { projects = this.projectService.findByWorkspaceManagerAll(); } else { projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(Lists.newArrayList("02"), ProjectType.BTS_PROJECT.toString()); @@ -208,8 +217,20 @@ void SetMeAndDownProjectIds(List<Long> parentProjectIds, WidgetCondition widgetCondition) { List<Long> downProjectIds = Lists.newArrayList(); + List<Long> projectIds = Lists.newArrayList(); + projectIds.add(-1L); + User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); if(parentProjectIds != null && parentProjectIds.size() > 0){ for(Long parentProjectId : parentProjectIds){ + if(!this.userWorkspaceService.checkWorkspaceManager(user) || !MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT)){ + Project project = this.projectService.getProject(parentProjectId); + List<Map<String, Object>> results = this.projectService.findByWorkspaceIdAndIncludeProject(Lists.newArrayList("01", "02", "03"), project.getProjectType().toString()); + if(results == null || results.size() < 1) { + widgetCondition.setMeAndDownProjectIds(projectIds); + break; + } + } List<ProjectClosure> projectClosures = this.projectClosureRepository.findByParentProjectId(parentProjectId); //�궡 �봽濡쒖젥�듃ID媛� �긽�쐞�봽濡쒖젥�듃�씤寃� �엳�뒗吏� if(projectClosures != null && projectClosures.size() > 0){ for(ProjectClosure projectClosure : projectClosures){ @@ -246,10 +267,12 @@ widgetCondition.setLoginUserId(this.webAppUtil.getLoginId()); widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); if (widgetCondition.getProjectIds().size() > 0) { SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); - if (this.userWorkspaceService.checkWorkspaceManager(user)) { + if (this.userWorkspaceService.checkWorkspaceManager(user) + || (MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE))) { remainIssue = this.widgetMapper.countRemainIssue(widgetCondition); // �옍�뿬 �씠�뒋 delayIssue = this.widgetMapper.countTodayDelayIssue(widgetCondition); // 吏��뿰�맂 �씠�뒋 assigneeIssue = this.widgetMapper.countAssigneeIssue(widgetCondition); // �븷�떦�맂 �씠�뒋 @@ -260,8 +283,10 @@ SetMyDepartmentId(widgetCondition); remainIssue = this.widgetMapper.countRemainIssueByDepartment(widgetCondition); // �옍�뿬 �씠�뒋 delayIssue = this.widgetMapper.countTodayDelayIssueByDepartment(widgetCondition); // 吏��뿰�맂 �씠�뒋 - assigneeIssue = this.widgetMapper.countAssigneeIssueByDepartment(widgetCondition); // �븷�떦�맂 �씠�뒋 - registerIssue = this.widgetMapper.countTodayRegisterIssueByDepartment(widgetCondition); // �벑濡앺븳 �씠�뒋 + //assigneeIssue = this.widgetMapper.countAssigneeIssueByDepartment(widgetCondition); // �븷�떦�맂 �씠�뒋 + assigneeIssue = this.widgetMapper.countAssigneeIssue(widgetCondition); // �븷�떦�맂 �씠�뒋 + //registerIssue = this.widgetMapper.countTodayRegisterIssueByDepartment(widgetCondition); // �벑濡앺븳 �씠�뒋 + registerIssue = this.widgetMapper.countTodayRegisterIssue(widgetCondition); // �벑濡앺븳 �씠�뒋 //noAssigneeIssue = this.widgetMapper.countNoAssigneeIssueByDepartment(widgetCondition); // �씪諛� �쑀���뒗 誘명븷�떦 �씠�뒋 0媛쒕줈 蹂댁씠寃� completeIssue = this.widgetMapper.countCompleteIssueByDepartment(widgetCondition); // �셿猷뚮맂 �씠�뒋 } @@ -289,10 +314,12 @@ List<Map<String, Object>> progressingProjectDetails = Lists.newArrayList(); User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); if (widgetCondition.getProjectIds().size() > 0) { SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); - if (this.userWorkspaceService.checkWorkspaceManager(user)) { + if (this.userWorkspaceService.checkWorkspaceManager(user) + || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT)) { progressingProjectDetails = this.widgetMapper.findProjectProgressAll(widgetCondition); } else { progressingProjectDetails = this.widgetMapper.findProjectProgress(widgetCondition); @@ -392,6 +419,7 @@ if (widgetCondition.getProjectIds().size() > 0) { SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); + this.SetMyDepartmentId(widgetCondition); todayCount = this.widgetMapper.countTodayMyAssigneeIssue(widgetCondition); assigneeIssues = this.widgetMapper.findMyAssigneeIssue(widgetCondition); totalCount = this.widgetMapper.countMyAssigneeIssue(widgetCondition); @@ -422,7 +450,7 @@ if (widgetCondition.getProjectIds().size() > 0) { SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); - + this.SetMyDepartmentId(widgetCondition); delayIssues = this.widgetMapper.findDelayIssue(widgetCondition); totalCount = this.widgetMapper.countDelayIssue(widgetCondition); } @@ -496,11 +524,13 @@ widgetCondition.setLoginUserId(this.webAppUtil.getLoginId()); widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); if (widgetCondition.getProjectId() != null) { SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); List<Map<String, Object>> projectMemberIssues = Lists.newArrayList(); - if (this.userWorkspaceService.checkWorkspaceManager(user)) { + if (this.userWorkspaceService.checkWorkspaceManager(user) + || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { projectMemberIssues = this.widgetMapper.findProjectMemberIssue(widgetCondition); } else { projectMemberIssues = this.widgetMapper.findProjectMemberIssueByDepartment(widgetCondition); @@ -782,10 +812,17 @@ } List<Map<String, Object>> results = Lists.newArrayList(); + User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); if (widgetCondition.getProjectIds().size() > 0) { SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); - results = this.widgetMapper.findByStandIssueStatus(widgetCondition); + if (this.userWorkspaceService.checkWorkspaceManager(user) + || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { + results = this.widgetMapper.findByStandIssueStatus(widgetCondition); + }else { + results = this.widgetMapper.findByStandIssueStatusOfDepartment(widgetCondition); + } } for (Map<String, Object> result : results) { @@ -809,10 +846,24 @@ public void findByStandIssueType(Map<String, Object> resJsonData, WidgetCondition widgetCondition, Boolean getWidgetCondition) { // �쐞�젽 寃��깋 議곌굔�쓣 �뼸�뼱�빞 �븷 �긽�솴�씪 �븣 - �솕硫댁뿉�꽌 �꺆�쓣 �닃�윭 �뜲�씠�꽣瑜� �옱�슂泥��뻽�쓣 �븣 �쐞�젽 寃��깋 議곌굔�쓣 留뚮뱾怨� �쟾泥� �봽濡쒖젥�듃 �젙蹂대�� 由ы꽩�븳�떎. Map<String, Object> results = this.makeWidgetConditionAllProject(widgetCondition, getWidgetCondition); - + User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); if (widgetCondition.getProjectId() != null) { SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); - List<Map<String, Object>> issueTypeIssues = this.widgetMapper.findByStandIssueType(widgetCondition); + if (widgetCondition.getMeAndDownProjectIds() != null) { + for (Long meAndProjectId : widgetCondition.getMeAndDownProjectIds()) { + if(meAndProjectId == -1L) { + results.replace("projectVos", null); + } + } + } + List<Map<String, Object>> issueTypeIssues = Lists.newArrayList(); + if (this.userWorkspaceService.checkWorkspaceManager(user) + || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { + issueTypeIssues = this.widgetMapper.findByStandIssueType(widgetCondition); + } else { + issueTypeIssues = this.widgetMapper.findByStandIssueTypeOfDepartment(widgetCondition); + } // �씠�뒋 �젙蹂� results.put("issues", issueTypeIssues); } else { @@ -825,6 +876,7 @@ // �쐞�젽 寃��깋 議곌굔�쓣 留뚮뱾怨� �쟾泥� �봽濡쒖젥�듃 �젙蹂대�� 由ы꽩�븳�떎. private Map<String, Object> makeWidgetConditionAllProject(WidgetCondition widgetCondition, boolean getWidgetCondition) { Map<String, Object> results = new HashMap<>(); + SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); // �쐞�젽 寃��깋 議곌굔�쓣 �뼸�뼱�빞 �븷 �긽�솴�씪 �븣 - �솕硫댁뿉�꽌 �꺆�쓣 �닃�윭 �뜲�씠�꽣瑜� �옱�슂泥��뻽�쓣 �븣 if (getWidgetCondition) { @@ -888,10 +940,12 @@ widgetCondition.setLoginUserId(this.webAppUtil.getLoginId()); widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); User user = this.webAppUtil.getLoginUserObject(); + UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId()); if (widgetCondition.getProjectIds().size() > 0) { SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); - if (this.userWorkspaceService.checkWorkspaceManager(user)) { + if (this.userWorkspaceService.checkWorkspaceManager(user) + || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { severityCounts = this.widgetMapper.countSeverityIssue(widgetCondition); severityIssues = this.widgetMapper.findSeverityIssues(widgetCondition); totalCount = this.widgetMapper.countSearchIssue(widgetCondition); @@ -1105,7 +1159,7 @@ if (changeAssigneeType != null) { if (changeAssigneeType.equals("1")) { - riskType = this.messageAccessor.message("common.reversalAssigneeUpdate"); // 鍮덈쾲�븳 �떞�떦�옄 蹂�寃� + riskType = this.messageAccessor.message("common.reversalAssigneeTeamUpdate"); // 鍮덈쾲�븳 �떞�떦遺��꽌 蹂�寃� } } @@ -1117,7 +1171,7 @@ if (changeAssigneeType != null && changeIssueStatusType != null) { if (changeAssigneeType.equals("1") && changeIssueStatusType.equals("1")) { - riskType = this.messageAccessor.message("common.reversalAssigneeUpdate") + '\n' + this.messageAccessor.message("common.reversalStatusUpdate"); // 鍮덈쾲�븳 �떞�떦�옄 蹂�寃�, 踰덈났�릺�뒗 �긽�깭 蹂�寃� + riskType = this.messageAccessor.message("common.reversalAssigneeTeamUpdate") + '\n' + this.messageAccessor.message("common.reversalStatusUpdate"); // 鍮덈쾲�븳 �떞�떦遺��꽌 蹂�寃�, 踰덈났�릺�뒗 �긽�깭 蹂�寃� } } @@ -1145,11 +1199,11 @@ excelInfo.setFileName(this.messageAccessor.message("common.managementRisk")); // �쐞�뿕 愿�由� excelInfo.setDatas(riskIssues); excelInfo.addAttrInfos(new ExportExcelAttrVo("issueKey", this.messageAccessor.message("common.issueKey"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // �씠�뒋 踰덊샇 - excelInfo.addAttrInfos(new ExportExcelAttrVo("riskType", this.messageAccessor.message("common.division"), 15, ExportExcelAttrVo.ALIGN_CENTER)); // 援щ텇 + //excelInfo.addAttrInfos(new ExportExcelAttrVo("riskType", this.messageAccessor.message("common.division"), 15, ExportExcelAttrVo.ALIGN_CENTER)); // 援щ텇 excelInfo.addAttrInfos(new ExportExcelAttrVo("projectName", this.messageAccessor.message("common.project"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // �봽濡쒖젥�듃 excelInfo.addAttrInfos(new ExportExcelAttrVo("title", this.messageAccessor.message("common.issueTitle"), 40, ExportExcelAttrVo.ALIGN_LEFT)); // �씠�뒋 excelInfo.addAttrInfos(new ExportExcelAttrVo("issueStatusName", this.messageAccessor.message("common.status"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // �긽�깭 - excelInfo.addAttrInfos(new ExportExcelAttrVo("issueUsers", this.messageAccessor.message("common.assignee"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // �떞�떦�옄 + //excelInfo.addAttrInfos(new ExportExcelAttrVo("issueUsers", this.messageAccessor.message("common.assignee"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // �떞�떦�옄 return excelInfo; } -- Gitblit v1.8.0